Quantcast
Viewing all articles
Browse latest Browse all 40524

How to switch soundstream.setdevice AFTER soundstream.setup

When my app launches it picks the first audio device it can find with a particular name.
I then made a dropdown in which the user can switch the audio input.
But when I try to change the device nothing really happens.

Do I need to reinit or something?

void ofApp::setupAudio() {

  // first try to get akai device, else oF will use device 0
  vector<ofSoundDevice> matches = soundStream.getMatchingDevices("Akai Professional, LP: EIE pro (Core Audio)");
  if(matches.size())
    soundStream.setDevice(matches[0]);

  // setup the soundstream
  bufferSize = 256;
  soundStream.setup(this, 0, 1, 44100, bufferSize, 4);
}

Dropdown callback:

void ParameterWindow::onDropdownEvent(ofxDatGuiDropdownEvent e) {
  soundStream.setDevice(audioDeviceList[e.child]);
}

Viewing all articles
Browse latest Browse all 40524

Trending Articles