home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Game Audio Programming
/
GameAudioProgramming.iso
/
Game_Audio
/
AudioTest
/
CDAudio.cpp
< prev
next >
Wrap
C/C++ Source or Header
|
2002-05-27
|
4KB
|
144 lines
/***********************************************************\
Copyright (C) James Boer, 2002.
All rights reserved worldwide.
This software is provided "as is" without express or implied
warranties. You may freely copy and compile this source into
applications you distribute provided that the copyright text
below is included in the resulting source code, for example:
"Portions Copyright (C) James Boer, 2002"
\***********************************************************/
#include "stdafx.h"
#include "audiotest.h"
#include "CDAudio.h"
#include "Audio.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
using namespace Audio;
/////////////////////////////////////////////////////////////////////////////
// CCDAudio property page
IMPLEMENT_DYNCREATE(CCDAudio, CPropertyPage)
CCDAudio::CCDAudio() : CPropertyPage(CCDAudio::IDD)
{
//{{AFX_DATA_INIT(CCDAudio)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
m_bInit = false;
}
CCDAudio::~CCDAudio()
{
}
void CCDAudio::DoDataExchange(CDataExchange* pDX)
{
CPropertyPage::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CCDAudio)
DDX_Control(pDX, IDC_CHECK_CD_LOOPING, m_Looping);
DDX_Control(pDX, IDC_SPIN_TRACK, m_TrackNumber);
DDX_Control(pDX, IDC_STOP_CD, m_Stop);
DDX_Control(pDX, IDC_PAUSE_CD, m_Pause);
DDX_Control(pDX, IDC_PLAY_CD, m_Play);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CCDAudio, CPropertyPage)
//{{AFX_MSG_MAP(CCDAudio)
ON_WM_DESTROY()
ON_BN_CLICKED(IDC_INIT_PLAYER, OnInitPlayer)
ON_BN_CLICKED(IDC_TERM_PLAYER, OnTermPlayer)
ON_BN_CLICKED(IDC_PLAY_CD, OnPlayCD)
ON_BN_CLICKED(IDC_PAUSE_CD, OnPauseCD)
ON_BN_CLICKED(IDC_STOP_CD, OnStopCD)
ON_BN_CLICKED(IDC_CHECK_CD_LOOPING, OnCheckCdLooping)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CCDAudio message handlers
BOOL CCDAudio::OnInitDialog()
{
CPropertyPage::OnInitDialog();
// Load the play button icons
m_hPlayIcon = LoadIcon(::AfxGetInstanceHandle(), MAKEINTRESOURCE(IDI_PLAY));
m_hPauseIcon = LoadIcon(::AfxGetInstanceHandle(), MAKEINTRESOURCE(IDI_PAUSE));
m_hStopIcon = LoadIcon(::AfxGetInstanceHandle(), MAKEINTRESOURCE(IDI_STOP));
// Set the master play control buttons
m_Play.SetIcon(m_hPlayIcon);
m_Pause.SetIcon(m_hPauseIcon);
m_Stop.SetIcon(m_hStopIcon);
// Set the track spinner range and default position
m_TrackNumber.SetRange(1, 99);
m_TrackNumber.SetPos(1);
m_bInit = true;
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void CCDAudio::OnDestroy()
{
CPropertyPage::OnDestroy();
// TODO: Add your message handler code here
}
void CCDAudio::OnInitPlayer()
{
CDPlayer()->Init(GetSafeHwnd());
CDPlayer()->Play();
}
void CCDAudio::OnTermPlayer()
{
CDPlayer()->Term();
}
void CCDAudio::OnPlayCD()
{
CDPlayer()->SetCurrentTrack(m_TrackNumber.GetPos());
CDPlayer()->Play();
}
void CCDAudio::OnPauseCD()
{
CDPlayer()->Pause();
}
void CCDAudio::OnStopCD()
{
CDPlayer()->Stop();
}
void CCDAudio::OnCheckCdLooping()
{
CDPlayer()->SetLooping((m_Looping.GetCheck()) ? true : false);
}
LRESULT CCDAudio::WindowProc(UINT message, WPARAM wParam, LPARAM lParam)
{
if(message == MM_MCINOTIFY)
CDPlayer()->OnMCINotify(wParam, lParam);
return CPropertyPage::WindowProc(message, wParam, lParam);
}