dude there is infact an example of it in the main program directory of FreeBASIC -> Examples -> Libraries -> Sound.
You should see a file called bass_test, it should have the bass dll in there, if not you'll need anything from v 2.2.0 upwards from
www.u4seen.comHere's a lib I just knocked up for you, for loading in tracker formats that have been bin2bas'd. In other words from memory.
the lib file:
#include once "bass.bi"
dim shared as HMUSIC bass_music
dim shared as single bass_volume=100
declare sub free_bass()
declare sub initialize_bass()
declare sub load_bass_music( byval tune as ubyte ptr, byval length as integer )
declare sub play_bass_music()
declare sub set_bass_volume( byval volume as single )
sub free_bass()
BASS_ChannelStop( bass_music )
BASS_MusicFree ( bass_music )
BASS_Stop
BASS_Free
end Sub
sub initialize_bass()
'
' Check correct version being used.
'
if(BASS_GetVersion()<MAKELONG(2,2)) then
print "Error: BASS version 2.2 or above required"
sleep 2000
end 1
end if
'
' Initialize Bass with 441hzm sound quality.
' ( not 100% need to check bass.chm.
'
if (BASS_Init( -1, 44100, 0, 0, 0 ))=0 then
print "Error: BASS_Init failed"
sleep 2000
end 1
end if
end sub
sub load_bass_music( byval tune as ubyte ptr, byval length as integer )
'
' Load the tune in as bass_music with looping enabled.
'
bass_music = BASS_MusicLoad( true, @tune[0], 0, length-1, BASS_MUSIC_LOOP or BASS_MUSIC_RAMP, 0 )
if( bass_music=0 ) then
print "Error: BASS_MusicLoad failed"
sleep 2000
BASS_Free
end 1
end If
end sub
sub play_bass_music()
'
' And finally...
'
BASS_ChannelPlay( bass_music, false )
end sub
sub set_bass_volume( byval volume as single )
'
' Ensure new volume is within acceptable range.
'
if volume<0 then
volume = 0
elseif volume>100 then
volume = 100
end if
bass_volume=volume
Bass_ChannelSetAttributes( bass_music, -1, cint( bass_volume ), -101 )
end sub
then in your main program:
'
' bass lib test
' - uses the black window! ;) remember to remove your -s gui
option explicit
option static
#include once "lib - bass music v1-2.bas"
#include once "media\your_tune.bas"
declare sub initialize_test()
declare sub run_test()
declare sub update_effect()
initialize_test()
run_test()
end
sub initialize_test()
initialize_bass()
load_bass_music( @music_data(0), 8837 ) ; music data is the variable name, 8837 will be the songs length
; change as appropriate.
end sub
sub run_test()
play_bass_music()
while inkey<>chr(27)
cls
locate 1,1
print "bAsS mUsIc TeSt ViA mR. cLyDe RaDcLifFe"
print : print "zEe TuNe Iz NoW pLaYiNgZ..."
sleep(1)
wend
end sub
Hope it helps.
Clyde.