Hello! Flame here!
Been awhile since I last posted here, and I come back with a rather odd question/problem. Hopefully it's a simple one that can be easily fixed.
I am busy working on a game that uses BPMs of the background music to create enemies in a sort of shooter game. I knew right away I'd need to use BASS to get the job done, and after looking around, I found out my function I need is BASS_FX_BPM_DecodeGet. After finding the parameters needed, I came up with this in the main loop:
The music handler is done by such:
This is using a modified demo_stream.bb script from the a Bass.dll source that included many examples and userlibs (I think this is the 2.1 one or something), but upon running it, I get a MAV on BASS_FX_BPM_DecodeGet.
My question is: What am I doing wrong?
Source:
Been awhile since I last posted here, and I come back with a rather odd question/problem. Hopefully it's a simple one that can be easily fixed.
I am busy working on a game that uses BPMs of the background music to create enemies in a sort of shooter game. I knew right away I'd need to use BASS to get the job done, and after looking around, I found out my function I need is BASS_FX_BPM_DecodeGet. After finding the parameters needed, I came up with this in the main loop:
thesize# = BASS_ChannelBytes2Seconds#(music, BASS_ChannelGetLength(music)) duh = BASS_FX_BPM_DecodeGet(music, 0, thesize#, 0, 2, BASS_NULL)
The music handler is done by such:
music = BASS_StreamCreateFile(0,"media\free.mp3",0,0,BASS_STREAM_DECODE) BASS_ChannelPlay(music,BASS_TRUE)
This is using a modified demo_stream.bb script from the a Bass.dll source that included many examples and userlibs (I think this is the 2.1 one or something), but upon running it, I get a MAV on BASS_FX_BPM_DecodeGet.
My question is: What am I doing wrong?
Source:
Include "includes\bass.bb" Include "includes\bass_fx.bb" Timer=CreateTimer (60) Graphics 640,480,0,2 SetBuffer BackBuffer() error = BASS_Init(-1,44100,0,0,BASS_NULL) If error <> 1 Then RuntimeError(error) Global music ;music = BASS_StreamCreateFile(0,"media\Darwinia - Pain Fading Down.mp3",0,0,BASS_MUSIC_FLOAT) music = BASS_StreamCreateFile(0,"media\free.mp3",0,0,BASS_STREAM_DECODE) BASS_ChannelPlay(music,BASS_TRUE) While Not KeyHit (1) Color 255,255,255 Cls Text 0,0,"Bass Stream demo" version = BASS_GetVersion() Text 0,20,"Bass version : " +Hex$(version) cpu# = BASS_GetCPU() Text 0,30,"CPU time : "+cpu+"%" device$ = BASS_GetDeviceDescriptionString(1) Text 0,40,"First (real) device : "+device devid = BASS_GetDevice() Text 0,50,"Device id : "+devid mvolume = BASS_GetVolume() Text 0,60,"Master Volume : " +mvolume pos = BASS_ChannelGetPosition(music) Text 0,80, "Stream position : "+pos Text 300,80,"Seconds: "+BASS_ChannelBytes2Seconds(music,pos) Text 300,100,BASS_ChannelBytes2Seconds(music,pos)/pos Text 0,100, "Hit 8 to jump to position 3000000" If KeyHit (9) Then BASS_ChannelSetPosition(music,3000000) vumono = BASS_ChannelGetLevel (music) vuleft = BASS_MakeLoWord (vumono) vuright = BASS_MakeHiWord (vumono) Color Rand(0,255),Rand(0,255),Rand(0,255) Text 0,170,"Left channel : "+vuleft Rect 0,200,vuleft/52,20,1 Rect 0,240,vuright/52,20,1 Text 0,270,"Right channel : "+vuright thesize# = BASS_ChannelBytes2Seconds#(music, BASS_ChannelGetLength(music)) If KeyHit(57) Then duh = BASS_FX_BPM_DecodeGet(music, 0, thesize#, 0, 2, BASS_NULL) Text 0,150,"Power: "+duh DrawFFT(100) WaitTimer Timer Flip 0 Wend BASS_Free() End Function DrawFFT(coloring) sdbank = CreateBank(2048*4) duh=BASS_ChannelGetData(music,sdbank,BASS_DATA_FFT1024) For a = 0 To 512 Step 8 fftd# = PeekFloat(sdbank,a) fftd2# = PeekFloat(sdbank,(a) + 4) fftd# = Sqr((fftd#))*3*100 fftd2# = Sqr((fftd2#))*3*100 fftd# = (fftd# + fftd2#)/2 Color coloring,0,coloring Rect a/2,480-fftd#,4,fftd# ;Line 50+a,(GraphicsHeight() / 2) - (fftd# * (GraphicsHeight() * 1.5))+200,50+a+4,(GraphicsHeight() / 2) - (fftd2# * (GraphicsHeight() * 1.5))+200 Next Color 255,255,255 FreeBank sdbank End Function ;~IDEal Editor Parameters: ;~C#Blitz3D