forked from Onek8/LNXSDK
23 lines
495 B
Haxe
23 lines
495 B
Haxe
package leenkx.logicnode;
|
|
|
|
#if lnx_audio
|
|
import iron.object.SpeakerObject;
|
|
#end
|
|
|
|
class SetPitchSoundNode extends LogicNode {
|
|
|
|
public function new(tree: LogicTree) {
|
|
super(tree);
|
|
}
|
|
|
|
override function run(from: Int) {
|
|
#if lnx_audio
|
|
var object: SpeakerObject = cast(inputs[1].get(), SpeakerObject);
|
|
if (object == null){ runOutput(0); return; }
|
|
object.data.pitch = inputs[2].get();
|
|
object.sound.sampleRate = Std.int(object.sampleRate * object.data.pitch);
|
|
#end
|
|
runOutput(0);
|
|
}
|
|
}
|