Code example for ByteBuffer

Methods: clear

0
	 *  
	 * @see com.backyardbrains.audio.RecievesAudio#receiveAudio(byte[]) 
	 */ 
	@Override 
	public void receiveAudio(ByteBuffer audioInfo) {
		audioBuffer.add(audioInfo);
		lastSamplesReceivedTimestamp = System.currentTimeMillis();
		if(triggerMode) {
//			Log.d(TAG, "Pushing audio to triggerAverager, length: "+audioInfo.capacity()); 
			triggerAverager.push(audioInfo);
		} 
		if (mRecordingSaverInstance != null) {
			recordAudio(audioInfo);
		} 
 
	} 
 
	/** 
	 * dispatch audio to the active RecordingSaver instance 
	 *  
	 * @param audioInfo 
	 */ 
	private void recordAudio(ByteBuffer audioInfo) {
		audioInfo.clear();
		try { 
			mRecordingSaverInstance.receiveAudio(audioInfo);
		} catch (IllegalStateException e) {
			Log.w(getClass().getCanonicalName(),
					"Ignoring bytes received while not synced: " 
							+ e.getMessage());
		}