]> git.saurik.com Git - wxWidgets.git/blob - wxPython/src/_sound.i
made wxNumberEntryDialog public; extracted it and wxGetNumberFromUser() in a separate...
[wxWidgets.git] / wxPython / src / _sound.i
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: _sound.i
3 // Purpose: SWIG interface stuff for wxSound
4 //
5 // Author: Robin Dunn
6 //
7 // Created: 18-June-1999
8 // RCS-ID: $Id$
9 // Copyright: (c) 2003 by Total Control Software
10 // Licence: wxWindows license
11 /////////////////////////////////////////////////////////////////////////////
12
13 // Not a %module
14
15
16 //---------------------------------------------------------------------------
17 %newgroup
18
19 %{
20 #include <wx/sound.h>
21 %}
22
23 //---------------------------------------------------------------------------
24
25 enum wxSoundFlags
26 {
27 wxSOUND_SYNC = 0,
28 wxSOUND_ASYNC = 1,
29 wxSOUND_LOOP = 2
30 };
31
32
33
34 %{
35 #if !wxUSE_SOUND
36 // A C++ stub class for wxWave for platforms that don't have it.
37 class wxSound : public wxObject
38 {
39 public:
40 wxSound() {
41 wxPyBeginBlockThreads();
42 PyErr_SetString(PyExc_NotImplementedError,
43 "wxSound is not available on this platform.");
44 wxPyEndBlockThreads();
45 }
46 wxSound(const wxString&, bool) {
47 wxPyBeginBlockThreads();
48 PyErr_SetString(PyExc_NotImplementedError,
49 "wxSound is not available on this platform.");
50 wxPyEndBlockThreads();
51 }
52 wxSound(int, const wxByte*) {
53 wxPyBeginBlockThreads();
54 PyErr_SetString(PyExc_NotImplementedError,
55 "wxSound is not available on this platform.");
56 wxPyEndBlockThreads();
57 }
58
59 ~wxSound() {};
60
61 bool Create(const wxString&, bool) { return false; }
62 bool Create(int, const wxByte*) { return false; };
63 bool IsOk() { return false; };
64 bool Play(unsigned) const { return false; }
65 static bool Play(const wxString&, unsigned) { return false; }
66 static void Stop() {}
67 };
68
69 #endif
70 %}
71
72
73
74 class wxSound /*: public wxObject*/
75 {
76 public:
77 %nokwargs wxSound;
78 wxSound();
79 wxSound(const wxString& fileName, bool isResource = false);
80 wxSound(int size, const wxByte* data);
81 ~wxSound();
82
83 %nokwargs Create;
84 %nokwargs Play;
85
86 // Create from resource or file
87 bool Create(const wxString& fileName, bool isResource = false);
88
89 #ifndef __WXMAC__
90 // Create from data
91 bool Create(int size, const wxByte* data);
92 #else
93 %extend {
94 bool Create(int size, const wxByte* data) {
95 wxPyBeginBlockThreads();
96 PyErr_SetString(PyExc_NotImplementedError,
97 "Create from data is not available on this platform.");
98 wxPyEndBlockThreads();
99 }
100 }
101 #endif
102
103 bool IsOk();
104
105 // Play the sound:
106 bool Play(unsigned flags = wxSOUND_ASYNC) const;
107
108 // Plays sound from filename:
109 %name(PlaySound)static bool Play(const wxString& filename, unsigned flags = wxSOUND_ASYNC);
110
111 #ifndef __WXMAC__
112 static void Stop();
113 #else
114 %extend {
115 static void Stop() {}
116 }
117 #endif
118
119 %pythoncode { def __nonzero__(self): return self.IsOk() }
120 };
121
122
123
124
125 //---------------------------------------------------------------------------