Browse Source

Fix possible zynaddsubfx crash when loading project

tags/1.9.7
falkTX 8 years ago
parent
commit
f1f3324012
2 changed files with 8 additions and 4 deletions
  1. +7
    -3
      source/native-plugins/zynaddsubfx/Misc/Master.cpp
  2. +1
    -1
      source/native-plugins/zynaddsubfx/Misc/Master.h

+ 7
- 3
source/native-plugins/zynaddsubfx/Misc/Master.cpp View File

@@ -618,7 +618,7 @@ int msg_id=0;
/* /*
* Master audio out (the final sound) * Master audio out (the final sound)
*/ */
void Master::AudioOut(float *outl, float *outr)
bool Master::AudioOut(float *outl, float *outr)
{ {
//Danger Limits //Danger Limits
if(memory->lowMemory(2,1024*1024)) if(memory->lowMemory(2,1024*1024))
@@ -645,7 +645,7 @@ void Master::AudioOut(float *outl, float *outr)
if (mastercb) if (mastercb)
mastercb(mastercb_ptr, new_master); mastercb(mastercb_ptr, new_master);
bToU->write("/free", "sb", "Master", sizeof(Master*), &this_master); bToU->write("/free", "sb", "Master", sizeof(Master*), &this_master);
return;
return false;
} }


//XXX yes, this is not realtime safe, but it is useful... //XXX yes, this is not realtime safe, but it is useful...
@@ -821,6 +821,8 @@ void Master::AudioOut(float *outl, float *outr)


//update the global frame timer //update the global frame timer
time++; time++;

return true;
} }


//TODO review the respective code from yoshimi for this //TODO review the respective code from yoshimi for this
@@ -846,7 +848,9 @@ void Master::GetAudioOutSamples(size_t nsamples,
nsamples -= smps; nsamples -= smps;


//generate samples //generate samples
AudioOut(bufl, bufr);
if (! AudioOut(bufl, bufr))
return;

off = 0; off = 0;
out_off += smps; out_off += smps;
smps = synth.buffersize; smps = synth.buffersize;


+ 1
- 1
source/native-plugins/zynaddsubfx/Misc/Master.h View File

@@ -100,7 +100,7 @@ class Master
void vuUpdate(const float *outl, const float *outr); void vuUpdate(const float *outl, const float *outr);


/**Audio Output*/ /**Audio Output*/
void AudioOut(float *outl, float *outr) REALTIME;
bool AudioOut(float *outl, float *outr) REALTIME;
/**Audio Output (for callback mode). /**Audio Output (for callback mode).
* This allows the program to be controled by an external program*/ * This allows the program to be controled by an external program*/
void GetAudioOutSamples(size_t nsamples, void GetAudioOutSamples(size_t nsamples,


Loading…
Cancel
Save