![]() |
Which control i should use to play sound??
Hi all...
My question is much like previous one but with little difference.. This time i am developing an application which browses file having .wav or .avi extention.... Pls also tell me in which control i can play selected sound... Regards... |
What libraries are you currently using for your application ?
|
Hi .. Following is code behind three buttons like Load, Play n Stop:-
void Sound::LoadSound() { char path[255]; GetCurrentDirectory(255, path); CFileDialog dialog(TRUE,NULL,NULL,OFN_OVERWRITEPROMPT,"WAV Files (*.wav)|*.wav||"); INT_PTR ptr= dialog.DoModal(); SetCurrentDirectory(path); if (ptr==IDOK) { UpdateData(); CString str=dialog.GetPathName(); m_snd_ext = dialog.GetFileExt(); m_snd_filename=str; PlaySnd(); UpdateData(FALSE); } } void Sound::PlaySnd() { m_valid_snd = PlaySound(m_snd_filename,NULL,SND_ASYNC|SND_FILENAME|SND_LOOP); if(m_valid_snd) { this->GetDlgItem(IDC_SND_PLAY)->EnableWindow(FALSE); this->GetDlgItem(IDC_SND_STOP)->EnableWindow(TRUE); } } void Sound::StopSound() { PlaySound(NULL,NULL,SND_PURGE); this->GetDlgItem(IDC_SND_STOP)->EnableWindow(FALSE); this->GetDlgItem(IDC_SND_PLAY)->EnableWindow(TRUE); } One may select a sound (.wav file)which may be corrupted. Its better to check the file in advance then Call PlaySound(). Can we have check on corrupted wav file ?? |
Have a look:
Quote:
|
Following is code behind three buttons like Load, Play n Stop:-
code behind LoadSound Button... :
void Sound::LoadSound()code behind PlaySnd Button... :
void Sound::PlaySnd()Code behind StopSound button... :
void Sound::StopSound()Its better to check the file in advance and then Load it or Call PlaySound(). Can we have check on corrupted wav file ?? |
Thansk Dawei for your suggestion....
|
Updated now
|
| All times are GMT -5. The time now is 2:54 AM. |
Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC