Skip to content

Commit

Permalink
bugfix fmod sound player for macos. closes #6714 #6708 (#6717)
Browse files Browse the repository at this point in the history
  • Loading branch information
ofTheo committed Mar 24, 2021
1 parent 4648321 commit 23f9bfd
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions libs/openFrameworks/sound/ofFmodSoundPlayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ static unsigned int buffersize = 1024;
static FMOD_DSP* fftDSP = NULL;

// --------------------- static vars
static FMOD_CHANNELGROUP * channelgroup;
static FMOD_SYSTEM * sys;
static FMOD_CHANNELGROUP * channelgroup = NULL;
static FMOD_SYSTEM * sys = NULL;

// these are global functions, that affect every sound / channel:
// ------------------------------------------------------------
Expand Down Expand Up @@ -159,7 +159,7 @@ void ofFmodSoundPlayer::initializeFmod(){
#ifdef TARGET_LINUX
FMOD_System_SetOutput(sys,FMOD_OUTPUTTYPE_ALSA);
#endif
FMOD_System_Init(sys, 32, FMOD_INIT_NORMAL, nullptr); //do we want just 32 channels?
FMOD_System_Init(sys, 512, FMOD_INIT_NORMAL, nullptr); //do we want just 512 channels?
FMOD_System_GetMasterChannelGroup(sys, &channelgroup);
bFmodInitialized_ = true;
}
Expand Down Expand Up @@ -233,7 +233,7 @@ void ofFmodSoundPlayer::unload(){
bool ofFmodSoundPlayer::isPlaying() const{

if (!bLoadedOk) return false;

if(channel == NULL) return false;
int playing = 0;
FMOD_Channel_IsPlaying(channel, &playing);
return (playing != 0 ? true : false);
Expand Down
4 changes: 2 additions & 2 deletions libs/openFrameworks/sound/ofFmodSoundPlayer.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,8 @@ class ofFmodSoundPlayer : public ofBaseSoundPlayer {
unsigned int length; // in samples;

FMOD_RESULT result;
FMOD_CHANNEL * channel;
FMOD_SOUND * sound;
FMOD_CHANNEL * channel = NULL;
FMOD_SOUND * sound = NULL;
};

#endif //OF_SOUND_PLAYER_FMOD

0 comments on commit 23f9bfd

Please sign in to comment.