Bass Module?

BlitzMax Forums/BlitzMax Programming/Bass Module?

The problem is BASS is that there isn't a Linux version (hence the reason why FMOD is used).

My FightTune originally used BASS, and thus I created the following interface code:

/*
 *  BASS.c
 *  BASS
 *
 *  Created by Nicholas Kingsley on 20/07/2007.
 *  Copyright 2007 __MyCompanyName__. All rights reserved.
 *
 */

//#define WIN32

#include "stdio.h"
#include "stdlib.h"
#include "string.h"
#include "math.h"

#ifdef WIN32
	// Windows
	#define BASSDEF(f) (WINAPI *f) // define the functions as pointers
	#include "c:\program files\BASS\c\bass.h"
	HINSTANCE bass=NULL;
#else
	// OSX Version
	#include "/Developer/bass23-osx/bass.h"
#endif

BASS_CHANNELINFO	channelInfo;
int specpos;
int diff[4];

//----------System
extern DWORD BASSGetVersion(void)
{
	return BASSVERSION;
}

extern char BASSInitialise(int device,int freq,int flags,DWORD windowHandle)
{
	memset(&channelInfo,(char) 0,sizeof(channelInfo));
	specpos=0;
	memset(&diff,(char) 0,sizeof(diff));

#ifdef WIN32
	bass=LoadLibrary("BASS.DLL"); // load BASS
	if (bass)
	{
		BASS_Init=GetProcAddress(bass,"BASS_Init"); // get BASS_Init
		if (BASS_Init)
		{
			BASS_Free=GetProcAddress(bass,"BASS_Free");
			//BASS_GetVersion=GetProcAddress(bass,"BASS_GetVersion");
			BASS_Start=GetProcAddress(bass,"BASS_Start");
			BASS_ErrorGetCode=GetProcAddress(bass,"BASS_ErrorGetCode");
			BASS_SampleLoad=GetProcAddress(bass,"BASS_SampleLoad");
			BASS_SampleGetChannel=GetProcAddress(bass,"BASS_SampleGetChannel");
			BASS_SampleStop=GetProcAddress(bass,"BASS_SampleStop");
			BASS_StreamCreateFile=GetProcAddress(bass,"BASS_StreamCreateFile");
			BASS_ChannelPlay=GetProcAddress(bass,"BASS_ChannelPlay");
			BASS_ChannelPause=GetProcAddress(bass,"BASS_ChannelPause");
			BASS_ChannelGetPosition=GetProcAddress(bass,"BASS_ChannelGetPosition");
			BASS_ChannelPreBuf=GetProcAddress(bass,"BASS_ChannelPreBuf");
			BASS_StreamFree=GetProcAddress(bass,"BASS_StreamFree");
			BASS_ChannelGetLength=GetProcAddress(bass,"BASS_ChannelGetLength");
			BASS_ChannelGetInfo=GetProcAddress(bass,"BASS_ChannelGetInfo");
			BASS_ChannelGetData=GetProcAddress(bass,"BASS_ChannelGetData");
			BASS_ChannelIsActive=GetProcAddress(bass,"BASS_ChannelIsActive");
			BASS_ChannelStop=GetProcAddress(bass,"BASS_ChannelStop");
			BASS_ChannelSetPosition=GetProcAddress(bass,"BASS_ChannelSetPosition");
			BASS_ChannelSetAttributes=GetProcAddress(bass,"BASS_ChannelSetAttributes");
			BASS_ChannelBytes2Seconds=GetProcAddress(bass,"BASS_ChannelBytes2Seconds");
			BASS_ChannelGetTags=GetProcAddress(bass,"BASS_ChannelGetTags");
			return BASS_Init(device,freq,flags,(HWND) windowHandle,NULL);
		}
		else
		{
			BASS_Free=NULL;
			BASS_ErrorGetCode=NULL;
		}
	}
	
	return -1;
#else
	return BASS_Init(device,freq,flags,0,NULL);
#endif
}

extern char BASSStart()
{
	return BASS_Start();
}

extern int BASSErrorGetCode(void)
{
	if (BASS_ErrorGetCode)
	{
		return BASS_ErrorGetCode();
	}
	else
	{
		return -1;
	}
}

