HephAudio v3.1.0
A cross-platform C++ library for recording, playing, and processing audio on Windows, Android, Linux, iOS, and macOS.
Loading...
Searching...
No Matches
AudioObject.h
Go to the documentation of this file.
1#pragma once
2#include "HephAudioShared.h"
3#include "AudioBuffer.h"
4#include "Event.h"
5#include "Guid.h"
6#include <vector>
7#include <filesystem>
8
15#define HEPHAUDIO_INFINITE_LOOP (0)
16
18#define HEPHAUDIO_RENDER_HANDLER_DEFAULT &HephAudio::AudioObject::DefaultRenderHandler
19
21#define HEPHAUDIO_RENDER_HANDLER_MATCH_FORMAT &HephAudio::AudioObject::MatchFormatRenderHandler
22
24#define HEPHAUDIO_FINISHED_PLAYING_HANDLER_DEFAULT &HephAudio::AudioObject::DefaultFinishedPlayingHandler
25
26namespace HephAudio
27{
33 {
39
44 std::filesystem::path filePath;
45
50 std::string name;
51
58
64 uint32_t playCount;
65
71 double volume;
72
78
83 size_t frameIndex;
84
90
96
99
101 AudioObject(AudioObject&& rhs) noexcept;
102
103 AudioObject& operator=(AudioObject&& rhs) noexcept;
104
109 double GetPosition() const;
110
116 void SetPosition(double position);
117
122 void Pause();
123
128 void Resume();
129
135 static void DefaultRenderHandler(const Heph::EventParams& eventParams);
136
142 static void MatchFormatRenderHandler(const Heph::EventParams& eventParams);
143
149 static void DefaultFinishedPlayingHandler(const Heph::EventParams& eventParams);
150 };
151}
#define HEPH_API
Definition HephShared.h:124
class for storing the audio samples in internal format.
Definition AudioBuffer.h:16
class for managing callback functions.
Definition Event.h:25
stores information that's necessary to play audio.
Definition AudioObject.h:33
bool isPaused
Definition AudioObject.h:57
double GetPosition() const
static void DefaultFinishedPlayingHandler(const Heph::EventParams &eventParams)
AudioBuffer buffer
Definition AudioObject.h:77
AudioObject(AudioObject &&rhs) noexcept
static void MatchFormatRenderHandler(const Heph::EventParams &eventParams)
Heph::Guid id
Definition AudioObject.h:38
Heph::Event OnRender
Definition AudioObject.h:89
std::string name
Definition AudioObject.h:50
static void DefaultRenderHandler(const Heph::EventParams &eventParams)
std::filesystem::path filePath
Definition AudioObject.h:44
Heph::Event OnFinishedPlaying
Definition AudioObject.h:95
size_t frameIndex
Definition AudioObject.h:83
uint32_t playCount
Definition AudioObject.h:64
double volume
Definition AudioObject.h:71
void SetPosition(double position)
stores the information required to handle an event.
Definition EventParams.h:16
struct for storing globally unique identifiers.
Definition Guid.h:14