public class RecordToSample extends UGen
Sample
.
RecordToSample has three different modes, which dictate
how it behaves when the end of the sample is reached:
clip()
the sample once done. Alternatively you can see
how many frames were written
.
Tip: Be sure to UGen.pause(boolean)
the recorder when using INFINITE mode,
otherwise it will keep recording and you may quickly run out of memory.
setResizingParameters(double, double)
.Modifier and Type | Class and Description |
---|---|
static class |
RecordToSample.Mode |
UGen.OutputInitializationRegime, UGen.OutputPauseRegime
bufferSize, bufIn, bufOut, context, ins, outputInitializationRegime, outputPauseRegime, outs
Constructor and Description |
---|
RecordToSample(AudioContext context,
int numChannels) |
RecordToSample(AudioContext context,
Sample sample)
Instantiates a new RecordToSample.
|
RecordToSample(AudioContext context,
Sample sample,
RecordToSample.Mode mode)
Instantiates a new RecordToSample.
|
Modifier and Type | Method and Description |
---|---|
void |
calculateBuffer()
Called by the signal chain to update this UGen's ouput data.
|
void |
clip()
Once you have finished writing into a sample this method clips the sample
length to the recorded data.
|
RecordToSample.Mode |
getMode() |
long |
getNumFramesRecorded() |
double |
getPosition()
Gets the position.
|
Sample |
getSample()
Gets the Sample.
|
boolean |
isLoopRecord()
Deprecated.
Use
getMode() instead. |
void |
reset()
Resets the Recorder to record into the beginning of the Sample.
|
void |
setLoopRecord(boolean loopRecord)
Deprecated.
Use
setMode(Mode) instead. |
void |
setMode(RecordToSample.Mode mode) |
void |
setPosition(double positionMs)
Sets the position to record to in milliseconds.
|
void |
setResizingParameters(double doubleUpTime,
double constantResizeLength)
Advanced: Change the parameters used when resizing samples in INFINITE recorder mode.
|
void |
setSample(Sample sample)
Sets the Sample.
|
addDependent, addInput, addInput, clearDependents, clearInputConnections, containsInput, crossfadeInput, getConnectedInputs, getContext, getEnvelopes, getIns, getNumberOfConnectedUGens, getNumberOfDependents, getOutBuffer, getOuts, getTimeTakenLastUpdate, getValue, getValue, getValueDouble, getValueDouble, initializeOuts, isTimerMode, isUpdated, noInputs, pause, printInBuffers, printInputList, printOutBuffers, removeAllConnections, removeConnection, removeDependent, setOutsToPause, setTimerMode, setValue, update, zeroIns, zeroOuts
getKillListener, getName, isDeleted, isPaused, kill, message, messageReceived, setKillListener, setName, start, toString
public RecordToSample(AudioContext context, Sample sample)
context
- the AudioContext.sample
- the Sample.java.lang.Exception
- if sample is not writeable.public RecordToSample(AudioContext context, Sample sample, RecordToSample.Mode mode)
context
- the AudioContext.sample
- the Sample.mode
- the Recording Mode to use.java.lang.Exception
- if sample is not writeable.public RecordToSample(AudioContext context, int numChannels)
public Sample getSample()
public void setSample(Sample sample)
sample
- the new Sample.public void reset()
public void clip()
public void setPosition(double positionMs)
positionMs
- the new position in milliseconds.public void calculateBuffer()
UGen
UGen.bufIn
and putting data
into UGen.bufOut
in some way. UGen.bufIn
and UGen.bufOut
are 2D arrays of floats of the form float[numChannels][bufferSize]. The length of the buffers is given by
UGen.bufferSize
, and the number of channels of the input and output buffers are given by UGen.ins
and UGen.outs
respectively.calculateBuffer
in class UGen
public double getPosition()
public long getNumFramesRecorded()
public RecordToSample.Mode getMode()
public void setMode(RecordToSample.Mode mode)
mode
- Change the mode of this recorder. Can be changed while running.public void setResizingParameters(double doubleUpTime, double constantResizeLength)
doubleUpTime
- The time (in ms) up to which the sample size should be doubled.constantResizeLength
- The length (in ms) of the extra space appended to Sample.public boolean isLoopRecord()
getMode()
instead.public void setLoopRecord(boolean loopRecord)
setMode(Mode)
instead.loopRecord
- true to enable loop record mode.