ScummVM API documentation
Stark::Resources::Sound Class Reference

#include <sound.h>

Inheritance diagram for Stark::Resources::Sound:
Stark::Resources::Object

Public Types

enum  SubType { kSoundBackground = 3, kSoundStock = 5 }
 
enum  SoundType { kSoundTypeVoice = 0, kSoundTypeEffect = 1, kSoundTypeMusic = 2 }
 

Public Member Functions

 Sound (Object *parent, byte subType, uint16 index, const Common::String &name)
 
void readData (Formats::XRCReadStream *stream) override
 
void onPreDestroy () override
 
void onGameLoop () override
 
void saveLoadCurrent (ResourceSerializer *serializer) override
 
void onEnginePause (bool pause) override
 
void play ()
 
bool isPlaying ()
 
void stop ()
 
uint32 getStockSoundType () const
 
void changeVolumePan (int32 volume, int32 pan, int32 duration)
 
void setLooping (bool looping)
 
void setStopOnDestroy (bool stopOnDestroy)
 
- Public Member Functions inherited from Stark::Resources::Object
Type getType () const
 
byte getSubType () const
 
uint16 getIndex () const
 
Common::String getIndexAsString () const
 
Common::String getName () const
 
virtual void saveLoad (ResourceSerializer *serializer)
 
virtual void onPostRead ()
 
virtual void onAllLoaded ()
 
virtual void onEnterLocation ()
 
virtual void onExitLocation ()
 
template<class T >
T * findParent ()
 
ObjectfindChildWithIndex (Type type, uint16 index, int subType=-1) const
 
ObjectfindChildWithOrder (Type type, uint16 order, int subType=-1) const
 
ObjectfindChildWithName (Type type, const Common::String &name, int subType=-1) const
 
template<class T >
T * findChild (bool mustBeUnique=true) const
 
template<class T >
T * findChildWithSubtype (int subType, bool mustBeUnique=true) const
 
template<class T >
T * findChildWithIndex (uint16 index, int subType=-1) const
 
template<class T >
T * findChildWithOrder (uint16 order, int subType=-1) const
 
template<class T >
T * findChildWithName (const Common::String &name, int subType=-1) const
 
template<class T >
Common::Array< T * > listChildren (int subType=-1) const
 
template<class T >
Common::Array< T * > listChildrenRecursive (int subType=-1)
 
void addChild (Object *child)
 
virtual void print (uint depth=0)
 
template<>
Objectcast (Object *resource)
 
template<>
ObjectfindParent ()
 
template<>
Common::Array< Object * > listChildren (int subType) const
 

Static Public Attributes

static const Type::ResourceType TYPE = Type::kSoundItem
 

Protected Member Functions

void printData () override
 
Audio::RewindableAudioStreammakeAudioStream ()
 
Audio::Mixer::SoundType getMixerSoundType ()
 
- Protected Member Functions inherited from Stark::Resources::Object
 Object (Object *parent, byte subType, uint16 index, const Common::String &name)
 
void printWithDepth (uint depth, const Common::String &string) const
 
void printDescription (uint depth) const
 

Protected Attributes

Common::Path _filename
 
Common::Path _archiveName
 
uint32 _enabled
 
bool _looping
 
uint32 _field_64
 
bool _loopIndefinitely
 
uint32 _maxDuration
 
bool _loadFromFile
 
uint32 _stockSoundType
 
Common::String _soundName
 
uint32 _field_6C
 
uint32 _soundType
 
float _pan
 
float _volume
 
bool _shouldStopOnDestroy
 
int32 _fadeDurationRemaining
 
float _fadeTargetVolume
 
float _fadeTargetPan
 
Audio::SoundHandle _handle
 
- Protected Attributes inherited from Stark::Resources::Object
Type _type
 
byte _subType
 
uint16 _index
 
Common::String _name
 
Object_parent
 
Common::Array< Object * > _children
 

Additional Inherited Members

- Static Public Member Functions inherited from Stark::Resources::Object
template<class T >
static T * cast (Object *resource)
 

Detailed Description

A sound resource

Member Function Documentation

◆ readData()

void Stark::Resources::Sound::readData ( Formats::XRCReadStream stream)
overridevirtual

Deserialize the resource static data and initial state.

Reimplemented from Stark::Resources::Object.

◆ onPreDestroy()

void Stark::Resources::Sound::onPreDestroy ( )
overridevirtual

Called before a resource sub-tree is unloaded.

Reimplemented from Stark::Resources::Object.

◆ onGameLoop()

void Stark::Resources::Sound::onGameLoop ( )
overridevirtual

Called once per game loop

Reimplemented from Stark::Resources::Object.

◆ saveLoadCurrent()

void Stark::Resources::Sound::saveLoadCurrent ( ResourceSerializer serializer)
overridevirtual

Persist / restore the resource state

Called only for active locations

Reimplemented from Stark::Resources::Object.

◆ onEnginePause()

void Stark::Resources::Sound::onEnginePause ( bool  pause)
overridevirtual

Called when ScummVM pauses or resumes the engine

Reimplemented from Stark::Resources::Object.

◆ play()

void Stark::Resources::Sound::play ( )

Start playing the sound

◆ isPlaying()

bool Stark::Resources::Sound::isPlaying ( )

Is the sound playing

◆ stop()

void Stark::Resources::Sound::stop ( )

Stop the sound

◆ getStockSoundType()

uint32 Stark::Resources::Sound::getStockSoundType ( ) const

Get the type for stock sounds

◆ changeVolumePan()

void Stark::Resources::Sound::changeVolumePan ( int32  volume,
int32  pan,
int32  duration 
)

Fade the sound's current volume and pan to the specified target over duration milliseconds

◆ setLooping()

void Stark::Resources::Sound::setLooping ( bool  looping)
inline

Set whether to loop or not

◆ setStopOnDestroy()

void Stark::Resources::Sound::setStopOnDestroy ( bool  stopOnDestroy)

In the menus, we don't want sounds to be cut when changing screens. The actual sounds need to outlive the entity. This flag allows to do so.


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