ScummVM API documentation
Audio::AudioStream Class Referenceabstract

#include <audiostream.h>

Inheritance diagram for Audio::AudioStream:
Adl::Sound Agi::SoundGen2GS Agi::SoundGenA2 Agi::SoundGenCoCo3 Agi::SoundGenPCJr Agi::SoundGenSarien Audio::EmulatedChip Audio::LoopableAudioStream Audio::PacketizedAudioStream Audio::Paula Audio::PCSpeaker Audio::QueuingAudioStream Audio::RewindableAudioStream Dgds::Mixer_Mac< T > Gob::SoundMixer MidiDriver_Emulated MTropolis::AudioPlayer Neverhood::NeverhoodAudioStream Sci::Audio32 Sci::Mixer_Mac< T > Sci::RobotAudioStream Scumm::MacPlayerAudioStream Scumm::Player_AppleII Scumm::Player_MOD Scumm::Player_NES Scumm::Player_SID Scumm::Player_V2 Sword2::CLUInputStream Sword2::MusicInputStream Sword2::Sound Tinsel::PCMMusicPlayer Toon::AudioStreamInstance TownsPC98_FmSynth Ultima::Nuvie::U6Audio::RandomCollectionAudioStream VCruise::AudioPlayer VCruise::SampleLoopAudioStream

Public Member Functions

virtual int readBuffer (int16 *buffer, const int numSamples)=0
 
virtual bool isStereo () const =0
 
virtual int getRate () const =0
 
virtual bool endOfData () const =0
 
virtual bool endOfStream () const
 

Detailed Description

Generic audio input stream. Subclasses of this are used to feed arbitrary sampled audio data into ScummVM's audio mixer.

Member Function Documentation

◆ readBuffer()

virtual int Audio::AudioStream::readBuffer ( int16 *  buffer,
const int  numSamples 
)
pure virtual

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.

Implemented in Audio::StatelessPacketizedAudioStream, Sci::RobotAudioStream, Audio::SubSeekableAudioStream, Audio::SubLoopingAudioStream, Audio::DK3_ADPCMStream, Scumm::Player_AppleII, Audio::MS_ADPCMStream, Sword2::Sound, Agi::SoundGen2GS, Sci::Audio32, Neverhood::NeverhoodAudioStream, Audio::MSIma_ADPCMStream, Scumm::MacPlayerAudioStream, Audio::LoopingAudioStream, Audio::Apple_ADPCMStream, Sword2::MusicInputStream, Ultima::Nuvie::PCSpeakerStutterStream, Tinsel::PCMMusicPlayer, Audio::DVI_ADPCMStream, Ultima::Nuvie::PCSpeakerRandomStream, Audio::EmulatedChip, Sword2::CLUInputStream, Audio::XA_ADPCMStream, Audio::Mp3PspStream, ZVision::RawZorkStream, Audio::Paula, Ultima::Nuvie::PCSpeakerSweepFreqStream, Audio::Audio3DO_SDX2_Stream, Tinsel::Tinsel8_ADPCMStream, Audio::Oki_ADPCMStream, MidiDriver_Emulated, Audio::PCSpeaker, Tinsel::Tinsel6_ADPCMStream, TownsPC98_FmSynth, VCruise::SampleLoopAudioStream, Ultima::Nuvie::PCSpeakerFreqStream, Agi::SoundGenPCJr, Agi::SoundGenSarien, Audio::VocStream, Audio::QuickTimeAudioDecoder::QuickTimeAudioTrack, Audio::Audio3DO_ADP4_Stream, Dgds::Mixer_Mac< T >, Sci::Mixer_Mac< T >, Scumm::Player_SID, Tinsel::Tinsel4_ADPCMStream, Toon::AudioStreamInstance, BladeRunner::AudStream, Scumm::Player_MOD, AudioCDStream, Scumm::Player_NES, Gob::SoundMixer, Scumm::Player_V2, Adl::Sound, Ultima::Nuvie::U6AdPlugDecoderStream, Ultima::Nuvie::AdLibSfxStream, MTropolis::AudioPlayer, Ultima::Nuvie::FMtownsDecoderStream, Grim::SCXStream, VCruise::AudioPlayer, Agi::SoundGenA2, and Agi::SoundGenCoCo3.

◆ isStereo()

◆ getRate()

◆ endOfData()

virtual bool Audio::AudioStream::endOfData ( ) const
pure virtual

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.

Implemented in Audio::StatelessPacketizedAudioStream, Sci::RobotAudioStream, Audio::SubSeekableAudioStream, Audio::SubLoopingAudioStream, Scumm::Player_AppleII, Audio::MS_ADPCMStream, Sword2::Sound, Agi::SoundGen2GS, Sci::Audio32, Neverhood::NeverhoodAudioStream, Scumm::MacPlayerAudioStream, Audio::LoopingAudioStream, Sword2::MusicInputStream, Tinsel::PCMMusicPlayer, Audio::DVI_ADPCMStream, Audio::EmulatedChip, MidiDriver_Emulated, Sword2::CLUInputStream, ZVision::RawZorkStream, Audio::Mp3PspStream, Audio::XA_ADPCMStream, Audio::Paula, Audio::Audio3DO_SDX2_Stream, Audio::PCSpeaker, Audio::Oki_ADPCMStream, Agi::SoundGenPCJr, TownsPC98_FmSynth, VCruise::SampleLoopAudioStream, Agi::SoundGenSarien, Audio::VocStream, Ultima::Nuvie::U6AdPlugDecoderStream, Audio::QuickTimeAudioDecoder::QuickTimeAudioTrack, Toon::AudioStreamInstance, Ultima::Nuvie::AdLibSfxStream, Dgds::Mixer_Mac< T >, Sci::Mixer_Mac< T >, Scumm::Player_SID, Audio::Audio3DO_ADP4_Stream, Audio::ADPCMStream, Scumm::Player_MOD, Ultima::Nuvie::FMtownsDecoderStream, BladeRunner::AudStream, Ultima::Nuvie::PCSpeakerStream, AudioCDStream, Scumm::Player_NES, Gob::SoundMixer, Scumm::Player_V2, Adl::Sound, MTropolis::AudioPlayer, Agi::SoundGenA2, Agi::SoundGenCoCo3, VCruise::AudioPlayer, and Grim::SCXStream.

◆ endOfStream()

virtual bool Audio::AudioStream::endOfStream ( ) const
inlinevirtual

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 in Audio::StatelessPacketizedAudioStream, Sci::RobotAudioStream, Audio::SubSeekableAudioStream, Audio::SubLoopingAudioStream, Sci::Audio32, Audio::LoopingAudioStream, Tinsel::PCMMusicPlayer, Audio::PCSpeaker, Gob::SoundMixer, and Freescape::SizedPCSpeaker.


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