AudioStream
JavaScript is disabled on your browser.
br.usp.ime.dspbenchmarking.streams
Class AudioStream
- java.lang.Object
-
- br.usp.ime.dspbenchmarking.streams.AudioStream
-
public abstract class AudioStream extends java.lang.Object
An AudioStream is a stream of input audio signal. This abstract class may be implemented to provide input audio streams of many types, such as from microphones, audio files and others. Each AudioStream implementation is responsible for executing a DspCallback periodically, which will in turn execute an algorithm over a block of samples.
-
-
Field Summary
Fields Modifier and Type Field and Description protected intblockSizeprotected longcallbackPeriod(package private) DspThread.DspPerformCallbackdspCallbackprotected booleanisRunningprotected longreadTicksprotected longsampleReadTime
-
Constructor Summary
Constructors Constructor and Description AudioStream()
-
Method Summary
Methods Modifier and Type Method and Description abstract intblocks()short[]createBuffer()Create a new buffer to store input samples.abstract intgetBufferSize()longgetCallbackPeriod()abstract intgetMinBufferSize()longgetReadTicks()longgetSampleReadTime()abstract voidreadLoop(short[] buffer)voidreset()Reset the audio stream parameters.abstract voidscheduleDspCallback(long blockPeriodNanoseconds)voidsetBlockSize(int bSize)Set the block size for the signal processing of the stream.voidsetDspCallback(DspThread.DspPerformCallback callback)Define the callback that works over samples.abstract voidstopRunning()
-
-
-
Field Detail
-
callbackPeriod
protected long callbackPeriod
-
readTicks
protected long readTicks
-
sampleReadTime
protected long sampleReadTime
-
isRunning
protected boolean isRunning
-
dspCallback
DspThread.DspPerformCallback dspCallback
-
blockSize
protected int blockSize
-
-
Method Detail
-
getBufferSize
public abstract int getBufferSize()
-
scheduleDspCallback
public abstract void scheduleDspCallback(long blockPeriodNanoseconds)
-
readLoop
public abstract void readLoop(short[] buffer)
-
blocks
public abstract int blocks()
-
stopRunning
public abstract void stopRunning()
-
getMinBufferSize
public abstract int getMinBufferSize()
-
setBlockSize
public void setBlockSize(int bSize)
Set the block size for the signal processing of the stream.- Parameters:
bSize-
-
getCallbackPeriod
public long getCallbackPeriod()
- Returns:
- The sum of the periods of callback calls.
-
getReadTicks
public long getReadTicks()
- Returns:
- The amount of times blocks were read from input.
-
getSampleReadTime
public long getSampleReadTime()
- Returns:
- The sum of the time taken to read from input.
-
reset
public void reset()
Reset the audio stream parameters.
-
setDspCallback
public void setDspCallback(DspThread.DspPerformCallback callback)
Define the callback that works over samples.
-
createBuffer
public short[] createBuffer()
Create a new buffer to store input samples.
-
-