Wt::Sound Class Reference

#include <sound.h>

Inheritance diagram for Wt::Sound:

Inheritance graph
[legend]
Collaboration diagram for Wt::Sound:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 Sound (const std::string &filename)
 Sound ()
const std::string & fileName () const
bool isFinished () const
void play ()
void stop ()

Static Public Member Functions

static bool available ()
static bool isAvailable ()
static void play (const std::string &filename)

Protected Member Functions

void detach ()

Private Types

typedef boost::shared_ptr<
Audio::Chunk
Ptr

Private Attributes

Ptr chunk
std::string filename_

Detailed Description

Definition at line 34 of file sound.h.


Member Typedef Documentation

typedef boost::shared_ptr<Audio::Chunk> Wt::Sound::Ptr [private]

Definition at line 51 of file sound.h.


Constructor & Destructor Documentation

Wt::Sound::Sound ( const std::string &  filename  ) 

Definition at line 25 of file sound.cpp.

00026         : chunk(Audio::instance()->loadChunk(filename)),
00027 filename_(filename) {}

Wt::Sound::Sound (  ) 

Definition at line 29 of file sound.cpp.

00030         : chunk(static_cast<Audio::Chunk *>(0)) {}


Member Function Documentation

bool Wt::Sound::available (  )  [static]

Definition at line 61 of file sound.cpp.

References Wt::Singleton< DERIVED >::instance().

00061                       {
00062     return Audio::instance()->isAvailable();
00063 }

Here is the call graph for this function:

void Wt::Sound::detach (  )  [protected]

Definition at line 54 of file sound.cpp.

References chunk.

Referenced by play(), and stop().

00054                    {
00055     //avoid detaching if we are the only client for this Sound
00056     if (!chunk.unique()) {
00057         chunk.reset(chunk->clone());
00058     }
00059 }

const std::string & Wt::Sound::fileName (  )  const

Definition at line 32 of file sound.cpp.

References filename_.

00032                                        {
00033     return filename_;
00034 }

bool Wt::Sound::isAvailable (  )  [static]

Definition at line 65 of file sound.cpp.

References Wt::Singleton< DERIVED >::instance().

00065                         {
00066     return Audio::instance()->isAvailable();
00067 }

Here is the call graph for this function:

bool Wt::Sound::isFinished (  )  const

Definition at line 36 of file sound.cpp.

References chunk.

00036                              {
00037     return (chunk) ? !chunk->playing() : true;
00038 }

void Wt::Sound::play ( const std::string &  filename  )  [static]

Definition at line 73 of file sound.cpp.

References Wt::Audio::Chunk::finished, Wt::finished_chunk(), Wt::Singleton< DERIVED >::instance(), and Wt::Audio::Chunk::play().

00073                                           {
00074     Audio::Chunk *c = Audio::instance()->loadChunk(filename);
00075     if (c) {
00076         c->finished.connect(sigc::slot1<void,
00077                             Audio::Chunk *>(sigc::ptr_fun(&finished_chunk)));
00078         c->play();
00079     }
00080 }

Here is the call graph for this function:

void Wt::Sound::play (  ) 

Definition at line 40 of file sound.cpp.

References chunk, and detach().

Referenced by Wt::Button::setSound().

00040                  {
00041     if (chunk) {
00042         detach();
00043         chunk->play();
00044     }
00045 }

Here is the call graph for this function:

void Wt::Sound::stop (  ) 

Definition at line 47 of file sound.cpp.

References chunk, and detach().

00047                  {
00048     if (chunk) {
00049         detach();
00050         chunk->stop();
00051     }
00052 }

Here is the call graph for this function:


Member Data Documentation

Ptr Wt::Sound::chunk [private]

Definition at line 52 of file sound.h.

Referenced by detach(), isFinished(), play(), and stop().

std::string Wt::Sound::filename_ [private]

Definition at line 53 of file sound.h.

Referenced by fileName().


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

Generated Fri Jul 28 19:33:09 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.