extern char BASSFree(void)
{
BOOL result;

	if (BASS_Free)
	{
		result=BASS_Free();
	}
	else
	{
		result=-1;
	}

#ifdef WIN32
	FreeLibrary(bass);
	bass=NULL;
#endif
	return (char) result;
}

extern char *BASSGetDeviceDescription(DWORD device)
{
	return (char *) BASS_GetDeviceDescription(device);
}

//------------Samples
extern DWORD BASSSampleLoad(char *fileName,DWORD offset,DWORD length,DWORD max,DWORD flags)
{
	return (DWORD) BASS_SampleLoad(0,fileName,offset,length,max,flags);
}

//------------Streams
extern DWORD BASSStreamCreateFile(char *fileName,DWORD offset,DWORD length,DWORD flags)
{
	return ((DWORD) BASS_StreamCreateFile(0,fileName,offset,length,flags));
}

extern char BASSStreamFree(DWORD handle)
{
	return BASS_StreamFree((HSTREAM) handle);
}

extern DWORD BASSSampleGetChannel(DWORD handle,char onlyNew)
{
	return (DWORD) BASS_SampleGetChannel((HSAMPLE) handle,(BOOL) onlyNew);
}

extern char BASSSampleStop(DWORD handle)
{
	return BASS_SampleStop(handle);
}

//------------Channels
extern char BASSChannelPlay(DWORD handle,char restart)
{
	return BASS_ChannelPlay(handle,restart);
}

extern char BASSChannelPause(DWORD handle)
{
	return BASS_ChannelPause(handle);
}

extern QWORD BASSChannelGetPosition(DWORD handle)
{
	return BASS_ChannelGetPosition(handle);
}

extern char BASSChannelSetPosition(DWORD handle,QWORD position)
{
	return BASS_ChannelSetPosition(handle,position);
}

extern QWORD BASSChannelGetLength(DWORD handle)
{
	return BASS_ChannelGetLength(handle);
}

extern char BASSGetChannelInfo(DWORD handle)
{
	return BASS_ChannelGetInfo(handle,&channelInfo);
}

extern char BASSChannelGetData(DWORD handle,char *buffer,DWORD length)
{
	return BASS_ChannelGetData(handle,buffer,length);
}

extern DWORD BASSChannelIsActive(DWORD handle)
{
	return BASS_ChannelIsActive(handle);
}

extern char BASSChannelStop(DWORD handle)
{
	return BASS_ChannelStop(handle);
}

extern char BASSChannelSetAttributes(DWORD handle,int freq,int volume,int pan)
{
	return BASS_ChannelSetAttributes(handle,freq,volume,pan);
}

extern DWORD BASSChannelBytes2Seconds(DWORD handle,QWORD pos)
{
float length;

	// Cant return a float for some reason to BlitzMax
	length=BASS_ChannelBytes2Seconds(handle,pos);
	return (DWORD) length;
}

extern char *BASSChannelGetTags(DWORD handle,DWORD tags)
{
	return BASS_ChannelGetTags(handle,tags);
}

extern char BASSChannelPreBuf(DWORD handle,DWORD length)
{
	return BASS_ChannelPreBuf(handle,length);
}

//-----------Get information from structures
extern DWORD BASS_ReturnNumberOfChannels(void)
{
	return channelInfo.chans;
}

extern DWORD BASS_ReturnPlaybackFreq(void)
{
	return channelInfo.freq;
}

extern DWORD BASS_ReturnFlags(void)
{
	return channelInfo.flags;
}

extern DWORD BASS_ReturnCType(void)
{
	return channelInfo.ctype;
}

extern DWORD BASS_ReturnOriginalResolution(void)
{
	return channelInfo.origres;
}

extern void BASS_ClearDiff(void)
{
	memset(&diff,(char) 0,sizeof(diff));
}

