Wt::SDLMixer::Channel Class Reference

#include <sdlmixer.h>

Inheritance diagram for Wt::SDLMixer::Channel:

Inheritance graph
[legend]
Collaboration diagram for Wt::SDLMixer::Channel:

Collaboration graph
[legend]
List of all members.

Public Member Functions

virtual void setVolume (int)
virtual void play (Audio::Chunk &chunk, int duration=-1)
virtual void fadeIn (Audio::Chunk &chunk, int ms, int duration=-1)
virtual void fadeOut (int ms)
virtual void pause ()
 pause channel
virtual void resume ()
 resume channel
virtual void stop (int ms=0)
 stop channel
virtual bool playing () const
virtual bool paused () const
virtual int fading () const
virtual Audio::Chunkchunk () const

Public Attributes

Signal01< void, Channel * > finished
WVar< intloops

Protected Member Functions

 Channel (int id)

Private Attributes

Audio::Chunkchunk_p
int channel_id

Friends

class Audio
class SDLMixer
class Chunk

Detailed Description

Definition at line 97 of file sdlmixer.h.


Constructor & Destructor Documentation

Wt::SDLMixer::Channel::Channel ( int  id  )  [protected]

Definition at line 351 of file sdlmixer.cpp.

00351                                :
00352         Audio::Channel(),
00353         chunk_p(0),
00354 channel_id(id) {}


Member Function Documentation

Audio::Chunk * Wt::SDLMixer::Channel::chunk (  )  const [virtual]

Reimplemented from Wt::Audio::Channel.

Definition at line 408 of file sdlmixer.cpp.

References chunk_p.

Referenced by fadeIn(), and play().

00408                                          {
00409     return chunk_p;
00410 }

void Wt::SDLMixer::Channel::fadeIn ( Audio::Chunk chunk,
int  ms,
int  duration = -1 
) [virtual]

Reimplemented from Wt::Audio::Channel.

Definition at line 371 of file sdlmixer.cpp.

References channel_id, chunk(), chunk_p, and Wt::Audio::Channel::loops.

00371                                                                     {
00372     SDLMixer::Chunk& c = * static_cast<SDLMixer::Chunk *>(&chunk);
00373     int status = Mix_FadeInChannelTimed(channel_id, c,
00374                                         loops - 1, ms, duration);
00375     if (!status)
00376         chunk_p = &c;
00377 }

Here is the call graph for this function:

void Wt::SDLMixer::Channel::fadeOut ( int  ms  )  [virtual]

Reimplemented from Wt::Audio::Channel.

Definition at line 379 of file sdlmixer.cpp.

References channel_id.

00379                                     {
00380     Mix_FadeOutChannel(channel_id, ms);
00381 }

int Wt::SDLMixer::Channel::fading (  )  const [virtual]

Reimplemented from Wt::Audio::Channel.

Definition at line 404 of file sdlmixer.cpp.

References channel_id, and Wt::SDLMixer::fadingTypeMap.

00404                                   {
00405     return fadingTypeMap[Mix_FadingChannel(channel_id)];
00406 }

void Wt::SDLMixer::Channel::pause (  )  [virtual]

pause channel

Reimplemented from Wt::Audio::Channel.

Definition at line 383 of file sdlmixer.cpp.

References channel_id.

00383                             {
00384     Mix_Pause(channel_id);
00385 }

bool Wt::SDLMixer::Channel::paused (  )  const [virtual]

Reimplemented from Wt::Audio::Channel.

Definition at line 400 of file sdlmixer.cpp.

References channel_id.

00400                                    {
00401     return Mix_Paused(channel_id);
00402 }

void Wt::SDLMixer::Channel::play ( Audio::Chunk chunk,
int  duration = -1 
) [virtual]

Reimplemented from Wt::Audio::Channel.

Definition at line 362 of file sdlmixer.cpp.

References channel_id, chunk(), chunk_p, Wt::Audio::Channel::loops, and trace.

00362                                                           {
00363     trace("sdlmixer", "SDLMixer::Channel::play()\n");
00364     SDLMixer::Chunk& c = * static_cast<SDLMixer::Chunk *>(&chunk);
00365     int status = Mix_PlayChannelTimed(channel_id, c,
00366                                       loops - 1, duration);
00367     if (!status)
00368         chunk_p = &c;
00369 }

Here is the call graph for this function:

bool Wt::SDLMixer::Channel::playing (  )  const [virtual]

Reimplemented from Wt::Audio::Channel.

Definition at line 396 of file sdlmixer.cpp.

References channel_id.

00396                                     {
00397     return Mix_Playing(channel_id);
00398 }

void Wt::SDLMixer::Channel::resume (  )  [virtual]

resume channel

Reimplemented from Wt::Audio::Channel.

Definition at line 387 of file sdlmixer.cpp.

References channel_id.

00387                              {
00388     Mix_Resume(channel_id);
00389 }

void Wt::SDLMixer::Channel::setVolume ( int   )  [virtual]

Reimplemented from Wt::Audio::Channel.

Definition at line 356 of file sdlmixer.cpp.

References channel_id, and Wt::Singleton< DERIVED >::instance().

00356                                           {
00357     SDLMixer& self = * static_cast<SDLMixer *>(instance());
00358     int hwvol = self.HWVolume(volume);
00359     Mix_Volume(channel_id, hwvol);
00360 }

Here is the call graph for this function:

void Wt::SDLMixer::Channel::stop ( int  ms = 0  )  [virtual]

stop channel

Reimplemented from Wt::Audio::Channel.

Definition at line 391 of file sdlmixer.cpp.

References channel_id.

00391                                  {
00392     (ms) ? Mix_ExpireChannel(channel_id, ms) :
00393     Mix_HaltChannel(channel_id);
00394 }


Friends And Related Function Documentation

friend class Audio [friend]

Reimplemented from Wt::Audio::Channel.

Definition at line 98 of file sdlmixer.h.

friend class Chunk [friend]

Definition at line 100 of file sdlmixer.h.

friend class SDLMixer [friend]

Definition at line 99 of file sdlmixer.h.


Member Data Documentation

int Wt::SDLMixer::Channel::channel_id [private]

Definition at line 123 of file sdlmixer.h.

Referenced by fadeIn(), fadeOut(), fading(), pause(), paused(), play(), playing(), resume(), setVolume(), and stop().

Audio::Chunk* Wt::SDLMixer::Channel::chunk_p [private]

Definition at line 122 of file sdlmixer.h.

Referenced by chunk(), fadeIn(), and play().

Signal01<void, Channel *> Wt::Audio::Channel::finished [inherited]

Definition at line 151 of file audio.h.

Referenced by Wt::Audio::handleAudioEvent().

WVar<int> Wt::Audio::Channel::loops [inherited]

Definition at line 152 of file audio.h.

Referenced by fadeIn(), and play().


The documentation for this class was generated from the following files:

Generated Fri Jul 28 19:32:41 2006.
Copyright © 1998-2003 by the respective authors.

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.