1//--------------------------------------------------------------------------- 2// This file is generated by wxPython's SIP generator. Do not edit by hand. 3// 4// Copyright: (c) 2018 by Total Control Software 5// License: wxWindows License 6// 7// This file will be included by _adv.sip 8// 9//--------------------------------------------------------------------------- 10 11%ModuleHeaderCode 12#include <wx/sound.h> 13#include "wxpybuffer.h" 14%End 15 16 17//--------------------------------------------------------------------------- 18 19const int wxSOUND_SYNC; 20const int wxSOUND_ASYNC; 21const int wxSOUND_LOOP; 22class wxSound : wxObject 23{ 24 %Docstring 25 Sound() 26 Sound(fileName) 27 28 This class represents a short sound (loaded from Windows WAV file), 29 that can be stored in memory and played. 30 %End 31 %TypeHeaderCode 32 #include <wx/sound.h> 33 %End 34 35public: 36 wxSound(); 37 %PreMethodCode 38 if (!wxPyCheckForApp()) return NULL; 39 %End 40 41 wxSound( 42 const wxString & fileName 43 ); 44 %PreMethodCode 45 if (!wxPyCheckForApp()) return NULL; 46 %End 47 48 virtual 49 ~wxSound(); 50 51 bool Play( 52 unsigned flags = wxSOUND_ASYNC 53 ) const; 54 %Docstring 55 Play(flags=SOUND_ASYNC) -> bool 56 57 Plays the sound file. 58 %End 59 %PreMethodCode 60 if (!wxPyCheckForApp()) return NULL; 61 %End 62 63 static 64 bool Play( 65 const wxString & filename, 66 unsigned flags = wxSOUND_ASYNC 67 ) /PyName=PlaySound/; 68 %Docstring 69 PlaySound(filename, flags=SOUND_ASYNC) -> bool 70 71 Plays the sound file. 72 %End 73 74 bool Create( 75 const wxString & fileName 76 ); 77 %Docstring 78 Create(fileName) -> bool 79 80 Constructs a wave object from a file or resource. 81 %End 82 83 bool IsOk() const; 84 %Docstring 85 IsOk() -> bool 86 87 Returns true if the object contains a successfully loaded file or 88 resource, false otherwise. 89 %End 90 91 static 92 void Stop(); 93 %Docstring 94 Stop() 95 96 If a sound is played, this function stops it. 97 %End 98 %PreMethodCode 99 if (!wxPyCheckForApp()) return NULL; 100 %End 101 102 private: 103 wxSound(const wxSound&); 104 105 106 public: 107 108 109 bool CreateFromData(wxPyBuffer* data); 110 %Docstring 111 CreateFromData(data) -> bool 112 113 Create a sound object from data in a memory buffer in WAV format. 114 %End 115 %MethodCode 116 PyErr_Clear(); 117 Py_BEGIN_ALLOW_THREADS 118 sipRes = _wxSound_CreateFromData(sipCpp, data); 119 Py_END_ALLOW_THREADS 120 if (PyErr_Occurred()) sipIsErr = 1; 121 %End 122 %TypeCode 123 bool _wxSound_CreateFromData(wxSound* self, wxPyBuffer* data) 124 { 125 return self->Create((size_t)data->m_len, data->m_ptr); 126 } 127 %End 128 129 int __nonzero__(); 130 %Docstring 131 __nonzero__() -> int 132 %End 133 %MethodCode 134 PyErr_Clear(); 135 Py_BEGIN_ALLOW_THREADS 136 sipRes = _wxSound___nonzero__(sipCpp); 137 Py_END_ALLOW_THREADS 138 if (PyErr_Occurred()) sipIsErr = 1; 139 %End 140 %TypeCode 141 int _wxSound___nonzero__(wxSound* self) 142 { 143 return self->IsOk(); 144 } 145 %End 146 147 int __bool__(); 148 %Docstring 149 __bool__() -> int 150 %End 151 %MethodCode 152 PyErr_Clear(); 153 Py_BEGIN_ALLOW_THREADS 154 sipRes = _wxSound___bool__(sipCpp); 155 Py_END_ALLOW_THREADS 156 if (PyErr_Occurred()) sipIsErr = 1; 157 %End 158 %TypeCode 159 int _wxSound___bool__(wxSound* self) 160 { 161 return self->IsOk(); 162 } 163 %End 164 165}; // end of class wxSound 166 167 168 169//--------------------------------------------------------------------------- 170 171