public interface Synthesizer
Modifier and Type | Field and Description |
---|---|
static int |
FRAMES_PER_BLOCK |
Modifier and Type | Method and Description |
---|---|
void |
add(UnitGenerator ugen)
Add a unit generator to the synthesizer so it can be played.
|
void |
addAudioTask(java.lang.Runnable task)
Add a task that will get run on the Audio Thread before it generates a new block of Audio.
|
void |
clearCommandQueue()
Clear all scheduled commands from the queue.
|
TimeStamp |
createTimeStamp()
Create a TimeStamp using the current audio time.
|
AudioDeviceManager |
getAudioDeviceManager()
An AudioDeviceManager is an interface to audio hardware.
|
double |
getCurrentTime() |
long |
getFrameCount()
This count is not reset if you stop and restart.
|
double |
getFramePeriod() |
int |
getFrameRate() |
double |
getUsage() |
java.lang.String |
getVersion() |
int |
getVersionCode() |
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 |
removeAudioTask(java.lang.Runnable task) |
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 |
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 ouputDeviceID,
int numOutputChannels)
Starts the synthesizer using specific audio devices.
|
void |
startUnit(UnitGenerator unit)
The startUnit and stopUnit methods are mainly for internal use.
|
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)
The startUnit and stopUnit methods are mainly for internal use.
|
void |
stopUnit(UnitGenerator unit,
double time) |
void |
stopUnit(UnitGenerator unit,
TimeStamp timeStamp) |
static final int FRAMES_PER_BLOCK
void start()
void start(int frameRate)
frameRate
- in Hertzvoid start(int frameRate, int inputDeviceID, int numInputChannels, int ouputDeviceID, int numOutputChannels)
frameRate
- in HertzinputDeviceID
- obtained from an AudioDeviceManager
or pass
AudioDeviceManager.USE_DEFAULT_DEVICEnumInputChannels
- 1 for mono, 2 for stereo, etceteraouputDeviceID
- obtained from an AudioDeviceManager or pass
AudioDeviceManager.USE_DEFAULT_DEVICEnumOutputChannels
- 1 for mono, 2 for stereo, etceterajava.lang.String getVersion()
int getVersionCode()
void stop()
AudioDeviceManager getAudioDeviceManager()
int getFrameRate()
void add(UnitGenerator ugen)
ugen
- a unit generator to be executed by the synthesizervoid remove(UnitGenerator ugen)
double getCurrentTime()
void startUnit(UnitGenerator unit, double time)
void startUnit(UnitGenerator unit, TimeStamp timeStamp)
void startUnit(UnitGenerator unit)
unit
- void stopUnit(UnitGenerator unit, double time)
void stopUnit(UnitGenerator unit, TimeStamp timeStamp)
void stopUnit(UnitGenerator unit)
unit
- void sleepUntil(double time) throws java.lang.InterruptedException
java.lang.InterruptedException
void sleepFor(double duration) throws java.lang.InterruptedException
java.lang.InterruptedException
void setRealTime(boolean realTime)
realTime
- boolean isRealTime()
TimeStamp createTimeStamp()
double getUsage()
double getFramePeriod()
long getFrameCount()
void scheduleCommand(TimeStamp timeStamp, ScheduledCommand command)
void scheduleCommand(double time, ScheduledCommand command)
void queueCommand(ScheduledCommand command)
void clearCommandQueue()
boolean isRunning()
void addAudioTask(java.lang.Runnable task)
task
- void removeAudioTask(java.lang.Runnable task)