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 int
blockSize
protected long
callbackPeriod
(package private) DspThread.DspPerformCallback
dspCallback
protected boolean
isRunning
protected long
readTicks
protected long
sampleReadTime
-
Constructor Summary
Constructors Constructor and Description AudioStream()
-
Method Summary
Methods Modifier and Type Method and Description abstract int
blocks()
short[]
createBuffer()
Create a new buffer to store input samples.abstract int
getBufferSize()
long
getCallbackPeriod()
abstract int
getMinBufferSize()
long
getReadTicks()
long
getSampleReadTime()
abstract void
readLoop(short[] buffer)
void
reset()
Reset the audio stream parameters.abstract void
scheduleDspCallback(long blockPeriodNanoseconds)
void
setBlockSize(int bSize)
Set the block size for the signal processing of the stream.void
setDspCallback(DspThread.DspPerformCallback callback)
Define the callback that works over samples.abstract void
stopRunning()
-
-
-
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.
-
-