RavEngine
Loading...
Searching...
No Matches
RavEngine::SampledAudioDataProvider Struct Reference

#include <AudioSource.hpp>

Inheritance diagram for RavEngine::SampledAudioDataProvider:
[legend]
Collaboration diagram for RavEngine::SampledAudioDataProvider:
[legend]

Public Member Functions

 SampledAudioDataProvider (decltype(asset) a, uint8_t nchannels=1)
 
void SetAudio (decltype(SampledAudioDataProvider::asset) a)
 
void Restart () final
 
void Pause () final
 
void Play () final
 
void ProvideBufferData (PlanarSampleBufferInlineView &buffer, PlanarSampleBufferInlineView &scratchSpace) final
 
- Public Member Functions inherited from RavEngine::AudioGraphComposed
void SetGraph (decltype(effectGraph) inGraph)
 
auto GetGraph () const
 
void Render (PlanarSampleBufferInlineView &inputSamples, PlanarSampleBufferInlineView &intermediateBuffer, uint8_t nchannels)
 
- Public Member Functions inherited from RavEngine::AudioDataProvider
 AudioDataProvider (uint16_t nsamples, uint8_t nchannels)
 
float GetVolume () const
 
void SetVolume (float vol)
 
void SetLoop (bool loop)
 
bool IsPlaying () const
 

Public Attributes

Ref< AudioAsset > asset
 
uint64_t lastPlayTime = 0
 
- Public Attributes inherited from RavEngine::AudioDataProvider
SingleAudioRenderBuffer renderData
 
float volume = 1
 
bool loops: 1 = false
 
bool isPlaying: 1 = false
 

Additional Inherited Members

- Public Types inherited from RavEngine::AudioGraphComposed
using effect_graph_ptr_t = Ref< AudioGraphAsset >
 

Detailed Description

Player for AudioAssets

Member Function Documentation

◆ Pause()

void SampledAudioDataProvider::Pause ( )
finalvirtual

Stop the source if it is playing. Call Play() to resume.

Reimplemented from RavEngine::AudioDataProvider.

◆ Play()

void SampledAudioDataProvider::Play ( )
finalvirtual

Starts playing the audio source if it is not playing. Call Pause() to suspend it.

Reimplemented from RavEngine::AudioDataProvider.

◆ ProvideBufferData()

void SampledAudioDataProvider::ProvideBufferData ( PlanarSampleBufferInlineView &  buffer,
PlanarSampleBufferInlineView &  scratchSpace 
)
finalvirtual

Get the next region, accounting for looping and volume, of the current track. The playhead advances buffer.size() % (loops? numsamples : 1). If the next region is shorter than the remaining space in the buffer, that space is filled with 0.

Parameters
bufferoutput destination

Implements RavEngine::AudioDataProvider.

◆ Restart()

void SampledAudioDataProvider::Restart ( )
finalvirtual

Reset the audio playhead to the beginning of this source. This does not trigger it to begin playing.

Implements RavEngine::AudioDataProvider.

◆ SetAudio()

void RavEngine::SampledAudioDataProvider::SetAudio ( decltype(SampledAudioDataProvider::asset)  a)
inline

Change the audio asset in this player

Parameters
athe audio asset

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