ScummVM API documentation
Kyra::Sound Class Referenceabstract

#include <sound.h>

Inheritance diagram for Kyra::Sound:
Kyra::MixedSoundDriver Kyra::SoundAmiga_LoK Kyra::SoundMac Kyra::SoundMidiPC Kyra::SoundPC98_LoK Kyra::SoundPC_v1 Kyra::SoundTowns_LoK Kyra::SoundTownsPC98_v2

Classes

struct  SoundChannel
 

Public Types

enum  kType {
  kAdLib, kMidiMT32, kMidiGM, kTowns,
  kPC98, kPCSpkr, kPCjr, kAmiga,
  kSegaCD, kMac
}
 

Public Member Functions

 Sound (KyraEngine_v1 *vm, Audio::Mixer *mixer)
 
virtual kType getMusicType () const =0
 
virtual kType getSfxType () const
 
virtual bool useDigitalSfx () const
 
virtual bool init ()=0
 
virtual void process ()
 
virtual void updateVolumeSettings ()
 
virtual void initAudioResourceInfo (int set, void *info)=0
 
virtual void selectAudioResourceSet (int set)=0
 
virtual bool hasSoundFile (uint file) const =0
 
virtual void loadSoundFile (uint file)=0
 
virtual void loadSoundFile (const Common::Path &file)=0
 
virtual void unloadSoundFile (const Common::String &file)
 
virtual void loadSfxFile (const Common::Path &file)
 
virtual void playTrack (uint8 track)=0
 
virtual void haltTrack ()=0
 
virtual void playSoundEffect (uint16 track, uint8 volume=0xFF)=0
 
virtual void stopAllSoundEffects ()
 
virtual bool isPlaying () const
 
virtual void beginFadeOut ()=0
 
virtual void beginFadeOut (int)
 
virtual void pause (bool paused)
 
virtual void enableMusic (int enable)
 
int musicEnabled () const
 
void enableSFX (bool enable)
 
bool sfxEnabled () const
 
bool isVoicePresent (const char *file) const
 
virtual int32 voicePlay (const char *file, Audio::SoundHandle *handle=0, uint8 volume=255, uint8 priority=255, bool isSfx=false)
 
Audio::SeekableAudioStreamgetVoiceStream (const char *file) const
 
bool playVoiceStream (Audio::AudioStream *stream, Audio::SoundHandle *handle=0, uint8 volume=255, uint8 priority=255, bool isSfx=false)
 
bool voiceIsPlaying (const Audio::SoundHandle *handle=0) const
 
bool allVoiceChannelsPlaying () const
 
uint32 voicePlayedTime (const Audio::SoundHandle &handle) const
 
void voiceStop (const Audio::SoundHandle *handle=0)
 
virtual int checkTrigger ()
 
virtual void resetTrigger ()
 

Protected Types

enum  { kNumChannelHandles = 4 }
 

Protected Attributes

SoundChannel _soundChannels [kNumChannelHandles]
 
int _musicEnabled
 
bool _sfxEnabled
 
KyraEngine_v1_vm
 
Audio::Mixer_mixer
 

Detailed Description

Analog audio output device API for Kyrandia games. It contains functionality to play music tracks, sound effects and voices.

Member Function Documentation

◆ init()

virtual bool Kyra::Sound::init ( )
pure virtual

Initializes the output device.

Returns
true on success, else false

Implemented in Kyra::SoundMac, Kyra::MixedSoundDriver, Kyra::SoundAmiga_LoK, Kyra::SoundTownsPC98_v2, Kyra::SoundPC98_LoK, Kyra::SoundTowns_LoK, Kyra::SoundMidiPC, and Kyra::SoundPC_v1.

◆ process()

virtual void Kyra::Sound::process ( )
inlinevirtual

Updates the device, this is needed for some devices.

Reimplemented in Kyra::MixedSoundDriver, Kyra::SoundTownsPC98_v2, Kyra::SoundTowns_LoK, and Kyra::SoundPC_v1.

