Package com.io7m.jsamplebuffer.api
Interface SampleBufferReadableType
- All Known Subinterfaces:
SampleBufferType
- All Known Implementing Classes:
SampleBufferDouble
,SampleBufferFloat
public interface SampleBufferReadableType
A readable sample buffer. A sample buffer is an abstraction over a block of audio data. The
sample buffer pretends that the audio is interleaved (such that all of the samples for a given
frame are stored consecutively) and consists of double-precision floating-point samples.
Sample buffers may store audio differently internally, and may store using a lower level of
precision than the double-precision API implies.
All methods that take sample/frame indices as arguments throw
com.io7m.jranges.RangeCheckException
exceptions if the indices are out of range.-
Method Summary
Modifier and TypeMethodDescriptionint
channels()
double
frameGetExact
(long index) Get the value of frameindex
.void
frameGetExact
(long index, double[] output) Get the value of frameindex
.long
frames()
double
default long
samples()
-
Method Details
-
channels
int channels()- Returns:
- The number of channels in a frame
-
frames
long frames()- Returns:
- The number of frames in the buffer
-
sampleRate
double sampleRate()- Returns:
- The sample rate in hz
-
samples
default long samples()- Returns:
- The number of samples in the buffer
-
frameGetExact
void frameGetExact(long index, double[] output) Get the value of frameindex
.- Parameters:
index
- The frame indexoutput
- The output- Throws:
IllegalArgumentException
- Ifoutput.length != channels()
-
frameGetExact
double frameGetExact(long index) Get the value of frameindex
.- Parameters:
index
- The frame index- Returns:
- The value in the frame
- Throws:
IllegalArgumentException
- If1 != channels()
-