extern DWORD BASS_Spectrograph5(DWORD handle,DWORD diffValue,char *storeSpec,DWORD SPECHEIGHT,DWORD BANDS)
{
register int b0,x,sc,b1,y;
float fft[1024];
float sum;
DWORD	result;

	result=0;
	if (BASS_ChannelGetData(handle,fft,BASS_DATA_FFT2048))
	{
		b0=0;
		for (x=0;x<BANDS;x++) 
		{
			sum=0.0;
			
			b1=pow(2,x*10.0/(BANDS-1));
			if (b1>1023) 
			{
				b1=1023;
			}
			
			if (b1<=b0) 
			{
				b1=b0+1; // make sure it uses at least 1 FFT bin
			}
			
			sc=10+b1-b0;
			for (;b0<b1;b0++) 
			{
				sum+=fft[1+b0];
			}
			
			y=(int) ((sqrt(sum/log10(sc))*1.7*SPECHEIGHT)-4.0); // scale it
			y=(y>SPECHEIGHT ? SPECHEIGHT : \
				y<0 ? 0 : y); 
			
			*(storeSpec+x)=(char) y;
				
			if (labs(diff[x]-y)>diffValue)
			{
				diff[x]=y;
				result=(x==0 ? result | 1 : \
						x==1 ? result | 2 : \
						x==2 ? result | 4 : result | 8);
			}
		}
	}

	return result;
}

extern void BASS_Spectrograph4(DWORD handle,DWORD SPECWIDTH,DWORD SPECHEIGHT,char *specBuff)
{
float fft[1024];
register int x,y;

	if (specBuff==NULL)	return;
	
	BASS_ChannelGetData(handle,fft,BASS_DATA_FFT2048); // get the FFT data
		
	for (x=0;x<SPECHEIGHT;x++) 
	{
		y=sqrt(fft[x+1])*3*127; // scale it (sqrt to make low values more visible)
		if (y>127) 
		{
			y=127; // cap it
		}
		
		specBuff[x*SPECWIDTH+specpos]=128+y; // plot it
	}
	
	// move marker onto next position
	specpos=(specpos+1)%SPECWIDTH;
	for (x=0;x<SPECHEIGHT;x++) 
	{
		specBuff[x*SPECWIDTH+specpos]=255;
	}
}

extern void BASS_Spectrograph3(DWORD handle,DWORD SPECWIDTH,DWORD SPECHEIGHT,char *specBuff,DWORD BANDS)
{
register int b0,x,sc,b1,y;
float fft[1024];
float sum;

	if (specBuff==NULL)	return;
	
	BASS_ChannelGetData(handle,fft,BASS_DATA_FFT2048); // get the FFT data
	
	b0=0;
	memset(specBuff,0,SPECWIDTH*SPECHEIGHT);
	for (x=0;x<BANDS;x++) 
	{
		sum=0.0;
		
		b1=pow(2,x*10.0/(BANDS-1));
		if (b1>1023) 
		{
			b1=1023;
		}
		
		if (b1<=b0) 
		{
			b1=b0+1; // make sure it uses at least 1 FFT bin
		}
		
		sc=10+b1-b0;
		for (;b0<b1;b0++) 
		{
			sum+=fft[1+b0];
		}
		
		y=(sqrt(sum/log10(sc))*1.7*SPECHEIGHT)-4; // scale it
		if (y>SPECHEIGHT) 
		{
			y=SPECHEIGHT; // cap it
		}
		
		while (--y>=0)
		{
			memset(specBuff+y*SPECWIDTH+x*(SPECWIDTH/BANDS),y+1,SPECWIDTH/BANDS-2); // draw bar
		}
	}
}

extern void BASS_Spectrograph2(DWORD handle,DWORD SPECWIDTH,DWORD SPECHEIGHT,char *specBuff)
{
float fft[1024];
register int x,y,y1;

	if (specBuff==NULL)	return;
	
	BASS_ChannelGetData(handle,fft,BASS_DATA_FFT2048); // get the FFT data

	memset(specBuff,0,SPECWIDTH*SPECHEIGHT);
	for (x=0;x<SPECWIDTH/2;x++) 
	{
		y=sqrt(fft[x+1])*3*SPECHEIGHT-4; // scale it (sqrt to make low values more visible)
//#else
//				y=fft[x+1]*10*SPECHEIGHT; // scale it (linearly)
//#endif
		if (y>SPECHEIGHT) 
		{
			y=SPECHEIGHT; // cap it
		}
		
		if (x && (y1=(y+y1)/2))
		{
			// interpolate from previous to make the display smoother
			while (--y1>=0) 
			{
				specBuff[y1*SPECWIDTH+x*2-1]=y1+1;
			}
		}
		
		y1=y;
		while (--y>=0)
		{
			specBuff[y*SPECWIDTH+x*2]=y+1; // draw level
		}
	}
}

extern void BASS_Spectrograph1(DWORD handle,DWORD SPECWIDTH,DWORD SPECHEIGHT,char *specBuff)
{
register int c,x,v,y;
float *buf;

	if (specBuff==NULL)	return;
	
	BASS_ChannelGetInfo(handle,&channelInfo); 
	buf=alloca(channelInfo.chans*SPECWIDTH*sizeof(float)); // allocate buffer for data
	if (buf==NULL)
	{
		return;
	}
	
	BASS_ChannelGetData(handle,buf,(channelInfo.chans*SPECWIDTH*sizeof(float))|BASS_DATA_FLOAT);
	memset(specBuff,(char) 0,SPECWIDTH*SPECHEIGHT);
	y=0;
	for (c=0; c<channelInfo.chans; c++) 
	{
		for (x=0;x<SPECWIDTH;x++) 
		{
			v=(1-buf[x*channelInfo.chans+c])*SPECHEIGHT/2; // invert and scale to fit display
			if (v<0) 
			{
				v=0;
			}
			else 
			if (v>=SPECHEIGHT) 
			{
				v=SPECHEIGHT-1;
			}
			
			if (!x) 
			{
				y=v;
			}
			
			do { // draw line from previous sample...
				if (y<v) 
				{
					y++;
				}
				else 
				if (y>v) 
				{
					y--;
				}
					
				specBuff[y*SPECWIDTH+x]=c&1?127:1; // left=green, right=red (could add more colours to palette for more chans)
			} while (y!=v);
		}
	}
}


' Bass constants
' Bass error messages
Const BASS_OK:Int=				0	' all is OK
Const BASS_ERROR_MEM:Int=		1	' memory error
Const BASS_ERROR_FILEOPEN:Int=	2	' can't open the file
Const BASS_ERROR_DRIVER:Int=	3	' can't find a free/valid driver
Const BASS_ERROR_BUFLOST:Int=	4	' the sample buffer was lost
Const BASS_ERROR_HANDLE:Int=	5	' invalid handle
Const BASS_ERROR_FORMAT:Int=	6	' unsupported sample format
Const BASS_ERROR_POSITION:Int=	7	' invalid playback position
Const BASS_ERROR_INIT:Int=		8	' BASS_Init has Not been successfully called
Const BASS_ERROR_START:Int=		9	' BASS_Start has Not been successfully called
Const BASS_ERROR_ALREADY:Int=	14	' already initialized/paused/whatever
Const BASS_ERROR_NOPAUSE:Int=	16	' Not paused
Const BASS_ERROR_NOCHAN:Int=	18	' can't get a free channel
Const BASS_ERROR_ILLTYPE:Int=	19	' an illegal Type was specified
Const BASS_ERROR_ILLPARAM:Int=	20	' an illegal parameter was specified
Const BASS_ERROR_NO3D:Int=		21	' no 3D support
Const BASS_ERROR_NOEAX:Int=		22	' no EAX support
Const BASS_ERROR_DEVICE:Int=	23	' illegal device number
Const BASS_ERROR_NOPLAY:Int=	24	' Not playing
Const BASS_ERROR_FREQ:Int=		25	' illegal sample rate
Const BASS_ERROR_NOTFILE:Int=	27	' the stream is Not a file stream
Const BASS_ERROR_NOHW:Int=		29	' no hardware voices available
Const BASS_ERROR_EMPTY:Int=		31	' the Mod music has no sequence data
Const BASS_ERROR_NONET:Int=		32	' no internet connection could be opened
Const BASS_ERROR_CREATE:Int=	33	' couldn't create the file
Const BASS_ERROR_NOFX:Int=		34	' effects are Not available
Const BASS_ERROR_PLAYING:Int=	35	' the channel is playing
Const BASS_ERROR_NOTAVAIL:Int=	37	' requested data is Not available
Const BASS_ERROR_DECODE:Int=	38	' the channel is a "decoding channel"
Const BASS_ERROR_DX:Int=		39	' a sufficient DirectX version is Not installed
Const BASS_ERROR_TIMEOUT:Int=	40	' connection timedout
Const BASS_ERROR_FILEFORM:Int=	41	' unsupported file format
Const BASS_ERROR_SPEAKER:Int=	42	' unavailable speaker
Const BASS_ERROR_VERSION:Int=	43	' invalid BASS version (used by add-ons)
Const BASS_ERROR_CODEC:Int=		44  ' codec is Not available/supported
Const BASS_ERROR_UNKNOWN:Int=	-1	' some other mystery error

