nomlib
Loading...
Searching...
No Matches
nom::PlayAudioSourcev2 Class Reference

[TODO: Description] More...

#include <PlayAudioSource_v2.hpp>

Inheritance diagram for nom::PlayAudioSourcev2:
[legend]

Public Types

typedef PlayAudioSourcev2 self_type
Public Types inherited from nom::IActionObject
enum  FrameState { COMPLETED , PLAYING }
 The update status of the action. More...
typedef IActionObject self_type
typedef std::function< real32(real32, real32, real32, real32)> timing_curve_func
 A function pointer to a timing mode.

Public Member Functions

 PlayAudioSourcev2 (audio::IOAudioEngine *dev, const char *filename)
 Default constructor; create the action from an audio file on disk.
 PlayAudioSourcev2 (audio::IOAudioEngine *dev, audio::SoundBuffer *buffer)
 Construct the action from a pre-initialized audio buffer.
virtual ~PlayAudioSourcev2 ()
 Destructor.
virtual std::unique_ptr< IActionObject > clone () const override
 Create a deep copy instance of the action.
virtual IActionObject::FrameState next_frame (real32 delta_time) override
 Play the action forward in time by one time step.
virtual IActionObject::FrameState prev_frame (real32 delta_time) override
 Play the action backwards in time by one time step.
virtual void pause (real32 delta_time) override
 Freeze the action's internal state.
virtual void resume (real32 delta_time) override
 Resume logic for the animation object.
virtual void rewind (real32 delta_time) override
 Reset the internal state of the action back to its initial starting values.
virtual void release () override
 Free externally referenced resources held by the action.
Public Member Functions inherited from nom::IActionObject
const std::string & name () const
 Get the unique identifier of the action.
real32 duration () const
 Get the duration of the action.
real32 speed () const
 Get the speed modifier of the action.
const IActionObject::timing_curve_func & timing_curve () const
 Get the timing mode function used by the action.
void set_name (const std::string &action_id)
 Set the unique identifier of the action.
virtual void set_speed (real32 speed)
 Set the speed factor of the action.
virtual void set_timing_curve (const IActionObject::timing_curve_func &mode)
 Set the timing mode of the action.

Private Types

typedef std::vector< audio::SoundBuffer * > audio_buffers

Private Member Functions

IActionObject::FrameState update (real32 t, uint8 b, int16 c, real32 d)
 Execute the alpha blending logic for the animation.
void first_frame (real32 delta_time)
void last_frame (real32 delta_time)

Private Attributes

nom::size_type curr_frame_ = 0
audio::IOAudioEngine * impl_ = nullptr
audio::ISoundFileReader * fp_ = nullptr
audio_buffers audible_
uint32 input_pos_ = 0

Static Private Attributes

static const char * DEBUG_CLASS_NAME
static const nom::size_type TOTAL_STREAM_BUFFERS = 32
static const nom::size_type STREAM_BUFFER_SIZE = 32767

Friends

class ActionTest
 Allow access into our private parts for unit testing.

Additional Inherited Members

Protected Member Functions inherited from nom::IActionObject
IActionObject::FrameState status () const
 Get the current state of the action.
void set_duration (real32 seconds)
 Set the duration of the action.
void set_status (FrameState state)
 Set the state of the action.
Protected Attributes inherited from nom::IActionObject
real32 elapsed_frames_ = 0.0f
 Internal frames counter.
Timer timer_
 Internal time clock (milliseconds resolution).

Detailed Description

[TODO: Description]

Definition at line 50 of file PlayAudioSource_v2.hpp.

Member Typedef Documentation

◆ audio_buffers

typedef std::vector<audio::SoundBuffer*> nom::PlayAudioSourcev2::audio_buffers
private

Definition at line 99 of file PlayAudioSource_v2.hpp.

◆ self_type

typedef PlayAudioSourcev2 nom::PlayAudioSourcev2::self_type

Definition at line 56 of file PlayAudioSource_v2.hpp.

Member Function Documentation

◆ clone()

virtual std::unique_ptr< IActionObject > nom::PlayAudioSourcev2::clone ( ) const
overridevirtual

Create a deep copy instance of the action.

