Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import com.haxepunk.Sfx;
- import lime.audio.openal.AL;
- @:access(lime.audio.AudioSource)
- @:access(lime._backend.native.NativeAudioSource)
- @:access(openfl.media.SoundChannel)
- class LBSfx extends Sfx
- {
- public function setPitch(v:Float) : Bool
- {
- #if (html5 || js)
- return false;
- #elseif flash
- return false;
- #else
- var h = _channel.__source.backend.handle;
- // This crashes the game on Scene.update()
- // It doesn't have to be called, it just has to exist somewhere in the code (ie be compiled)
- AL.sourcef(h, AL.PITCH, v);
- return true;
- #end
- }
- public function getPitch() : Float
- {
- #if (html5 || js)
- return 1.;
- #elseif flash
- return 1.;
- #else // sys
- var h = _channel.__source.backend.handle;
- // same here
- return AL.getSourcef(h, AL.PITCH);
- #end
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement