haloBASS

Blitz3D Forums/Blitz3D Programming/haloBASS

JoshK(Posted 2004) [#1]
Wow, here is haloBASS(TM)! Replaces all Blitz sound commands with ones from BASS and allows you to add EAX effects.

1) Include the two files below.

2) Copy BASS.decls into your userlbs folder.

3) Add an UpdateSound() command in your game loop.

4) Before freeing any entity that might emit noise, use a FreeEntitySound() command.

5) Enable EAX with SetSoundEnvironment(EAX_ENVIRONMENT_GENERIC) or disable it with SetSoundEnvironment(-1)

haloBASS.bb:
Global BASSENABLED=True
Global BASSINITIALIZED
Global BASS_LISTENER

Type Active3dSound
Field sample
Field entity
Field channel
End Type

Function CreateListener(parent,rolloff_factor#=1.0,doppler_scale#=1.0,distance_scale#=1.0)
If Not BASSINITIALIZED InitSound()
If Not BASSINITIALIZED Return
BASS_Set3DFactors distance_scale,rolloff_factor,doppler_scale
If BASS_LISTENER FreeEntity BASS_LISTENER
BASS_LISTENER=CreatePivot()
EntityParent BASS_LISTENER,parent
PositionEntity BASS_LISTENER,0,0,0
Return BASS_LISTENER
End Function

Function InitSound(userdevice=0)
DebugLog "Initializing BASS..."
If Not BASS_Init(userdevice,44100,BASS_DEVICE_3D,0)
	BASS_Stop()
	BASS_Free()
	DebugLog "BASS failed to initialize."
	Return False
	EndIf
DebugLog "Initializing digital output..."
If Not BASS_Start()
	BASS_Stop()
	BASS_Free()	
	DebugLog "Failed to initialize digital output."
	Return False
	EndIf
BASSINITIALIZED=True
Return True
End Function

Function SetSoundEnvironment(effect,volume#=0.2,decay#=10.0,dampening#=1.0)
If effect=-1
	BASS_SetEAXParameters -1,0,0,0
	Else
	BASS_SetEAXParameters effect,volume,decay,dampening
	EndIf
End Function

Function FreeEntitySound(entity)
For Active3dSound.Active3dSound=Each Active3dSound
	If Active3dSound\entity=entity
		Delete Active3dSound
		EndIf
	Next
End Function

Function UpdateSound()
If Not BASS_LISTENER Return
pos=CreateBank(12)
rot=CreateBank(12)
vel=CreateBank(12)
front=CreateBank(12)
top=CreateBank(12)
For Active3dSound.Active3dSound=Each Active3dSound
	PokeFloat pos,0,EntityX(Active3dSound\entity,1)
	PokeFloat pos,4,EntityY(Active3dSound\entity,1)
	PokeFloat pos,8,EntityZ(Active3dSound\entity,1)
	BASS_ChannelSet3DPosition Active3dSound\channel,pos,rot,vel
	Next
PokeFloat pos,0,EntityX(BASS_LISTENER,1)
PokeFloat pos,4,EntityY(BASS_LISTENER,1)
PokeFloat pos,8,EntityZ(BASS_LISTENER,1)
TFormVector 0,0,1,BASS_LISTENER,0
PokeFloat front,0,TFormedX()
PokeFloat front,4,TFormedY()
PokeFloat front,8,TFormedZ()
TFormVector 0,1,0,BASS_LISTENER,0
PokeFloat top,0,TFormedX()
PokeFloat top,4,TFormedY()
PokeFloat top,8,TFormedZ()
BASS_Set3DPosition pos,vel,front,top
FreeBank pos
FreeBank rot
FreeBank vel
FreeBank front
FreeBank top
BASS_Apply3D()
End Function

Function LoadSound(file$)
If Not BASSINITIALIZED InitSound()
If Not BASSINITIALIZED Return
DebugLog "Loading sound "+Chr(34)+file+Chr(34)+"..."
noise=BASS_SampleLoad(0,file,0,0,3,0)
If Not noise
	DebugLog "Failed to load sound "+Chr(34)+file+Chr(34)+"."
	EndIf
Return noise
End Function

Function Load3DSound(file$)
If Not BASSINITIALIZED InitSound()
If Not BASSINITIALIZED Return
DebugLog "Loading sound "+Chr(34)+file+Chr(34)+"..."
noise=BASS_SampleLoad(0,file,0,0,3,BASS_SAMPLE_3D)
If Not noise
	DebugLog "Failed to load sound "+Chr(34)+file+Chr(34)+"."
	EndIf
Return noise
End Function

Function EmitSound(sound,entity)
pos=CreateBank(12)
rot=CreateBank(12)
vel=CreateBank(12)
channel=BASS_SamplePlay3D(sound,pos,rot,vel)
For Active3dSound.Active3dSound=Each Active3dSound
	If Active3dSound\channel=channel
		Delete Active3dSound
		EndIf
	Next
FreeBank pos
FreeBank rot
FreeBank vel
If channel
	Active3dSound.Active3dSound=New Active3dSound
	Active3dSound\sample=sound
	Active3dSound\entity=entity
	Active3dSound\channel=channel
	EndIf
End Function

Function PlaySound(sound)
If Not BASSINITIALIZED Return
channel=BASS_SamplePlay(sound)
For Active3dSound.Active3dSound=Each Active3dSound
	If Active3dSound\channel=channel
		Delete Active3dSound
		EndIf
	Next
If sound Return channel
End Function

Function FreeSound(sound)
If Not BASSINITIALIZED Return
BASS_SampleFree(sound)
End Function

Const BASS_SAMPLE_FLAGS=8

Function LoopSound(sound)
If Not BASSINITIALIZED Return
bank=CreateBank(60)
BASS_SampleGetInfo(sound,bank)
flags=PeekShort(bank,12)
If Not (BASS_SAMPLE_LOOP And flags)
	flags=flags+BASS_SAMPLE_LOOP
	PokeShort bank,12,flags
	BASS_SampleSetInfo sound,bank
	EndIf
FreeBank bank
End Function


BASS_const.bb:
Const BASSTRUE = 1    
Const BASSFALSE = 0  
Const BASS_OK = 0                
Const BASS_ERROR_MEM = 1        
Const BASS_ERROR_FILEOPEN = 2    
Const BASS_ERROR_DRIVER = 3      
Const BASS_ERROR_BUFLOST = 4    
Const BASS_ERROR_HANDLE = 5      
Const BASS_ERROR_FORMAT = 6      
Const BASS_ERROR_POSITION = 7    
Const BASS_ERROR_INIT = 8        
Const BASS_ERROR_START = 9      
Const BASS_ERROR_INITCD = 10    
Const BASS_ERROR_CDINIT = 11    
Const BASS_ERROR_NOCD = 12      
Const BASS_ERROR_CDTRACK = 13    
Const BASS_ERROR_ALREADY = 14 
Const BASS_ERROR_CDVOL = 15      
Const BASS_ERROR_NOPAUSE = 16    
Const BASS_ERROR_NOTAUDIO = 17  
Const BASS_ERROR_NOCHAN = 18    
Const BASS_ERROR_ILLTYPE = 19    
Const BASS_ERROR_ILLPARAM = 20  
Const BASS_ERROR_NO3D = 21      
Const BASS_ERROR_NOEAX = 22      
Const BASS_ERROR_DEVICE = 23    
Const BASS_ERROR_NOPLAY = 24    
Const BASS_ERROR_FREQ = 25      
Const BASS_ERROR_NOTFILE = 27    
Const BASS_ERROR_NOHW = 29      
Const BASS_ERROR_EMPTY = 31      
Const BASS_ERROR_NONET = 32      
Const BASS_ERROR_CREATE = 33    
Const BASS_ERROR_NOFX = 34      
Const BASS_ERROR_PLAYING = 35    
Const BASS_ERROR_NOTAVAIL = 37  
Const BASS_ERROR_DECODE = 38    
Const BASS_ERROR_DX = 39        
Const BASS_ERROR_TIMEOUT = 40    
Const BASS_ERROR_FILEFORM = 41  
Const BASS_ERROR_SPEAKER = 42    
Const BASS_ERROR_UNKNOWN = -1    
Const BASS_DEVICE_8BITS = 1      
Const BASS_DEVICE_MONO = 2      
Const BASS_DEVICE_3D = 4        
Const BASS_DEVICE_LEAVEVOL = 32 
Const BASS_DEVICE_NOTHREAD = 128 
Const BASS_DEVICE_LATENCY = 256 
Const BASS_DEVICE_VOL1000 = 512 
Const BASS_DEVICE_FLOATDSP = 1024 
Const BASS_DEVICE_SPEAKERS = 2048 
Const DSCAPS_CONTINUOUSRATE = 16 
Const DSCAPS_EMULDRIVER = 32 
Const DSCAPS_CERTIFIED = 64 
Const DSCAPS_SECONDARYMONO = 256    
Const DSCAPS_SECONDARYSTEREO = 512  
Const DSCAPS_SECONDARY8BIT = 1024    
Const DSCAPS_SECONDARY16BIT = 2048  
Const DSCCAPS_EMULDRIVER = DSCAPS_EMULDRIVER 
Const DSCCAPS_CERTIFIED = DSCAPS_CERTIFIED 
Const WAVE_FORMAT_1M08 = $1          
Const WAVE_FORMAT_1S08 = $2          
Const WAVE_FORMAT_1M16 = $4          
Const WAVE_FORMAT_1S16 = $8          
Const WAVE_FORMAT_2M08 = $10          
Const WAVE_FORMAT_2S08 = $20          
Const WAVE_FORMAT_2M16 = $40          
Const WAVE_FORMAT_2S16 = $80          
Const WAVE_FORMAT_4M08 = $100        
Const WAVE_FORMAT_4S08 = $200        
Const WAVE_FORMAT_4M16 = $400        
Const WAVE_FORMAT_4S16 = $800        
Const BASS_MUSIC_RAMP = 1        
Const BASS_MUSIC_RAMPS = 2      
Const BASS_MUSIC_LOOP = 4        
Const BASS_MUSIC_FT2MOD = 16    
Const BASS_MUSIC_PT1MOD = 32    
Const BASS_MUSIC_MONO = 64      
Const BASS_MUSIC_3D = 128        
Const BASS_MUSIC_POSRESET = 256 
Const BASS_MUSIC_SURROUND = 512 
Const BASS_MUSIC_SURROUND2 = 1024 
Const BASS_MUSIC_STOPBACK = 2048 
Const BASS_MUSIC_FX = 4096      
Const BASS_MUSIC_CALCLEN = 8192 
Const BASS_MUSIC_NONINTER = 16384 
Const BASS_MUSIC_FLOAT = $10000    
Const BASS_MUSIC_DECODE = $200000 
Const BASS_MUSIC_NOSAMPLE = $400000 
Const BASS_SAMPLE_8BITS = 1          
Const BASS_SAMPLE_FLOAT = 256        
Const BASS_SAMPLE_MONO = 2            
Const BASS_SAMPLE_LOOP = 4            
Const BASS_SAMPLE_3D = 8              
Const BASS_SAMPLE_SOFTWARE = 16      
Const BASS_SAMPLE_MUTEMAX = 32        
Const BASS_SAMPLE_VAM = 64            
Const BASS_SAMPLE_FX = 128            
Const BASS_SAMPLE_OVER_VOL = 65536    
Const BASS_SAMPLE_OVER_POS = 131072  
Const BASS_SAMPLE_OVER_DIST = 196608 
Const BASS_MP3_SETPOS = 131072        
Const BASS_STREAM_AUTOFREE = 262144  
Const BASS_STREAM_RESTRATE = 524288  
Const BASS_STREAM_BLOCK = 1048576    
Const BASS_STREAM_DECODE = $200000  
Const BASS_STREAM_META = $400000    
Const BASS_STREAM_FILEPROC = $800000 
Const BASS_SPEAKER_FRONT = $1000000 
Const BASS_SPEAKER_REAR = $2000000  
Const BASS_SPEAKER_CENLFE = $3000000 
Const BASS_SPEAKER_REAR2 = $4000000 
Const BASS_SPEAKER_LEFT = $10000000 
Const BASS_SPEAKER_RIGHT = $20000000 
Const BASS_SPEAKER_FRONTLEFT = BASS_SPEAKER_FRONT Or BASS_SPEAKER_LEFT 
Const BASS_SPEAKER_FRONTRIGHT = BASS_SPEAKER_FRONT Or BASS_SPEAKER_RIGHT 
Const BASS_SPEAKER_REARLEFT = BASS_SPEAKER_REAR Or BASS_SPEAKER_LEFT 
Const BASS_SPEAKER_REARRIGHT = BASS_SPEAKER_REAR Or BASS_SPEAKER_RIGHT 
Const BASS_SPEAKER_CENTER = BASS_SPEAKER_CENLFE Or BASS_SPEAKER_LEFT 
Const BASS_SPEAKER_LFE = BASS_SPEAKER_CENLFE Or BASS_SPEAKER_RIGHT 
Const BASS_SPEAKER_REAR2LEFT = BASS_SPEAKER_REAR2 Or BASS_SPEAKER_LEFT 
Const BASS_SPEAKER_REAR2RIGHT = BASS_SPEAKER_REAR2 Or BASS_SPEAKER_RIGHT 
Const BASS_TAG_ID3 = 0    
Const BASS_TAG_ID3V2 = 1 
Const BASS_TAG_OGG = 2    
Const BASS_TAG_HTTP = 3  
Const BASS_TAG_ICY = 4    
Const BASS_TAG_META = 5  
Const BASS_3DMODE_NORMAL = 0 
Const BASS_3DMODE_RELATIVE = 1 
Const BASS_3DMODE_OFF = 2 
Const EAX_ENVIRONMENT_GENERIC = 0 
Const EAX_ENVIRONMENT_PADDEDCELL = 1 
Const EAX_ENVIRONMENT_ROOM = 2 
Const EAX_ENVIRONMENT_BATHROOM = 3 
Const EAX_ENVIRONMENT_LIVINGROOM = 4 
Const EAX_ENVIRONMENT_STONEROOM = 5 
Const EAX_ENVIRONMENT_AUDITORIUM = 6 
Const EAX_ENVIRONMENT_CONCERTHALL = 7 
Const EAX_ENVIRONMENT_CAVE = 8 
Const EAX_ENVIRONMENT_ARENA = 9 
Const EAX_ENVIRONMENT_HANGAR = 10 
Const EAX_ENVIRONMENT_CARPETEDHALLWAY = 11 
Const EAX_ENVIRONMENT_HALLWAY = 12 
Const EAX_ENVIRONMENT_STONECORRIDOR = 13 
Const EAX_ENVIRONMENT_ALLEY = 14 
Const EAX_ENVIRONMENT_FOREST = 15 
Const EAX_ENVIRONMENT_CITY = 16 
Const EAX_ENVIRONMENT_MOUNTAINS = 17 
Const EAX_ENVIRONMENT_QUARRY = 18 
Const EAX_ENVIRONMENT_PLAIN = 19 
Const EAX_ENVIRONMENT_PARKINGLOT = 20 
Const EAX_ENVIRONMENT_SEWERPIPE = 21 
Const EAX_ENVIRONMENT_UNDERWATER = 22 
Const EAX_ENVIRONMENT_DRUGGED = 23 
Const EAX_ENVIRONMENT_DIZZY = 24 
Const EAX_ENVIRONMENT_PSYCHOTIC = 25 
Const EAX_ENVIRONMENT_COUNT = 26 
Const EAX_PRESET_GENERIC = 1 
Const EAX_PRESET_PADDEDCELL = 2 
Const EAX_PRESET_ROOM = 3 
Const EAX_PRESET_BATHROOM = 4 
Const EAX_PRESET_LIVINGROOM = 5 
Const EAX_PRESET_STONEROOM = 6 
Const EAX_PRESET_AUDITORIUM = 7 
Const EAX_PRESET_CONCERTHALL = 8 
Const EAX_PRESET_CAVE = 9 
Const EAX_PRESET_ARENA = 10 
Const EAX_PRESET_HANGAR = 11 
Const EAX_PRESET_CARPETEDHALLWAY = 12 
Const EAX_PRESET_HALLWAY = 13 
Const EAX_PRESET_STONECORRIDOR = 14 
Const EAX_PRESET_ALLEY = 15 
Const EAX_PRESET_FOREST = 16 
Const EAX_PRESET_CITY = 17 
Const EAX_PRESET_MOUNTAINS = 18 
Const EAX_PRESET_QUARRY = 19 
Const EAX_PRESET_PLAIN = 20 
Const EAX_PRESET_PARKINGLOT = 21 
Const EAX_PRESET_SEWERPIPE = 22 
Const EAX_PRESET_UNDERWATER = 23 
Const EAX_PRESET_DRUGGED = 24 
Const EAX_PRESET_DIZZY = 25 
Const EAX_PRESET_PSYCHOTIC = 26 
Const BASS_SYNC_POS = 0 
Const BASS_SYNC_MUSICPOS = 0 
Const BASS_SYNC_MUSICINST = 1 
Const BASS_SYNC_END = 2 
Const BASS_SYNC_MUSICFX = 3 
Const BASS_SYNC_META = 4 
Const BASS_SYNC_SLIDE = 5 
Const BASS_SYNC_MESSAGE = $20000000 
Const BASS_SYNC_MIXTIME = $40000000 
Const BASS_SYNC_ONETIME = $80000000 
Const CDCHANNEL = 0        
Const RECORDCHAN = 1      
Const BASS_ACTIVE_STOPPED = 0 
Const BASS_ACTIVE_PLAYING = 1 
Const BASS_ACTIVE_STALLED = 2 
Const BASS_ACTIVE_PAUSED = 3 
Const BASS_SLIDE_FREQ = 1 
Const BASS_SLIDE_VOL = 2 
Const BASS_SLIDE_PAN = 4 
Const BASS_CDID_IDENTITY = 0 
Const BASS_CDID_UPC = 1 
Const BASS_CDID_CDDB = 2 
Const BASS_CDID_CDDB2 = 3 
Const BASS_DATA_AVAILABLE= 0          
Const BASS_DATA_FFT512   = $80000000 
Const BASS_DATA_FFT1024  = $80000001 
Const BASS_DATA_FFT2048  = $80000002 
Const BASS_DATA_FFT512S  = $80000010 
Const BASS_DATA_FFT1024S = $80000011 
Const BASS_DATA_FFT2048S = $80000012 
Const BASS_DATA_FFT_NOWINDOW = $20    
Const BASS_INPUT_OFF = $10000 
Const BASS_INPUT_ON = $20000 
Const BASS_INPUT_LEVEL = $40000 
Const BASS_INPUT_TYPE_MASK = $ff000000 
Const BASS_INPUT_TYPE_UNDEF = $00000000 
Const BASS_INPUT_TYPE_DIGITAL = $01000000 
Const BASS_INPUT_TYPE_LINE = $02000000 
Const BASS_INPUT_TYPE_MIC = $03000000 
Const BASS_INPUT_TYPE_SYNTH = $04000000 
Const BASS_INPUT_TYPE_CD = $05000000 
Const BASS_INPUT_TYPE_PHONE = $06000000 
Const BASS_INPUT_TYPE_SPEAKER = $07000000 
Const BASS_INPUT_TYPE_WAVE = $08000000 
Const BASS_INPUT_TYPE_AUX = $09000000 
Const BASS_INPUT_TYPE_ANALOG = $0a000000 
Const BASS_NET_TIMEOUT = 0 
Const BASS_NET_BUFFER = 1 
Const BASS_FILEPOS_DECODE = 0 
Const BASS_FILEPOS_DOWNLOAD = 1 
Const BASS_FILEPOS_END = 2 
Const BASS_FILE_CLOSE = 0 
Const BASS_FILE_READ = 1 
Const BASS_FILE_QUERY = 2 
Const BASS_FILE_LEN = 3 
Const BASS_OBJECT_DS = 1                      
Const BASS_OBJECT_DS3DL = 2                  
Const BASS_VAM_HARDWARE = 1 
Const BASS_VAM_SOFTWARE = 2 
Const BASS_VAM_TERM_TIME = 4 
Const BASS_VAM_TERM_DIST = 8 
Const BASS_VAM_TERM_PRIO = 16 
Const BASS_3DALG_DEFAULT = 0 
Const BASS_3DALG_OFF = 1 
Const BASS_3DALG_FULL = 2 
Const BASS_3DALG_LIGHT = 3 
Const BASS_FX_CHORUS = 0                  
Const BASS_FX_COMPRESSOR = 1              
Const BASS_FX_DISTORTION = 2              
Const BASS_FX_ECHO = 3                    
Const BASS_FX_FLANGER = 4                
Const BASS_FX_GARGLE = 5                  
Const BASS_FX_I3DL2REVERB = 6            
Const BASS_FX_PARAMEQ = 7                
Const BASS_FX_REVERB = 8                  
Const BASS_FX_PHASE_NEG_180 = 0 
Const BASS_FX_PHASE_NEG_90 = 1 
Const BASS_FX_PHASE_ZERO = 2 
Const BASS_FX_PHASE_90 = 3 
Const BASS_FX_PHASE_180 = 4


BASS.decls:
.lib "dlls\bass.dll" 
BASS_ErrorGetCode%() : "BASS_ErrorGetCode" 
BASS_Free() : "BASS_Free" 
BASS_GetCPU#() : "BASS_GetCPU" 
BASS_GetDeviceDescriptionInt%(devnum) : "BASS_GetDeviceDescription" 
BASS_GetDSoundObject(object) : "BASS_GetDSoundObject" 
BASS_GetGlobalVolumes(musvol*,samvol*,strvol*) : "BASS_GetGlobalVolumes" 
BASS_GetInfo(info*) : "BASS_GetInfo" 
BASS_GetVersion%() : "BASS_GetVersion" 
BASS_GetVolume%() : "BASS_GetVolume" 
BASS_Init%(device,freq,flags,win) : "BASS_Init" 
BASS_Pause%() : "BASS_Pause" 
BASS_SetBufferLength#(length#) : "BASS_SetBufferLength" 
BASS_SetCLSID(clsid*) : "BASS_SetCLSID" 
BASS_SetGlobalVolumes(musvol,samvol,strvol) : "BASS_SetGlobalVolumes" 
BASS_SetLogCurves(volume,pan) : "BASS_SetLogCurves" 
BASS_SetNetConfig%(option,value) : "BASS_SetNetConfig" 
BASS_SetVolume%(volume) : "BASS_SetVolume" 
BASS_Start%() : "BASS_Start" 
BASS_Stop%() : "BASS_Stop" 
BASS_Update%() : "BASS_Update" 

BASS_Apply3D%() : "BASS_Apply3D" 
BASS_Get3DFactors%(distf*,rollf*,doppf*) : "BASS_Get3DFactors" 
BASS_Get3DPosition%(pos*,vel*,front*,top*) : "BASS_Get3DPosition" 
BASS_GetEAXParameters%(env*,vol*,decay*,damp*) : "BASS_GetEAXParameters" 
BASS_Set3DAlgorithm(algo) : "BASS_Set3DAlgorithm" 
BASS_Set3DFactors%(distf#,rollf#,doppf#) : "BASS_Set3DFactors" 
BASS_Set3DPosition%(pos*,vel*,front*,top*) : "BASS_Set3DPosition" 
BASS_SetEAXParameters%(env,vol#,decay#,damp#) : "BASS_SetEAXParameters" 

BASS_CDDoor%(open) : "BASS_CDDoor" 
BASS_CDFree() : "BASS_CDFree" 
BASS_CDGetID$(id) : "BASS_CDGetID" 
BASS_CDGetTrackLength%(track) : "BASS_CDGetTrackLength" 
BASS_CDGetTracks%() : "BASS_CDGetTracks" 
BASS_CDInDrive%() : "BASS_CDInDrive" 
BASS_CDInit%(drive$,flags) : "BASS_CDInit" 
BASS_CDPlay%(track,loop,wait) : "BASS_CDPlay" 

BASS_SampleCreate%(length,freg,max,flags) : "BASS_SampleCreate" 
BASS_SampleCreateDone%() : "BASS_SampleCreateDone" 
BASS_SampleFree(handle) : "BASS_SampleFree" 
BASS_SampleGetInfo%(handle,info*) : "BASS_SampleGetInfo" 
BASS_SampleLoad%(mem,file$,offset,length,max,flags) : "BASS_SampleLoad" 
BASS_SamplePlay%(handle) : "BASS_SamplePlay" 
BASS_SamplePlay3D%(handle,pos*,orient*,vel*) : "BASS_SamplePlay3D" 
BASS_SamplePlay3DEx%(handle,pos*,orient*,vel*,start,freg,volume,loop) : "BASS_SamplePlay3DEx" 
BASS_SamplePlayEx%(handle,start,freg,volume,pan,loop) : "BASS_SamplePlayEx" 
BASS_SampleSetInfo%(handle,info*) : "BASS_SampleSetInfo" 
BASS_SampleStop%(handle) : "BASS_SampleStop" 

BASS_StreamCreate%(freg,flags,proc*,user) : "BASS_StreamCreate" 
BASS_StreamCreateFile%(mem,file$,offset,length,flags) : "BASS_StreamCreateFile" 
BASS_StreamCreateURL%(url$,offset,flags,save$) : "BASS_StreamCreateURL" 
BASS_StreamFree(handle) : "BASS_StreamFree" 
BASS_StreamGetFilePosition%(handle,mode) : "BASS_StreamGetFilePosition" 
BASS_StreamGetLength%(handle) : "BASS_StreamGetLength" 
BASS_StreamGetTagsInt%(handle,tags) : "BASS_StreamGetTags" 
BASS_StreamPlay%(handle,flush,flags) : "BASS_StreamPlay" 
BASS_StreamPreBuf%(handle) : "BASS_StreamPreBuf" 

BASS_MusicFree(handle) : "BASS_MusicFree" 
BASS_MusicGetChannelVol%(handle,channel) : "BASS_MusicGetChannelVol" 
BASS_MusicGetLength%(handle,playlen) : "BASS_MusicGetLength" 
BASS_MusicGetName$(handle) : "BASS_MusicGetName" 
BASS_MusicLoad%(mem,file$,offset,length,flags) : "BASS_MusicLoad" 
BASS_MusicPlay%(handle) : "BASS_MusicPlay" 
BASS_MusicPlayEx%(handle,pos,flags,reset) : "BASS_MusicPlayEx" 
BASS_MusicPreBuf%(handle) : "BASS_MusicPreBuf" 
BASS_MusicSetAmplify%(handle,amp) : "BASS_MusicSetAmplify" 
BASS_MusicSetChannelVol%(handle,channel,volume) : "BASS_MusicSetChannelVol" 
BASS_MusicSetPanSep%(handle,pan) : "BASS_MusicSetPanSep" 
BASS_MusicSetPositionScaler%(handle,scale) : "BASS_MusicSetPositionScaler" 

BASS_RecordFree() : "BASS_RecordFree" 
BASS_RecordGetDeviceDescriptionInt%(devnum) : "BASS_RecordGetDeviceDescription" 
BASS_RecordGetInfo(info*) : "BASS_RecordGetInfo" 
BASS_RecordGetInput%(input) : "BASS_RecordGetInput" 
BASS_RecordGetInputNameInt%(input) : "BASS_RecordGetInputName" 
BASS_RecordInit%(device) : "BASS_RecordInit" 
BASS_RecordSetInput%(input,setting) : "BASS_RecordSetInput" 
BASS_RecordStart%(freg,flags,proc*,user) : "BASS_RecordStart" 

BASS_ChannelBytes2Seconds#(handle,pos) : "BASS_ChannelBytes2Seconds" 
BASS_ChannelGet3DAttributes%(handle,mode*,min*,max*,iangle*,oangle*,outvol*) : "BASS_ChannelGet3DAttributes" 
BASS_ChannelGet3DPosition%(pos*,orient*,vel*) : "BASS_ChannelGet3DPosition" 
BASS_ChannelGetAttributes%(handle,freq*,volume*,pan*) : "BASS_ChannelGetAttributes" 
BASS_ChannelGetData%(handle,buffer*,length) : "BASS_ChannelGetData" 
BASS_ChannelGetEAXMix%(handle,mix*) : "BASS_ChannelGetEAXMix" 
BASS_ChannelGetFlags%(handle) : "BASS_ChannelGetFlags" 
BASS_ChannelGetLevel%(handle) : "BASS_ChannelGetLevel" 
BASS_ChannelGetPosition%(handle) : "BASS_ChannelGetPosition" 
BASS_ChannelIsActive%(handle) : "BASS_ChannelIsActive" 
BASS_ChannelIsSliding%(handle) : "BASS_ChannelIsSliding" 
BASS_ChannelPause%(handle) : "BASS_ChannelPause" 
BASS_ChannelRemoveDSP%(handle,dsp) : "BASS_ChannelRemoveDSP" 
BASS_ChannelRemoveFX%(handle,fx) : "BASS_ChannelRemoveFX" 
BASS_ChannelRemoveLink%(handle,cahn) : "BASS_ChannelRemoveLink" 
BASS_ChannelRemoveSync%(handle,sync) : "BASS_ChannelRemoveSync" 
BASS_ChannelResume%(handle) : "BASS_ChannelResume" 
BASS_ChannelSeconds2Bytes%(handle,pos#) : "BASS_ChannelSeconds2Bytes" 
BASS_ChannelSet3DAttributes%(handle,mode,min#,max#,iangle,oangle,outvol) : "BASS_ChannelSet3DAttributes" 
BASS_ChannelSet3DPosition%(handle,pos*,orient*,vel*) : "BASS_ChannelSet3DPosition" 
BASS_ChannelSetAttributes%(handle,freg,volume,pan) : "BASS_ChannelSetAttributes" 
BASS_ChannelSetDSP%(handle,proc*,user) : "BASS_ChannelSetDSP" 
BASS_ChannelSetEAXMix%(handle,mix#) : "BASS_ChannelSetEAXMix" 
BASS_ChannelSetFX%(handle,type) : "BASS_ChannelSetFX" 
BASS_ChannelSetLink%(handle,chan) : "BASS_ChannelSetLink" 
BASS_ChannelSetPosition%(handle,pos) : "BASS_ChannelSetPosition" 
BASS_ChannelSetSync%(handle,type,param,proc*,user) : "BASS_ChannelSetSync" 
BASS_ChannelSlideAttributes%(handle,freg,volume,pan,time) : "BASS_ChannelSlideAttributes" 
BASS_ChannelStop%(handle) : "BASS_ChannelStop" 

BASS_FXGetParameters%(handle,par*) : "BASS_FXGetParameters" 
BASS_FXSetParameters%(handle,par*) : "BASS_FXSetParameters"

;.lib "User32.dll"
;GetActiveWindow%() : "GetActiveWindow"

.lib "Kernel32.dll"
RtlMoveMemory1%(Destination*,Source,Length) : "RtlMoveMemory" 
;RtlMoveMemory2%(Destination,Source*,Length) : "RtlMoveMemory"



Jeremy Alessi(Posted 2004) [#2]
Cool ... can you give a demo showing the sound differences?


JoshK(Posted 2004) [#3]
No. This is all the effort I am making.


Jeremy Alessi(Posted 2004) [#4]
Ok, I'll have to be less lazy ... <curses> ;)


Space_guy(Posted 2004) [#5]
Just out of curiosity wasnt there already a BASS dll?
I know i experimented with one some half year ago or so.
Anyway. The more the merrier


Dirk Krause(Posted 2004) [#6]
Thanks Halo!


Tom(Posted 2004) [#7]
Don't forget BASS licencing!

http://www.un4seen.com/


Michael Reitzenstein(Posted 2004) [#8]
Wouldn't rockstarBASS have been a much more appropriate title?


Damien Sturdy(Posted 2004) [#9]
Excelent work :D


Wayne(Posted 2004) [#10]
Nice work Halo!


Dragon57(Posted 2004) [#11]
Good stuff! Many thanks.


morduun(Posted 2004) [#12]
Many thanks for this, halo; an extremely useful contribution. Any objections to me attempting to extend it a bit and posting the additions here?


JoshK(Posted 2004) [#13]
Ummm, yeah...I like, object. No, why would I care?

For my own use, I took the functions and added "_" to the end. If a global paramater (BASSENABLED) is true, I use BASS. If not, I use the natve Blitz commands.


morduun(Posted 2004) [#14]
Always nice to ask. There's some additional functionality I can get to now so I see no reason not to expand and share a bit.


Ziltch(Posted 2004) [#15]
Thanks yet again for some cool code.


Filax(Posted 2004) [#16]
Hi :)

It is possible to make a VUMETER ?


Jeroen(Posted 2004) [#17]
Hi Halo,

Excellent work man. That rocks!

Jeroen


danjo(Posted 2004) [#18]
can i ask whats the advantage of using this over whats already available? - btw im not being rude.


morduun(Posted 2004) [#19]
Mainly it's a means to get at sound functionality Blitz can't provide. By extending the userlib you can get to seek-to-millisec/pattern, VU meters and all sorts of other sound functionality Mark's ignored for years.

The downside is that using it in a commercial game requires a payment to the library providers, which is why we yammered after Mark to get it in Blitz all this time, but it's plain that's not going to happen now so this is as good as it gets.


Gabriel(Posted 2004) [#20]
It is possible to make a VUMETER ?


I was just thinking that.

This command maybe?

BASS_ChannelGetLevel%(handle) : "BASS_ChannelGetLevel"



John Blackledge(Posted 2004) [#21]
"It is possible to make a VUMETER ? "
Yeah, I've done it; and then lost the code (arrgghh!)
It didn't deal with frequencies though, just reported amplitude at any moment as an up and down slidey line. So if that's what you want, then Bass can do it.

"we yammered after Mark to get it in Blitz all this time, but it's plain that's not going to happen now"
Are we absolutely sure it's not going to happen? It seems so obvious an addition to Blitz. The method briefly described above would be the means to get accurate syncing between a playing wavefile and a model's jaw movements for realistic looking speech.


morduun(Posted 2004) [#22]
Given that I've had this request outstanding for over two years, had two threads in support of it go over 200 posts only to get locked and the only movement we've seen is additional software channels provided so we don't overrun the hardware channels -- I think it's safe to say Blitz sound won't be changed radically any time soon.


Filax(Posted 2004) [#23]
I have try this code but i can retrieve the channel level ?