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 wxWave for platforms that don't have it.
37 class wxSound : public wxObject
41 wxPyBlock_t blocked = wxPyBeginBlockThreads();
42 PyErr_SetString(PyExc_NotImplementedError,
43 "wxSound is not available on this platform.");
44 wxPyEndBlockThreads(blocked);
46 wxSound(const wxString&/*, bool*/) {
47 wxPyBlock_t blocked = wxPyBeginBlockThreads();
48 PyErr_SetString(PyExc_NotImplementedError,
49 "wxSound is not available on this platform.");
50 wxPyEndBlockThreads(blocked);
52 wxSound(int, const wxByte*) {
53 wxPyBlock_t blocked = wxPyBeginBlockThreads();
54 PyErr_SetString(PyExc_NotImplementedError,
55 "wxSound is not available on this platform.");
56 wxPyEndBlockThreads(blocked);
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; }
75 MustHaveApp(wxSound::Play);
76 MustHaveApp(wxSound::Stop);
78 class wxSound /*: public wxObject*/
82 wxSound(const wxString& fileName = wxPyEmptyString /*, bool isResource = false*/) {
83 if (fileName.Length() == 0)
86 return new wxSound(fileName);
88 %RenameCtor(SoundFromData, wxSound(PyObject* data))
90 unsigned char* buffer; int size;
91 wxSound *sound = NULL;
93 wxPyBlock_t blocked = wxPyBeginBlockThreads();
94 if (!PyArg_Parse(data, "t#", &buffer, &size))
96 sound = new wxSound(size, buffer);
98 wxPyEndBlockThreads(blocked);
106 // Create from resource or file
107 bool Create(const wxString& fileName/*, bool isResource = false*/);
110 bool CreateFromData(PyObject* data) {
112 unsigned char* buffer;
116 wxPyBlock_t blocked = wxPyBeginBlockThreads();
117 if (!PyArg_Parse(data, "t#", &buffer, &size))
119 rv = self->Create(size, buffer);
121 wxPyEndBlockThreads(blocked);
124 wxPyBlock_t blocked = wxPyBeginBlockThreads();
125 PyErr_SetString(PyExc_NotImplementedError,
126 "Create from data is not available on this platform.");
127 wxPyEndBlockThreads(blocked);
136 bool Play(unsigned flags = wxSOUND_ASYNC) const;
138 // Plays sound from filename:
139 %Rename(PlaySound, static bool, Play(const wxString& filename, unsigned flags = wxSOUND_ASYNC));
143 %pythoncode { def __nonzero__(self): return self.IsOk() }
149 //---------------------------------------------------------------------------