Javascript
Les JavaScripts sont de simples fichiers texte avec l'extension .js, exécutés par le Player à partir de la commande Launch JavaScript
du menu File.
Les instances de classe Java dans un script ne sont que des objets miroirs des objets du Player (les "objets réels" en quelque sorte); en aucun cas la création ou la suppression directe d'un objet Java n'implique la création ou la suppression d'un objet dans le Player.
Les documents et les objets du Player sont instanciés par des méthodes Java du type createSomething(); la suppression d'un objet du Player se fait par la méthode destroy() (rappelons que le mot clés delete est réservé en Java); la fermeture d'un document se fait par la méthode close().
Dans un script, les documents, les sous-scripts et les fichiers sons qui ne sont pas désignés par un chemin d'accès absolu sont considérés avec un chemin d'accès relatif à l'emplacement du script exécuté
Voici l'ensemble des classes et méthodes disponibles pour scripter le Player (les unités de temps sont en secondes).
Global Functions⚓
Basics⚓
_LOG(string tolog);
Math Functions⚓
Constants⚓
double pi;
Functions⚓
double abs(double x);
double acos(double x);
double asin(double x);
double atan(double x);
double ceil(double x);
double cos(double x);
double cosh(double x);
double exp(double x);
double floor(double x);
double fmod(double x, double m);
double log(double x);
double log10(double x);
double pow(double x, double p);
double round(double x);
double sin(double x);
double sinh(double x);
double sqrt(double x);
double tan(double x);
double tanh(double x);
double random();
Class NTApplication⚓
Create Documents⚓
NTDocument newDocument(string name);
NTDocument openDocument(string path);
NTDocument getActiveDocument();
Example: var myDocument = NTApp.newDocument("Flanger");
Class NTDocument⚓
Basics (returns int for error)⚓
int activate();
int save();
int saveAs(string path);
int saveAsOverwrite(string path);
int saveAsDialog();
int close();
int setPreferedNextObjectID(int nextID);
void logInfo();
Create Objects⚓
NTPlayer createPlayer();
NTPlayer createPlayerMulti(subCount);
NTSequence createSequenceEmpty(string name);
NTSequence createSequenceWithEmptyTrack(string name);
NTSequence createSequenceWithSound(string path);
Example: var mySequence = myDocument.createSequenceWithSound("../Sounds/Bach.aiff");
Commands (returns int for error)⚓
int doCommandDelete(NTObjectSelection selection);
int doCommandCut(NTObjectSelection selection);
int doCommandCopy(NTObjectSelection selection);
int doCommandPaste(NTObjectSelection selection);
int doCommandDuplicate(NTObjectSelection selection);
int doCommandUndo();
int doCommandRedo();
int doCommandPaste2(NTObject target);
Class NTObject - Abstract⚓
Basics⚓
bool exists();
void destroy();
int setName(string name);
string getName();
void logInfo();
Class NTPlayable - Inherits from NTObject⚓
Commands (returns int for error)⚓
int play();
int stop();
int rewind();
int forward();
int toBegin();
int toEnd();
int rephase();
Setters (returns int for error)⚓
int setPlay(bool value);
int setLoop(bool value);
int setMute(bool value);
int setSolo(bool value);
int setTime(double value);
int setRelaTime(double value);
int setPhase(double value);
int setSpan(double value);
int setSpanIntv(double begin, double end);
int setSpeed(double value);
int setSpeedWow(double value);
int setSpeedSubx(double value);
int setVolume(double value);
int setGain(double value);
Getters⚓
bool isWorking(); // <=> (isPlaying() || isRewinding() || isForwarding())
bool isPlaying();
bool isRewinding();
bool isForwarding();
bool isLoop();
bool isMute();
bool isSolo();
double getTime();
double getRelaTime();
double getPhase();
double getSpan();
array[double,double] getSpanIntv();
double getSpeed();
double getSpeedWow();
double getSpeedSubx();
double getVolume();
double getGain();
Class NTPlayer - Inherits from NTPlayable⚓
Class NTSequence - Inherits from NTPlayable⚓
Selection⚓
array[double,double] getSelection();
int setSelection(double begin, double end);
int setSelectionAll();
int setSelectionNone();
Attached Players⚓
int attachPlayer(NTPlayer player);
NTPlayer createAndAttachPlayer();
NTPlayer createAndAttachPlayerMulti(int subCount);
NTPlayer getAttachedPlayerAtIndex(int index);
int getAttachedPlayerCount();
array[NTPlayers] getAttachedPlayers();
Sub Tracks⚓
int mixWithSequence(NTSequence sequence);
NTTrack createAndAddSubTrack();
NTTrack getSubTrackAtIndex(int index);
int getSubTrackCount();
array[NTTracks] getSubTracks();
Tracks Parts⚓
double begin();
double end();
double duration();
NTTrackPart all();
NTTrackPart part(double begin, double end);
Simple Commands (returns int for error)⚓
int reset();
int crop(double begin, double end);
int remove(double begin, double end);
int erase(double begin, double end);
int scale(double begin, double end, double k);
int reverse(double begin, double end);
Sequencing (returns int for error)⚓
int moveAt(NTTrackPart part, double at);
int copyAt(NTTrackPart part, double at);
int prepend(NTTrackPart part);
int append(NTTrackPart part);
NTSequence plus(NTTrackPart part); // Returns this NTSequence.
Class NTTrack - Inherits from NTObject⚓
Tracks Parts⚓
double begin();
double end();
double duration();
NTTrackPart all();
NTTrackPart part(double begin, double end);
Simple Commands (returns int for error)⚓
int reset();
int crop(double begin, double end);
int remove(double begin, double end);
int erase(double begin, double end);
int scale(double begin, double end, double k);
int reverse(double begin, double end);
Sequencing (returns int for error)⚓
int moveAt(NTTrackPart part, double at);
int copyAt(NTTrackPart part, double at);
int prepend(NTTrackPart part);
int append(NTTrackPart part);
NTSequence plus(NTTrackPart part); // Returns this NTSequence.
Class NTTrackPart⚓
Constructor (never directly called by user)⚓
NTTrackPart NTTrackPart(NTTrack track, double begin, double end);
Class NTObjectSelection⚓
Fill with Objects⚓
void pushObject(NTObject object);