]> git.saurik.com Git - wxWidgets.git/blob - utils/wxMMedia2/sample/test_med2.cpp
26b7dfaaf235c703a220ecd3657c0e6372c44ae5
[wxWidgets.git] / utils / wxMMedia2 / sample / test_med2.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/app.h>
9 #include <wx/wfstream.h>
10 #include <wx/frame.h>
11 #include "../lib/sndoss.h"
12 #include "../lib/sndesd.h"
13 #include "../lib/sndwav.h"
14 #include "../lib/sndaiff.h"
15
16 class MyApp: public wxApp {
17 bool OnInit() {
18 // wxSoundStreamOSS *oss_dev = new wxSoundStreamOSS();
19 wxSoundStreamESD *oss_dev = new wxSoundStreamESD();
20 wxFileInputStream *f_input = new wxFileInputStream(argv[1]);
21 wxSoundFileStream *wav_file;
22 wxFrame *frame = new wxFrame(NULL, -1, "My Frame");
23 wxSoundFormatPcm pcm;
24
25 if (oss_dev->GetError() != wxSOUND_NOERR) {
26 wxPrintf("No device\n");
27 return FALSE;
28 }
29
30 wav_file = new wxSoundWave(*f_input, *oss_dev);
31 if (!wav_file->CanRead()) {
32 wav_file = new wxSoundAiff(*f_input, *oss_dev);
33 if (!wav_file->CanRead())
34 return FALSE;
35 }
36
37 wav_file->Play();
38 frame->Show(TRUE);
39 return TRUE;
40 }
41 };
42
43 IMPLEMENT_APP(MyApp)