#include <audio32.h>
Public Types | |
enum | { kMaxVolume = 127, kMonitorAudioFlagSci3 = 0x80 } |
Public Member Functions | |
Audio32 (ResourceManager *resMan) | |
void | saveLoadWithSerializer (Common::Serializer &s) override |
int | readBuffer (Audio::st_sample_t *buffer, const int numSamples) override |
bool | isStereo () const override |
int | getRate () const override |
bool | endOfData () const override |
bool | endOfStream () const override |
uint8 | getNumActiveChannels () const |
uint8 | getNumUnlockedChannels () const |
int16 | findChannelByArgs (EngineState *s, int argc, const reg_t *argv, const int startIndex, const reg_t soundNode) const |
int16 | findChannelById (const ResourceId resourceId, const reg_t soundNode=NULL_REG) const |
void | lockResource (const ResourceId resourceId, const bool lock) |
uint16 | getSampleRate () const |
void | setSampleRate (uint16 rate) |
uint8 | getBitDepth () const |
void | setBitDepth (uint8 depth) |
uint8 | getNumOutputChannels () const |
void | setNumOutputChannels (int16 numChannels) |
uint8 | getPreload () const |
void | setPreload (uint8 preload) |
bool | playRobotAudio (const RobotAudioStream::RobotAudioPacket &packet) |
bool | queryRobotAudio (RobotAudioStream::StreamState &outStatus) const |
bool | finishRobotAudio () |
bool | stopRobotAudio () |
uint16 | play (int16 channelIndex, const ResourceId resourceId, const bool autoPlay, const bool loop, const int16 volume, const reg_t soundNode, const bool monitor) |
bool | resume (const int16 channelIndex) |
bool | resume (const ResourceId resourceId, const reg_t soundNode=NULL_REG) |
bool | pause (const int16 channelIndex) |
bool | pause (const ResourceId resourceId, const reg_t soundNode=NULL_REG) |
int16 | stop (const int16 channelIndex) |
int16 | stop (const ResourceId resourceId, const reg_t soundNode=NULL_REG) |
uint16 | restart (const ResourceId resourceId, const bool autoPlay, const bool loop, const int16 volume, const reg_t soundNode, const bool monitor) |
int16 | getPosition (const int16 channelIndex) const |
int16 | getPosition (const ResourceId resourceId, const reg_t soundNode=NULL_REG) |
void | setLoop (const int16 channelIndex, const bool loop) |
void | setLoop (const ResourceId resourceId, const reg_t soundNode, const bool loop) |
void | setPan (const int16 channelIndex, const int16 pan) |
int16 | getVolume (const int16 channelIndex) const |
int16 | getVolume (const ResourceId resourceId, const reg_t soundNode) const |
void | setVolume (const int16 channelIndex, int16 volume) |
void | setVolume (const ResourceId resourceId, const reg_t soundNode, const int16 volume) |
void | setMasterVolume (const int16 volume) |
bool | fadeChannel (const int16 channelIndex, const int16 targetVolume, const int16 speed, const int16 steps, const bool stopAfterFade) |
bool | fadeChannel (const ResourceId resourceId, const reg_t soundNode, const int16 targetVolume, const int16 speed, const int16 steps, const bool stopAfterFade) |
bool | getAttenuatedMixing () const |
void | setAttenuatedMixing (bool attenuated) |
bool | hasSignal () const |
reg_t | kernelPlay (const bool autoPlay, EngineState *s, const int argc, const reg_t *const argv) |
reg_t | kernelStop (EngineState *s, const int argc, const reg_t *const argv) |
reg_t | kernelPause (EngineState *s, const int argc, const reg_t *const argv) |
reg_t | kernelResume (EngineState *s, const int argc, const reg_t *const argv) |
reg_t | kernelPosition (EngineState *s, const int argc, const reg_t *const argv) |
reg_t | kernelVolume (EngineState *s, const int argc, const reg_t *const argv) |
reg_t | kernelMixing (const int argc, const reg_t *const argv) |
reg_t | kernelFade (EngineState *s, const int argc, const reg_t *const argv) |
void | kernelLoop (EngineState *s, const int argc, const reg_t *const argv) |
void | kernelPan (EngineState *s, const int argc, const reg_t *const argv) |
void | kernelPanOff (EngineState *s, const int argc, const reg_t *const argv) |
void | printAudioList (Console *con) const |
Audio32 acts as a permanent audio stream into the system mixer and provides digital audio services for the SCI32 engine, since the system mixer does not support all the features of SCI.
|
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.
Implements Audio::AudioStream.
|
inlineoverridevirtual |
Check whether this is a stereo stream.
Implements Audio::AudioStream.
|
inlineoverridevirtual |
Sample rate of the stream.
Implements Audio::AudioStream.
|
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.
|
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.
|
inline |
Gets the number of currently active channels.
uint8 Sci::Audio32::getNumUnlockedChannels | ( | ) | const |
Gets the number of currently active channels that are playing from unlocked resources.
int16 Sci::Audio32::findChannelByArgs | ( | EngineState * | s, |
int | argc, | ||
const reg_t * | argv, | ||
const int | startIndex, | ||
const reg_t | soundNode | ||
) | const |
Finds a channel that is already configured for the given audio sample.
startIndex | The location of the audio resource information in the arguments list. |
int16 Sci::Audio32::findChannelById | ( | const ResourceId | resourceId, |
const reg_t | soundNode = NULL_REG |
||
) | const |
Finds a channel that is already configured for the given audio sample.
void Sci::Audio32::lockResource | ( | const ResourceId | resourceId, |
const bool | lock | ||
) |
Sets or clears a lock on the given resource ID.
|
inline |
Gets the (fake) sample rate of the hardware DAC. For script compatibility only.
void Sci::Audio32::setSampleRate | ( | uint16 | rate | ) |
Sets the (fake) sample rate of the hardware DAC. For script compatibility only.
|
inline |
Gets the (fake) bit depth of the hardware DAC. For script compatibility only.
void Sci::Audio32::setBitDepth | ( | uint8 | depth | ) |
Sets the (fake) sample rate of the hardware DAC. For script compatibility only.
|
inline |
Gets the (fake) number of output (speaker) channels of the hardware DAC. For script compatibility only.
void Sci::Audio32::setNumOutputChannels | ( | int16 | numChannels | ) |
Sets the (fake) number of output (speaker) channels of the hardware DAC. For script compatibility only.
|
inline |
Gets the (fake) number of preloaded channels. For script compatibility only.
|
inline |
Sets the (fake) number of preloaded channels. For script compatibility only.
uint16 Sci::Audio32::play | ( | int16 | channelIndex, |
const ResourceId | resourceId, | ||
const bool | autoPlay, | ||
const bool | loop, | ||
const int16 | volume, | ||
const reg_t | soundNode, | ||
const bool | monitor | ||
) |
Starts or resumes playback of an audio channel.
bool Sci::Audio32::resume | ( | const int16 | channelIndex | ) |
Resumes playback of a paused audio channel, or of the entire audio player.
bool Sci::Audio32::pause | ( | const int16 | channelIndex | ) |
Pauses an audio channel, or the entire audio player.
int16 Sci::Audio32::stop | ( | const int16 | channelIndex | ) |
Stops and unloads an audio channel, or the entire audio player.
uint16 Sci::Audio32::restart | ( | const ResourceId | resourceId, |
const bool | autoPlay, | ||
const bool | loop, | ||
const int16 | volume, | ||
const reg_t | soundNode, | ||
const bool | monitor | ||
) |
Restarts playback of the given audio resource.
int16 Sci::Audio32::getPosition | ( | const int16 | channelIndex | ) | const |
Returns the playback position for the given channel number, in ticks.
void Sci::Audio32::setLoop | ( | const int16 | channelIndex, |
const bool | loop | ||
) |
Sets whether or not the given channel should loop.
|
inline |
Sets the stereo panning for the given channel.
int16 Sci::Audio32::getVolume | ( | const int16 | channelIndex | ) | const |
Gets the volume for a given channel. Passing kAllChannels
will get the global volume.
void Sci::Audio32::setVolume | ( | const int16 | channelIndex, |
int16 | volume | ||
) |
Sets the volume of an audio channel. Passing kAllChannels
will set the global volume.
|
inline |
Sets the master volume for digital audio playback.
bool Sci::Audio32::fadeChannel | ( | const int16 | channelIndex, |
const int16 | targetVolume, | ||
const int16 | speed, | ||
const int16 | steps, | ||
const bool | stopAfterFade | ||
) |
Initiate an immediate fade of the given channel.
|
inline |
Gets whether attenuated mixing mode is active.
|
inline |
Sets the attenuated mixing mode.
bool Sci::Audio32::hasSignal | ( | ) | const |
Returns whether the currently monitored audio channel contains any signal within the next audio frame.