public class SynthesisEngine extends java.lang.Object implements java.lang.Runnable, Synthesizer
Synthesizer| Modifier and Type | Field and Description |
|---|---|
static double |
DB96 |
static int |
DEFAULT_FRAME_RATE |
FRAMES_PER_BLOCK| Constructor and Description |
|---|
SynthesisEngine() |
SynthesisEngine(AudioDeviceManager audioDeviceManager) |
| Modifier and Type | Method and Description |
|---|---|
void |
add(UnitGenerator ugen)
Add a unit generator to the synthesizer so it can be played.
|
void |
addBlockTask(java.lang.Runnable blockTask) |
void |
autoStopUnit(UnitGenerator unitGenerator) |
static short |
convertDoubleToShort(double d)
Convert a double value in the range -1.0 to almost 1.0 to a short.
|
static double |
convertShortToDouble(short sdata)
Convert a short value to a double in the range -1.0 to almost 1.0.
|
double |
convertTimeToExponentialScaler(double duration) |
TimeStamp |
createTimeStamp()
Create a TimeStamp using the current audio time.
|
void |
generateNextBlock() |
AudioDeviceManager |
getAudioDeviceManager()
An AudioDeviceManager is an interface to audio hardware.
|
double |
getCurrentTime() |
long |
getFrameCount() |
double |
getFramePeriod() |
int |
getFrameRate() |
double[] |
getInputBuffer(int i) |
double |
getInputLatency() |
double |
getInverseNyquist() |
double[] |
getOutputBuffer(int i) |
double |
getOutputLatency() |
double |
getUsage() |
java.lang.String |
getVersion() |
int |
getVersionCode() |
boolean |
isPullDataEnabled() |
boolean |
isRealTime()
Is JSyn running in real-time mode?
|
boolean |
isRunning() |
void |
queueCommand(ScheduledCommand command)
Queue a command to be processed as soon as possible in the background audio thread.
|
void |
remove(UnitGenerator ugen)
Removes a unit generator added using add().
|
void |
removeBlockTask(java.lang.Runnable blockTask) |
void |
run() |
void |
scheduleCommand(double time,
ScheduledCommand command)
Queue a command to be processed at a specific time in the background audio thread.
|
void |
scheduleCommand(TimeStamp timeStamp,
ScheduledCommand command)
Queue a command to be processed at a specific time in the background audio thread.
|
void |
setPullDataEnabled(boolean pullDataEnabled)
If set true then audio data will be pulled from the output ports of
connected unit generators.
|
void |
setRealTime(boolean realTime)
If set true then the synthesizer will generate audio in real-time.
|
void |
sleepFor(double duration)
Sleep for the specified audio time duration.
|
void |
sleepUntil(double time)
Sleep until the specified audio time is reached.
|
void |
start()
Starts a background thread that generates audio using the default frame
rate of 44100 and two stereo output channels.
|
void |
start(int frameRate)
Starts a background thread that generates audio using the specified frame
rate and two stereo output channels.
|
void |
start(int frameRate,
int inputDeviceID,
int numInputChannels,
int outputDeviceID,
int numOutputChannels)
Starts the synthesizer using specific audio devices.
|
void |
startUnit(UnitGenerator unit)
Start a unit generator now.
|
void |
startUnit(UnitGenerator unit,
double time)
Start a unit generator at the specified time.
|
void |
startUnit(UnitGenerator unit,
TimeStamp timeStamp) |
void |
stop()
Stops the background thread that generates the audio.
|
void |
stopUnit(UnitGenerator unit) |
void |
stopUnit(UnitGenerator unit,
double time) |
void |
stopUnit(UnitGenerator unit,
TimeStamp timeStamp) |
void |
terminate() |
java.lang.String |
toString() |
public static final int DEFAULT_FRAME_RATE
public static final double DB96
public SynthesisEngine(AudioDeviceManager audioDeviceManager)
public SynthesisEngine()
public java.lang.String getVersion()
getVersion in interface Synthesizerpublic int getVersionCode()
getVersionCode in interface Synthesizerpublic java.lang.String toString()
toString in class java.lang.Objectpublic boolean isPullDataEnabled()
public void setPullDataEnabled(boolean pullDataEnabled)
pullDataEnabled - public void terminate()
public void start()
Synthesizerstart in interface Synthesizerpublic void start(int frameRate)
Synthesizerstart in interface SynthesizerframeRate - in Hertzpublic void start(int frameRate,
int inputDeviceID,
int numInputChannels,
int outputDeviceID,
int numOutputChannels)
Synthesizerstart in interface SynthesizerframeRate - in HertzinputDeviceID - obtained from an AudioDeviceManager or pass AudioDeviceManager.USE_DEFAULT_DEVICEnumInputChannels - 1 for mono, 2 for stereo, etceteraoutputDeviceID - obtained from an AudioDeviceManager or pass AudioDeviceManager.USE_DEFAULT_DEVICEnumOutputChannels - 1 for mono, 2 for stereo, etceterapublic boolean isRunning()
isRunning in interface Synthesizerpublic void stop()
Synthesizerstop in interface Synthesizerpublic void run()
run in interface java.lang.Runnablepublic void generateNextBlock()
public double getCurrentTime()
getCurrentTime in interface Synthesizerpublic TimeStamp createTimeStamp()
SynthesizercreateTimeStamp in interface Synthesizerpublic void scheduleCommand(TimeStamp timeStamp, ScheduledCommand command)
SynthesizerscheduleCommand in interface Synthesizerpublic void scheduleCommand(double time,
ScheduledCommand command)
SynthesizerscheduleCommand in interface Synthesizerpublic void queueCommand(ScheduledCommand command)
SynthesizerqueueCommand in interface Synthesizerpublic double[] getInputBuffer(int i)
public double[] getOutputBuffer(int i)
public void autoStopUnit(UnitGenerator unitGenerator)
public void startUnit(UnitGenerator unit, double time)
SynthesizerstartUnit in interface Synthesizerpublic void stopUnit(UnitGenerator unit, double time)
stopUnit in interface Synthesizerpublic void startUnit(UnitGenerator unit, TimeStamp timeStamp)
startUnit in interface Synthesizerpublic void stopUnit(UnitGenerator unit, TimeStamp timeStamp)
stopUnit in interface Synthesizerpublic void startUnit(UnitGenerator unit)
SynthesizerstartUnit in interface Synthesizerpublic void stopUnit(UnitGenerator unit)
stopUnit in interface Synthesizerpublic double getInverseNyquist()
public double convertTimeToExponentialScaler(double duration)
public long getFrameCount()
public int getFrameRate()
getFrameRate in interface Synthesizerpublic double getFramePeriod()
getFramePeriod in interface Synthesizerpublic static double convertShortToDouble(short sdata)
public static short convertDoubleToShort(double d)
public void addBlockTask(java.lang.Runnable blockTask)
public void removeBlockTask(java.lang.Runnable blockTask)
public double getUsage()
getUsage in interface Synthesizerpublic AudioDeviceManager getAudioDeviceManager()
SynthesizergetAudioDeviceManager in interface Synthesizerpublic void setRealTime(boolean realTime)
SynthesizersetRealTime in interface Synthesizerpublic boolean isRealTime()
SynthesizerisRealTime in interface Synthesizerpublic double getOutputLatency()
public double getInputLatency()
public void add(UnitGenerator ugen)
Synthesizeradd in interface Synthesizerugen - a unit generator to be executed by the synthesizerpublic void remove(UnitGenerator ugen)
Synthesizerremove in interface Synthesizerpublic void sleepUntil(double time)
throws java.lang.InterruptedException
SynthesizersleepUntil in interface Synthesizerjava.lang.InterruptedExceptionpublic void sleepFor(double duration)
throws java.lang.InterruptedException
SynthesizersleepFor in interface Synthesizerjava.lang.InterruptedException