home *** CD-ROM | disk | FTP | other *** search
- // waveview.cpp : implementation file
- //
-
- #include "stdafx.h"
- #include "wave.h"
- #include "waveview.h"
-
- #ifdef _DEBUG
- #undef THIS_FILE
- static char BASED_CODE THIS_FILE[] = __FILE__;
- #endif
-
- /////////////////////////////////////////////////////////////////////////////
- // CWaveView
-
- IMPLEMENT_DYNCREATE(CWaveView, CFormView)
-
- CWaveView::CWaveView()
- : CFormView(CWaveView::IDD)
- {
- //{{AFX_DATA_INIT(CWaveView)
- m_wav = NULL;
- //}}AFX_DATA_INIT
- }
-
- CWaveView::~CWaveView()
- {
- }
-
- void CWaveView::DoDataExchange(CDataExchange* pDX)
- {
- CFormView::DoDataExchange(pDX);
- //{{AFX_DATA_MAP(CWaveView)
- DDX_VBControl(pDX, IDC_TEGOMM_WAV, m_wav);
- //}}AFX_DATA_MAP
- }
-
-
- BEGIN_MESSAGE_MAP(CWaveView, CFormView)
- //{{AFX_MSG_MAP(CWaveView)
- ON_VBXEVENT(VBN_DONE, IDC_TEGOMM_WAV, OnDoneTegommWav)
- ON_BN_CLICKED(IDC_BUTTON_HIDE, OnButtonHide)
- ON_BN_CLICKED(IDC_BUTTON_SHOW, OnButtonShow)
- ON_BN_CLICKED(IDC_BUTTON_PLAY, OnButtonPlay)
- //}}AFX_MSG_MAP
- END_MESSAGE_MAP()
-
-
- /////////////////////////////////////////////////////////////////////////////
- // CWaveView message handlers
-
- //////////////////////
- // MY CODE STARTS HERE
- //////////////////////
-
- void CWaveView::OnInitialUpdate()
- {
-
- // Call the base class function.
- CFormView::OnInitialUpdate();
-
- // Set the device type for playback of WAV files.
- m_wav->SetStrProperty("DeviceType","WaveAudio");
-
- // To play through the PC speaker, simply set the DeviceType
- // to PCSpeaker as follows:
- // m_wav->SetStrProperty("DeviceType","PCSpeaker");
-
- // Set the WAV file name.
- m_wav->SetStrProperty("FileName",
- "\\VCPROG\\WAV\\ITSBEEN1.WAV" );
-
- // Open the Wave device.
- m_wav->SetStrProperty("Command", "Open");
-
- }
-
- ////////////////////
- // MY CODE ENDS HERE
- ////////////////////
-
- void CWaveView::OnDoneTegommWav(UINT, int, CWnd*, LPVOID)
- {
- // TODO: Add your VBX event notification handler code here
-
- //////////////////////
- // MY CODE STARTS HERE
- //////////////////////
-
- // Get current position.
- long position = m_wav->GetNumProperty("Position");
-
- // Get total length.
- long length = m_wav->GetNumProperty("Length");
-
- // If current position is end position, rewind the tape.
- if (position == length)
- m_wav->SetStrProperty("Command", "Prev");
-
- ////////////////////
- // MY CODE ENDS HERE
- ////////////////////
-
- }
-
- void CWaveView::OnButtonHide()
- {
- // TODO: Add your control notification handler code here
-
- ///////////////////////
- // MY CODE STARTS HERE
- //////////////////////
-
- // Hide the multimedia control.
- m_wav->SetNumProperty("Visible", FALSE);
-
- ////////////////////
- // MY CODE ENDS HERE
- ////////////////////
-
- }
-
- void CWaveView::OnButtonShow()
- {
- // TODO: Add your control notification handler code here
-
- //////////////////////
- // MY CODE STARTS HERE
- //////////////////////
-
- // Show the multimedia control.
- m_wav->SetNumProperty("Visible", TRUE);
-
- ////////////////////
- // MY CODE ENDS HERE
- ////////////////////
-
- }
-
- void CWaveView::OnButtonPlay()
- {
- // TODO: Add your control notification handler code here
-
- ///////////////////////
- // MY CODE STARTS HERE
- //////////////////////
-
- // Play the WAV file.
- m_wav->SetStrProperty("Command", "Play");
-
- ////////////////////
- // MY CODE ENDS HERE
- ////////////////////
-
- }
-