mirror of
https://github.com/Tonejs/Tone.js
synced 2024-11-16 00:27:58 +00:00
changing singleton references to lowercase
This commit is contained in:
parent
5ca79dfb58
commit
df5c800df4
4 changed files with 23 additions and 16 deletions
|
@ -56,11 +56,11 @@ define(["Tone/core/Tone", "Tone/core/Gain"], function(Tone){
|
|||
|
||||
//remove all the send/receives when a new audio context is passed in
|
||||
Tone.Context.on("init", function(context){
|
||||
if (context.Buses){
|
||||
Buses = context.Buses;
|
||||
if (context.buses){
|
||||
Buses = context.buses;
|
||||
} else {
|
||||
Buses = {};
|
||||
context.Buses = Buses;
|
||||
context.buses = Buses;
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
@ -47,6 +47,9 @@ define(["Tone/core/Tone", "Tone/component/CrossFade", "Tone/component/Merge", "T
|
|||
Tone.getContext(function(){
|
||||
// set the default position/forward
|
||||
this.set(ListenerConstructor.defaults);
|
||||
|
||||
//listener is a singleton so it adds itself to the context
|
||||
this.context.listener = this;
|
||||
}.bind(this));
|
||||
|
||||
};
|
||||
|
@ -292,14 +295,13 @@ define(["Tone/core/Tone", "Tone/component/CrossFade", "Tone/component/Merge", "T
|
|||
Tone.Listener = new ListenerConstructor();
|
||||
|
||||
Tone.Context.on("init", function(context){
|
||||
if (context.Listener instanceof ListenerConstructor){
|
||||
if (context.listener instanceof ListenerConstructor){
|
||||
//a single listener object
|
||||
Tone.Listener = context.Listener;
|
||||
Tone.Listener = context.listener;
|
||||
} else {
|
||||
//make new Listener insides
|
||||
Tone.Listener = new ListenerConstructor();
|
||||
}
|
||||
context.Listener = Tone.Listener;
|
||||
});
|
||||
//END SINGLETON SETUP
|
||||
|
||||
|
|
|
@ -45,6 +45,9 @@ define(["Tone/core/Tone", "Tone/component/Volume", "Tone/core/Context", "Tone/co
|
|||
this._readOnly("volume");
|
||||
//connections
|
||||
this.input.chain(this.output, this.context.destination);
|
||||
|
||||
//master is a singleton so it adds itself to the context
|
||||
this.context.master = this;
|
||||
}.bind(this));
|
||||
};
|
||||
|
||||
|
@ -147,17 +150,16 @@ define(["Tone/core/Tone", "Tone/component/Volume", "Tone/core/Context", "Tone/co
|
|||
|
||||
Tone.Context.on("init", function(context){
|
||||
// if it already exists, just restore it
|
||||
if (context.Master instanceof MasterConstructor){
|
||||
Tone.Master = context.Master;
|
||||
if (context.master instanceof MasterConstructor){
|
||||
Tone.Master = context.master;
|
||||
} else {
|
||||
Tone.Master = new MasterConstructor();
|
||||
}
|
||||
context.Master = Tone.Master;
|
||||
});
|
||||
|
||||
Tone.Context.on("close", function(context){
|
||||
if (context.Master instanceof MasterConstructor){
|
||||
context.Master.dispose();
|
||||
if (context.master instanceof MasterConstructor){
|
||||
context.master.dispose();
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
@ -156,6 +156,9 @@ define(["Tone/core/Tone", "Tone/core/Clock", "Tone/type/Type", "Tone/core/Timeli
|
|||
*/
|
||||
this._swingAmount = 0;
|
||||
|
||||
//transport is a singleton so it adds itself to the context
|
||||
this.context.transport = this;
|
||||
|
||||
}.bind(this));
|
||||
};
|
||||
|
||||
|
@ -781,18 +784,18 @@ define(["Tone/core/Tone", "Tone/core/Clock", "Tone/type/Type", "Tone/core/Timeli
|
|||
Tone.Transport = new TransportConstructor();
|
||||
|
||||
Tone.Context.on("init", function(context){
|
||||
if (context.Transport instanceof TransportConstructor){
|
||||
Tone.Transport = context.Transport;
|
||||
if (context.transport instanceof TransportConstructor){
|
||||
Tone.Transport = context.transport;
|
||||
} else {
|
||||
Tone.Transport = new TransportConstructor();
|
||||
}
|
||||
//store the Transport on the context so it can be retrieved later
|
||||
context.Transport = Tone.Transport;
|
||||
context.transport = Tone.Transport;
|
||||
});
|
||||
|
||||
Tone.Context.on("close", function(context){
|
||||
if (context.Transport instanceof TransportConstructor){
|
||||
context.Transport.dispose();
|
||||
if (context.transport instanceof TransportConstructor){
|
||||
context.transport.dispose();
|
||||
}
|
||||
});
|
||||
|
||||
|
|
Loading…
Reference in a new issue