コード例 #1
0
ファイル: AudioBuffer.cpp プロジェクト: DHaylock/ofxPlaymodes
	//-------------------------------------------------------------------------------
	void AudioBuffer::setup(AudioSource & source,float sizeInSecs,int sampleR, int bufferS, int numCh)
	{		
		this->source			=&source;
		fps						=source.getFps();
		totalFrames				=0;
		aSampleRate				=sampleR;
		aSoundStreamBufferSize	=bufferS;
		aNumCh					=numCh;
		
		this->maxSize			= sizeInSecs *(float(aSampleRate)/float(aSoundStreamBufferSize));
		this->maxSizeSamples	= sizeInSecs * aSampleRate;
		stopped					=false;

		resume();	
		
	}
コード例 #2
0
	//-----------------------------------------------------------------------------------------
	void AudioBufferSamples::setup(AudioSource & source,float sizeInSecs,int sampleR, int bufferS, int numCh)
	{		
		this->source=&source;
		fps=source.getFps();
		aSampleRate=sampleR;
		aSoundStreamBufferSize=bufferS;
		aNumCh=numCh;
		
		// this is the max size related to seconds ... but ... keep reading :
		this->usedSizeSamples	= sizeInSecs * aSampleRate;
		this->maxSize			= this->usedSizeSamples/aSoundStreamBufferSize +1 ;
		// ? because aex. to fill 7s we need 656,25 AudioFrames ... we need 657 AF to be declared.
		this->maxSizeSamples	= this->maxSize * aSoundStreamBufferSize;
		this->unusedSamples		= maxSizeSamples - usedSizeSamples;
		
		resume();	
		stopped					= false;
		
	}