◆ updateVolumeSettings()

virtual void Kyra::Sound::updateVolumeSettings ( )
inlinevirtual

Updates internal volume settings according to ConfigManager.

Reimplemented in Kyra::SoundMac, Kyra::MixedSoundDriver, Kyra::SoundTownsPC98_v2, Kyra::SoundPC98_LoK, Kyra::SoundTowns_LoK, Kyra::SoundMidiPC, and Kyra::SoundPC_v1.

◆ initAudioResourceInfo()

virtual void Kyra::Sound::initAudioResourceInfo ( int  set,
void *  info 
)
pure virtual

Assigns static resource data with information on how to load audio resources to

Parameters
setvalue defined in AudioResourceSet enum info various types of resource info data (file list, file name pattern, struct, etc. - depending on the inheriting driver type)

Implemented in Kyra::SoundMac, Kyra::MixedSoundDriver, Kyra::SoundAmiga_LoK, Kyra::SoundTownsPC98_v2, Kyra::SoundPC98_LoK, Kyra::SoundTowns_LoK, Kyra::SoundMidiPC, and Kyra::SoundPC_v1.

◆ selectAudioResourceSet()

virtual void Kyra::Sound::selectAudioResourceSet ( int  set)
pure virtual

Select audio resource set.

Parameters
setvalue defined in AudioResourceSet enum

Implemented in Kyra::SoundMac, Kyra::MixedSoundDriver, Kyra::SoundAmiga_LoK, Kyra::SoundTownsPC98_v2, Kyra::SoundPC98_LoK, Kyra::SoundTowns_LoK, Kyra::SoundMidiPC, and Kyra::SoundPC_v1.

◆ hasSoundFile()

virtual bool Kyra::Sound::hasSoundFile ( uint  file) const
pure virtual

Checks if a given sound file is present.

Parameters
tracktrack number
Returns
true if available, false otherwise

Implemented in Kyra::SoundMac, Kyra::MixedSoundDriver, Kyra::SoundAmiga_LoK, Kyra::SoundTownsPC98_v2, Kyra::SoundPC98_LoK, Kyra::SoundTowns_LoK, Kyra::SoundMidiPC, and Kyra::SoundPC_v1.

◆ loadSoundFile() [1/2]

virtual void Kyra::Sound::loadSoundFile ( uint  file)
pure virtual

Load a specifc sound file for use of playing music and sound effects.

Implemented in Kyra::SoundMac, Kyra::MixedSoundDriver, Kyra::SoundAmiga_LoK, Kyra::SoundTownsPC98_v2, Kyra::SoundPC98_LoK, Kyra::SoundTowns_LoK, Kyra::SoundMidiPC, and Kyra::SoundPC_v1.

◆ loadSoundFile() [2/2]

virtual void Kyra::Sound::loadSoundFile ( const Common::Path file)
pure virtual

Load a sound file for playing music (and sometimes sound effects) from.

Implemented in Kyra::SoundMac, Kyra::MixedSoundDriver, Kyra::SoundAmiga_LoK, Kyra::SoundTownsPC98_v2, Kyra::SoundPC98_LoK, Kyra::SoundTowns_LoK, Kyra::SoundMidiPC, and Kyra::SoundPC_v1.

◆ unloadSoundFile()

virtual void Kyra::Sound::unloadSoundFile ( const Common::String file)
inlinevirtual

Unload a specifc sound file that has been loaded before.

◆ loadSfxFile()

virtual void Kyra::Sound::loadSfxFile ( const Common::Path file)
inlinevirtual

Load a sound file for playing sound effects from.

Reimplemented in Kyra::MixedSoundDriver, and Kyra::SoundMidiPC.

◆ playTrack()

virtual void Kyra::Sound::playTrack ( uint8  track)
pure virtual

◆ haltTrack()

virtual void Kyra::Sound::haltTrack ( )
pure virtual

◆ playSoundEffect()

