This commit is contained in:
Ryzerth
2020-11-02 03:57:44 +01:00
parent 50a73a380d
commit 75f8a45119
33 changed files with 1712 additions and 3339 deletions

View File

@@ -1,6 +1,7 @@
#pragma once
#include <dsp/stream.h>
#include <dsp/routing.h>
#include <dsp/audio.h>
#include <io/audio.h>
#include <map>
@@ -15,7 +16,7 @@ namespace audio {
struct BoundStream_t {
dsp::stream<float>* monoStream;
dsp::stream<dsp::StereoFloat_t>* stereoStream;
dsp::stream<dsp::stereo_t>* stereoStream;
dsp::StereoToMono* s2m;
dsp::MonoToStereo* m2s;
void (*streamRemovedHandler)(void* ctx);
@@ -27,12 +28,12 @@ namespace audio {
struct AudioStream_t {
io::AudioSink* audio;
dsp::stream<float>* monoAudioStream;
dsp::stream<dsp::StereoFloat_t>* stereoAudioStream;
dsp::stream<dsp::stereo_t>* stereoAudioStream;
std::vector<BoundStream_t> boundStreams;
dsp::stream<float>* monoStream;
dsp::DynamicSplitter<float>* monoDynSplit;
dsp::stream<dsp::StereoFloat_t>* stereoStream;
dsp::DynamicSplitter<dsp::StereoFloat_t>* stereoDynSplit;
dsp::Splitter<float>* monoDynSplit;
dsp::stream<dsp::stereo_t>* stereoStream;
dsp::Splitter<dsp::stereo_t>* stereoDynSplit;
int (*sampleRateChangeHandler)(void* ctx, double sampleRate);
double sampleRate;
int blockSize;
@@ -48,15 +49,15 @@ namespace audio {
extern std::map<std::string, AudioStream_t*> streams;
double registerMonoStream(dsp::stream<float>* stream, std::string name, std::string vfoName, int (*sampleRateChangeHandler)(void* ctx, double sampleRate), void* ctx);
double registerStereoStream(dsp::stream<dsp::StereoFloat_t>* stream, std::string name, std::string vfoName, int (*sampleRateChangeHandler)(void* ctx, double sampleRate), void* ctx);
double registerStereoStream(dsp::stream<dsp::stereo_t>* stream, std::string name, std::string vfoName, int (*sampleRateChangeHandler)(void* ctx, double sampleRate), void* ctx);
void startStream(std::string name);
void stopStream(std::string name);
void removeStream(std::string name);
dsp::stream<float>* bindToStreamMono(std::string name, void (*streamRemovedHandler)(void* ctx), void (*sampleRateChangeHandler)(void* ctx, double sampleRate, int blockSize), void* ctx);
dsp::stream<dsp::StereoFloat_t>* bindToStreamStereo(std::string name, void (*streamRemovedHandler)(void* ctx), void (*sampleRateChangeHandler)(void* ctx, double sampleRate, int blockSize), void* ctx);
dsp::stream<dsp::stereo_t>* bindToStreamStereo(std::string name, void (*streamRemovedHandler)(void* ctx), void (*sampleRateChangeHandler)(void* ctx, double sampleRate, int blockSize), void* ctx);
void setBlockSize(std::string name, int blockSize);
void unbindFromStreamMono(std::string name, dsp::stream<float>* stream);
void unbindFromStreamStereo(std::string name, dsp::stream<dsp::StereoFloat_t>* stream);
void unbindFromStreamStereo(std::string name, dsp::stream<dsp::stereo_t>* stream);
std::string getNameFromVFO(std::string vfoName);
void setSampleRate(std::string name, double sampleRate);
void setAudioDevice(std::string name, int deviceId, double sampleRate);