class
#include <nCine/Audio/IAudioPlayer.h>
IAudioPlayer Audio player interface.
Base classes
- class Object
- Base class of nCine objects.
Derived classes
- class AudioBufferPlayer
- Audio buffer player.
- class AudioStreamPlayer
- Audio stream player.
Public types
- enum class PlayerState { Initial = 0, Playing, Paused, Stopped }
- Player state.
Constructors, destructors, conversion operators
- IAudioPlayer(ObjectType type)
- ~IAudioPlayer() override
- IAudioPlayer(IAudioPlayer&&) defaulted
- Default move constructor.
Public functions
- auto operator=(IAudioPlayer&&) -> IAudioPlayer& defaulted
- Default move assignment operator.
-
auto sourceId() const -> std::
uint32_t - Returns the OpenAL id of the player source.
-
auto bufferId() const -> std::
uint32_t pure virtual - Returns the OpenAL id of the currently playing buffer.
-
auto bytesPerSample() const -> std::
int32_t pure virtual - Returns the number of bytes per sample.
-
auto numChannels() const -> std::
int32_t pure virtual - Returns the number of audio channels of the currently playing buffer.
-
auto frequency() const -> std::
int32_t pure virtual - Returns the samples frequency of the currently playing buffer.
-
auto numSamples() const -> std::
int32_t pure virtual - Returns the number of samples.
- auto duration() const -> float pure virtual
- Returns the duration in seconds.
-
auto bufferSize() const -> std::
int32_t pure virtual - Returns the size of the currently playing buffer in bytes.
-
auto sampleOffset() const -> std::
int32_t virtual - Returns the playback position expressed in samples.
-
void setSampleOffset(std::
int32_t offset) virtual - Sets the playback position expressed in samples.
- void play() pure virtual
- Starts playing.
- void pause() pure virtual
- Pauses playing.
- void stop() pure virtual
- Stops playing and rewind.
- auto state() const -> PlayerState
- Returns the state of the player.
- auto isPlaying() const -> bool
- Queries the playing state of the player.
- auto isPaused() const -> bool
- Queries the paused state of the player.
- auto isStopped() const -> bool
- Queries the stopped state of the player.
- auto isLooping() const -> bool
- Queries the looping property of the player.
- void setLooping(bool value) virtual
- Sets player looping property.
- auto isSourceRelative() const -> bool
- Queries the source relative property of the player.
- void setSourceRelative(bool value) virtual
- Sets player source relative property.
- auto isAs2D() const -> bool
- void setAs2D(bool value) virtual
- auto gain() const -> float
- Returns player gain value.
- void setGain(float gain) virtual
- Sets player gain value.
- auto pitch() const -> float
- Returns player pitch value.
- void setPitch(float pitch) virtual
- Sets player pitch value.
- auto lowPass() const -> float
- Returns player low-pass value.
- void setLowPass(float value) virtual
- Sets player low-pass value.
- auto position() const -> Vector3f
- Returns player position value.
- void setPosition(const Vector3f& position) virtual
- Sets player position value through vector.
Protected functions
- void updateState() pure virtual
- Updates the state of the player if the source has done playing.
- void updateFilters() virtual
- auto getAdjustedPosition(IAudioDevice& device, const Vector3f& pos, bool isSourceRelative, bool isAs2D) -> Vector3f virtual
- void setPositionInternal(const Vector3f& position)
Function documentation
void nCine:: IAudioPlayer:: updateState() pure virtual protected
Updates the state of the player if the source has done playing.
It is called every frame by the IAudioDevice
class and it is also responsible for buffer queueing/unqueueing in stream players.