NLSOUND::IMusicBuffer Class Reference

IMusicBuffer. More...

#include <music_buffer.h>

Inherited by NLSOUND::CMusicBufferVorbis.

List of all members.

Public Member Functions

 IMusicBuffer ()
virtual ~IMusicBuffer ()
virtual uint32 getRequiredBytes ()=0
 Get how many bytes the music buffer requires for output minimum.
virtual uint32 getNextBytes (uint8 *buffer, uint32 minimum, uint32 maximum)=0
 Get an amount of bytes between minimum and maximum (can be lower than minimum if at end).
virtual uint16 getChannels ()=0
 Get the amount of channels (2 is stereo) in output.
virtual uint32 getSamplesPerSec ()=0
 Get the samples per second (often 44100) in output.
virtual uint16 getBitsPerSample ()=0
 Get the bits per sample (often 16) in output.
virtual bool isMusicEnded ()=0
 Get if the music has ended playing (never true if loop).
virtual float getLength ()=0
 Get the total time in seconds.

Static Public Member Functions

static IMusicBuffercreateMusicBuffer (const std::string &filepath, bool async, bool loop)
 Create a new music buffer, may return NULL if unknown type, destroy with delete. Filepath lookup done here. If async is true, it will stream from hd, else it will load in memory first.
static IMusicBuffercreateMusicBuffer (const std::string &type, NLMISC::IStream *stream, bool loop)
 Create a new music buffer from a stream, type is file extension like "ogg" etc.
static bool getInfo (const std::string &filepath, std::string &artist, std::string &title)
 Get information on a music file (only artist and title at the moment).

Private Attributes

NLMISC::IStream_InternalStream
 Stream from file created by IMusicBuffer.

Detailed Description

IMusicBuffer.

Date:
2008-08-30 11:38GMT
Author:
Jan Boon (Kaetemi) IMusicBuffer is only used by the driver implementation to stream music files into a readable format (it's a simple decoder interface). You should not call these functions (getSongTitle) on nlsound or user level, as a driver might have additional music types implemented. TODO: Change IMusicBuffer to IAudioDecoder, and change the interface to make more sense. TODO: Allow user application to register more decoders. TODO: Look into libavcodec for decoding audio.

Definition at line 87 of file music_buffer.h.


Constructor & Destructor Documentation

NLSOUND::IMusicBuffer::IMusicBuffer (  ) 

Definition at line 47 of file music_buffer.cpp.

NLSOUND::IMusicBuffer::~IMusicBuffer (  )  [virtual]

Definition at line 52 of file music_buffer.cpp.

References _InternalStream.


Member Function Documentation

IMusicBuffer * NLSOUND::IMusicBuffer::createMusicBuffer ( const std::string &  type,
NLMISC::IStream stream,
bool  loop 
) [static]

Create a new music buffer from a stream, type is file extension like "ogg" etc.

Definition at line 80 of file music_buffer.cpp.

References nlwarning, and NLMISC::toLower().

IMusicBuffer * NLSOUND::IMusicBuffer::createMusicBuffer ( const std::string &  filepath,
bool  async,
bool  loop 
) [static]

Create a new music buffer, may return NULL if unknown type, destroy with delete. Filepath lookup done here. If async is true, it will stream from hd, else it will load in memory first.

Definition at line 57 of file music_buffer.cpp.

References _InternalStream, NLMISC::CIFile::allowBNPCacheFileOnOpen(), nlwarning, NLMISC::CIFile::open(), and NLMISC::CIFile::setCacheFileOnOpen().

Referenced by NLSOUND::CMusicChannelXAudio2::play().

virtual uint16 NLSOUND::IMusicBuffer::getBitsPerSample (  )  [pure virtual]

Get the bits per sample (often 16) in output.

Implemented in NLSOUND::CMusicBufferVorbis.

Referenced by NLSOUND::CMusicChannelXAudio2::play().

virtual uint16 NLSOUND::IMusicBuffer::getChannels (  )  [pure virtual]

Get the amount of channels (2 is stereo) in output.

Implemented in NLSOUND::CMusicBufferVorbis.

Referenced by NLSOUND::CMusicChannelXAudio2::play().

bool NLSOUND::IMusicBuffer::getInfo ( const std::string &  filepath,
std::string &  artist,
std::string &  title 
) [static]

Get information on a music file (only artist and title at the moment).

Definition at line 99 of file music_buffer.cpp.

References NLMISC::CIFile::allowBNPCacheFileOnOpen(), nlwarning, NLMISC::CIFile::open(), NLMISC::CIFile::setCacheFileOnOpen(), and NLMISC::toLower().

Referenced by NLSOUND::CSoundDriverXAudio2::getMusicInfo().

virtual float NLSOUND::IMusicBuffer::getLength (  )  [pure virtual]

Get the total time in seconds.

Implemented in NLSOUND::CMusicBufferVorbis.

Referenced by NLSOUND::CMusicChannelXAudio2::getLength().

virtual uint32 NLSOUND::IMusicBuffer::getNextBytes ( uint8 buffer,
uint32  minimum,
uint32  maximum 
) [pure virtual]

Get an amount of bytes between minimum and maximum (can be lower than minimum if at end).

Implemented in NLSOUND::CMusicBufferVorbis.

virtual uint32 NLSOUND::IMusicBuffer::getRequiredBytes (  )  [pure virtual]

Get how many bytes the music buffer requires for output minimum.

Implemented in NLSOUND::CMusicBufferVorbis.

virtual uint32 NLSOUND::IMusicBuffer::getSamplesPerSec (  )  [pure virtual]

Get the samples per second (often 44100) in output.

Implemented in NLSOUND::CMusicBufferVorbis.

Referenced by NLSOUND::CMusicChannelXAudio2::play().

virtual bool NLSOUND::IMusicBuffer::isMusicEnded (  )  [pure virtual]

Get if the music has ended playing (never true if loop).

Implemented in NLSOUND::CMusicBufferVorbis.

Referenced by NLSOUND::CMusicChannelXAudio2::isEnded().


Member Data Documentation

Stream from file created by IMusicBuffer.

Definition at line 92 of file music_buffer.h.

Referenced by createMusicBuffer(), and ~IMusicBuffer().


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

Generated on Thu Jan 7 08:30:23 2010 for NeL by  doxygen 1.6.1