Main Page · Modules · All Classes · Class Hierarchy
Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions | List of all members
MASpeakerController Class Reference

Speaker controller class. More...

#include <MASpeakerController.hpp>

Inheritance diagram for MASpeakerController:
MAController MARobotStateUpdater MAContainerLocker

Public Member Functions

virtual MA::DeviceList GetMotors () const override
 Get the list of the motors. More...
 
bool IsFree () const
 Check if any sound is being played back. More...
 
void SwitchSoundProfile ()
 Switch the sound profile.
 
std::string GetSoundProfileName () const
 Get sound profile name. More...
 
void SetSoundProfileName (const std::string &profile_name)
 Set sound profile name. More...
 
virtual void LoadSoundProfile ()
 Load the sound profile.
 
virtual void SaveSoundProfile ()
 Save the sound profile.
 
virtual void LoadVolumeControl ()
 Load the volume control.
 
virtual void SaveVolumeControl ()
 Save the volume control.
 
bool Preload (const std::string &name)
 Preload a sound. More...
 
void FreePreloadedSound (const std::string &name)
 Free a preloaded sound. More...
 
int Play (const std::string &name)
 Play a sound by name. More...
 
int Play (MA::SoundBaseSPtr sound)
 Play a sound and register the playback. More...
 
bool IsPlayed (const int playback_id) const
 Check if a playback ID is active. More...
 
bool IsPlayed (const std::string &sound_name) const
 Check if a sound playback is active. More...
 
void SetVolume (const MA::VolumeType new_volume)
 Set a new volume level. More...
 
- Public Member Functions inherited from MAController
 MAController (MA::ControllerType controller_type)
 Class constructor. More...
 
MC::StringList GetTransitionNames () const
 Get the list of the transition names. More...
 
MC::StringList GetActiveTransitionsByDevice (const MADevice &device)
 Get a transition list by device. More...
 
virtual int StartTransition (const std::string &name)
 Start a transition. More...
 
virtual void StopTransition (const std::string &name)
 Stop a transition. More...
 
bool IsTransitionActive (const std::string &name)
 Whenever the transition is still active. More...
 
bool IsAnyActiveTransition ()
 Check if any transition is active. More...
 
bool IsAnyActiveSkitTransition ()
 Check if any skit transition is active. More...
 
bool IsTransitionSuccessful (const std::string &name)
 Whenever the transition is successful. More...
 
bool TransitionHasCheck (const std::string &name)
 Test if the transition has a check. More...
 
- Public Member Functions inherited from MARobotStateUpdater
 MARobotStateUpdater (MA::RobotStateUpdateType update_type)
 Struct constructor.
 
virtual ~MARobotStateUpdater ()
 Struct destructor.
 
- Public Member Functions inherited from MAContainerLocker
 MAContainerLocker (const std::string &class_name, const std::string &file_name)
 Class constructor. More...
 
int RegisterContainer (const std::string &container_name)
 Register a container for locking. More...
 
int Lock (int container_id, int line, const char *file_name=nullptr)
 Lock a container. More...
 
int Unlock (int container_id, int line, const char *file_name=nullptr)
 Unlock a container. More...
 

Static Public Member Functions

static void RegisterFutureSound (const int id, const std::string &name, const int duration)
 Register a sound for future playback. More...
 
- Static Public Member Functions inherited from MAController
static void SetVerbose (bool new_state)
 Set the verbosity of the controller domain. More...
 
static bool IsVerbose ()
 Get the verbosity of the controller domain. More...
 
- Static Public Member Functions inherited from MARobotStateUpdater
static void RegisterUpdater (MARobotStateUpdater &updater)
 Register a robot state updater. More...
 
static void Run (MARobotState &state)
 Run the robot state updates. More...
 

Protected Member Functions

virtual MA::DeviceGeneratorsMap GetSkitTransitionGenerators (MA::SkitBaseSPtr skit) override
 Get skit transition generators. More...
 
- Protected Member Functions inherited from MAController
void GeneratorContainerExpired (MAGeneratorContainer &container)
 Slot for the expired generator containers. More...
 
