Switchboard Extension SDK
Toggle main menu visibility
Loading...
Searching...
No Matches
AudioGraphResampler.hpp
1
//
2
// AudioGraphResampler.hpp
3
// SwitchboardSDK
4
//
5
// Created by Balazs Kiss on 2025. 04. 15..
6
//
7
8
#pragma once
9
10
#include <audio/ResamplingFIFO.hpp>
11
#include <buffer/AudioData.hpp>
12
#include <functional>
13
#include <memory>
14
#include <switchboard/export.h>
15
#include <switchboard_core/AudioBusList.hpp>
16
17
namespace
switchboard {
18
23
class
SWITCHBOARDSDK_EXPORT
AudioGraphResampler
{
24
public
:
33
using
ProcessCallback
= std::function<bool(
AudioBusList
& inAudioBuses,
AudioBusList
& outAudioBuses)>;
34
41
AudioGraphResampler
(
int
sampleRate,
int
bufferSize);
42
46
~AudioGraphResampler
();
47
53
void
setProcessCallback
(
ProcessCallback
callback);
54
63
bool
setNumberOfBuses
(
const
uint numberOfInputBuses,
const
uint numberOfOutputBuses);
64
73
bool
process
(
AudioBusList
& inAudioBuses,
AudioBusList
& outAudioBuses);
74
75
private
:
76
ProcessCallback
processCallback;
77
int
sampleRate;
78
int
bufferSize;
79
int
numberOfInputBuses;
80
int
numberOfOutputBuses;
81
std::unique_ptr<audio::ResamplingFIFO> inputResamplingFIFO;
82
std::unique_ptr<audio::ResamplingFIFO> outputResamplingFIFO;
83
buffer::AudioData<float> interleavedData;
84
buffer::AudioData<float> callbackInAudioData;
85
buffer::AudioData<float> callbackOutAudioData;
86
87
bool
callProcessCallback(
AudioBuffer<float>
* inBuffer,
AudioBuffer<float>
* outBuffer);
88
void
configureResamplers(
AudioBuffer<float>
* inBuffer,
AudioBuffer<float>
* outBuffer);
89
bool
process
(
AudioBuffer<float>
* inBuffer,
AudioBuffer<float>
* outBuffer);
90
void
pushInputBufferToResampler(
AudioBuffer<float>
& buffer);
91
void
popInputBufferFromResampler(
AudioBuffer<float>
& buffer);
92
void
pushOutputBufferToResampler(
AudioBuffer<float>
& buffer);
93
void
popOutputBufferFromResampler(
AudioBuffer<float>
& buffer);
94
};
95
96
}
switchboard::AudioBuffer
Provides an abstraction around raw audio buffers stored in memory.
Definition
AudioBuffer.hpp:22
switchboard::AudioGraphResampler::AudioGraphResampler
AudioGraphResampler(int sampleRate, int bufferSize)
Constructor for AudioGraphResampler.
switchboard::AudioGraphResampler::setProcessCallback
void setProcessCallback(ProcessCallback callback)
Sets the process callback function.
switchboard::AudioGraphResampler::process
bool process(AudioBusList &inAudioBuses, AudioBusList &outAudioBuses)
Processes the audio data.
switchboard::AudioGraphResampler::setNumberOfBuses
bool setNumberOfBuses(const uint numberOfInputBuses, const uint numberOfOutputBuses)
Sets the number of input and output buses.
switchboard::AudioGraphResampler::~AudioGraphResampler
~AudioGraphResampler()
Destructor for AudioGraphResampler.
switchboard::AudioGraphResampler::ProcessCallback
std::function< bool(AudioBusList &inAudioBuses, AudioBusList &outAudioBuses)> ProcessCallback
Callback function type for processing audio data.
Definition
AudioGraphResampler.hpp:33
switchboard::AudioBusList
Holds a list of AudioBus instances.
Definition
AudioBusList.hpp:25
SwitchboardSDK
include
switchboard_core
AudioGraphResampler.hpp
Generated by
1.17.0