' Initialisation variables
Const BASS_DEVICE_8BITS:Int=	1	' use 8 bit resolution, Else 16 bit
Const BASS_DEVICE_MONO:Int=		2	' use mono, Else stereo
Const BASS_DEVICE_3D:Int=		4	' enable 3D functionality

' If the BASS_DEVICE_3D flag is Not specified when initilizing BASS,

' Then the 3D flags (BASS_SAMPLE_3D And BASS_MUSIC_3D) are ignored when

' loading/creating a sample/stream/music.

Const BASS_DEVICE_LATENCY:Int=	256	' calculate device latency (BASS_INFO struct)
Const BASS_DEVICE_SPEAKERS:Int=	2048	' force enabling of speaker assignment
Const BASS_DEVICE_NOSPEAKER:Int=4096	' ignore speaker arrangement
Const BASS_SAMPLE_8BITS:Int=		1	' 8 bit
Const BASS_SAMPLE_FLOAT:Int=		256	' 32-bit floating-point
Const BASS_SAMPLE_MONO:Int=			2	' mono
Const BASS_SAMPLE_LOOP:Int=			4	' looped
Const BASS_SAMPLE_3D:Int=			8	' 3D functionality enabled
Const BASS_SAMPLE_SOFTWARE:Int=		16	' it's NOT using hardware mixing
Const BASS_SAMPLE_MUTEMAX:Int=		32	' muted at Max distance (3D only)
Const BASS_SAMPLE_VAM:Int=			64	' uses the DX7 voice allocation & management
Const BASS_SAMPLE_FX:Int=			128	' old implementation of DX8 effects are enabled

Const BASS_SAMPLE_OVER_VOL:Int=		$10000	' override lowest volume
Const BASS_SAMPLE_OVER_POS:Int=		$20000	' override longest playing
Const BASS_SAMPLE_OVER_DIST:Int=	$30000 ' override furthest from listener (3D only)

Const BASS_STREAM_PRESCAN:Int=		$20000 ' enable pin-point seeking (MP3/MP2/MP1)
Const BASS_MP3_SETPOS:Int=			BASS_STREAM_PRESCAN
Const BASS_STREAM_AUTOFREE:Int=		$40000	' automatically free the stream when it stop/ends
Const BASS_STREAM_RESTRATE:Int=		$80000	' restrict the download rate of internet file streams
Const BASS_STREAM_BLOCK:Int=		$100000' download/play internet file stream in small blocks
Const BASS_STREAM_DECODE:Int=		$200000' don't play the stream, only decode (BASS_ChannelGetData)
Const BASS_STREAM_STATUS:Int=		$800000' give server status info (HTTP/ICY tags) in DOWNLOADPROC
Const BASS_MUSIC_FLOAT:Int=			BASS_SAMPLE_FLOAT ' 32-bit floating-point
Const BASS_MUSIC_MONO:Int=			BASS_SAMPLE_MONO ' force mono mixing (less CPU usage)
Const BASS_MUSIC_LOOP:Int=			BASS_SAMPLE_LOOP ' loop music
Const BASS_MUSIC_3D:Int=			BASS_SAMPLE_3D ' enable 3D functionality
Const BASS_MUSIC_FX:Int=			BASS_SAMPLE_FX ' enable old implementation of DX8 effects
Const BASS_MUSIC_AUTOFREE:Int=		BASS_STREAM_AUTOFREE ' automatically free the music when it stop/ends
Const BASS_MUSIC_DECODE:Int=		BASS_STREAM_DECODE ' don't play the music, only decode (BASS_ChannelGetData)
Const BASS_MUSIC_PRESCAN:Int=		BASS_STREAM_PRESCAN	' calculate playback length
Const BASS_MUSIC_CALCLEN:Int=		BASS_MUSIC_PRESCAN
Const BASS_MUSIC_RAMP:Int=			$200	' normal ramping
Const BASS_MUSIC_RAMPS:Int=			$400	' sensitive ramping
Const BASS_MUSIC_SURROUND:Int=		$800	' surround sound
Const BASS_MUSIC_SURROUND2:Int=		$1000	' surround sound (mode 2)
Const BASS_MUSIC_FT2MOD:Int=		$2000	' play .Mod as FastTracker 2 does
Const BASS_MUSIC_PT1MOD:Int=		$4000	' play .Mod as ProTracker 1 does
Const BASS_MUSIC_NONINTER:Int=		$10000	' non-interpolated mixing
Const BASS_MUSIC_POSRESET:Int=		$8000	' stop all notes when moving position
Const BASS_MUSIC_POSRESETEX	:Int=	$400000' stop all notes And reset bmp/etc when moving position
Const BASS_MUSIC_STOPBACK:Int=		$80000	' stop the music on a backwards jump effect
Const BASS_MUSIC_NOSAMPLE:Int=		$100000' don't load the samples

