|
@@ -0,0 +1,40 @@
|
|
|
+#pragma once
|
|
|
+
|
|
|
+
|
|
|
+#include <vector>
|
|
|
+
|
|
|
+extern "C" {
|
|
|
+ #define MINIAUDIO_IMPLEMENTATION
|
|
|
+ #include <miniaudio.h>
|
|
|
+}
|
|
|
+
|
|
|
+#include "AudioInterface.h"
|
|
|
+
|
|
|
+namespace Audio
|
|
|
+{
|
|
|
+
|
|
|
+ const float PI_F=3.14159265358979f;
|
|
|
+
|
|
|
+ class MiniAudio : public AudioInterface
|
|
|
+ {
|
|
|
+
|
|
|
+ private:
|
|
|
+ std::vector<float> m_sample;
|
|
|
+ bool m_is_playing = false;
|
|
|
+ void generate_samples();
|
|
|
+ float const m_frequency = 440.0f;
|
|
|
+ float const m_sample_rate = 48000.00f;
|
|
|
+ float const m_amplitude = 0.8f;
|
|
|
+
|
|
|
+ ma_device_config m_config;
|
|
|
+ ma_device *m_device;
|
|
|
+
|
|
|
+
|
|
|
+ public:
|
|
|
+
|
|
|
+ MiniAudio();
|
|
|
+ void play() override;
|
|
|
+ void pause() override;
|
|
|
+ bool is_playing() override;
|
|
|
+ };
|
|
|
+}
|