]> git.saurik.com Git - wxWidgets.git/blob - utils/wxMMedia2/sample/test_med4.cpp
SetSelection() in wxNotebook now sets the focus,
[wxWidgets.git] / utils / wxMMedia2 / sample / test_med4.cpp
1 // --------------------------------------------------------------------------
2 // Name: test_med.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 #include <wx/app.h>
10 #include <wx/wfstream.h>
11 #include <wx/frame.h>
12 #include "../lib/sndoss.h"
13 #include "../lib/sndwav.h"
14 #include "../lib/sndaiff.h"
15 #include "../lib/sndwin.h"
16
17 class MyApp: public wxApp {
18 wxSoundStream *oss_dev;
19 wxOutputStream *f_output;
20 wxSoundFileStream *wav_file;
21
22 bool OnInit() {
23 wxFrame *frame = new wxFrame(NULL, -1, "My Frame");
24 wxSoundFormatPcm pcm;
25
26 oss_dev = new wxSoundStreamWin();
27 f_output = new wxFileOutputStream(argv[1]);
28 wav_file = new wxSoundWave(*f_output, *oss_dev);
29
30 if (oss_dev->GetError() != wxSOUND_NOERR) {
31 wxPrintf("No device\n");
32 return FALSE;
33 }
34
35 pcm.SetSampleRate(22050);
36 pcm.SetBPS(8);
37 pcm.SetChannels(1);
38
39 wav_file->SetSoundFormat(pcm);
40
41 // Record 10 sec of sound
42 wav_file->Record(10);
43 frame->Show(TRUE);
44 return TRUE;
45 }
46 int OnExit() {
47 delete wav_file;
48 delete f_output;
49 delete oss_dev;
50 return 0;
51 }
52 };
53
54 IMPLEMENT_APP(MyApp)