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
AudioStream.h
Go to the documentation of this file.
1#pragma once
2#include "HephAudioShared.h"
3#include "Audio.h"
4#include "AudioBuffer.h"
5#include <filesystem>
6
13#define HEPHAUDIO_STREAM_EVENT_USER_ARG_KEY "audio_stream"
14
15namespace HephAudio
16{
23 {
24 private:
25 Native::NativeAudio* pNativeAudio;
26 AudioFormatInfo formatInfo;
27 size_t frameCount;
28 AudioObject* pAudioObject;
29 AudioBuffer decodedBuffer;
30
31 public:
38
45
52 AudioStream(Native::NativeAudio* pNativeAudio, const std::filesystem::path& filePath);
53
60 AudioStream(Audio& audio, const std::filesystem::path& filePath);
61
62 AudioStream(const AudioStream&) = delete;
63
65 AudioStream(AudioStream&& rhs) noexcept;
66
69
70 AudioStream& operator=(const AudioStream&) = delete;
71 AudioStream& operator=(AudioStream&& rhs) noexcept;
72
78
84
90
95 size_t GetFrameCount() const;
96
101 void ChangeFile(const std::filesystem::path& newFilePath);
102
107 void Start();
108
113 void Stop();
114
119 double GetPosition() const;
120
125 void SetPosition(double position);
126
131 void Release();
132
133 private:
134 void Release(bool destroyAO);
135 static void OnRender(const Heph::EventParams& eventParams);
136 static void OnFinishedPlaying(const Heph::EventParams& eventParams);
137 };
138}
#define HEPH_API
Definition HephShared.h:132
class for storing the audio samples in internal format.
Definition AudioBuffer.h:16
Class for playing audio files without loading them into memory. Reads the portion of audio data from ...
Definition AudioStream.h:23
const AudioFormatInfo & GetAudioFormatInfo() const
AudioStream(Audio &audio, const std::filesystem::path &filePath)
void SetPosition(double position)
AudioStream(Native::NativeAudio *pNativeAudio)
AudioObject * GetAudioObject() const
AudioStream(Audio &audio)
double GetPosition() const
Native::NativeAudio * GetNativeAudio() const
size_t GetFrameCount() const
AudioStream(AudioStream &&rhs) noexcept
AudioStream(Native::NativeAudio *pNativeAudio, const std::filesystem::path &filePath)
void ChangeFile(const std::filesystem::path &newFilePath)
manages the native audio classes.
Definition Audio.h:39
base class for the classes that interact with the native audio APIs.
Definition NativeAudio.h:28
stores the properties of the audio signals
Definition AudioFormatInfo.h:20
stores information that's necessary to play audio.
Definition AudioObject.h:36
stores the information required to handle an event.
Definition EventParams.h:16