Skip to content

Commit

Permalink
temp fix for brokwen emscripten window (#7490)
Browse files Browse the repository at this point in the history
#changelog #emscripten
  • Loading branch information
ofTheo authored Apr 15, 2023
1 parent 59301f7 commit 102986e
Showing 1 changed file with 23 additions and 11 deletions.
34 changes: 23 additions & 11 deletions libs/openFrameworks/sound/ofSoundStream.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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<ofSoundDevice> ofSoundStreamListDevices(){
vector<ofSoundDevice> deviceList = getSystemSoundStream().getDeviceList();
vector<ofSoundDevice> deviceList = OF_SYSTEM_SS.getDeviceList();
ofLogNotice("ofSoundStreamListDevices") << std::endl << deviceList;
return deviceList;
}
Expand Down Expand Up @@ -190,7 +202,7 @@ void ofSoundStream::printDeviceList() const{
void ofSoundStream::setDeviceID(int deviceID){
if( soundStream ){
tmpDeviceId = deviceID;
}
}
}

//------------------------------------------------------------
Expand Down

0 comments on commit 102986e

Please sign in to comment.