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
AudioPlaylist.h
Go to the documentation of this file.
1#pragma once
2#include "HephAudioShared.h"
3#include "AudioStream.h"
7#include "EventArgs.h"
8#include "EventResult.h"
9#include <string>
10#include <vector>
11
18#define HEPHAUDIO_PLAYLIST_EVENT_USER_ARG_KEY "audio_playlist"
19
20namespace HephAudio
21{
28 {
29 private:
30 AudioStream stream;
31 std::vector<std::filesystem::path> files;
32
33 public:
40 AudioPlaylist(std::shared_ptr<Native::NativeAudio> pNativeAudio);
48
56 AudioPlaylist(std::shared_ptr<Native::NativeAudio> pNativeAudio, const std::vector<std::filesystem::path>& files);
57
65 AudioPlaylist(Audio& audio, const std::vector<std::filesystem::path>& files);
66
67 AudioPlaylist(const AudioPlaylist&) = delete;
68
71
72 AudioPlaylist& operator=(const AudioPlaylist&) = delete;
73 AudioPlaylist& operator=(const std::filesystem::path& rhs);
74 AudioPlaylist& operator=(const std::vector<std::filesystem::path>& rhs);
75 AudioPlaylist& operator=(AudioPlaylist&& rhs) noexcept;
76
81 size_t Size() const;
82
87 std::shared_ptr<Native::NativeAudio> GetNativeAudio() const;
88
94
99 void Start();
100
105 void Stop();
106
112 void Add(const std::filesystem::path& filePath);
113
119 void Add(const std::vector<std::filesystem::path>& files);
120
127 void Insert(const std::filesystem::path& filePath, size_t index);
128
135 void Insert(const std::vector<std::filesystem::path>& files, size_t index);
136
142 void Remove(size_t index);
143
150 void Remove(size_t index, size_t count);
151
156 void Remove(const std::filesystem::path& filePath);
157
162 void Skip();
163
169 void Skip(size_t n);
170
175 void Clear();
176
177 private:
178 void ChangeFile();
179 static void OnFinishedPlaying(const Heph::EventParams& eventParams);
180 };
181}
#define HEPH_API
Definition HephShared.h:124
class for creating playlists. Uses AudioStream internally to play the files.
Definition AudioPlaylist.h:28
void Remove(size_t index, size_t count)
void Insert(const std::vector< std::filesystem::path > &files, size_t index)
void Remove(const std::filesystem::path &filePath)
AudioPlaylist(Audio &audio)
AudioPlaylist(std::shared_ptr< Native::NativeAudio > pNativeAudio, const std::vector< std::filesystem::path > &files)
void Add(const std::filesystem::path &filePath)
void Remove(size_t index)
AudioPlaylist(std::shared_ptr< Native::NativeAudio > pNativeAudio)
std::shared_ptr< Native::NativeAudio > GetNativeAudio() const
void Add(const std::vector< std::filesystem::path > &files)
AudioObject * GetAudioObject() const
AudioPlaylist(AudioPlaylist &&rhs) noexcept
AudioPlaylist(Audio &audio, const std::vector< std::filesystem::path > &files)
void Insert(const std::filesystem::path &filePath, size_t index)
Class for playing audio files without loading them into memory. Reads the portion of audio data from ...
Definition AudioStream.h:23
manages the native audio classes.
Definition Audio.h:47
stores information that's necessary to play audio.
Definition AudioObject.h:33
stores the information required to handle an event.
Definition EventParams.h:16