forked from LeenkxTeam/LNXSDK
Add leenkx/Sources/leenkx/logicnode/SetAudioPositionNode.hx
This commit is contained in:
23
leenkx/Sources/leenkx/logicnode/SetAudioPositionNode.hx
Normal file
23
leenkx/Sources/leenkx/logicnode/SetAudioPositionNode.hx
Normal file
@ -0,0 +1,23 @@
|
||||
package leenkx.logicnode;
|
||||
|
||||
import aura.Aura;
|
||||
import aura.Types;
|
||||
|
||||
class SetAudioPositionNode extends LogicNode {
|
||||
|
||||
public function new(tree: LogicTree) {
|
||||
super(tree);
|
||||
}
|
||||
|
||||
override function run(from: Int) {
|
||||
var audio = inputs[1].get();
|
||||
if (audio == null) return;
|
||||
|
||||
var positionInSeconds:Float = inputs[2].get();
|
||||
if (positionInSeconds < 0.0) positionInSeconds = 0.0;
|
||||
|
||||
audio.channel.floatPosition = positionInSeconds * audio.channel.sampleRate;
|
||||
|
||||
runOutput(0);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user