MA::TransitionMap::iterator RegisterSkitTransition (const std::string &skit_name)
 Register a skit transition if it has not been. More...
 

Protected Attributes

int BufferSize
 Determinates the buffer duration for the playback.
 
MA::SoundPlaybackMap Playbacks
 Actual playback list of the sound files.
 
boost::shared_ptr< MASpeakerDevice > SpeakerDevice
 Speaker device.
 
- Protected Attributes inherited from MAController
MA::ControllerType Type
 Controller type.
 
MA::TransitionMap Transitions
 The map of the transitions.
 

Private Member Functions

virtual void UpdateRobotState (MARobotState &state) override
 Update the robot state. More...
 

Detailed Description

Speaker controller class.

Definition at line 59 of file MASpeakerController.hpp.

Member Function Documentation

void MASpeakerController::FreePreloadedSound ( const std::string &  name)

Free a preloaded sound.

Parameters
nameSound name prefix (without profile name and extension)

Definition at line 223 of file MASpeakerController.cpp.

MA::DeviceList MASpeakerController::GetMotors ( ) const
overridevirtual

Get the list of the motors.

Returns
List of motors

Implements MAController.

Definition at line 121 of file MASpeakerController.cpp.

MA::DeviceGeneratorsMap MASpeakerController::GetSkitTransitionGenerators ( MA::SkitBaseSPtr  skit)
overrideprotectedvirtual

Get skit transition generators.

Parameters
skitMotion skit
Returns
Generator map of a skit for the current controller

Implements MAController.

Definition at line 427 of file MASpeakerController.cpp.

std::string MASpeakerController::GetSoundProfileName ( ) const

Get sound profile name.

Returns
Sound profile name

Definition at line 156 of file MASpeakerController.cpp.

bool MASpeakerController::IsFree ( ) const

Check if any sound is being played back.

Returns
False if any sound is being played back otherwise true.

Definition at line 136 of file MASpeakerController.cpp.

bool MASpeakerController::IsPlayed ( const int  playback_id) const

Check if a playback ID is active.

Parameters
playback_idPlayback ID
Returns
True if the sound with the playback ID is being played back

Definition at line 307 of file MASpeakerController.cpp.

bool MASpeakerController::IsPlayed ( const std::string &  sound_name) const

Check if a sound playback is active.

Parameters
sound_nameSound name
Returns
True if the sound is being played back

Definition at line 323 of file MASpeakerController.cpp.

int MASpeakerController::Play ( const std::string &  name)

Play a sound by name.

Parameters
nameSound name
Returns
Playback ID

Definition at line 255 of file MASpeakerController.cpp.

int MASpeakerController::Play ( MA::SoundBaseSPtr  sound)

Play a sound and register the playback.

Parameters
soundIn-memory sound data
Returns
Playback ID

Definition at line 279 of file MASpeakerController.cpp.

bool MASpeakerController::Preload ( const std::string &  name)

Preload a sound.

Parameters
nameSound name prefix (without profile name and extension)
Returns
True if successful otherwise false.

Definition at line 196 of file MASpeakerController.cpp.

void MASpeakerController::RegisterFutureSound ( const int  id,
const std::string &  name,
const int  duration 
)
static

Register a sound for future playback.

Parameters
idPlayback ID
nameSound name
durationExpected playback duration

This method is for testing purposes. Never use for production code.

Definition at line 128 of file MASpeakerController.cpp.

void MASpeakerController::SetSoundProfileName ( const std::string &  profile_name)

Set sound profile name.

Parameters
profile_nameProfile name

Definition at line 162 of file MASpeakerController.cpp.

void MASpeakerController::SetVolume ( const MA::VolumeType  new_volume)

Set a new volume level.

Parameters
new_volumeNew volume level

Definition at line 337 of file MASpeakerController.cpp.

void MASpeakerController::UpdateRobotState ( MARobotState state)
overrideprivatevirtual

Update the robot state.

Parameters
stateRobot state to be updated

Implements MARobotStateUpdater.

Definition at line 113 of file MASpeakerController.cpp.


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