1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: SWIG interface stuff for wxSound
7 // Created: 18-June-1999
9 // Copyright: (c) 2003 by Total Control Software
10 // Licence: wxWindows license
11 /////////////////////////////////////////////////////////////////////////////
16 //---------------------------------------------------------------------------
23 //---------------------------------------------------------------------------
36 // A C++ stub class for wxSound for platforms that don't have it.
45 class wxSound : public wxObject
49 wxPyBlock_t blocked = wxPyBeginBlockThreads();
50 PyErr_SetString(PyExc_NotImplementedError,
51 "wxSound is not available on this platform.");
52 wxPyEndBlockThreads(blocked);
54 wxSound(const wxString&/*, bool*/) {
55 wxPyBlock_t blocked = wxPyBeginBlockThreads();
56 PyErr_SetString(PyExc_NotImplementedError,
57 "wxSound is not available on this platform.");
58 wxPyEndBlockThreads(blocked);
60 wxSound(int, const wxByte*) {
61 wxPyBlock_t blocked = wxPyBeginBlockThreads();
62 PyErr_SetString(PyExc_NotImplementedError,
63 "wxSound is not available on this platform.");
64 wxPyEndBlockThreads(blocked);
69 bool Create(const wxString&/*, bool*/) { return false; }
70 bool Create(int, const wxByte*) { return false; };
71 bool IsOk() { return false; };
72 bool Play(unsigned) const { return false; }
73 static bool Play(const wxString&, unsigned) { return false; }
83 MustHaveApp(wxSound::Play);
84 MustHaveApp(wxSound::Stop);
86 class wxSound /*: public wxObject*/
90 wxSound(const wxString& fileName = wxPyEmptyString /*, bool isResource = false*/) {
91 if (fileName.Length() == 0)
94 return new wxSound(fileName);
96 %RenameCtor(SoundFromData, wxSound(PyObject* data))
98 unsigned char* buffer; int size;
99 wxSound *sound = NULL;
101 wxPyBlock_t blocked = wxPyBeginBlockThreads();
102 if (!PyArg_Parse(data, "t#", &buffer, &size))
104 sound = new wxSound(size, buffer);
106 wxPyEndBlockThreads(blocked);
114 // Create from resource or file
115 bool Create(const wxString& fileName/*, bool isResource = false*/);
118 bool CreateFromData(PyObject* data) {
120 unsigned char* buffer;
124 wxPyBlock_t blocked = wxPyBeginBlockThreads();
125 if (!PyArg_Parse(data, "t#", &buffer, &size))
127 rv = self->Create(size, buffer);
129 wxPyEndBlockThreads(blocked);
132 wxPyBlock_t blocked = wxPyBeginBlockThreads();
133 PyErr_SetString(PyExc_NotImplementedError,
134 "Create from data is not available on this platform.");
135 wxPyEndBlockThreads(blocked);
144 bool Play(unsigned flags = wxSOUND_ASYNC) const;
146 // Plays sound from filename:
147 %Rename(PlaySound, static bool, Play(const wxString& filename, unsigned flags = wxSOUND_ASYNC));
151 %pythoncode { def __nonzero__(self): return self.IsOk() }
157 //---------------------------------------------------------------------------