diff --git a/libs/openFrameworks/sound/ofSoundStream.cpp b/libs/openFrameworks/sound/ofSoundStream.cpp index 0edd715b66f..a5c018cd056 100644 --- a/libs/openFrameworks/sound/ofSoundStream.cpp +++ b/libs/openFrameworks/sound/ofSoundStream.cpp @@ -20,12 +20,24 @@ #define OF_SOUND_STREAM_TYPE ofxEmscriptenSoundStream #endif -namespace{ - ofSoundStream &getSystemSoundStream() { - static ofSoundStream _; - return _; + +//FIXME: this is needed to make video work on emscripten +//See: https://github.com/openframeworks/openFrameworks/issues/7377 +#ifdef OF_SOUNDSTREAM_EMSCRIPTEN + namespace{ + ofSoundStream systemSoundStream; } -} + #define OF_SYSTEM_SS systemSoundStream +#else + namespace{ + ofSoundStream &getSystemSoundStream() { + static ofSoundStream _; + return _; + } + } + #define OF_SYSTEM_SS getSystemSoundStream() +#endif + using std::shared_ptr; using std::vector; @@ -121,27 +133,27 @@ void ofSoundStreamSetup(int nOutputChannels, int nInputChannels, ofBaseApp * app //------------------------------------------------------------ void ofSoundStreamSetup(ofSoundStreamSettings & settings) { - getSystemSoundStream().setup(settings); + OF_SYSTEM_SS.setup(settings); } //------------------------------------------------------------ void ofSoundStreamStop(){ - getSystemSoundStream().stop(); + OF_SYSTEM_SS.stop(); } //------------------------------------------------------------ void ofSoundStreamStart(){ - getSystemSoundStream().start(); + OF_SYSTEM_SS.start(); } //------------------------------------------------------------ void ofSoundStreamClose(){ - getSystemSoundStream().close(); + OF_SYSTEM_SS.close(); } //------------------------------------------------------------ vector ofSoundStreamListDevices(){ - vector deviceList = getSystemSoundStream().getDeviceList(); + vector deviceList = OF_SYSTEM_SS.getDeviceList(); ofLogNotice("ofSoundStreamListDevices") << std::endl << deviceList; return deviceList; } @@ -190,7 +202,7 @@ void ofSoundStream::printDeviceList() const{ void ofSoundStream::setDeviceID(int deviceID){ if( soundStream ){ tmpDeviceId = deviceID; - } + } } //------------------------------------------------------------