stmm-games-doc  0.32.0
Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Member Functions | List of all members
stmi::SndFinishedEvent Class Reference

Event generated when sound has finished. More...

Inheritance diagram for stmi::SndFinishedEvent:
Inheritance graph
[legend]

Public Types

enum  FINISHED_TYPE {
  FINISHED_TYPE_FIRST = 0, FINISHED_TYPE_COMPLETED = 0, FINISHED_TYPE_ABORTED = 1, FINISHED_TYPE_LISTENER_REMOVED = 2,
  FINISHED_TYPE_FILE_NOT_FOUND = 3, FINISHED_TYPE_LAST = 3
}
 
- Public Types inherited from stmi::Event
enum  AS_KEY_INPUT_TYPE { AS_KEY_PRESS = 1, AS_KEY_RELEASE = 2, AS_KEY_RELEASE_CANCEL = 3 }
 Key simulation type. More...
 

Public Member Functions

 SndFinishedEvent (int64_t nTimeUsec, const shared_ptr< PlaybackCapability > &refPlaybackCapability, FINISHED_TYPE eFinishedType, int32_t nSoundId) noexcept
 Constructor. More...
 
shared_ptr< PlaybackCapabilitygetPlaybackCapability () const noexcept
 The playback capability that generated the event. More...
 
shared_ptr< CapabilitygetCapability () const noexcept override
 Returns the capability that generated this event. More...
 
FINISHED_TYPE getFinishedType () const noexcept
 The type of finish. More...
 
int32_t getSoundId () const noexcept
 The sound id being finished. More...
 
- Public Member Functions inherited from stmi::Event
virtual ~Event () noexcept=default
 
int64_t getTimeUsec () const noexcept
 Returns the time this event originated. More...
 
int32_t getCapabilityId () const noexcept
 Returns the id of the capability that generated this event. More...
 
const shared_ptr< Accessor > & getAccessor () const noexcept
 Returns the accessor that helped generate this event. More...
 
virtual bool getAsKey (HARDWARE_KEY &eKey, AS_KEY_INPUT_TYPE &eType, bool &bMoreThanOne) const noexcept
 Tells whether the event can simulate hardware keys. More...
 
virtual std::vector< std::pair< HARDWARE_KEY, AS_KEY_INPUT_TYPE > > getAsKeys () const noexcept
 All the keys this event simulates. More...
 
const ClassgetEventClass () const noexcept
 Get the registered class of the event instance. More...
 

Static Public Member Functions

static const Event::ClassgetClass () noexcept
 
- Static Public Member Functions inherited from stmi::Event
static bool isEventClassIdRegistered (const std::string &sEventClassId) noexcept
 Tells whether the given event class id is registered. More...
 
static Class getEventClassIdClass (const std::string &sEventClassId) noexcept
 Gets the event class with given class id. More...
 

Static Public Attributes

static const char *const s_sClassId
 

Protected Member Functions

void setFinishedType (FINISHED_TYPE eFinishedType) noexcept
 Set the finished type. More...
 
void setSoundId (int32_t nSoundId) noexcept
 Sets sound id. More...
 
void setPlaybackCapability (const shared_ptr< PlaybackCapability > &refPlaybackCapability) noexcept
 Sets the capability. More...
 
- Protected Member Functions inherited from stmi::Event
 Event (const Class &oClass, int64_t nTimeUsec, int32_t nCapabilityId, const shared_ptr< Accessor > &refAccessor) noexcept
 Constructor to be called from subclasses. More...
 
 Event (const Class &oClass, int64_t nTimeUsec, int32_t nCapabilityId) noexcept
 Constructor to be called from subclasses (with empty accessor). More...
 
void setTimeUsec (int64_t nTimeUsec) noexcept
 Set the event time. More...
 
void setCapabilityId (int32_t nCapabilityId) noexcept
 Set the capability id. More...
 
void setAccessor (const shared_ptr< Accessor > &refAccessor) noexcept
 Set the accessor. More...
 

Additional Inherited Members

- Static Protected Member Functions inherited from stmi::Event
static bool isEventTypeRegistered (const std::type_info &oEventType) noexcept
 Tells whether an event type was registered. More...
 
static const std::type_info & getEventClassIdType (const std::string &sEventClassId, bool &bRegistered) noexcept
 Gets the type of the registered event subclass associated with class id. More...
 
static std::string getEventTypeClassId (const std::type_info &oType) noexcept
 Gets the class id of the given type. More...
 

Detailed Description

Event generated when sound has finished.

Note that the reference to the capability that generated this event is weak.

Member Enumeration Documentation

◆ FINISHED_TYPE

Enumerator
FINISHED_TYPE_FIRST 
FINISHED_TYPE_COMPLETED 

The sound was completed successfully.

FINISHED_TYPE_ABORTED 

The sound was aborted (probably device is being removed).

FINISHED_TYPE_LISTENER_REMOVED 

The listener receiving this event is being removed.

The sound might actually still be playing.

FINISHED_TYPE_FILE_NOT_FOUND 

The sound couldn't be started because file not found.

FINISHED_TYPE_LAST 

Constructor & Destructor Documentation

◆ SndFinishedEvent()

stmi::SndFinishedEvent::SndFinishedEvent ( int64_t  nTimeUsec,
const shared_ptr< PlaybackCapability > &  refPlaybackCapability,
FINISHED_TYPE  eFinishedType,
int32_t  nSoundId 
)
noexcept

Constructor.

Parameters
nTimeUsecTime from epoch in microseconds.
refPlaybackCapabilityThe capability that generated this event. Cannot be null.
eFinishedTypeThe type.
nSoundIdThe Sound id that finished playing.

Member Function Documentation

◆ getCapability()

shared_ptr<Capability> stmi::SndFinishedEvent::getCapability ( ) const
overridevirtualnoexcept

Returns the capability that generated this event.

The Event subclass implementation keeps only a weak_ptr on the capability to avoid reference cycles.

Returns
The capability or null if the capability was deleted.

Implements stmi::Event.

◆ getClass()

static const Event::Class& stmi::SndFinishedEvent::getClass ( )
inlinestaticnoexcept

◆ getFinishedType()

FINISHED_TYPE stmi::SndFinishedEvent::getFinishedType ( ) const
inlinenoexcept

The type of finish.

Returns
The type.

◆ getPlaybackCapability()

shared_ptr<PlaybackCapability> stmi::SndFinishedEvent::getPlaybackCapability ( ) const
inlinenoexcept

The playback capability that generated the event.

Returns
The capability or null if the capability was deleted.

◆ getSoundId()

int32_t stmi::SndFinishedEvent::getSoundId ( ) const
inlinenoexcept

The sound id being finished.

Returns
The sound id.

◆ setFinishedType()

void stmi::SndFinishedEvent::setFinishedType ( FINISHED_TYPE  eFinishedType)
protectednoexcept

Set the finished type.

Parameters
eFinishedTypeThe type.

◆ setPlaybackCapability()

void stmi::SndFinishedEvent::setPlaybackCapability ( const shared_ptr< PlaybackCapability > &  refPlaybackCapability)
protectednoexcept

Sets the capability.

Parameters
refPlaybackCapabilityThe capability that generated this event. Cannot be null.

◆ setSoundId()

void stmi::SndFinishedEvent::setSoundId ( int32_t  nSoundId)
protectednoexcept

Sets sound id.

Parameters
nSoundIdThe sound id. Must be >= 0.

Member Data Documentation

◆ s_sClassId

const char* const stmi::SndFinishedEvent::s_sClassId
static