Skip to content

Instantly share code, notes, and snippets.

@samuelmaddock
Last active January 17, 2016 05:00
Show Gist options
  • Save samuelmaddock/18f8457ab6526faae568 to your computer and use it in GitHub Desktop.
Save samuelmaddock/18f8457ab6526faae568 to your computer and use it in GitHub Desktop.
MediaPlayer grab fft
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