Last active
January 17, 2016 05:00
-
-
Save samuelmaddock/18f8457ab6526faae568 to your computer and use it in GitHub Desktop.
MediaPlayer grab fft
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local mp = MediaPlayer.Create( "global" ) | |
-- only allow media which supports FFTs (remove this if you don't want it) | |
mp.ServiceWhitelist = { 'af', 'sc' } | |
if CLIENT then | |
local function audioPostDraw( media ) | |
local fft = media.fft | |
if not fft then return end | |
-- do stuff | |
end | |
mp:on( "mediaChanged", function( media ) | |
if not media then return end | |
if media.Id == "af" then | |
-- override audio media PostDraw function with our own | |
media.PostDraw = audioPostDraw | |
end | |
end ) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment