ProgressBar Equalizer ;)
Posted: Fri Apr 25, 2008 4:01 pm
Hi All,
This is the 1st code I've submitted since using PB, I hope everyone likes it or can use it for something.
Basically uses uFMOD to playback the XM file from memory, and only ProgressBarGadget's for the volume equalizers
Someone may find it usefully, I'm just stuck in my 80's "Amiga-demo-old-skool" mode at the moment
>>Download<< Includes demo exe as well as uFMOD includes and XM file.
Thanks for watching
This is the 1st code I've submitted since using PB, I hope everyone likes it or can use it for something.
Basically uses uFMOD to playback the XM file from memory, and only ProgressBarGadget's for the volume equalizers

Someone may find it usefully, I'm just stuck in my 80's "Amiga-demo-old-skool" mode at the moment

Code: Select all
#XM_RESOURCE = 0
#XM_MEMORY = 1
#XM_FILE = 2
#XM_NOLOOP = 8
#XM_SUSPENDED = 16
#uFMOD_MIN_VOL = 0
#uFMOD_MAX_VOL = 25
#uFMOD_DEFAULT_VOL = 25
Macro LOWORD(Value)
Value & $FFFF
EndMacro
Macro HIWORD(Value)
(Value >> 16) & $FFFF
EndMacro
OpenWindow(0, 0, 0, 121, 31, "uFMOD Progress-alizer",#PB_Window_BorderLess | #PB_Window_ScreenCentered)
If LoadFont(0, "Small Fonts", 7)
SetGadgetFont(#PB_Default, FontID(0))
EndIf
uFMOD_PlaySong(?xm, ?endxm-?xm, #XM_MEMORY)
If CreateGadgetList(WindowID(0))
ProgressBarGadget(0,10,0,100,10,0,100,#PB_ProgressBar_Smooth)
ProgressBarGadget(1,10,20,100,10,0,100,#PB_ProgressBar_Smooth)
ProgressBarGadget(2,0,0,10,30,0,100,#PB_ProgressBar_Vertical | #PB_ProgressBar_Smooth)
ProgressBarGadget(3,110,0,10,30,0,100,#PB_ProgressBar_Vertical | #PB_ProgressBar_Smooth)
TextGadget(4, 10, 9, 100, 10, "uFMOD Progress-alizer",#PB_Text_Center)
EndIf
Repeat
volume = uFMOD_GetStats()
Delay(1) ; <-- comment out for realtime, but over 50% cpu ;(
lvol = Loword(volume)/70
rvol = Hiword(volume)/70
SetGadgetState(0,lvol)
SetGadgetState(1,rvol)
SetGadgetState(2,lvol*1.2)
SetGadgetState(3,rvol*1.2)
Until GetAsyncKeyState_(#VK_ESCAPE)
CloseWindow(0) : FreeGadget(0) : FreeGadget(1) : FreeGadget(2) : FreeGadget(3) : FreeGadget(4)
End
DataSection
xm:
IncludeBinary "artificial_sweetener.xm"
endxm:
EndDataSection
Thanks for watching
