|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.softsynth.jsyn.SynthContext
public class SynthContext
This class provides a context for the synthesis to occur. By using separate contexts, multiple JSyn programs can run at different sample rates, including non-real-time. This is particularly important when writing Applets for a browser because their execution may overlap.
The methods are similar to the Synth class methods. But the Synth class creates a shared SynthContext for compatability with older apps. You should delete the contextID when you are through using it to recover the allocated memory.
Synth
,
SynthObject
Constructor Summary | |
---|---|
SynthContext()
|
Method Summary | |
---|---|
void |
checkEngineErrors()
Used by sleep routines to keep FIFOs clear. |
int |
debug()
|
int |
debug(int command,
int data)
|
void |
delete()
|
void |
deleteAll()
Delete all tracked units, SynthSamples, SynthEnvelopes and other Synth objects created since initialize() was called. |
void |
enableDeletionByGarbageCollector(boolean ifEnabled)
Enable deletion of the native portion of SynthObjects (eg. |
void |
enableTracking(boolean ifTrack)
Request that all SynthObjects created by the currently executing thread be automatically tracked when created, or not. |
int |
getFrameCount()
Returns index of last calculated frame. |
double |
getFrameRate()
Rate that frames are generated, typically 44100.0. |
int |
getFramesPerTick()
|
double |
getInputLatency()
|
int |
getObjectCount()
|
double |
getOutputLatency()
|
SharedSleeper |
getSleeper()
Return SharedSleeper that is used to coordinate non-real-time synthesis. |
int |
getTickCount()
Get current time in ticks. |
double |
getTickRate()
|
int |
getTrace()
|
double |
getUsage()
Returns the fraction of critical resources used by synthesis context. |
void |
initialize()
Initialize Library. |
static boolean |
isApplet()
|
boolean |
isTrackingEnabled()
|
int |
setSuggestedInputLatency(double latency)
|
int |
setSuggestedOutputLatency(double latency)
|
void |
setTrace(int mask)
Set trace flags for debugging. |
void |
sleepForTicks(int ticks)
Sleep for the specified number of ticks. |
void |
sleepUntilTick(int wakeUpTick)
Sleep until the specified tick is reached. |
void |
start(int flags)
|
void |
start(int flags,
double frameRate)
Start the synthesis context. |
void |
start(int flags,
double frameRate,
int inputDeviceID,
int numInputChannels,
int outputDeviceID,
int numOutputChannels)
Starts execution of process that performs synthesis. |
void |
startEngine(int flags)
Starts execution of process using default frameRate. |
void |
startEngine(int flags,
double frameRate)
Calls initialize() and start( flags, frameRate ). |
void |
stop()
Stops execution of process that performs synthesis. |
void |
stopEngine()
Stops execution of process that performs synthesis. |
void |
terminate()
Terminate library. |
void |
track(SynthObject sob)
Keep a reference to this object in a vector in the SynthObject class. |
void |
unTrack(SynthObject sob)
Remove from tracking vector if tracked. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public SynthContext()
Method Detail |
---|
public void delete()
public int debug()
public int debug(int command, int data)
public double getUsage()
public int getObjectCount()
public int getFrameCount()
public int getTickCount()
public int getFramesPerTick()
public double getFrameRate()
public double getTickRate()
public void sleepUntilTick(int wakeUpTick) throws SynthException
SynthException
- If timer not running.public void checkEngineErrors() throws SynthException
SynthException
public void sleepForTicks(int ticks) throws SynthException
SynthException
- If timer not running.public void startEngine(int flags, double frameRate) throws SynthException
frameRate
- Calculation rate in Hertz, typically 44100.0.
SynthException
- If engine cannot be started or if plugin is an old version, or expired.public void start(int flags, double frameRate, int inputDeviceID, int numInputChannels, int outputDeviceID, int numOutputChannels) throws SynthException
flags
- used to select options. Legal flags are Synth.FLAG_NON_REAL_TIME, Synth.FLAG_ENABLE_INPUT, Synth.FLAG_DISABLE_OUTPUT.frameRate
- Calculation rate in Hertz, typically 44100.0.inputDeviceID
- PortAudio hardware audio device ID for input, Synth.NO_DEVICE for no input.numInputChannels
- Number of input channels to use. Typically 0 or 2.outputDeviceID
- PortAudio hardware audio device ID for output, Synth.NO_DEVICE for no output.numOutputChannels
- Number of output channels to use. Typically 0 or 2.
SynthException
- If engine cannot be started or if plugin is an old version, or expired.public void start(int flags, double frameRate) throws SynthException
SynthException
public void start(int flags) throws SynthException
SynthException
public SharedSleeper getSleeper()
public void initialize() throws SynthException
SynthException
- If engine cannot be started or if plugin is an old version, or expired.public void startEngine(int flags) throws SynthException
SynthException
- If engine cannot be started or if plugin is an old version, or expired.public void stopEngine() throws SynthException
SynthException
- If engine cannot be stopped.public void stop() throws SynthException
SynthException
- If engine cannot be stopped.public void terminate() throws SynthException
SynthException
- If engine cannot be stopped.public boolean isTrackingEnabled()
public void enableTracking(boolean ifTrack)
track
public void track(SynthObject sob)
public void unTrack(SynthObject sob)
public void deleteAll() throws SynthException
SynthException
public void enableDeletionByGarbageCollector(boolean ifEnabled)
ifEnabled
- set true to enable deletion, false to disable, default is truegetObjectCount
public void setTrace(int mask)
public int getTrace()
public static boolean isApplet()
public int setSuggestedInputLatency(double latency)
public int setSuggestedOutputLatency(double latency)
public double getOutputLatency()
public double getInputLatency()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |