Commit b2a24dd5 authored by BERTHAUT Florent's avatar BERTHAUT Florent
Browse files

Added buffer size setting

parent addab6e9
...@@ -15,7 +15,9 @@ void Gdpd::_register_methods() { ...@@ -15,7 +15,9 @@ void Gdpd::_register_methods() {
register_method("set_volume", &Gdpd::set_volume); register_method("set_volume", &Gdpd::set_volume);
} }
int Gdpd::audioCallback(void *outputBuffer, void *inputBuffer, unsigned int nBufferFrames, double streamTime, RtAudioStreamStatus status, void *userData){ int Gdpd::audioCallback(void *outputBuffer, void *inputBuffer,
unsigned int nBufferFrames, double streamTime,
RtAudioStreamStatus status, void *userData){
Gdpd* gdpd = static_cast<Gdpd*>(userData); Gdpd* gdpd = static_cast<Gdpd*>(userData);
gdpd->processAudio(outputBuffer, inputBuffer, nBufferFrames, streamTime, gdpd->processAudio(outputBuffer, inputBuffer, nBufferFrames, streamTime,
status, userData); status, userData);
...@@ -32,7 +34,7 @@ void Gdpd::_init() { ...@@ -32,7 +34,7 @@ void Gdpd::_init() {
Gdpd::~Gdpd() { Gdpd::~Gdpd() {
} }
int Gdpd::init(int nbInputs, int nbOutputs, int sampleRate) { int Gdpd::init(int nbInputs, int nbOutputs, int sampleRate, int bufferSize) {
if(!m_pd.init(nbInputs, nbOutputs, sampleRate, true)) { if(!m_pd.init(nbInputs, nbOutputs, sampleRate, true)) {
Godot::print("GDPD : Error starting libpd"); Godot::print("GDPD : Error starting libpd");
...@@ -62,7 +64,7 @@ int Gdpd::init(int nbInputs, int nbOutputs, int sampleRate) { ...@@ -62,7 +64,7 @@ int Gdpd::init(int nbInputs, int nbOutputs, int sampleRate) {
inParams.deviceId = m_audio.getDefaultOutputDevice(); inParams.deviceId = m_audio.getDefaultOutputDevice();
outParams.nChannels = m_nbInputs = nbInputs; outParams.nChannels = m_nbInputs = nbInputs;
inParams.nChannels = m_nbOutputs = nbOutputs; inParams.nChannels = m_nbOutputs = nbOutputs;
m_bufferFrames = 128; m_bufferFrames = bufferSize;
RtAudio::StreamOptions options; RtAudio::StreamOptions options;
options.streamName = "gdpd"; options.streamName = "gdpd";
......
...@@ -38,7 +38,7 @@ public: ...@@ -38,7 +38,7 @@ public:
void _init(); void _init();
//libpd functions //libpd functions
int init(int nbInputs, int nbOutputs, int sampleRate); int init(int nbInputs, int nbOutputs, int sampleRate, int bufferSize);
void openfile(String basename, String dirname); void openfile(String basename, String dirname);
void closefile(); void closefile();
bool has_message(); bool has_message();
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment