audiobox-doc  2.4.3.28
 All Classes Files Functions Variables
Public Member Functions | Public Attributes | List of all members
AL::Track Class Reference

#include <track.hpp>

Public Member Functions

void play ()
 
void pause ()
 
void stop ()
 
void abort ()
 
void requestAutoRestart ()
 
bool isPlaying ()
 
void setIdleState (enum trackState state)
 
enum trackState getIdleState () const
 
void setFileName (const std::string &filename)
 
std::string getFileName () const
 
void setVolume (float volume)
 
float getVolume () const
 
void setVolumePercent (float volume)
 
float getVolumePercent () const
 
void setBalance (float balance)
 
float getBalance () const
 
void seek (const qi::SteadyClock::time_point &pos)
 
qi::SteadyClock::time_point getPosition () const
 
qi::Duration getDuration () const
 
void setFadeIn (const qi::Duration &fadeTime)
 
qi::Duration getFadeIn () const
 
void setFadeOut (const qi::Duration &fadeTime)
 
qi::Duration getFadeOut () const
 
enum trackState getState () const
 

Public Attributes

qi::Signal< enum trackEvent > statusChange
 
qi::Signal
< qi::SteadyClock::time_point > 
signalPosition
 

Detailed Description

Simple File player.

Member Function Documentation

void AL::Track::abort ( )

Stop the stream with clipping the end of the output buffer. (faster as possible, but can have some audio artefact)

Note
do nothing if the playing is not active.
Exceptions
std::runtime_errorIf an error occured.
float AL::Track::getBalance ( ) const

Get the current Balance of the Track.

Returns
Balance value -1..1.
qi::Duration AL::Track::getDuration ( ) const

Total duration of the file find in the header property.

Returns
The file Duration [0 .. inf]
qi::Duration AL::Track::getFadeIn ( ) const

Get the current fade-in. The fade-in is apply all time (although in the start of the file)

Returns
Time fade-in [0..20second]
qi::Duration AL::Track::getFadeOut ( ) const

Get the current fade-out.

Returns
Time fade-out [0..20second]
std::string AL::Track::getFileName ( ) const

Get the current file name that might be read.

Returns
Current set filename
enum trackState AL::Track::getIdleState ( ) const

Get the Idle state of the Tack.

Returns
The current request: "STOP", "PRELOAD" or "SUSPEND".
qi::SteadyClock::time_point AL::Track::getPosition ( ) const

Get the Current position of the playing track.

Returns
The position in millisecond [0..getDuration()]
enum trackState AL::Track::getState ( ) const

Get state of the internal system:

Returns
the current track state
float AL::Track::getVolume ( ) const

Get the current playing volume in dB.

Returns
Volume value [-50..0]
float AL::Track::getVolumePercent ( ) const

Get the current playing volume in %.

Returns
Volume value [0..100]
bool AL::Track::isPlaying ( )

Check if track is currently playing.

Returns
true if playing is in progress
void AL::Track::pause ( )

Suspend the Current playing.

Note
do nothing if the playing is not active.
Exceptions
std::runtime_errorIf an error occured.
void AL::Track::play ( )

Start generating an output.

Note
this function done everything is needed for the playing of the file. When return the audio hardware will be started
this function is faster if the setIdleState(AL::trackEvent_suspend) is done.
Exceptions
std::runtime_errorIf file does not exist.
std::runtime_errorIf file is not set.
std::runtime_errorIf an error occured.
void AL::Track::seek ( const qi::SteadyClock::time_point &  pos)

Seek to a specify position in the file.

Parameters
[in]posSeek position in second [0..getDuration()]
Note
This is a synchronous function (return only when seeking is done or have an error)
void AL::Track::setBalance ( float  balance)

Set the current Balance of the Playing file.

Parameters
[in]balanceBalance value -1..1.
void AL::Track::setFadeIn ( const qi::Duration &  fadeTime)

Set the file fade-in.

Parameters
[in]fadeTimeTime fade-in [0..2000]
void AL::Track::setFadeOut ( const qi::Duration &  fadeTime)

Set the file fade-out.

Note
The fade-out is temporized of the buffering of the Pulse-audio interface (500ms before applying it)
Parameters
[in]fadeTimeTime fade-out [0..20second]
void AL::Track::setFileName ( const std::string &  filename)

Set the current file name to read.

Parameters
[in]filenameFile name to read
void AL::Track::setIdleState ( enum trackState  state)

Set the idle state of the Tack.

Parameters
[in]stateIdle state requested: trackState_stopped just an empty track instance. trackState_preload Le file ss loaded and the already parsed. trackState_suspend The harware interface is ready and wait for playing.
Note
If the track is playing it do nothing if the file is in stop mode, it can change the state of the track.
Exceptions
std::runtime_errorIf unknow state.
void AL::Track::setVolume ( float  volume)

Set the current volume of the player in dB.

Parameters
[in]volumeVolume to set [-50..0]
void AL::Track::setVolumePercent ( float  volume)

Set the current volume of the player in %.

Parameters
[in]volumeVolume to set [0..100]
void AL::Track::stop ( )

Stop the current playing with draining the current sample in the output.

Note
do nothing if the playing is not active.
Exceptions
std::runtime_errorIf an error occured.

Member Data Documentation

qi::Signal<qi::SteadyClock::time_point> AL::Track::signalPosition

Generate the current playing time, emited every 0.1s.

Returns
[0..getDuration()]
qi::Signal<enum trackEvent> AL::Track::statusChange

Event generated when status of the track change.

See Also
AL::trackEvent

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