Envelopes in ofMaxim

I’m trying to get ofMaxim envelopes working on iOS, but I’m having trouble understanding how to get them working with iOS audio. I cannot pinpoint my exact problem because the envelopes simply are not working. I don’t understand specifically how the envelopes are supposed to work. The following does not work, but it’s what I have in my testapp.mm

void testApp::audioOut( float * output, int bufferSize, int nChannels ){  
	if( initialBufferSize != bufferSize ){  
		ofLog(OF_LOG_ERROR, "your buffer size was set to %i - but the stream needs a buffer size of %i", initialBufferSize, bufferSize);  
    CurrentCount=myCounter.phasor(100, 1, 9);  
	if (CurrentCount<5)//simple if statement  
	else if (CurrentCount>=5)//and the 'else' bit.  
		myOscOutput=mySwitchableOsc.sinewave(CurrentCount*50);//one osc object can produce whichever waveform you want.   
	if (CurrentCount==1)   
		myEnvelope.trigger(0,myEnvelopeData[0]); //trigger the envelope  
	*output=myOscOutput*myCurrentVolume;//point me at your speakers and fire.  
        sample=myOscOutput*myCurrentVolume;//point me at your speakers and fire.  
	output[i*nChannels    ] = outputs1[0];  
	output[i*nChannels + 1] = outputs1[1];  

Thanks for any insight anyone can offer.

Hi, When you say doesn’t work do you mean no sound? or errors?

Do you have this part somewhere in your code:

maxiOsc myCounter,mySwitchableOsc;//
int CurrentCount;//
double myOscOutput,myCurrentVolume;//
double myEnvelopeData[4] = {1,0,0,500};//this data will be used to make an envelope. Value and time to value in ms.
maxiEnvelope myEnvelope;