This commit is contained in:
Dooho Yi 2022-12-04 22:52:03 +09:00
parent 133d98ebab
commit 40ae5cfc35

View file

@ -19,7 +19,7 @@ function Sample(arg) {
<!--<div nexus-ui="number" id="${arg.ui}-reverbnumber" style="width:60px;margin:10px;"></div>--> <!--<div nexus-ui="number" id="${arg.ui}-reverbnumber" style="width:60px;margin:10px;"></div>-->
</div> </div>
`; `;
//build the rack //build the rack
this.rack = new Nexus.Rack(arg.ui); this.rack = new Nexus.Rack(arg.ui);
//recollect components //recollect components
@ -28,7 +28,7 @@ function Sample(arg) {
// this.volumenumber = this.rack[arg.ui + '-volumenumber']; // this.volumenumber = this.rack[arg.ui + '-volumenumber'];
this.reverb = this.rack[arg.ui + '-reverb']; this.reverb = this.rack[arg.ui + '-reverb'];
// this.reverbnumber = this.rack[arg.ui + '-reverbnumber']; // this.reverbnumber = this.rack[arg.ui + '-reverbnumber'];
//presets //presets
this.button.mode = "toggle"; this.button.mode = "toggle";
this.button.state = false; this.button.state = false;
@ -42,7 +42,7 @@ function Sample(arg) {
this.reverb.value = 0; this.reverb.value = 0;
this.reverb.interaction = "vertical"; // this doesn't work. TBD.. sth. is wrong! this.reverb.interaction = "vertical"; // this doesn't work. TBD.. sth. is wrong!
// this.reverbnumber.link(this.reverb); // this.reverbnumber.link(this.reverb);
//colors //colors
this.rack.colorize("accent","#00DCD8"); this.rack.colorize("accent","#00DCD8");
this.rack.colorize("fill","#2B5EA3"); this.rack.colorize("fill","#2B5EA3");
@ -55,7 +55,7 @@ function Sample(arg) {
this.loop = false; this.loop = false;
this.autostart = false; this.autostart = false;
} }
// volume(gain) -> [Main output] // volume(gain) -> [Main output]
this.vol = new Tone.Volume().toDestination(); this.vol = new Tone.Volume().toDestination();
this.vol.mute = true; this.vol.mute = true;
@ -79,13 +79,14 @@ function Sample(arg) {
); );
// source -> reverb(fx) // source -> reverb(fx)
if (arg.autostart) this.button.turnOn(); if (this.autostart) this.button.turnOn();
this.player = new Tone.Player({ this.player = new Tone.Player({
url: arg.url, url: arg.url,
loop: arg.loop, loop: this.loop,
autostart: arg.autostart, autostart: this.autostart,
fadeIn: 5, fadeIn: 5,
fadeOut: 5, fadeOut: 5,
onstop: () => this.button.turnOff()
}).connect(this.rev); }).connect(this.rev);
this.button.on( this.button.on(
"change", "change",
@ -94,9 +95,6 @@ function Sample(arg) {
else this.player.stop(); else this.player.stop();
}.bind(this) }.bind(this)
); );
if (arg.type == "oneshot") {
this.player.onstop = () => this.button.turnOff()
}
} }
//script //script