]> git.saurik.com Git - wxWidgets.git/blob - utils/wxMMedia2/lib/sndwin.cpp
Sound recording works on Windows
[wxWidgets.git] / utils / wxMMedia2 / lib / sndwin.cpp
1 // --------------------------------------------------------------------------
2 // Name: sndwin.cpp
3 // Purpose:
4 // Date: 08/11/1999
5 // Author: Guilhem Lavaux <lavaux@easynet.fr> (C) 1999
6 // CVSID: $Id$
7 // --------------------------------------------------------------------------
8 #include <wx/wxprec.h>
9
10 #include <wx/app.h>
11 #include <wx/module.h>
12 #include <wx/msw/private.h>
13 #include <string.h>
14 #include "sndbase.h"
15 #include "sndwin.h"
16 #include "sndpcm.h"
17
18 #include <windows.h>
19 #include <mmsystem.h>
20
21 typedef struct _wxSoundInternal wxSoundInternal;
22 typedef struct _wxSoundInfoHeader wxSoundInfoHeader;
23
24 extern const wxChar *wxCanvasClassName;
25
26 wxList *wxSoundHandleList = NULL;
27
28 static inline wxSoundStreamWin *wxFindSoundFromHandle(WXHWND hWnd)
29 {
30 wxNode *node = wxSoundHandleList->Find((long)hWnd);
31 if (!node)
32 return NULL;
33 return (wxSoundStreamWin *)node->Data();
34 }
35
36 struct _wxSoundInternal {
37 HWND m_sndWin;
38 HWAVEIN m_devin;
39 HWAVEOUT m_devout;
40 bool m_output_enabled, m_input_enabled;
41 };
42
43 struct _wxSoundInfoHeader {
44 HGLOBAL m_h_header, m_h_data;
45 char *m_data;
46 WAVEHDR *m_header;
47 int m_mode;
48 bool m_playing, m_recording;
49 wxUint32 m_position, m_size;
50
51 wxSoundStreamWin *m_driver;
52 };
53
54 #define WXSOUND_MAX_QUEUE 10
55
56 wxSoundStreamWin::wxSoundStreamWin()
57 {
58 wxSoundFormatPcm pcm;
59
60 m_production_started = FALSE;
61 m_internal = new wxSoundInternal;
62 m_snderror = wxSOUND_NOERR;
63
64 // Setup defaults
65 CreateSndWindow();
66 SetSoundFormat(pcm);
67
68 m_internal->m_input_enabled = FALSE;
69 m_internal->m_output_enabled = FALSE;
70
71 m_waiting_for = FALSE;
72
73 if (!OpenDevice(wxSOUND_OUTPUT))
74 return;
75
76 CloseDevice();
77 }
78
79 wxSoundStreamWin::~wxSoundStreamWin()
80 {
81 if (m_production_started)
82 StopProduction();
83 DestroySndWindow();
84
85 delete m_internal;
86 }
87
88 LRESULT APIENTRY _EXPORT _wxSoundHandlerWndProc(HWND hWnd, UINT message,
89 WPARAM wParam, LPARAM lParam)
90 {
91 wxSoundStreamWin *sndwin;
92
93 sndwin = wxFindSoundFromHandle((WXHWND)hWnd);
94 if (!sndwin)
95 return (LRESULT)0;
96
97 switch (message) {
98 case MM_WOM_DONE:
99 sndwin->NotifyDoneBuffer(wParam, wxSOUND_OUTPUT);
100 break;
101 case MM_WIM_DATA:
102 sndwin->NotifyDoneBuffer(wParam, wxSOUND_INPUT);
103 break;
104 default:
105 break;
106 }
107 return (LRESULT)0;
108 }
109
110 // -----------------------------------------------------------------------
111 // CreateSndWindow() creates an hidden window which will receive the sound
112 // events
113 // -----------------------------------------------------------------------
114
115 void wxSoundStreamWin::CreateSndWindow()
116 {
117 FARPROC proc = MakeProcInstance((FARPROC)_wxSoundHandlerWndProc,
118 wxGetInstance());
119 int error;
120
121 m_internal->m_sndWin = ::CreateWindow(wxCanvasClassName, NULL, 0,
122 0, 0, 0, 0, NULL, (HMENU) NULL,
123 wxGetInstance(), NULL);
124
125 error = GetLastError();
126
127 ::SetWindowLong(m_internal->m_sndWin, GWL_WNDPROC, (LONG)proc);
128
129 // Add this window to the sound handle list so we'll be able to redecode
130 // the "magic" number.
131 wxSoundHandleList->Append((long)m_internal->m_sndWin, (wxObject *)this);
132 }
133
134 // -----------------------------------------------------------------------
135 // DestroySndWindow() destroys the hidden window
136 // -----------------------------------------------------------------------
137
138 void wxSoundStreamWin::DestroySndWindow()
139 {
140 if (m_internal->m_sndWin) {
141 ::DestroyWindow(m_internal->m_sndWin);
142 wxSoundHandleList->DeleteObject((wxObject *)this);
143 }
144 }
145
146 // -------------------------------------------------------------------------
147 // OpenDevice(int mode) initializes the windows driver for a "mode"
148 // operation. mode is a bit mask: if the bit "wxSOUND_OUTPUT" is set,
149 // the driver is opened for output operation, and if the bit "wxSOUND_INPUT"
150 // is set, then the driver is opened for input operation. The two modes
151 // aren't exclusive.
152 // The initialization parameters (sample rate, ...) are taken from the
153 // m_sndformat object.
154 // At the end, OpenDevice() calls AllocHeaders() to initialize the Sound IO
155 // queue.
156 // -------------------------------------------------------------------------
157 bool wxSoundStreamWin::OpenDevice(int mode)
158 {
159 wxSoundFormatPcm *pcm;
160 WAVEFORMATEX wformat;
161
162 if (!m_sndformat) {
163 m_snderror = wxSOUND_INVFRMT;
164 return FALSE;
165 }
166
167 pcm = (wxSoundFormatPcm *)m_sndformat;
168
169 wformat.wFormatTag = WAVE_FORMAT_PCM;
170 wformat.nChannels = pcm->GetChannels();
171 wformat.nBlockAlign = wformat.nChannels * pcm->GetBPS() / 8;
172 wformat.nSamplesPerSec = pcm->GetSampleRate();
173 wformat.nAvgBytesPerSec = wformat.nSamplesPerSec * wformat.nBlockAlign;
174 wformat.wBitsPerSample = pcm->GetBPS();
175 wformat.cbSize = 0;
176
177 // -----------------------------------
178 // Open the driver for Output operation
179 // -----------------------------------
180 if (mode & wxSOUND_OUTPUT) {
181 MMRESULT result;
182
183 result = waveOutOpen(&m_internal->m_devout,
184 WAVE_MAPPER, &wformat,
185 (DWORD)m_internal->m_sndWin, 0,
186 CALLBACK_WINDOW);
187
188 if (result != MMSYSERR_NOERROR) {
189 m_snderror = wxSOUND_INVDEV;
190 return FALSE;
191 }
192
193 m_output_frag_out = WXSOUND_MAX_QUEUE-1;
194 m_current_frag_out = 0;
195
196 m_internal->m_output_enabled = TRUE;
197 }
198 // -----------------------------------
199 // Open the driver for Input operation
200 // -----------------------------------
201 if (mode & wxSOUND_INPUT) {
202 MMRESULT result;
203
204 result = waveInOpen(&m_internal->m_devin,
205 WAVE_MAPPER, &wformat,
206 (DWORD)m_internal->m_sndWin, 0,
207 CALLBACK_WINDOW);
208
209 if (result != MMSYSERR_NOERROR) {
210 m_snderror = wxSOUND_INVDEV;
211 return FALSE;
212 }
213
214 m_current_frag_in = WXSOUND_MAX_QUEUE-1;
215 m_input_frag_in = 0;
216
217 m_internal->m_input_enabled = TRUE;
218 }
219
220 if (mode & wxSOUND_OUTPUT) {
221 if (!AllocHeaders(wxSOUND_OUTPUT)) {
222 CloseDevice();
223 return FALSE;
224 }
225 }
226 if (mode & wxSOUND_INPUT) {
227 if (!AllocHeaders(wxSOUND_INPUT)) {
228 CloseDevice();
229 return FALSE;
230 }
231 }
232
233 return TRUE;
234 }
235
236 // -------------------------------------------------------------------------
237 // CloseDevice() closes the driver handles and frees memory allocated for
238 // IO queues.
239 // -------------------------------------------------------------------------
240 void wxSoundStreamWin::CloseDevice()
241 {
242 if (m_internal->m_output_enabled) {
243 FreeHeaders(wxSOUND_OUTPUT);
244 m_internal->m_output_enabled = FALSE;
245 waveOutClose(m_internal->m_devout);
246 }
247
248 if (m_internal->m_input_enabled) {
249 FreeHeaders(wxSOUND_INPUT);
250 m_internal->m_input_enabled = FALSE;
251 waveInClose(m_internal->m_devin);
252 }
253 }
254
255 // -------------------------------------------------------------------------
256 // AllocHeader(int mode)
257 //
258 // mode has the same mean as in OpenDevice() except that here the two flags
259 // must be exclusive.
260 // AllocHeader() initializes an element of an operation (this can be input
261 // or output). It means it allocates the sound header's memory block
262 // and "prepares" it (It is needed by Windows). At the same time, it sets
263 // private datas so we can the header's owner (See callback).
264 //
265 // It returns the new allocated block or NULL.
266 // -------------------------------------------------------------------------
267 wxSoundInfoHeader *wxSoundStreamWin::AllocHeader(int mode)
268 {
269 wxSoundInfoHeader *info;
270 WAVEHDR *header;
271
272 // Some memory allocation
273 info = new wxSoundInfoHeader;
274 info->m_h_data = GlobalAlloc(GMEM_MOVEABLE | GMEM_SHARE, GetBestSize());
275 info->m_h_header = GlobalAlloc(GMEM_MOVEABLE | GMEM_SHARE, sizeof(WAVEHDR));
276 if (!info->m_h_data || !info->m_h_header) {
277 delete info;
278 m_snderror = wxSOUND_MEMERR;
279 return NULL;
280 }
281
282 // Get the two pointers from the system
283 info->m_data = (char *)GlobalLock(info->m_h_data);
284 info->m_header = (WAVEHDR *)GlobalLock(info->m_h_header);
285 // Set the header's mode
286 info->m_mode = mode;
287 // Set the parent of the header
288 info->m_driver = this;
289 // Clean it up
290 ClearHeader(info);
291
292 header = info->m_header;
293 // Initialize Windows variables
294 header->lpData = info->m_data;
295 header->dwBufferLength = GetBestSize();
296 header->dwUser = (DWORD)info;
297 header->dwFlags = WHDR_DONE;
298
299 // "Prepare" the header
300 if (mode == wxSOUND_INPUT) {
301 MMRESULT result;
302
303 result = waveInPrepareHeader(m_internal->m_devin, header,
304 sizeof(WAVEHDR));
305
306 if (result != MMSYSERR_NOERROR) {
307 // If something goes wrong, free everything.
308 GlobalUnlock(info->m_data);
309 GlobalUnlock(info->m_header);
310 GlobalFree(info->m_h_data);
311 GlobalFree(info->m_h_header);
312 delete info;
313
314 m_snderror = wxSOUND_IOERR;
315 return NULL;
316 }
317 } else if (mode == wxSOUND_OUTPUT) {
318 MMRESULT result;
319
320 result = waveOutPrepareHeader(m_internal->m_devout, header,
321 sizeof(WAVEHDR));
322
323 if (result != MMSYSERR_NOERROR) {
324 // If something goes wrong, free everything.
325 GlobalUnlock(info->m_data);
326 GlobalUnlock(info->m_header);
327 GlobalFree(info->m_h_data);
328 GlobalFree(info->m_h_header);
329 delete info;
330
331 m_snderror = wxSOUND_IOERR;
332 return NULL;
333 }
334 }
335 return info;
336 }
337
338 // -------------------------------------------------------------------------
339 // AllocHeaders(int mode)
340 //
341 // "mode" has the same mean as for OpenDevice() except that the two flags must
342 // be exclusive.
343 // AllocHeaders() allocates WXSOUND_MAX_QUEUE (= 128) blocks for an operation
344 // queue. It uses AllocHeader() for each element.
345 //
346 // Once it has allocated all blocks, it returns TRUE and if an error occured
347 // it returns FALSE.
348 // -------------------------------------------------------------------------
349 bool wxSoundStreamWin::AllocHeaders(int mode)
350 {
351 int i;
352 wxSoundInfoHeader **headers;
353
354 if (mode == wxSOUND_OUTPUT)
355 headers = m_headers_play = new wxSoundInfoHeader *[WXSOUND_MAX_QUEUE];
356 else
357 headers = m_headers_rec = new wxSoundInfoHeader *[WXSOUND_MAX_QUEUE];
358
359 memset(headers, 0, WXSOUND_MAX_QUEUE*sizeof(wxSoundInfoHeader *));
360
361 for (i=0;i<WXSOUND_MAX_QUEUE;i++) {
362 headers[i] = AllocHeader(mode);
363 if (!headers[i]) {
364 FreeHeaders(mode);
365 return FALSE;
366 }
367 }
368 return TRUE;
369 }
370
371 // -------------------------------------------------------------------------
372 // FreeHeader(int mode)
373 //
374 // "mode" has the same mean as for OpenDevice() except that the two flags must
375 // be exclusive.
376 // FreeHeader() frees a memory block and "unprepares" it.
377 // -------------------------------------------------------------------------
378 void wxSoundStreamWin::FreeHeader(wxSoundInfoHeader *header, int mode)
379 {
380 if (mode == wxSOUND_OUTPUT)
381 waveOutUnprepareHeader(m_internal->m_devout, header->m_header, sizeof(WAVEHDR));
382 else
383 waveInUnprepareHeader(m_internal->m_devin, header->m_header, sizeof(WAVEHDR));
384
385 GlobalUnlock(header->m_data);
386 GlobalUnlock(header->m_header);
387 GlobalFree(header->m_h_header);
388 GlobalFree(header->m_h_data);
389 delete header;
390 }
391
392 // -------------------------------------------------------------------------
393 // FreeHeaders(int mode)
394 //
395 // "mode" has the same mean as for OpenDevice() except that the two flags must
396 // be exclusive.
397 // FreeHeaders() frees all an operation queue once it has checked that
398 // all buffers have been terminated.
399 // -------------------------------------------------------------------------
400 void wxSoundStreamWin::FreeHeaders(int mode)
401 {
402 int i;
403 wxSoundInfoHeader ***headers;
404
405 if (mode == wxSOUND_OUTPUT)
406 headers = &m_headers_play;
407 else
408 headers = &m_headers_rec;
409
410 for (i=0;i<WXSOUND_MAX_QUEUE;i++) {
411 if ((*headers)[i]) {
412 // We wait for the end of the buffer
413 WaitFor((*headers)[i]);
414 // Then, we free the header
415 FreeHeader((*headers)[i], mode);
416 }
417 }
418 delete[] (*headers);
419 (*headers) = NULL;
420 }
421
422 // -------------------------------------------------------------------------
423 // WaitFor(wxSoundInfoHeader *info)
424 //
425 // "info" is one element of an IO queue
426 // WaitFor() checks whether the specified block has been terminated.
427 // If it hasn't been terminated, it waits for its termination.
428 //
429 // NB: if it's a partially filled buffer it adds it to the Windows queue
430 // -------------------------------------------------------------------------
431 void wxSoundStreamWin::WaitFor(wxSoundInfoHeader *info)
432 {
433 // If the buffer is finished, we return immediately
434 if (!info->m_playing) {
435
436 // We begun filling it: we must send it to the Windows queue
437 if (info->m_position != 0) {
438 memset(info->m_data + info->m_position, 0, info->m_size);
439 AddToQueue(info);
440 }
441 }
442
443 if (m_waiting_for) {
444 // PROBLEM //
445 return;
446 }
447 m_waiting_for = TRUE;
448 // Else, we wait for its termination
449 while (info->m_playing || info->m_recording)
450 wxYield();
451 m_waiting_for = FALSE;
452 }
453
454 // -------------------------------------------------------------------------
455 // AddToQueue(wxSoundInfoHeader *info)
456 //
457 // For "info", see WaitFor()
458 // AddToQueue() sends the IO queue element to the Windows queue.
459 //
460 // Warning: in the current implementation, it partially assume we send the
461 // element in the right order. This is true in that implementation but if
462 // you use it elsewhere, be careful: it may shuffle all your sound datas.
463 // -------------------------------------------------------------------------
464 bool wxSoundStreamWin::AddToQueue(wxSoundInfoHeader *info)
465 {
466 MMRESULT result;
467
468 if (info->m_mode == wxSOUND_INPUT) {
469 // Increment the input fragment pointer
470 result = waveInAddBuffer(m_internal->m_devin,
471 info->m_header, sizeof(WAVEHDR));
472 if (result == MMSYSERR_NOERROR)
473 info->m_recording = TRUE;
474 else
475 return FALSE;
476 } else if (info->m_mode == wxSOUND_OUTPUT) {
477 result = waveOutWrite(m_internal->m_devout,
478 info->m_header, sizeof(WAVEHDR));
479 if (result == MMSYSERR_NOERROR)
480 info->m_playing = TRUE;
481 else
482 return FALSE;
483 }
484 return TRUE;
485 }
486
487 // -------------------------------------------------------------------------
488 // ClearHeader(wxSoundInfoHeader *info)
489 //
490 // ClearHeader() reinitializes the parameters of "info" to their default
491 // value.
492 // -------------------------------------------------------------------------
493 void wxSoundStreamWin::ClearHeader(wxSoundInfoHeader *info)
494 {
495 info->m_playing = FALSE;
496 info->m_recording = FALSE;
497 info->m_position = 0;
498 info->m_size = GetBestSize();
499 }
500
501 // -------------------------------------------------------------------------
502 // wxSoundInfoHeader *NextFragmentOutput()
503 //
504 // NextFragmentOutput() looks for a free output block. It will always
505 // return you a non-NULL pointer but it may waits for an empty buffer a long
506 // time.
507 // -------------------------------------------------------------------------
508 wxSoundInfoHeader *wxSoundStreamWin::NextFragmentOutput()
509 {
510 if (m_headers_play[m_current_frag_out]->m_playing) {
511 m_current_frag_out = (m_current_frag_out + 1) % WXSOUND_MAX_QUEUE;
512
513 if (m_headers_play[m_current_frag_out]->m_playing)
514 WaitFor(m_headers_play[m_current_frag_out]);
515 }
516 if (m_current_frag_out == m_output_frag_out)
517 m_queue_filled = TRUE;
518 return m_headers_play[m_current_frag_out];
519 }
520
521 // -------------------------------------------------------------------------
522 // The behaviour of Write is documented in the global documentation.
523 // -------------------------------------------------------------------------
524 wxSoundStream& wxSoundStreamWin::Write(const void *buffer, wxUint32 len)
525 {
526 m_lastcount = 0;
527 if (!m_internal->m_output_enabled)
528 return *this;
529
530 while (len > 0) {
531 wxSoundInfoHeader *header;
532 wxUint32 to_copy;
533
534 // Get a new output fragment
535 header = NextFragmentOutput();
536
537 to_copy = (len > header->m_size) ? header->m_size : len;
538 memcpy(header->m_data + header->m_position, buffer, to_copy);
539
540 header->m_position += to_copy;
541 header->m_size -= to_copy;
542 buffer = (((const char *)buffer) + to_copy);
543 len -= to_copy;
544 m_lastcount += to_copy;
545
546 // If the fragment is full, we send it to the Windows queue.
547 if (header->m_size == 0)
548 if (!AddToQueue(header)) {
549 m_snderror = wxSOUND_IOERR;
550 return *this;
551 }
552 }
553 return *this;
554 }
555
556 // -------------------------------------------------------------------------
557 // NextFragmentInput is not functional.
558 // -------------------------------------------------------------------------
559 wxSoundInfoHeader *wxSoundStreamWin::NextFragmentInput()
560 {
561 wxSoundInfoHeader *header;
562
563 m_current_frag_in = (m_current_frag_in + 1) % WXSOUND_MAX_QUEUE;
564
565 header = m_headers_rec[m_current_frag_in];
566 if (header->m_recording)
567 WaitFor(header);
568
569 if (m_current_frag_in == m_input_frag_in)
570 m_queue_filled = TRUE;
571
572 return header;
573 }
574
575 // -------------------------------------------------------------------------
576 // The behaviour of Read is documented in the global documentation.
577 // -------------------------------------------------------------------------
578 wxSoundStream& wxSoundStreamWin::Read(void *buffer, wxUint32 len)
579 {
580 wxSoundInfoHeader *header;
581 wxUint32 to_copy;
582
583 m_lastcount = 0;
584 if (!m_internal->m_input_enabled)
585 return *this;
586
587 while (len > 0) {
588 header = NextFragmentInput();
589
590 to_copy = (len > header->m_size) ? header->m_size : len;
591 memcpy(buffer, header->m_data + header->m_position, to_copy);
592
593 header->m_position += to_copy;
594 header->m_size -= to_copy;
595 buffer = (((char *)buffer) + to_copy);
596 len -= to_copy;
597 m_lastcount += to_copy;
598
599 if (header->m_size == 0) {
600 ClearHeader(header);
601 if (!AddToQueue(header)) {
602 m_snderror = wxSOUND_IOERR;
603 return *this;
604 }
605 }
606 }
607 return *this;
608 }
609
610 // -------------------------------------------------------------------------
611 // NotifyDoneBuffer(wxUint32 dev_handle)
612 //
613 // NotifyDoneBuffer() is called by wxSoundHandlerProc each time a sound
614 // fragment finished. It reinitializes the parameters of the fragment and
615 // sends an event to the clients.
616 // -------------------------------------------------------------------------
617 void wxSoundStreamWin::NotifyDoneBuffer(wxUint32 dev_handle, int flag)
618 {
619 wxSoundInfoHeader *info;
620
621 if (flag == wxSOUND_OUTPUT) {
622 if (!m_internal->m_output_enabled)
623 return;
624
625 m_output_frag_out = (m_output_frag_out + 1) % WXSOUND_MAX_QUEUE;
626 info = m_headers_play[m_output_frag_out];
627 ClearHeader(info);
628 m_queue_filled = FALSE;
629 if (!m_waiting_for)
630 OnSoundEvent(wxSOUND_OUTPUT);
631 } else {
632 if (!m_internal->m_input_enabled)
633 return;
634
635 m_headers_rec[m_input_frag_in]->m_recording = FALSE;
636 m_input_frag_in = (m_input_frag_in + 1) % WXSOUND_MAX_QUEUE;
637 if (!m_waiting_for)
638 OnSoundEvent(wxSOUND_INPUT);
639 m_queue_filled = FALSE;
640 }
641 }
642
643 // -------------------------------------------------------------------------
644 // -------------------------------------------------------------------------
645 bool wxSoundStreamWin::SetSoundFormat(wxSoundFormatBase& base)
646 {
647 return wxSoundStream::SetSoundFormat(base);
648 }
649
650 // -------------------------------------------------------------------------
651 // -------------------------------------------------------------------------
652 bool wxSoundStreamWin::StartProduction(int evt)
653 {
654 if ((m_internal->m_output_enabled && (evt & wxSOUND_OUTPUT)) ||
655 (m_internal->m_input_enabled && (evt & wxSOUND_INPUT)))
656 CloseDevice();
657
658 if (!OpenDevice(evt))
659 return FALSE;
660
661 m_production_started = TRUE;
662 m_queue_filled = FALSE;
663 // Send a dummy event to start.
664 if (evt & wxSOUND_OUTPUT)
665 OnSoundEvent(wxSOUND_OUTPUT);
666
667 if (evt & wxSOUND_INPUT) {
668 int i;
669 for (i=0;i<WXSOUND_MAX_QUEUE;i++)
670 AddToQueue(m_headers_rec[i]);
671
672 waveInStart(m_internal->m_devin);
673 }
674
675 return TRUE;
676 }
677
678 // -------------------------------------------------------------------------
679 // -------------------------------------------------------------------------
680 bool wxSoundStreamWin::StopProduction()
681 {
682 m_production_started = FALSE;
683 CloseDevice();
684 return TRUE;
685 }
686
687 // -------------------------------------------------------------------------
688 // -------------------------------------------------------------------------
689 bool wxSoundStreamWin::QueueFilled() const
690 {
691 return (!m_production_started || m_queue_filled);
692 }
693
694
695 // --------------------------------------------------------------------------
696 // wxSoundWinModule
697 // --------------------------------------------------------------------------
698
699 class WXDLLEXPORT wxSoundWinModule : public wxModule {
700 DECLARE_DYNAMIC_CLASS(wxSoundWinModule)
701 public:
702 bool OnInit();
703 void OnExit();
704 };
705
706 IMPLEMENT_DYNAMIC_CLASS(wxSoundWinModule, wxModule)
707
708 bool wxSoundWinModule::OnInit() {
709 wxSoundHandleList = new wxList(wxKEY_INTEGER);
710 return TRUE;
711 }
712
713 void wxSoundWinModule::OnExit() {
714 delete wxSoundHandleList;
715 }