public final class Pulsar extends Metro implements ApplicationComponent
Pulsar dynamically composes music by writing programs by Scheme. Scheme is a dialect of a computer language which is called "lisp". Pulsar could be used to develop automatic DJ application or automatic backing track generators which composes on the fly.
In Pulsar, scripts should implicitly initialize the state of the sequencer if it is necessary because Pulsar does not do it automatically.
Pulsar has two important parameters :
The main-file
is a file path to the main file which Pulsar is
currently referring. Pulsar keeps checking the timestamp of the file and
trying to detect file modification. Whenever Pulsar detects any timestamp
update on the file, Pulsar automatically reads it and execute.
The main-invokable
is the invokable which initializes the state
of the sequencer. This method is the place where Pulsar starts a new song.
If a script file sets main-invokable
, this is effectively the
application opens a new-file in the sense of general applications. A
script file could also leave main-invokable
untouched.
This behavior is designed to be useful in some scenarios. For example, when a user repeatedly updates/modifies the script file repeatedly in order to check how it sounds, this behavior might help the user. If Pulse initializes the sequencer whenever it reads a file, the music must restart from the beginning. Users usually prefer it to keep the music playing and modify the music slightly to see what will happen.
This behavior could probably be used as implementing sub-modules.
client, inputPortList, jack, mainTrackId, outputPortList, thread
Constructor and Description |
---|
Pulsar(SchemeEngine schemeEngine)
Creates an instance of Pulsar object without opening any specific scheme
file.
|
Modifier and Type | Method and Description |
---|---|
void |
addCleanupHook(java.lang.Runnable runnable)
Add a hook that will be invoked whenever reset() method is called.
|
void |
close() |
MetroTrack |
createRecordingTrack(java.lang.Object name,
java.util.Collection<java.lang.Object> tags,
java.util.List<MetroPort> inputPorts,
java.util.List<MetroPort> outputPorts,
double recordLength,
boolean looper) |
static java.lang.Runnable |
createTimer(java.lang.Runnable threadInitializer,
long delay,
long interval,
Invokable invokable) |
MetroTrack |
createTrack(java.lang.Object name,
java.util.Collection<java.lang.Object> tags,
MetroSequence sequence) |
MetroTrack |
createTrack(java.lang.Object name,
java.util.Collection<java.lang.Object> tags,
gnu.mapping.Procedure procedure) |
void |
execCleanupHook() |
java.io.File |
getConfigDir() |
java.io.File |
getConfigFile() |
static Pulsar |
getCurrent() |
java.io.File |
getHistoryFile()
This mechanism is currently not used.
|
Invokable |
getMainProcedure()
Returns the main-invokable object.
|
ApplicationComponent |
getParentApplicationComponent() |
SchemeEngine |
getSchemeEngine() |
pulsar.TempoTapper |
getTempoTapper() |
void |
init() |
static void |
initScheme(kawa.standard.Scheme scheme)
Initializes an environment of scheme engine and defines API for the scripts.
|
static boolean |
isPresent() |
protected void |
onCreateThread() |
void |
processInit() |
void |
processQuit() |
void |
quit()
Notify every interface to shutdown the application.
|
protected java.util.List<MetroPort> |
readParamPort(java.lang.Object arg,
java.util.List<MetroPort> portList) |
protected static java.util.List<java.lang.Object> |
readParamPortName(java.lang.Object arg) |
static void |
registerSchemeInitializers(SchemeEngine schemeEngine) |
void |
reset()
reset() method resets the scheme environment.
|
void |
rewind()
rewind() method resets the state of the object and calls main
invokable to back to the state of beginning of the project. |
void |
setBeatsPerMinute(double beatsPerMinute) |
void |
setMainProcedure(Invokable mainProcedure)
Sets the main-invokable object.
|
void |
setParentApplicationComponent(ApplicationComponent parentApplicationComponent) |
void |
shutdown() |
calcOneBarLengthInFrames, clearAllPorts, clearTracks, clientShutdown, connectPort, connectPort, createInputPort, createOutputPort, destroyInputPort, destroyOutputPort, disconnectPort, dumpTracks, enterTrackChangeBlock, getAvailableInputPorts, getAvailableOutputPorts, getBeatsPerBar, getBeatsPerMinute, getInputPorts, getMainTrack, getMetroLock, getOneBarLengthInFrames, getOutputPorts, getPlaying, getThreadInitializer, getThreadInitializerCollection, getTrackByTag, getUpdateSequenceThreshold, inputPortNumberToPort, isOpened, leaveTrackChangeBlock, notifyTrackChange, open, outputPortNumberToPort, postMessage, process, putTrack, putTrack, registerTrack, registerTrack, removeTrack, removeTrack, replicateAllTracks, run, searchInputPort, searchInputPort, searchOutputPort, searchOutputPort, searchTrack, searchTrack, searchTracksByTag, searchTracksByTagSet, setBeatsPerBar, setMainTrackId, setPlaying, setUpdateSequenceThreshold, startClient, togglePlaying, unregisterTrack, unregisterTrack, updatePosition
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
requestInit, requestQuit
public Pulsar(SchemeEngine schemeEngine)
public static void registerSchemeInitializers(SchemeEngine schemeEngine)
public ApplicationComponent getParentApplicationComponent()
getParentApplicationComponent
in interface ApplicationComponent
public void setParentApplicationComponent(ApplicationComponent parentApplicationComponent)
setParentApplicationComponent
in interface ApplicationComponent
public void processInit()
processInit
in interface ApplicationComponent
public void processQuit()
processQuit
in interface ApplicationComponent
public static Pulsar getCurrent()
public static boolean isPresent()
protected void onCreateThread()
onCreateThread
in class Metro
public void init()
public void quit()
public void shutdown()
public void reset()
public SchemeEngine getSchemeEngine()
public void setMainProcedure(Invokable mainProcedure)
mainProcedure
public Invokable getMainProcedure()
mainProcedure
public void rewind()
rewind()
method resets the state of the object and calls main
invokable to back to the state of beginning of the project. This method:9
effectively invoke the main invokable. See mainProcedure
public void addCleanupHook(java.lang.Runnable runnable)
public void execCleanupHook()
public java.io.File getConfigDir()
public java.io.File getConfigFile()
public java.io.File getHistoryFile()
#readHistoryFile(JComboBox)
public static java.lang.Runnable createTimer(java.lang.Runnable threadInitializer, long delay, long interval, Invokable invokable)
public pulsar.TempoTapper getTempoTapper()
public void setBeatsPerMinute(double beatsPerMinute) throws org.jaudiolibs.jnajack.JackException
setBeatsPerMinute
in class Metro
org.jaudiolibs.jnajack.JackException
public MetroTrack createTrack(java.lang.Object name, java.util.Collection<java.lang.Object> tags, MetroSequence sequence)
createTrack
in class Metro
public MetroTrack createTrack(java.lang.Object name, java.util.Collection<java.lang.Object> tags, gnu.mapping.Procedure procedure)
public MetroTrack createRecordingTrack(java.lang.Object name, java.util.Collection<java.lang.Object> tags, java.util.List<MetroPort> inputPorts, java.util.List<MetroPort> outputPorts, double recordLength, boolean looper)
protected static java.util.List<java.lang.Object> readParamPortName(java.lang.Object arg)
protected java.util.List<MetroPort> readParamPort(java.lang.Object arg, java.util.List<MetroPort> portList)
public static void initScheme(kawa.standard.Scheme scheme)
scheme
- the scheme instance to initialize.