CeresEngine 0.2.0
A game development framework
Loading...
Searching...
No Matches
CeresEngine::AudioStream Class Referenceabstract

A audio stream is a larger piece of audio that will be streammed for the device (instead of feeding all audio samples all at once). More...

#include <CeresEngine/Audio/AudioResource.hpp>

Inheritance diagram for CeresEngine::AudioStream:
CeresEngine::AudioResource< AudioStream > CeresEngine::AbstractAudioResource

Public Types

using ReadSamplesCallback = std::function< void(AudioStream &, std::error_code, Samples &)>
 A callback used as a reply for a read samples operation.
 
- Public Types inherited from CeresEngine::AbstractAudioResource
using Sample = unsigned short
 A audio sample type.
 
using Samples = Vector< Sample >
 A collection of multiple audio samples.
 
using SampleIndex = unsigned int
 A type representing the index of a sample.
 
using SampleOffset = int
 A type representing a sample offset.
 

Public Member Functions

virtual void readSamples (unsigned int samples, ReadSamplesCallback &&callback)=0
 Reads up to samples from the stream.
 
virtual void seek (SampleIndex index)=0
 Seeks the audio stream.
 
AudioResourceType getType () const final
 
- Public Member Functions inherited from CeresEngine::AbstractAudioResource
virtual ~AbstractAudioResource ()=default
 
virtual const AudioMetadatagetMetadata () const =0
 
bool isClip () const
 
AudioClipasClip ()
 
const AudioClipasClip () const
 
bool isStream () const
 
AudioStreamasStream ()
 
const AudioStreamasStream () const
 

Detailed Description

A audio stream is a larger piece of audio that will be streammed for the device (instead of feeding all audio samples all at once).

Audio streams are suitable for background music, VOIP data (which by nature is a stream) or any other larger audio track that is large and the implementer does not want to load it entirely on RAM.

Member Typedef Documentation

◆ ReadSamplesCallback

A callback used as a reply for a read samples operation.

Member Function Documentation

◆ getType()

AudioResourceType CeresEngine::AudioStream::getType ( ) const
finalvirtual

Returns
The audio resource type

Implements CeresEngine::AbstractAudioResource.

◆ readSamples()

virtual void CeresEngine::AudioStream::readSamples ( unsigned int  samples,
ReadSamplesCallback &&  callback 
)
pure virtual

Reads up to samples from the stream.

Parameters
samplesThe maximum number of samples to be read
callbackThe callback to be called after the operation has completed

◆ seek()

virtual void CeresEngine::AudioStream::seek ( SampleIndex  index)
pure virtual

Seeks the audio stream.

Parameters
indexThe sample to seek the stream to

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