' Speaker assignment flags

Const BASS_SPEAKER_FRONT:Int=		$1000000	' front speakers
Const BASS_SPEAKER_REAR:Int=		$2000000	' rear/side speakers
Const BASS_SPEAKER_CENLFE:Int=		$3000000	' center & LFE speakers (5.1)
Const BASS_SPEAKER_REAR2:Int=		$4000000	' rear center speakers (7.1)
'Const BASS_SPEAKER_N(n)	((n)<<24)	' n'th pair of speakers (max 15)

Const BASS_SPEAKER_LEFT:Int=		$10000000	' modifier: Left
Const BASS_SPEAKER_RIGHT:Int=		$20000000	' modifier: Right
Const BASS_SPEAKER_FRONTLEFT:Int=	BASS_SPEAKER_FRONT|BASS_SPEAKER_LEFT
Const BASS_SPEAKER_FRONTRIGHT:Int=	BASS_SPEAKER_FRONT|BASS_SPEAKER_RIGHT
Const BASS_SPEAKER_REARLEFT	:Int=	BASS_SPEAKER_REAR|BASS_SPEAKER_LEFT
Const BASS_SPEAKER_REARRIGHT:Int=	BASS_SPEAKER_REAR|BASS_SPEAKER_RIGHT
Const BASS_SPEAKER_CENTER:Int=		BASS_SPEAKER_CENLFE|BASS_SPEAKER_LEFT
Const BASS_SPEAKER_LFE:Int=			BASS_SPEAKER_CENLFE|BASS_SPEAKER_RIGHT
Const BASS_SPEAKER_REAR2LEFT:Int=	BASS_SPEAKER_REAR2|BASS_SPEAKER_LEFT
Const BASS_SPEAKER_REAR2RIGHT:Int=	BASS_SPEAKER_REAR2|BASS_SPEAKER_RIGHT

Const BASS_UNICODE:Int=			$80000000
Const BASS_RECORD_PAUSE:Int=		$8000	' start recording paused
Const BASS_DATA_FLOAT:Int=			$40000000

Const BASS_ACTIVE_STOPPED:Int=	0
Const BASS_ACTIVE_PLAYING:Int=	1
Const BASS_ACTIVE_STALLED:Int=	2
Const BASS_ACTIVE_PAUSED:Int=	3


' Bass error messages
Const BASS_OK:Int=				0	' all is OK

Const BASS_ERROR_MEM:Int=		1	' memory error

Const BASS_ERROR_FILEOPEN:Int=	2	' can't open the file

Const BASS_ERROR_DRIVER:Int=	3	' can't find a free/valid driver

Const BASS_ERROR_BUFLOST:Int=	4	' the sample buffer was lost

Const BASS_ERROR_HANDLE:Int=	5	' invalid handle

Const BASS_ERROR_FORMAT:Int=	6	' unsupported sample format

Const BASS_ERROR_POSITION:Int=	7	' invalid playback position

Const BASS_ERROR_INIT:Int=		8	' BASS_Init has Not been successfully called

Const BASS_ERROR_START:Int=		9	' BASS_Start has Not been successfully called

Const BASS_ERROR_ALREADY:Int=	14	' already initialized/paused/whatever

Const BASS_ERROR_NOPAUSE:Int=	16	' Not paused

Const BASS_ERROR_NOCHAN:Int=	18	' can't get a free channel

Const BASS_ERROR_ILLTYPE:Int=	19	' an illegal Type was specified

Const BASS_ERROR_ILLPARAM:Int=	20	' an illegal parameter was specified

Const BASS_ERROR_NO3D:Int=		21	' no 3D support

Const BASS_ERROR_NOEAX:Int=		22	' no EAX support

Const BASS_ERROR_DEVICE:Int=	23	' illegal device number

Const BASS_ERROR_NOPLAY:Int=	24	' Not playing

Const BASS_ERROR_FREQ:Int=		25	' illegal sample rate

Const BASS_ERROR_NOTFILE:Int=	27	' the stream is Not a file stream

Const BASS_ERROR_NOHW:Int=		29	' no hardware voices available

Const BASS_ERROR_EMPTY:Int=		31	' the Mod music has no sequence data

Const BASS_ERROR_NONET:Int=		32	' no internet connection could be opened

Const BASS_ERROR_CREATE:Int=	33	' couldn't create the file

Const BASS_ERROR_NOFX:Int=		34	' effects are Not available

Const BASS_ERROR_PLAYING:Int=	35	' the channel is playing

Const BASS_ERROR_NOTAVAIL:Int=	37	' requested data is Not available

Const BASS_ERROR_DECODE:Int=	38	' the channel is a "decoding channel"

Const BASS_ERROR_DX:Int=		39	' a sufficient DirectX version is Not installed

Const BASS_ERROR_TIMEOUT:Int=	40	' connection timedout

Const BASS_ERROR_FILEFORM:Int=	41	' unsupported file format

Const BASS_ERROR_SPEAKER:Int=	42	' unavailable speaker

Const BASS_ERROR_VERSION:Int=	43	' invalid BASS version (used by add-ons)

Const BASS_ERROR_CODEC:Int=		44  ' codec is Not available/supported

Const BASS_ERROR_UNKNOWN:Int=	-1	' some other mystery error

' Initialisation variables
Const BASS_DEVICE_8BITS:Int=	1	' use 8 bit resolution, Else 16 bit

Const BASS_DEVICE_MONO:Int=		2	' use mono, Else stereo

Const BASS_DEVICE_3D:Int=		4	' enable 3D functionality

' If the BASS_DEVICE_3D flag is Not specified when initilizing BASS,

' Then the 3D flags (BASS_SAMPLE_3D And BASS_MUSIC_3D) are ignored when

' loading/creating a sample/stream/music.

Const BASS_DEVICE_LATENCY:Int=	256	' calculate device latency (BASS_INFO struct)

Const BASS_DEVICE_SPEAKERS:Int=	2048	' force enabling of speaker assignment

Const BASS_DEVICE_NOSPEAKER:Int=4096	' ignore speaker arrangement

Const BASS_SAMPLE_8BITS:Int=		1	' 8 bit

Const BASS_SAMPLE_FLOAT:Int=		256	' 32-bit floating-point

Const BASS_SAMPLE_MONO:Int=			2	' mono

Const BASS_SAMPLE_LOOP:Int=			4	' looped

Const BASS_SAMPLE_3D:Int=			8	' 3D functionality enabled

Const BASS_SAMPLE_SOFTWARE:Int=		16	' it's NOT using hardware mixing

Const BASS_SAMPLE_MUTEMAX:Int=		32	' muted at Max distance (3D only)

Const BASS_SAMPLE_VAM:Int=			64	' uses the DX7 voice allocation & management

Const BASS_SAMPLE_FX:Int=			128	' old implementation of DX8 effects are enabled

Const BASS_SAMPLE_OVER_VOL:Int=		$10000	' override lowest volume

Const BASS_SAMPLE_OVER_POS:Int=		$20000	' override longest playing

Const BASS_SAMPLE_OVER_DIST:Int=	$30000 ' override furthest from listener (3D only)



Const BASS_STREAM_PRESCAN:Int=		$20000 ' enable pin-point seeking (MP3/MP2/MP1)

Const BASS_MP3_SETPOS:Int=			BASS_STREAM_PRESCAN

Const BASS_STREAM_AUTOFREE:Int=		$40000	' automatically free the stream when it stop/ends

Const BASS_STREAM_RESTRATE:Int=		$80000	' restrict the download rate of internet file streams

Const BASS_STREAM_BLOCK:Int=		$100000' download/play internet file stream in small blocks

Const BASS_STREAM_DECODE:Int=		$200000' don't play the stream, only decode (BASS_ChannelGetData)

Const BASS_STREAM_STATUS:Int=		$800000' give server status info (HTTP/ICY tags) in DOWNLOADPROC



Const BASS_MUSIC_FLOAT:Int=			BASS_SAMPLE_FLOAT ' 32-bit floating-point

Const BASS_MUSIC_MONO:Int=			BASS_SAMPLE_MONO ' force mono mixing (less CPU usage)

Const BASS_MUSIC_LOOP:Int=			BASS_SAMPLE_LOOP ' loop music

Const BASS_MUSIC_3D:Int=			BASS_SAMPLE_3D ' enable 3D functionality

Const BASS_MUSIC_FX:Int=			BASS_SAMPLE_FX ' enable old implementation of DX8 effects

Const BASS_MUSIC_AUTOFREE:Int=		BASS_STREAM_AUTOFREE ' automatically free the music when it stop/ends

Const BASS_MUSIC_DECODE:Int=		BASS_STREAM_DECODE ' don't play the music, only decode (BASS_ChannelGetData)

Const BASS_MUSIC_PRESCAN:Int=		BASS_STREAM_PRESCAN	' calculate playback length

Const BASS_MUSIC_CALCLEN:Int=		BASS_MUSIC_PRESCAN

Const BASS_MUSIC_RAMP:Int=			$200	' normal ramping

Const BASS_MUSIC_RAMPS:Int=			$400	' sensitive ramping

Const BASS_MUSIC_SURROUND:Int=		$800	' surround sound

Const BASS_MUSIC_SURROUND2:Int=		$1000	' surround sound (mode 2)

Const BASS_MUSIC_FT2MOD:Int=		$2000	' play .Mod as FastTracker 2 does

Const BASS_MUSIC_PT1MOD:Int=		$4000	' play .Mod as ProTracker 1 does

Const BASS_MUSIC_NONINTER:Int=		$10000	' non-interpolated mixing

Const BASS_MUSIC_POSRESET:Int=		$8000	' stop all notes when moving position

Const BASS_MUSIC_POSRESETEX	:Int=	$400000' stop all notes And reset bmp/etc when moving position

Const BASS_MUSIC_STOPBACK:Int=		$80000	' stop the music on a backwards jump effect

Const BASS_MUSIC_NOSAMPLE:Int=		$100000' don't load the samples



' Speaker assignment flags

Const BASS_SPEAKER_FRONT:Int=		$1000000	' front speakers

Const BASS_SPEAKER_REAR:Int=		$2000000	' rear/side speakers

Const BASS_SPEAKER_CENLFE:Int=		$3000000	' center & LFE speakers (5.1)

Const BASS_SPEAKER_REAR2:Int=		$4000000	' rear center speakers (7.1)

'Const BASS_SPEAKER_N(n)	((n)<<24)	' n'th pair of speakers (max 15)

Const BASS_SPEAKER_LEFT:Int=		$10000000	' modifier: Left

Const BASS_SPEAKER_RIGHT:Int=		$20000000	' modifier: Right

Const BASS_SPEAKER_FRONTLEFT:Int=	BASS_SPEAKER_FRONT|BASS_SPEAKER_LEFT

Const BASS_SPEAKER_FRONTRIGHT:Int=	BASS_SPEAKER_FRONT|BASS_SPEAKER_RIGHT

Const BASS_SPEAKER_REARLEFT	:Int=	BASS_SPEAKER_REAR|BASS_SPEAKER_LEFT

Const BASS_SPEAKER_REARRIGHT:Int=	BASS_SPEAKER_REAR|BASS_SPEAKER_RIGHT

Const BASS_SPEAKER_CENTER:Int=		BASS_SPEAKER_CENLFE|BASS_SPEAKER_LEFT

Const BASS_SPEAKER_LFE:Int=			BASS_SPEAKER_CENLFE|BASS_SPEAKER_RIGHT

Const BASS_SPEAKER_REAR2LEFT:Int=	BASS_SPEAKER_REAR2|BASS_SPEAKER_LEFT

Const BASS_SPEAKER_REAR2RIGHT:Int=	BASS_SPEAKER_REAR2|BASS_SPEAKER_RIGHT



Const  BASS_UNICODE:Int=			$80000000



Const  BASS_RECORD_PAUSE:Int=		$8000	' start recording paused

Const BASS_DATA_FLOAT:Int=			$40000000


The interface code isn't complete, but the rest should be.