ScummVM API documentation
Asylum::Sound Class Reference

Public Member Functions

 Sound (AsylumEngine *engine, Audio::Mixer *mixer)
 
void playSound (ResourceId resourceId, bool looping=false, int32 volume=Config.sfxVolume, int32 panning=0)
 
void playMusic (ResourceId resourceId, int32 volume=Config.musicVolume)
 
void changeMusic (int32 index, int32 musicStatusExt)
 
bool isPlaying (ResourceId resourceId)
 
void setVolume (ResourceId resourceId, int32 volume)
 
void setMusicVolume (int32 volume)
 
int32 getMusicVolume ()
 
void setPanning (ResourceId resourceId, int32 panning)
 
int32 calculateVolumeAdjustement (const Common::Point &point, int32 attenuation, int32 delta)
 
int32 getAdjustedVolume (int32 volume) const
 
int32 calculatePanningAtPoint (const Common::Point &point)
 
void stop (ResourceId resourceId)
 
void stopAll (ResourceId resourceId)
 
void stopAll ()
 
void stopMusic ()
 

Static Public Member Functions

static void convertVolumeFrom (int32 &vol)
 
static void convertVolumeTo (int32 &vol)
 

Member Function Documentation

◆ playSound()

void Asylum::Sound::playSound ( ResourceId  resourceId,
bool  looping = false,
int32  volume = Config.sfxVolume,
int32  panning = 0 
)

Play sound

Parameters
resourceIdIdentifier for the resource.
loopingtrue to looping.
volumeThe volume.
panningThe panning.

◆ playMusic()

void Asylum::Sound::playMusic ( ResourceId  resourceId,
int32  volume = Config.musicVolume 
)

Play music

Parameters
resourceIdIdentifier for the resource.
volumeThe volume.

◆ changeMusic()

void Asylum::Sound::changeMusic ( int32  index,
int32  musicStatusExt 
)

Change music

Parameters
indexZero-based index of the music
musicStatusExtThe music status.

◆ isPlaying()

bool Asylum::Sound::isPlaying ( ResourceId  resourceId)

Query if a sound with the resource id is playing.

Parameters
resourceIdIdentifier for the resource.
Returns
true if playing, false if not.

◆ setVolume()

void Asylum::Sound::setVolume ( ResourceId  resourceId,
int32  volume 
)

Sets the volume for a buffered sound resource

Parameters
resourceIdIdentifier for the resource.
volumeThe volume.

◆ setMusicVolume()

void Asylum::Sound::setMusicVolume ( int32  volume)

Sets the music volume.

Parameters
volumeThe volume.

◆ getMusicVolume()

int32 Asylum::Sound::getMusicVolume ( )
inline

Gets the music volume.

Returns
The music volume.

◆ setPanning()

void Asylum::Sound::setPanning ( ResourceId  resourceId,
int32  panning 
)

Sets the panning for a buffered sound resource

Parameters
resourceIdIdentifier for the resource.
panningThe panning.

◆ calculateVolumeAdjustement()

int32 Asylum::Sound::calculateVolumeAdjustement ( const Common::Point point,
int32  attenuation,
int32  delta 
)

Determine the amount to increase the supplied sound sample's volume based on the position.

Parameters
pointThe coordinates
attenuationThe attenuation.
deltaThe delta.
Returns
The calculated volume adjustement.

◆ getAdjustedVolume()

int32 Asylum::Sound::getAdjustedVolume ( int32  volume) const

Gets an adjusted volume.

Parameters
volumeThe volume.
Returns
The adjusted volume.

◆ calculatePanningAtPoint()

int32 Asylum::Sound::calculatePanningAtPoint ( const Common::Point point)

Calculates the panning at point.

Parameters
pointThe coordinates.
Returns
The calculated panning at point.

◆ stop()

void Asylum::Sound::stop ( ResourceId  resourceId)

Stop the first playing sound with the ResourceId

Parameters
resourceIdIdentifier for the resource.

◆ stopAll() [1/2]

void Asylum::Sound::stopAll ( ResourceId  resourceId)

Stop all sounds with the ResourceId

Parameters
resourceIdIdentifier for the resource.

◆ stopAll() [2/2]

void Asylum::Sound::stopAll ( )

Stop all buffered sounds

◆ stopMusic()

void Asylum::Sound::stopMusic ( )

Stop music.

◆ convertVolumeFrom()

static void Asylum::Sound::convertVolumeFrom ( int32 &  vol)
static

Convert volume to a ScummVM mixer value

Parameters
[in,out]volThe volume.

◆ convertVolumeTo()

static void Asylum::Sound::convertVolumeTo ( int32 &  vol)
static

Convert ScummVM mixer value to a volume

Parameters
[in,out]volThe volume.

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