|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectddf.minim.MAudioBuffer
MAudioBuffer encapsulates a sample buffer of floats. All Minim
classes that give you access to audio samples do so with an
MAudioBuffer. The underlying array is not immutable and this
class has a number of methods for reading and writing to that array. It is
even possible to be given a direct handle on the array to process it as you
wish.
| Constructor Summary | |
MAudioBuffer(int bufferSize)
Constructs and MAudioBuffer that is bufferSize samples long. |
|
| Method Summary | |
void |
clear()
Sets all of the values in this buffer to zero. |
float |
get(int i)
Gets the ith sample in the buffer. |
float |
level()
Gets the current level of the buffer. |
void |
mix(float[] b1,
float[] b2)
Mixes the two float arrays and puts the result in this buffer. |
void |
mix(MAudioBuffer b1,
MAudioBuffer b2)
Mixes the two AudioBuffers and puts the result in this buffer. |
void |
set(float[] buffer)
Copies the values in buffer into this buffer. |
void |
set(int i,
float v)
Sets the ith sample to v. |
void |
set(MAudioBuffer buffer)
Copies the values in buffer into this buffer. |
int |
size()
Returns the length of the buffer. |
float[] |
toArray()
Returns the samples in the buffer in a new float array. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public MAudioBuffer(int bufferSize)
bufferSize samples long.
bufferSize - the size of the buffer| Method Detail |
public int size()
AudioBuffer
size in interface AudioBufferpublic float get(int i)
AudioBufferith sample in the buffer. This method
does not do bounds checking, so it may throw an exception.
get in interface AudioBufferi - the index of the sample you want to get
ith sample
public void set(int i,
float v)
ith sample to v.
i - the index of the value you want to setv - the value to set it topublic void set(float[] buffer)
buffer into this buffer. If
buffer is not the same length as the float array an error
will be reported and nothing will be copied.
buffer - the float array to copypublic void set(MAudioBuffer buffer)
buffer into this buffer. If
buffer is not the same length as the float array an error
will be reported and nothing will be copied.
buffer - the MAudioBuffer to copy
public void mix(float[] b1,
float[] b2)
samples[i] = (b1[i] + b2[i]) / 2
b1 - the first bufferb2 - the second buffer
public void mix(MAudioBuffer b1,
MAudioBuffer b2)
samples[i] = (b1[i] + b2[i]) / 2
b1 - the first bufferb2 - the second bufferpublic void clear()
public float level()
AudioBuffer
level in interface AudioBufferpublic float[] toArray()
AudioBuffer
toArray in interface AudioBuffer
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||