Skip to content

Commit ce64f15

Browse files
committed
added sound stream api control, solving windows audio drivers issues
1 parent d4feab4 commit ce64f15

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

src/ofxVisualProgramming.cpp

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,8 @@ ofxVisualProgramming::ofxVisualProgramming(){
8686
newFileCounter = 0;
8787

8888
audioSampleRate = 44100;
89+
audioBufferSize = 1024;
90+
audioNumBuffers = 4;
8991
audioGUIINIndex = -1;
9092
audioGUIOUTIndex = -1;
9193
bpm = 120;
@@ -1270,7 +1272,14 @@ void ofxVisualProgramming::loadPatch(string patchFile){
12701272
engine = new pdsp::Engine();
12711273

12721274
soundStreamIN.close();
1275+
#if defined(TARGET_WIN32)
1276+
audioDevices = soundStreamIN.getDeviceList(ofSoundDevice::Api::MS_DS);
1277+
#elif defined(TARGET_OSX)
1278+
audioDevices = soundStreamIN.getDeviceList(ofSoundDevice::Api::OSX_CORE);
1279+
#else
12731280
audioDevices = soundStreamIN.getDeviceList();
1281+
#endif
1282+
12741283
audioDevicesStringIN.clear();
12751284
audioDevicesID_IN.clear();
12761285
audioDevicesStringOUT.clear();
@@ -1347,7 +1356,7 @@ void ofxVisualProgramming::loadPatch(string patchFile){
13471356

13481357
engine->setOutputDeviceID(audioDevices[audioOUTDev].deviceID);
13491358
engine->setInputDeviceID(audioDevices[audioINDev].deviceID);
1350-
engine->setup(audioSampleRate, audioBufferSize, 3);
1359+
engine->setup(audioSampleRate, audioBufferSize, audioNumBuffers);
13511360
engine->sequencer.setTempo(bpm);
13521361

13531362
ofLog(OF_LOG_NOTICE,"[verbose]------------------- Soundstream INPUT Started on");
@@ -1573,7 +1582,7 @@ void ofxVisualProgramming::activateDSP(){
15731582

15741583
engine->setOutputDeviceID(audioDevices[audioOUTDev].deviceID);
15751584
engine->setInputDeviceID(audioDevices[audioINDev].deviceID);
1576-
engine->setup(audioSampleRate, audioBufferSize, 3);
1585+
engine->setup(audioSampleRate, audioBufferSize, audioNumBuffers);
15771586
engine->sequencer.setTempo(bpm);
15781587

15791588
bool found = weAlreadyHaveObject("audio device");

src/ofxVisualProgramming.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,7 @@ class ofxVisualProgramming : public pdsp::Wrapper {
186186
int audioGUIOUTIndex;
187187
int audioSampleRate;
188188
int audioBufferSize;
189+
int audioNumBuffers;
189190
int bpm;
190191
bool dspON;
191192

0 commit comments

Comments
 (0)