|
stmm-games-doc
0.32.0
|
The playback capability of a device. More...

Classes | |
| struct | SoundData |
| Return data type. More... | |
Public Member Functions | |
| virtual int32_t | preloadSound (const std::string &sFileName) noexcept=0 |
| Pre-load sound file. More... | |
| virtual int32_t | preloadSound (uint8_t const *p0Buffer, int32_t nBufferSize) noexcept=0 |
| Pre-load sound buffer. More... | |
| virtual SoundData | playSound (const std::string &sFileName, double fVolume, bool bLoop, bool bRelative, double fX, double fY, double fZ) noexcept=0 |
| Play sound file at a given position. More... | |
| virtual SoundData | playSound (uint8_t const *p0Buffer, int32_t nBufferSize, double fVolume, bool bLoop, bool bRelative, double fX, double fY, double fZ) noexcept=0 |
| Play sound buffer at a given position. More... | |
| virtual int32_t | playSound (int32_t nFileId, double fVolume, bool bLoop, bool bRelative, double fX, double fY, double fZ) noexcept=0 |
| Play previously played or pre-loaded file or buffer at a given position. More... | |
| SoundData | playSound (const std::string &sFileName) noexcept |
| Play sound file at current listener position. More... | |
| SoundData | playSound (uint8_t *p0Buffer, int32_t nBufferSize) noexcept |
| Play sound buffer at current listener position. More... | |
| int32_t | playSound (int32_t nFileId) noexcept |
| Play previously played or pre-loaded file or buffer at current listener position. More... | |
| virtual bool | setSoundPos (int32_t nSoundId, bool bRelative, double fX, double fY, double fZ) noexcept=0 |
| Set position of a currently playing sound. More... | |
| virtual bool | setSoundVol (int32_t nSoundId, double fVolume) noexcept=0 |
| Set volume of a currently playing sound. More... | |
| virtual bool | setListenerPos (double fX, double fY, double fZ) noexcept=0 |
| Set listener position. More... | |
| virtual bool | setListenerVol (double fVolume) noexcept=0 |
| Set listener volume. More... | |
| virtual bool | pauseSound (int32_t nSoundId) noexcept=0 |
| Pause a sound. More... | |
| virtual bool | resumeSound (int32_t nSoundId) noexcept=0 |
| Resume a sound. More... | |
| virtual bool | stopSound (int32_t nSoundId) noexcept=0 |
| Stop a sound. More... | |
| virtual bool | pauseDevice () noexcept=0 |
| Pause playback of device. More... | |
| virtual bool | resumeDevice () noexcept=0 |
| Resume playback of device. More... | |
| virtual void | stopAllSounds () noexcept=0 |
| Stops all sounds of device. More... | |
| virtual bool | isDefaultDevice () noexcept=0 |
| Tells whether this is the capability of the default playback device. More... | |
Public Member Functions inherited from stmi::Capability | |
| virtual | ~Capability () noexcept=default |
| int32_t | getId () const noexcept |
| The capability id. More... | |
| virtual shared_ptr< Device > | getDevice () const noexcept=0 |
| Returns the device owning this capability, if any. More... | |
| const Class & | getCapabilityClass () const noexcept |
| Get the registered class of the capability instance. More... | |
Static Public Member Functions | |
| static const Capability::Class & | getClass () noexcept |
Static Public Member Functions inherited from stmi::Capability | |
| static bool | isCapabilityClassIdRegistered (const std::string &sCapabilityClassId) noexcept |
| Tells whether the given capability class id is registered. More... | |
| static Class | getCapabilityClassIdClass (const std::string &sCapabilityClassId) noexcept |
| Gets the class with given class id. More... | |
Static Public Attributes | |
| static const char *const | s_sClassId |
Protected Member Functions | |
| PlaybackCapability () noexcept | |
Protected Member Functions inherited from stmi::Capability | |
| Capability (const Class &oClass) noexcept | |
| Constructor to be called from subclasses. More... | |
Additional Inherited Members | |
Static Protected Member Functions inherited from stmi::Capability | |
| static bool | isCapabilityTypeRegistered (const std::type_info &oCapabilityType) noexcept |
| Tells whether a capability type was registered. More... | |
| static const std::type_info & | getCapabilityClassIdType (const std::string &sCapabilityClassId, bool &bRegistered) noexcept |
| Gets the type of the registered capability subclass associated with class id. More... | |
| static std::string | getCapabilityTypeClassId (const std::type_info &oType) noexcept |
| Gets the class id of the given type. More... | |
The playback capability of a device.
Devices with this capability can generate "sound finished" events.
Note: the reference system is flipped by 180 degrees around the x axis compared with the coordinates of your typical screen. That is you should negate y and z coordinates when setting the position of listener and sounds.
This interface is very simple and limited compared to what OpenAL can do. The orientation of the listener cannot be changed, the direction of sounds and their sound cone cannot be set, etc.
If the listener is at position (0,0,0), the up direction is (0,1,0), the left direction is (-1,0,0), the behind direction is (0,0,1).
The user of this interface can assume that the listener's initial position is (0,0,0) and the listener volume is 1.
When one of the playSound methods is called, an event listener (added to the device manager managing the device implementing this capability) can expect to receive a SndFinishedEvent when the sound has finished playing or the device was removed. A listeners being removed will receive the SndFinishedEvent only if it was added with the finalization flag.
|
inlineprotectednoexcept |
|
inlinestaticnoexcept |
|
pure virtualnoexcept |
Tells whether this is the capability of the default playback device.
Only one of the playback devices of a device manager should be default.
|
pure virtualnoexcept |
Pause playback of device.
Subsequent resumeSound on already paused sounds have effect as soon as resumeAllSounds is called.
|
pure virtualnoexcept |
Pause a sound.
If called when the device is paused with pauseDevice(), the sound will not resume if resumeAllSounds() is called.
| nSoundId | The sound id to pause. |
|
pure virtualnoexcept |
Play sound file at a given position.
| sFileName | The absolute path of the sound file. Cannot be empty. |
| bRelative | Whether the position is relative to the listener. |
| fVolume | The volume (0.0 inaudible, 1.0 maximum). |
| bLoop | Whether to loop. |
| fX | The x coord. |
| fY | The y coord. |
| fZ | The z coord. |
|
pure virtualnoexcept |
Play sound buffer at a given position.
| p0Buffer | The pointer to a buffer. Cannot be null. |
| nBufferSize | The size of the buffer. Cannot be negative. |
| fVolume | The volume (0.0 inaudible, 1.0 maximum). |
| bLoop | Whether to loop. |
| bRelative | Whether the position is relative to the listener. |
| fX | The x coord. |
| fY | The y coord. |
| fZ | The z coord. |
|
pure virtualnoexcept |
Play previously played or pre-loaded file or buffer at a given position.
The nFileId is only valid within the instance that created it.
| nFileId | The id of the previously played file or buffer to play as a new sound. |
| fVolume | The volume (0.0 inaudible, 1.0 maximum). |
| bLoop | Whether to loop. |
| bRelative | Whether the position is relative to the listener. |
| fX | The x coord. |
| fY | The y coord. |
| fZ | The z coord. |
|
noexcept |
Play sound file at current listener position.
The sound is played at maximum volume.
| sFileName | The absolute path of the sound file. Cannot be empty. |
|
noexcept |
Play sound buffer at current listener position.
The sound is played at maximum volume.
| p0Buffer | The pointer to a buffer. Cannot be null. |
| nBufferSize | The size of the buffer. Cannot be negative. |
|
noexcept |
Play previously played or pre-loaded file or buffer at current listener position.
The sound is played at maximum volume.
The nFileId is only valid within the instance that created it.
| nFileId | The id of the previously played file or buffer to play as a new sound. |
|
pure virtualnoexcept |
Pre-load sound file.
The returned file id can be used with the playSound method.
| sFileName | The absolute path of the sound file. Cannot be empty. |
|
pure virtualnoexcept |
Pre-load sound buffer.
The returned file id can be used with the playSound method.
| p0Buffer | The pointer to a buffer. Cannot be null. |
| nBufferSize | The size of the buffer. Cannot be negative. |
|
pure virtualnoexcept |
Resume playback of device.
|
pure virtualnoexcept |
Resume a sound.
If called when the device is paused with pauseDevice(), the sound will resume only when resumeAllSounds() is called.
| nSoundId | The sound id to resume. |
|
pure virtualnoexcept |
Set listener position.
| fX | The x coord. |
| fY | The y coord. |
| fZ | The z coord. |
|
pure virtualnoexcept |
Set listener volume.
Values outside the 0.0 to 1.0 range are clamped.
| fVolume | The volume. A number from 0.0 (inaudible) to 1.0 (maximum). |
|
pure virtualnoexcept |
Set position of a currently playing sound.
| nSoundId | The sound id. |
| bRelative | Whether the position is relative to the listener. |
| fX | The x coord. |
| fY | The y coord. |
| fZ | The z coord. |
|
pure virtualnoexcept |
Set volume of a currently playing sound.
| nSoundId | The sound id. |
| fVolume | The volume (0.0 inaudible, 1.0 maximum). |
|
pure virtualnoexcept |
Stops all sounds of device.
Note: no SndFinishedEvent is sent to listeners.
|
pure virtualnoexcept |
Stop a sound.
Note: no SndFinishedEvent is sent to listeners.
| nSoundId | The sound id to stop. |
|
static |
1.8.13