@Override
	public int read(int[] chunk, int start, int length) {
		int[] samples = new int[length];
		int amountRead = 0;
		
		if (!backupReady && (mThread == null || !mThread.isAlive())) {
			mThread = new WorkerThread();
			mThread.start();
		}
		
		if (samplesInBuffer < length) {
			System.arraycopy(primaryBuffer,BUFFER_LENGTH-samplesInBuffer,
							chunk,start,
							samplesInBuffer);
			amountRead = samplesInBuffer;
			while (!backupReady) {
				block();
			}
			swapBuffers();
			System.arraycopy(primaryBuffer,0,
							chunk, start + amountRead,
							length - amountRead);
		}
		else {
			System.arraycopy(primaryBuffer, BUFFER_LENGTH-samplesInBuffer, 
					chunk, start, length);
			samplesInBuffer -= length;
			amountRead = length;
		}
		
		return amountRead;
	}