Skip to content

Instantly share code, notes, and snippets.

@roymacdonald
Created August 25, 2015 04:19
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save roymacdonald/6afd8f9917fe4a897603 to your computer and use it in GitHub Desktop.
Save roymacdonald/6afd8f9917fe4a897603 to your computer and use it in GitHub Desktop.
openframeworks audio pasthrough
#include "ofApp.h"
//--------------------------------------------------------------
void ofApp::setup(){
int bufferSize = 256;
ofSoundStreamSetup(2, 2, this, 44100, bufferSize, 4);
}
//--------------------------------------------------------------
void ofApp::update(){
}
//--------------------------------------------------------------
void ofApp::draw(){
}
//--------------------------------------------------------------
void ofApp::audioIn(ofSoundBuffer & buffer){
ofScopedLock lock(audioMutex);
this->buffer = buffer;
}
//--------------------------------------------------------------
void ofApp::audioOut( ofSoundBuffer& buffer ){
ofScopedLock lock(audioMutex);
this->buffer.copyTo(buffer);
}
#pragma once
#include "ofMain.h"
class ofApp : public ofBaseApp{
public:
void setup();
void update();
void draw();
void audioIn( ofSoundBuffer& buffer );
void audioOut( ofSoundBuffer& buffer );
ofMutex audioMutex;
ofSoundBuffer buffer;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment