-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathaudioplayer.h
More file actions
50 lines (36 loc) · 1.1 KB
/
audioplayer.h
File metadata and controls
50 lines (36 loc) · 1.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
// SPDX-License-Identifier: Apache-2.0
#pragma once
#include "../iaudioplayer.h"
#include "test_export.h"
struct ma_decoder;
struct ma_sound;
namespace libscratchcpp
{
class LIBSCRATCHCPP_TEST_EXPORT AudioPlayer : public IAudioPlayer
{
public:
AudioPlayer();
~AudioPlayer();
bool load(unsigned int size, const void *data, unsigned long sampleRate) override;
bool loadCopy(IAudioPlayer *player) override;
float volume() const override;
void setVolume(float volume) override;
float pitch() const override;
void setPitch(float pitch) override;
float pan() const override;
void setPan(float pan) override;
bool isLoaded() const override;
void start() override;
void stop() override;
bool isPlaying() const override;
private:
ma_decoder *m_decoder = nullptr;
ma_sound *m_sound;
bool m_loaded = false;
bool m_copy = false;
bool m_started = false;
float m_volume = 1;
float m_pitch = 1;
float m_pan = 0;
};
} // namespace libscratchcpp