ScummVM API documentation
Tinsel::PCMMusicPlayer Class Reference
Inheritance diagram for Tinsel::PCMMusicPlayer:
Audio::AudioStream

Public Member Functions

bool isPlaying () const
 
bool isDimmed () const
 
void getTunePlaying (void *voidPtr, int length)
 
void restoreThatTune (void *voidPtr)
 
void setMusicSceneDetails (SCNHANDLE hScript, SCNHANDLE hSegment, const char *fileName)
 
void setVolume (int volume)
 
void startPlay (int id)
 
void stopPlay ()
 
bool getMusicTinselDimmed () const
 
void dim (bool bTinselDim)
 
void unDim (bool bTinselUnDim)
 
void dimIteration ()
 
void startFadeOut (int ticks)
 
void fadeOutIteration ()
 
int readBuffer (int16 *buffer, const int numSamples) override
 
bool isStereo () const override
 
bool endOfData () const override
 
bool endOfStream () const override
 
int getRate () const override
 

Protected Types

enum  State {
  S_IDLE, S_NEW, S_MID, S_END1,
  S_END2, S_END3, S_NEXT, S_STOP
}
 

Protected Member Functions

void play ()
 
void stop ()
 
void setVol (uint8 volume)
 
bool getNextChunk ()
 
void loadMusicFromSegment (int segmentNum)
 
void loadADPCMMusicFromSegment (int segmentNum)
 
void loadMP3MusicFromSegment (int segmentNum)
 

Protected Attributes

Audio::SoundHandle _handle
 
Audio::AudioStream_curChunk
 
Common::Mutex _mutex
 
bool _end
 
int _silenceSamples
 
State _state
 
State _mState
 
bool _forcePlay
 
int32 _scriptNum
 
int32 _scriptIndex
 
SCNHANDLE _hScript
 
SCNHANDLE _hSegment
 
Common::Path _filename
 
uint8 _volume
 
bool _dimmed
 
bool _dimmedTinsel
 
uint8 _dimmedVolume
 
int _dimIteration
 
int _dimPosition
 
uint8 _fadeOutVolume
 
int _fadeOutIteration
 

Member Function Documentation

◆ readBuffer()

int Tinsel::PCMMusicPlayer::readBuffer ( int16 *  buffer,
const int  numSamples 
)
overridevirtual

Fill the given buffer with up to numSamples samples.

Data must be in native endianness, 16 bits per sample, signed. For stereo stream, the buffer will be filled with interleaved left and right channel samples, starting with the left sample. Furthermore, the samples in the left and right are summed up. So if you request 4 samples from a stereo stream, you will get a total of two left channel and two right channel samples.

Returns
The actual number of samples read, or -1 if a critical error occurred.
Note
You must check whether the returned value is less than what you requested. This indicates that the stream is fully used up.

Implements Audio::AudioStream.

◆ isStereo()

bool Tinsel::PCMMusicPlayer::isStereo ( ) const
overridevirtual

Check whether this is a stereo stream.

Implements Audio::AudioStream.

◆ endOfData()

bool Tinsel::PCMMusicPlayer::endOfData ( ) const
inlineoverridevirtual

Check whether end of data has been reached.

If this returns true, it indicates that at this time there is no data available in the stream. However, there might be more data in the future.

This is used by e.g. a rate converter to decide whether to keep on converting data or to stop.

Implements Audio::AudioStream.

◆ endOfStream()

bool Tinsel::PCMMusicPlayer::endOfStream ( ) const
inlineoverridevirtual

Check whether end of stream has been reached.

If this returns true, it indicates that all data in this stream is used up and no additional data will appear in it in the future.

This is used by the mixer to decide whether a given stream shall be removed from the list of active streams (and thus be destroyed). By default, this maps to endOfData().

Reimplemented from Audio::AudioStream.

◆ getRate()

int Tinsel::PCMMusicPlayer::getRate ( ) const
overridevirtual

Sample rate of the stream.

Implements Audio::AudioStream.


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