#include <sdlmixer.h>
Inheritance diagram for Wt::SDLMixer::Chunk:
Public Member Functions | |
virtual void | setVolume (int volume) |
virtual void | play (int duration=-1) |
virtual void | fadeIn (int ms, int duration=-1) |
virtual void | fadeOut (int ms) |
virtual void | pause () |
pause chunk | |
virtual void | resume () |
resume chunk | |
virtual void | stop (int ms=0) |
stop chunk | |
virtual bool | playing () const |
virtual bool | paused () const |
operator Mix_Chunk * () | |
operator const Mix_Chunk * () const | |
virtual Audio::Channel * | channel () const |
virtual Audio::Chunk * | clone () const |
virtual void | detach () |
~Chunk () | |
Public Attributes | |
Signal01< void, Chunk * > | finished |
WVar< int > | loops |
Protected Member Functions | |
Chunk (Mix_Chunk *chunk) | |
Private Types | |
typedef boost::shared_ptr< Mix_Chunk > | Ptr |
Private Attributes | |
Ptr | chunk_p |
int | channel_id |
Friends | |
class | SDLMixer |
class | Channel |
Classes | |
class | Deleter |
boost smart pointers with it More... |
Definition at line 45 of file sdlmixer.h.
typedef boost::shared_ptr<Mix_Chunk> Wt::SDLMixer::Chunk::Ptr [private] |
Definition at line 90 of file sdlmixer.h.
Wt::SDLMixer::Chunk::~Chunk | ( | ) | [virtual] |
Reimplemented from Wt::Audio::Chunk.
Definition at line 255 of file sdlmixer.cpp.
References chunk_p, stop(), and trace.
00255 { 00256 trace("sdlmixer", 00257 "SDLMixer::~Chunk Stoping chunk %p (%p)\n", 00258 this, chunk_p.get()); 00259 stop(); 00260 }
Here is the call graph for this function:
Wt::SDLMixer::Chunk::Chunk | ( | Mix_Chunk * | chunk | ) | [protected] |
Definition at line 246 of file sdlmixer.cpp.
References Wt::Audio::maxVolume, setVolume(), and trace.
00247 : Audio::Chunk(), 00248 chunk_p(mix_chunk_p, Deleter()), 00249 channel_id(-1) { 00250 trace("sdlmixer", 00251 "SDLMixer::Chunk Creating chunk %p (%p)\n", this, mix_chunk_p); 00252 setVolume(Audio::maxVolume); 00253 }
Here is the call graph for this function:
Audio::Channel * Wt::SDLMixer::Chunk::channel | ( | ) | const [virtual] |
Reimplemented from Wt::Audio::Chunk.
Definition at line 316 of file sdlmixer.cpp.
References channel_id, and Wt::Singleton< DERIVED >::instance().
00316 { 00317 SDLMixer& self = * static_cast<SDLMixer *>(instance()); 00318 return (channel_id < 0) ? 0 : self.channels[channel_id]; 00319 }
Here is the call graph for this function:
Audio::Chunk * Wt::SDLMixer::Chunk::clone | ( | ) | const [virtual] |
Reimplemented from Wt::Audio::Chunk.
Definition at line 335 of file sdlmixer.cpp.
References Wt::Audio::Chunk::Chunk(), Wt::clone_chunk(), and trace.
00335 { 00336 trace("sdlmixer", "SDLMixer::Chunk::clone %p\n", this); 00337 return new Chunk(clone_chunk(*this)); 00338 }
Here is the call graph for this function:
void Wt::SDLMixer::Chunk::detach | ( | ) | [virtual] |
Reimplemented from Wt::Audio::Chunk.
Definition at line 340 of file sdlmixer.cpp.
References chunk_p, Wt::clone_chunk(), and trace.
Referenced by fadeIn(), play(), and setVolume().
00340 { 00341 trace("sdlmixer", "SDLMixer::Chunk::detach %p\n", this); 00342 //avoid detaching if we are the only client for this Sound 00343 if (!chunk_p.unique()) { 00344 trace("sdlmixer", "SDLMixer::Chunk::detaching %p\n", this); 00345 chunk_p.reset(clone_chunk(*this), Deleter()); 00346 } 00347 }
Here is the call graph for this function:
Reimplemented from Wt::Audio::Chunk.
Definition at line 276 of file sdlmixer.cpp.
References channel_id, chunk_p, detach(), and Wt::Audio::Chunk::loops.
00276 { 00277 detach(); 00278 channel_id = Mix_FadeInChannelTimed(-1, *this, loops - 1, ms, duration); 00279 if (channel_id >= 0) 00280 Audio::Chunk::channel<SDLMixer>()->chunk_p = this; 00281 }
Here is the call graph for this function:
void Wt::SDLMixer::Chunk::fadeOut | ( | int | ms | ) | [virtual] |
Reimplemented from Wt::Audio::Chunk.
Definition at line 283 of file sdlmixer.cpp.
References channel_id.
00283 { 00284 if (channel_id < 0) 00285 return; 00286 Mix_FadeOutChannel(channel_id, ms); 00287 }
Wt::SDLMixer::Chunk::operator const Mix_Chunk * | ( | ) | const [inline] |
Definition at line 68 of file sdlmixer.h.
References chunk_p.
00068 { 00069 return chunk_p.get(); 00070 }
Wt::SDLMixer::Chunk::operator Mix_Chunk * | ( | ) | [inline] |
Definition at line 64 of file sdlmixer.h.
References chunk_p.
00064 { 00065 return chunk_p.get(); 00066 }
void Wt::SDLMixer::Chunk::pause | ( | ) | [virtual] |
pause chunk
Reimplemented from Wt::Audio::Chunk.
Definition at line 289 of file sdlmixer.cpp.
References channel_id.
00289 { 00290 if (channel_id < 0) 00291 return; 00292 Mix_Pause(channel_id); 00293 }
bool Wt::SDLMixer::Chunk::paused | ( | ) | const [virtual] |
Reimplemented from Wt::Audio::Chunk.
Definition at line 312 of file sdlmixer.cpp.
References channel_id.
00312 { 00313 return (channel_id < 0) ? false : Mix_Paused(channel_id); 00314 }
void Wt::SDLMixer::Chunk::play | ( | int | duration = -1 |
) | [virtual] |
Reimplemented from Wt::Audio::Chunk.
Definition at line 269 of file sdlmixer.cpp.
References channel_id, chunk_p, detach(), and Wt::Audio::Chunk::loops.
00269 { 00270 detach(); 00271 channel_id = Mix_PlayChannelTimed(-1, *this, loops - 1, duration); 00272 if (channel_id >= 0) 00273 Audio::Chunk::channel<SDLMixer>()->chunk_p = this; 00274 }
Here is the call graph for this function:
bool Wt::SDLMixer::Chunk::playing | ( | ) | const [virtual] |
Reimplemented from Wt::Audio::Chunk.
Definition at line 308 of file sdlmixer.cpp.
References channel_id.
00308 { 00309 return (channel_id < 0) ? false : Mix_Playing(channel_id); 00310 }
void Wt::SDLMixer::Chunk::resume | ( | ) | [virtual] |
resume chunk
Reimplemented from Wt::Audio::Chunk.
Definition at line 295 of file sdlmixer.cpp.
References channel_id.
00295 { 00296 if (channel_id < 0) 00297 return; 00298 Mix_Resume(channel_id); 00299 }
void Wt::SDLMixer::Chunk::setVolume | ( | int | volume | ) | [virtual] |
Reimplemented from Wt::Audio::Chunk.
Definition at line 262 of file sdlmixer.cpp.
References detach(), and Wt::Singleton< DERIVED >::instance().
Referenced by Chunk().
00262 { 00263 SDLMixer& self = * static_cast<SDLMixer *>(instance()); 00264 int hwvol = self.HWVolume(volume); 00265 detach(); 00266 Mix_VolumeChunk(*this, hwvol); 00267 }
Here is the call graph for this function:
void Wt::SDLMixer::Chunk::stop | ( | int | ms = 0 |
) | [virtual] |
stop chunk
Reimplemented from Wt::Audio::Chunk.
Definition at line 301 of file sdlmixer.cpp.
References channel_id.
Referenced by ~Chunk().
00301 { 00302 if (channel_id < 0) 00303 return; 00304 (ms) ? Mix_ExpireChannel(channel_id, ms) : 00305 Mix_HaltChannel(channel_id); 00306 }
friend class Channel [friend] |
Definition at line 47 of file sdlmixer.h.
friend class SDLMixer [friend] |
Definition at line 46 of file sdlmixer.h.
int Wt::SDLMixer::Chunk::channel_id [private] |
Ptr Wt::SDLMixer::Chunk::chunk_p [private] |
Definition at line 91 of file sdlmixer.h.
Referenced by detach(), fadeIn(), operator const Mix_Chunk *(), operator Mix_Chunk *(), play(), and ~Chunk().
Signal01<void, Chunk *> Wt::Audio::Chunk::finished [inherited] |
WVar<int> Wt::Audio::Chunk::loops [inherited] |
This document is licensed under the terms of the GNU Free Documentation License and may be freely distributed under the conditions given by this license.