added delay property
This commit is contained in:
parent
c955e95152
commit
97e13acd20
|
|
@ -8,6 +8,7 @@ oscillatorDefaults = {
|
||||||
endType: "none",
|
endType: "none",
|
||||||
length: 1,
|
length: 1,
|
||||||
volume: 1,
|
volume: 1,
|
||||||
|
delay: 0,
|
||||||
};
|
};
|
||||||
|
|
||||||
audioObject = {};
|
audioObject = {};
|
||||||
|
|
@ -32,7 +33,7 @@ function oscillator(name="test",parameterObject=oscillatorDefaults){ //creates o
|
||||||
audioObject[oscillatorNodeName].connect(audioObject[gainNodeName])
|
audioObject[oscillatorNodeName].connect(audioObject[gainNodeName])
|
||||||
audioObject[oscillatorNodeName].frequency.value = parameterObject.frequency
|
audioObject[oscillatorNodeName].frequency.value = parameterObject.frequency
|
||||||
audioObject[gainNodeName].connect(audioContext.destination)
|
audioObject[gainNodeName].connect(audioContext.destination)
|
||||||
audioObject[oscillatorNodeName].start(0)
|
audioObject[oscillatorNodeName].start(audioContext.currentTime + parameterObject.delay)
|
||||||
|
|
||||||
//stopping handler
|
//stopping handler
|
||||||
if(parameterObject.endType === "exponential") { //starts fading immediately
|
if(parameterObject.endType === "exponential") { //starts fading immediately
|
||||||
|
|
@ -44,17 +45,18 @@ function oscillator(name="test",parameterObject=oscillatorDefaults){ //creates o
|
||||||
0.00001, audioContext.currentTime + parameterObject.length
|
0.00001, audioContext.currentTime + parameterObject.length
|
||||||
);
|
);
|
||||||
} else { //waits to stop
|
} else { //waits to stop
|
||||||
audioObject[oscillatorNodeName].stop(audioContext.currentTime + parameterObject.length);
|
audioObject[oscillatorNodeName].stop(audioContext.currentTime + parameterObject.delay + parameterObject.length);
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
elements.note_block = {
|
elements.note_block = {
|
||||||
color: "#ee33ee",
|
color: "#ee33ee",
|
||||||
behavior: behaviors.WALL,
|
behavior: behaviors.WALL,
|
||||||
state: "liquid",
|
state: "solid",
|
||||||
category: "liquids",
|
category: "machines",
|
||||||
density: 1200,
|
density: 1200,
|
||||||
hardness: 1,
|
hardness: 0.2,
|
||||||
|
breakInto: ["plastic","metal_scrap","metal_scrap","metal_scrap"],
|
||||||
conduct: 1,
|
conduct: 1,
|
||||||
properties: {
|
properties: {
|
||||||
frequency: 440,
|
frequency: 440,
|
||||||
|
|
@ -62,6 +64,7 @@ elements.note_block = {
|
||||||
endType: "none",
|
endType: "none",
|
||||||
length: 1,
|
length: 1,
|
||||||
volume: 1,
|
volume: 1,
|
||||||
|
delay: 0,
|
||||||
debounce: 0,
|
debounce: 0,
|
||||||
debounceLength: tps,
|
debounceLength: tps,
|
||||||
},
|
},
|
||||||
|
|
@ -74,6 +77,7 @@ elements.note_block = {
|
||||||
endType: pixel.endType,
|
endType: pixel.endType,
|
||||||
length: pixel.length,
|
length: pixel.length,
|
||||||
volume: pixel.volume,
|
volume: pixel.volume,
|
||||||
|
delay: pixel.delay,
|
||||||
};
|
};
|
||||||
|
|
||||||
//console.log(pixelPropertyObject);
|
//console.log(pixelPropertyObject);
|
||||||
|
|
@ -91,3 +95,13 @@ elements.note_block = {
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
runAfterLoad(function() {
|
||||||
|
elements.note_block.movable = false;
|
||||||
|
});
|
||||||
|
|
||||||
|
if(runAfterAutogen) {
|
||||||
|
runAfterAutogen(function() {
|
||||||
|
elements.note_block.movable = false;
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue