use of net.beadsproject.beads.events.AudioContextStopTrigger in project narchy by automenta.
the class AudioContext method runForNMillisecondsNonRealTime.
/**
* Runs the AudioContext in non-realtime for n milliseconds (that's n
* non-realtime milliseconds).
*
* @param n number of milliseconds.
*/
public void runForNMillisecondsNonRealTime(double n) {
// time the playback to n seconds
DelayTrigger dt = new DelayTrigger(this, n, new AudioContextStopTrigger(this));
out.dependsOn(dt);
runNonRealTime();
}
use of net.beadsproject.beads.events.AudioContextStopTrigger in project narchy by automenta.
the class AudioContext method record.
/**
* Tells the AudioContext to record all output for the given millisecond
* duration, kill the AudioContext, and save the recording to the given file
* path. This is a convenient way to make quick recordings, but may not suit
* every circumstance.
*
* @param timeMS the time in milliseconds to record for.
* @param filename the filename to save the recording to.
* @throws IOException Signals that an I/O exception has occurred.
* @see RecordToSample recorder
* @see Sample sample
*/
public void record(double timeMS, String filename) throws Exception {
Sample s = new Sample(timeMS, audioFormat.outputs, audioFormat.sampleRate);
RecordToSample r;
try {
r = new RecordToSample(this, s);
r.in(out);
out.dependsOn(r);
r.start();
r.after(new AudioContextStopTrigger(this));
} catch (Exception e) {
/* won't happen */
}
while (isRunning()) {
}
s.write(filename);
}
Aggregations