08.02.2012, 21:57
(
Last edited by Scott; 18/11/2012 at 07:29 AM.
)
BASS Spectrum Analyzer
This plugin utilizes the BASS audio library to return a FFT representation of an audio stream. Use at your own risk, it is not threaded and will cause delays to the main thread when starting audio streams.
Natives/Documentation:
Most natives return 1 on success, 0 on failure, use BASS_ErrorGetCode() to get failure reason
Code:
native BASS_Init(); native BASS_Free(); native BASS_PlayStream(url[]); // Returns the handle ID created native BASS_StopStream(handle); native BASS_ErrorGetCode(); native BASS_ChannelGetData(handle, Float:buffer[], length); //Note: length does not match documentation syntax, see include for which are defined native BASS_ChannelGetLevel(handle, &left, &right); native BASS_ChannelGetLength(handle); // Returns channel length in seconds
Examples provided are meant to be proof-of-concepts, they would not be realistic to use in a production environment due to the high amount of bandwidth required. Try on a local server.
FFT Laser - https://github.com/h02/SA-MP-BASS-Sp...pect-laser.pwn
A video using the same concept (but a different library at the time):
http://*********/yMc4dm9QeME
FFT Bars: https://github.com/h02/SA-MP-BASS-Sp.../spect-bar.pwn
http://i.imgur.com/UNiay.jpg
Levels: https://github.com/h02/SA-MP-BASS-Sp...pect-level.pwn
Particles/Fireworks: https://github.com/h02/SA-MP-BASS-Sp...-particles.pwn
(The most suitable example of what could be used on a live server.)
You have all the data made available from the library function so you could probably make something much cooler than what I did, and something that would actually work in a production environment.
Download: BASS Library Source: http://www.un4seen.com/bass.html