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