virtual void Kyra::Sound::playSoundEffect ( uint16  track,
uint8  volume = 0xFF 
)
pure virtual

Plays the specified sound effect.

Parameters
tracksound effect id

Implemented in Kyra::SoundMac, Kyra::MixedSoundDriver, Kyra::SoundAmiga_LoK, Kyra::SoundTownsPC98_v2, Kyra::SoundPC98_LoK, Kyra::SoundTowns_LoK, Kyra::SoundMidiPC, and Kyra::SoundPC_v1.

◆ stopAllSoundEffects()

virtual void Kyra::Sound::stopAllSoundEffects ( )
inlinevirtual

Stop playback of all sfx tracks.

Reimplemented in Kyra::MixedSoundDriver, Kyra::SoundTowns_LoK, and Kyra::SoundMidiPC.

◆ isPlaying()

virtual bool Kyra::Sound::isPlaying ( ) const
virtual

Checks if the sound driver plays any sound.

Returns
true if playing, false otherwise

Reimplemented in Kyra::SoundMac, Kyra::MixedSoundDriver, Kyra::SoundMidiPC, and Kyra::SoundPC_v1.

◆ beginFadeOut()

virtual void Kyra::Sound::beginFadeOut ( )
pure virtual

Starts fading out the volume.

This keeps fading out the output until it is silenced, but does not change the volume set by setVolume! It will automatically reset the volume when playing a new track or sound effect.

Implemented in Kyra::SoundMac, Kyra::MixedSoundDriver, Kyra::SoundAmiga_LoK, Kyra::SoundTownsPC98_v2, Kyra::SoundPC98_LoK, Kyra::SoundTowns_LoK, Kyra::SoundMidiPC, and Kyra::SoundPC_v1.

◆ pause()

virtual void Kyra::Sound::pause ( bool  paused)
inlinevirtual

Stops all audio playback when paused. Continues after end of pause.

Reimplemented in Kyra::MixedSoundDriver, and Kyra::SoundMidiPC.

◆ isVoicePresent()

bool Kyra::Sound::isVoicePresent ( const char *  file) const

Checks whether a voice file with the given name is present

Parameters
filefile name
Returns
true if available, false otherwise

◆ voicePlay()

virtual int32 Kyra::Sound::voicePlay ( const char *  file,
Audio::SoundHandle handle = 0,
uint8  volume = 255,
uint8  priority = 255,
bool  isSfx = false 
)
virtual

Plays the specified voice file.

Also before starting to play the specified voice file, it stops the current voice.

Parameters
filefile to be played
volumevolume of the voice file
isSfxmarks file as sfx instead of voice
handlestore a copy of the sound handle
Returns
playtime of the voice file (-1 marks unknown playtime)

Reimplemented in Kyra::SoundAmiga_LoK, Kyra::SoundTownsPC98_v2, and Kyra::SoundPC98_LoK.

◆ voiceIsPlaying()

bool Kyra::Sound::voiceIsPlaying ( const Audio::SoundHandle handle = 0) const

Checks if a voice is being played.

Returns
true when playing, else false

◆ allVoiceChannelsPlaying()

bool Kyra::Sound::allVoiceChannelsPlaying ( ) const

Checks if all voice handles are used.

Returns
false when a handle is free, else true

◆ voicePlayedTime()

uint32 Kyra::Sound::voicePlayedTime ( const Audio::SoundHandle handle) const
inline

Checks how long a voice has been playing

Returns
time in milliseconds

◆ voiceStop()

void Kyra::Sound::voiceStop ( const Audio::SoundHandle handle = 0)

Stops playback of the current voice.

◆ checkTrigger()

virtual int Kyra::Sound::checkTrigger ( )
inlinevirtual

Receive notifications from a song at certain points.

Reimplemented in Kyra::SoundPC_v1.

◆ resetTrigger()

virtual void Kyra::Sound::resetTrigger ( )
inlinevirtual

Reset sound trigger.

Reimplemented in Kyra::SoundPC_v1.


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