Fixed bug in wxSound windows driver (Recording is in progress: don't try it
it make Windows crash completely) git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@4556 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
454e2a22c0
commit
cc82835c2b
@ -18,7 +18,7 @@ THISDIR = $(MMDIR)\lib
|
||||
EXTRALIBS=$(WXDIR)\lib\glcanvas.lib
|
||||
|
||||
LIBTARGET=$(WXDIR)\lib\mmedia2.lib
|
||||
OBJECTS = cdbase.obj cdwin.obj g711.obj g721.obj g723_24.obj \
|
||||
OBJECTS = cdbase.obj cdwin.obj g711.obj g721.obj g723_24.obj sndg72x.obj \
|
||||
g723_40.obj g72x.obj sndbase.obj sndcodec.obj sndpcm.obj \
|
||||
sndcpcm.obj sndulaw.obj sndfile.obj sndwav.obj sndaiff.obj sndwin.obj \
|
||||
vidbase.obj
|
||||
|
@ -65,6 +65,9 @@ wxSoundStreamWin::wxSoundStreamWin()
|
||||
CreateSndWindow();
|
||||
SetSoundFormat(pcm);
|
||||
|
||||
m_internal->m_input_enabled = FALSE;
|
||||
m_internal->m_output_enabled = FALSE;
|
||||
|
||||
if (!OpenDevice(wxSOUND_OUTPUT))
|
||||
return;
|
||||
|
||||
@ -83,12 +86,18 @@ wxSoundStreamWin::~wxSoundStreamWin()
|
||||
LRESULT APIENTRY _EXPORT _wxSoundHandlerWndProc(HWND hWnd, UINT message,
|
||||
WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
wxSoundStreamWin *sndwin;
|
||||
|
||||
sndwin = wxFindSoundFromHandle((WXHWND)hWnd);
|
||||
if (!sndwin)
|
||||
return (LRESULT)0;
|
||||
|
||||
switch (message) {
|
||||
case MM_WOM_DONE:
|
||||
wxFindSoundFromHandle((WXHWND)hWnd)->NotifyDoneBuffer(wParam, wxSOUND_OUTPUT);
|
||||
sndwin->NotifyDoneBuffer(wParam, wxSOUND_OUTPUT);
|
||||
break;
|
||||
case MM_WIM_DATA:
|
||||
wxFindSoundFromHandle((WXHWND)hWnd)->NotifyDoneBuffer(wParam, wxSOUND_INPUT);
|
||||
sndwin->NotifyDoneBuffer(wParam, wxSOUND_INPUT);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@ -228,16 +237,15 @@ bool wxSoundStreamWin::OpenDevice(int mode)
|
||||
// -------------------------------------------------------------------------
|
||||
void wxSoundStreamWin::CloseDevice()
|
||||
{
|
||||
m_internal->m_output_enabled = FALSE;
|
||||
m_internal->m_input_enabled = FALSE;
|
||||
|
||||
if (m_internal->m_output_enabled) {
|
||||
m_internal->m_output_enabled = FALSE;
|
||||
waveOutReset(m_internal->m_devout);
|
||||
FreeHeaders(wxSOUND_OUTPUT);
|
||||
waveOutClose(m_internal->m_devout);
|
||||
}
|
||||
|
||||
if (m_internal->m_input_enabled) {
|
||||
m_internal->m_input_enabled = FALSE;
|
||||
waveInReset(m_internal->m_devin);
|
||||
FreeHeaders(wxSOUND_INPUT);
|
||||
waveInClose(m_internal->m_devin);
|
||||
@ -549,12 +557,12 @@ wxSoundInfoHeader *wxSoundStreamWin::NextFragmentInput()
|
||||
{
|
||||
wxSoundInfoHeader *header;
|
||||
|
||||
m_current_frag_in = (m_current_frag_in + 1) % WXSOUND_MAX_QUEUE;
|
||||
|
||||
header = m_headers_rec[m_current_frag_in];
|
||||
if (header->m_recording)
|
||||
WaitFor(header);
|
||||
|
||||
m_current_frag_in = (m_current_frag_in + 1) % WXSOUND_MAX_QUEUE;
|
||||
|
||||
if (m_current_frag_in == m_input_frag_in)
|
||||
m_queue_filled = TRUE;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user