Remarks
A cloned instance is created using the action's attributes at the time of construction. External resources of the action – i.e.: nom::Sprite – are not modified, and you may need to reset the state appropriately if the action has been ran previously.

Implements nom::IActionObject.

◆ next_frame()

virtual IActionObject::FrameState nom::PlayAudioSourcev2::next_frame ( real32 delta_time)
overridevirtual

Play the action forward in time by one time step.

Parameters
delta_timeReserved for application-defined implementations.
Note
This method should not normally need to be called externally! Exceptions might include: a) implementing a new action; b) advanced debugging
See also
nom::DispatchQueue

Implements nom::IActionObject.

◆ pause()

virtual void nom::PlayAudioSourcev2::pause ( real32 delta_time)
overridevirtual

Freeze the action's internal state.

Parameters
delta_timeReserved for application-defined implementations.
Note
This method should not normally need to be called externally! Exceptions might include: a) implementing a new action; b) advanced debugging
See also
nom::DispatchQueue

Implements nom::IActionObject.

◆ prev_frame()

virtual IActionObject::FrameState nom::PlayAudioSourcev2::prev_frame ( real32 delta_time)
overridevirtual

Play the action backwards in time by one time step.

Parameters
delta_timeReserved for application-defined implementations.
Note
This method should not normally need to be called externally! Exceptions might include: a) implementing a new action; b) advanced debugging
Remarks
Not all actions are reversible – see the action's documentation for its implementation details.
See also
nom::ReversedAction

Implements nom::IActionObject.

◆ release()

virtual void nom::PlayAudioSourcev2::release ( )
overridevirtual

Free externally referenced resources held by the action.

Note
This method should not normally need to be called externally! Exceptions might include: a) implementing a new action; b) advanced debugging
See also
nom::RemoveAction

Implements nom::IActionObject.

◆ resume()

virtual void nom::PlayAudioSourcev2::resume ( real32 delta_time)
overridevirtual

Resume logic for the animation object.

Remarks
Reserved for future implementation.

Implements nom::IActionObject.

◆ rewind()

virtual void nom::PlayAudioSourcev2::rewind ( real32 delta_time)
overridevirtual

Reset the internal state of the action back to its initial starting values.

Parameters
delta_timeReserved for application-defined implementations.
Note
This method should not normally need to be called externally! Exceptions might include: a) implementing a new action; b) advanced debugging
See also
nom::RepeatForAction, nom::RepeatForeverAction

Implements nom::IActionObject.

◆ ActionTest

friend class ActionTest
friend

Allow access into our private parts for unit testing.

Definition at line 54 of file PlayAudioSource_v2.hpp.

Member Data Documentation

◆ audible_

audio_buffers nom::PlayAudioSourcev2::audible_
private

Definition at line 102 of file PlayAudioSource_v2.hpp.

◆ curr_frame_

nom::size_type nom::PlayAudioSourcev2::curr_frame_ = 0
private

Definition at line 94 of file PlayAudioSource_v2.hpp.

◆ DEBUG_CLASS_NAME

const char* nom::PlayAudioSourcev2::DEBUG_CLASS_NAME
staticprivate

Definition at line 86 of file PlayAudioSource_v2.hpp.

◆ fp_

audio::ISoundFileReader* nom::PlayAudioSourcev2::fp_ = nullptr
private

Definition at line 97 of file PlayAudioSource_v2.hpp.

◆ impl_

audio::IOAudioEngine* nom::PlayAudioSourcev2::impl_ = nullptr
private

Definition at line 96 of file PlayAudioSource_v2.hpp.

◆ input_pos_

uint32 nom::PlayAudioSourcev2::input_pos_ = 0
private

Definition at line 104 of file PlayAudioSource_v2.hpp.

◆ STREAM_BUFFER_SIZE

const nom::size_type nom::PlayAudioSourcev2::STREAM_BUFFER_SIZE = 32767
staticprivate

Definition at line 107 of file PlayAudioSource_v2.hpp.

◆ TOTAL_STREAM_BUFFERS

const nom::size_type nom::PlayAudioSourcev2::TOTAL_STREAM_BUFFERS = 32
staticprivate

Definition at line 106 of file PlayAudioSource_v2.hpp.


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