HephAudio v3.0.6
A cross-platform C++ library for recording, playing, and processing audio on Windows, Android, Linux, iOS, and macOS.
Loading...
Searching...
No Matches
HephAudio::AudioStream Class Referencefinal

Class for playing audio files without loading them into memory. Reads the portion of audio data from the file just before rendering. More...

#include <AudioStream.h>

Public Member Functions

 AudioStream (Native::NativeAudio *pNativeAudio)
 
 AudioStream (Audio &audio)
 
 AudioStream (Native::NativeAudio *pNativeAudio, const std::filesystem::path &filePath)
 
 AudioStream (Audio &audio, const std::filesystem::path &filePath)
 
 AudioStream (const AudioStream &)=delete
 
 AudioStream (AudioStream &&rhs) noexcept
 
 ~AudioStream ()
 
AudioStreamoperator= (const AudioStream &)=delete
 
AudioStreamoperator= (AudioStream &&rhs) noexcept
 
Native::NativeAudioGetNativeAudio () const
 
AudioObjectGetAudioObject () const
 
const AudioFormatInfoGetAudioFormatInfo () const
 
size_t GetFrameCount () const
 
void ChangeFile (const std::filesystem::path &newFilePath)
 
void Start ()
 
void Stop ()
 
double GetPosition () const
 
void SetPosition (double position)
 
void Release ()
 

Detailed Description

Class for playing audio files without loading them into memory. Reads the portion of audio data from the file just before rendering.

Constructor & Destructor Documentation

◆ AudioStream() [1/5]

HephAudio::AudioStream::AudioStream ( Native::NativeAudio * pNativeAudio)

creates a new instance and initializes it with the provided values.

Parameters
pNativeAudiopointer to the native audio instance that will be used for playing the files.

◆ AudioStream() [2/5]

HephAudio::AudioStream::AudioStream ( Audio & audio)

creates a new instance and initializes it with the provided values.

Parameters
audiothe audio instance that will be used for playing the files.

◆ AudioStream() [3/5]

HephAudio::AudioStream::AudioStream ( Native::NativeAudio * pNativeAudio,
const std::filesystem::path & filePath )

creates a new instance and initializes it with the provided values.

Parameters
pNativeAudiopointer to the native audio instance that will be used for playing the files.
filePathfile that will be played.

◆ AudioStream() [4/5]

HephAudio::AudioStream::AudioStream ( Audio & audio,
const std::filesystem::path & filePath )

creates a new instance and initializes it with the provided values.

Parameters
audiothe audio instance that will be used for playing the files.
filePathfile that will be played.

◆ AudioStream() [5/5]

HephAudio::AudioStream::AudioStream ( AudioStream && rhs)
noexcept

creates a new instance and moves the rhs's data to it.

Parameters
rhsinstance whose data will be moved.

◆ ~AudioStream()

HephAudio::AudioStream::~AudioStream ( )

releases the resources and destroys the instance.

Member Function Documentation

◆ GetNativeAudio()

Native::NativeAudio * HephAudio::AudioStream::GetNativeAudio ( ) const

gets the pointer to the NativeAudio instance that's used for rendering audio data.

◆ GetAudioObject()

AudioObject * HephAudio::AudioStream::GetAudioObject ( ) const

gets the pointer to the AudioObject instance that's created to play audio data.

◆ GetAudioFormatInfo()

const AudioFormatInfo & HephAudio::AudioStream::GetAudioFormatInfo ( ) const

gets the format info of the audio data.

◆ GetFrameCount()

size_t HephAudio::AudioStream::GetFrameCount ( ) const

gets the number of audio frames the file contains.

◆ ChangeFile()

void HephAudio::AudioStream::ChangeFile ( const std::filesystem::path & newFilePath)

changes the file that's currently playing with the provided one.

◆ Start()

void HephAudio::AudioStream::Start ( )

starts (resumes) playing the file.

◆ Stop()

void HephAudio::AudioStream::Stop ( )

stops (pauses) playing the file.

◆ GetPosition()

double HephAudio::AudioStream::GetPosition ( ) const

gets the position of the frame that will be rendered next between 0 and 1.

◆ SetPosition()

void HephAudio::AudioStream::SetPosition ( double position)

sets the position of the frame that will be rendered next between 0 and 1.

◆ Release()

void HephAudio::AudioStream::Release ( )

releases the resources.