Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add method to get audio position #20

Closed
KCFindstr opened this issue Mar 19, 2019 · 1 comment
Closed

add method to get audio position #20

KCFindstr opened this issue Mar 19, 2019 · 1 comment

Comments

@KCFindstr
Copy link

Hi,

It'll be great if there's an API to get precise playing position from audio. Currently I'm using timers, but I'm afraid they are not precise enough regarding the music being played.

@super-toki
Copy link

super-toki commented Aug 27, 2020

This is an unofficial API, but you can use it.

local handle = audio.loadSound(filename)
local ch, src = audio.play( handle, { channel=1, loops=0 } )
local function onFrame(event)
        local position = al.GetSource(src, al.SEC_OFFSET)
        print(position)
end
Runtime:addEventListener( "enterFrame", onFrame )

p.s: Use the forums to find suggestions or solutions. (This is a space for reporting "bugs".)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants