Creating Modules (BASS Mod)

BlitzMax Forums/BlitzMax Programming/Creating Modules (BASS Mod)

I'm very new to the whole BMax-Module stuff and I want to use the Un4Seen BASS Audio Engine with BlitzMax. So I've downloaded the BASS-Engine and started to write a module for BMax.

Using the tools 'pexports' and 'dlltool' I created a lib-file from the bass.dll. Then I created a new Blitz-Module-File that looks like this:


Strict

Module imw.Bass

ModuleInfo "Name: Bass BlitzMax Module"
ModuleInfo "Description: Wrapper Moduler for BASS Audio Engine"

Import "libbass.a"

Extern "win32"
End Extern


And here's the problem: I don't know how I have to declare the function calls. I've tried various things and everytime I've done a call my app crashes without a message - even in debug mode.

The original header-file of BASS looks like that:

/* BASS 2.1 C/C++ header file, copyright (c) 1999-2005 Ian Luck.
   Please report bugs/suggestions/etc... to bass@...

   See the BASS.CHM file for more complete documentation */

#ifndef BASS_H
#define BASS_H

#include <wtypes.h>

#ifdef __cplusplus
extern "C" {
#endif

#ifndef BASSDEF
#define BASSDEF(f) WINAPI f
#endif

typedef unsigned __int64 QWORD;	// 64-bit

typedef DWORD HMUSIC;		// MOD music handle
typedef DWORD HSAMPLE;		// sample handle
typedef DWORD HCHANNEL;		// playing sample's channel handle
typedef DWORD HSTREAM;		// sample stream handle
typedef DWORD HRECORD;		// recording handle
typedef DWORD HSYNC;		// synchronizer handle
typedef DWORD HDSP;			// DSP handle
typedef DWORD HFX;			// DX8 effect handle

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

// Initialization flags
#define BASS_DEVICE_8BITS	1	// use 8 bit resolution, else 16 bit
#define BASS_DEVICE_MONO	2	// use mono, else stereo
#define BASS_DEVICE_3D		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. */
#define BASS_DEVICE_LATENCY	256	// calculate device latency (BASS_INFO struct)
#define BASS_DEVICE_SPEAKERS 2048	// force enabling of speaker assignment

// DirectSound interfaces (for use with BASS_GetDSoundObject)
#define BASS_OBJECT_DS		1	// IDirectSound
#define BASS_OBJECT_DS3DL	2	// IDirectSound3DListener

typedef struct {
	DWORD size;		// size of this struct (set this before calling the function)
	DWORD flags;	// device capabilities (DSCAPS_xxx flags)
	DWORD hwsize;	// size of total device hardware memory
	DWORD hwfree;	// size of free device hardware memory
	DWORD freesam;	// number of free sample slots in the hardware
	DWORD free3d;	// number of free 3D sample slots in the hardware
	DWORD minrate;	// min sample rate supported by the hardware
	DWORD maxrate;	// max sample rate supported by the hardware
	BOOL eax;		// device supports EAX? (always FALSE if BASS_DEVICE_3D was not used)
	DWORD minbuf;	// recommended minimum buffer length in ms (requires BASS_DEVICE_LATENCY)
	DWORD dsver;	// DirectSound version
	DWORD latency;	// delay (in ms) before start of playback (requires BASS_DEVICE_LATENCY)
	DWORD initflags;// "flags" parameter of BASS_Init call
	DWORD speakers; // number of speakers available
	char *driver;	// driver
} BASS_INFO;

// BASS_INFO flags (from DSOUND.H)
#define DSCAPS_CONTINUOUSRATE	0x00000010
/* supports all sample rates between min/maxrate */
#define DSCAPS_EMULDRIVER		0x00000020
/* device does NOT have hardware DirectSound support */
#define DSCAPS_CERTIFIED		0x00000040
/* device driver has been certified by Microsoft */
/* The following flags tell what type of samples are supported by HARDWARE
mixing, all these formats are supported by SOFTWARE mixing */
#define DSCAPS_SECONDARYMONO	0x00000100	// mono
#define DSCAPS_SECONDARYSTEREO	0x00000200	// stereo
#define DSCAPS_SECONDARY8BIT	0x00000400	// 8 bit
#define DSCAPS_SECONDARY16BIT	0x00000800	// 16 bit

typedef struct {
	DWORD size;		// size of this struct (set this before calling the function)
	DWORD flags;	// device capabilities (DSCCAPS_xxx flags)
	DWORD formats;	// supported standard formats (WAVE_FORMAT_xxx flags)
	DWORD inputs;	// number of inputs
	BOOL singlein;	// TRUE = only 1 input can be set at a time
	char *driver;	// driver
} BASS_RECORDINFO;

// BASS_RECORDINFO flags (from DSOUND.H)
#define DSCCAPS_EMULDRIVER	DSCAPS_EMULDRIVER
/* device does NOT have hardware DirectSound recording support */
#define DSCCAPS_CERTIFIED	DSCAPS_CERTIFIED
/* device driver has been certified by Microsoft */

// defines for formats field of BASS_RECORDINFO (from MMSYSTEM.H)
#ifndef WAVE_FORMAT_1M08
#define WAVE_FORMAT_1M08       0x00000001       /* 11.025 kHz, Mono,   8-bit  */
#define WAVE_FORMAT_1S08       0x00000002       /* 11.025 kHz, Stereo, 8-bit  */
#define WAVE_FORMAT_1M16       0x00000004       /* 11.025 kHz, Mono,   16-bit */
#define WAVE_FORMAT_1S16       0x00000008       /* 11.025 kHz, Stereo, 16-bit */
#define WAVE_FORMAT_2M08       0x00000010       /* 22.05  kHz, Mono,   8-bit  */
#define WAVE_FORMAT_2S08       0x00000020       /* 22.05  kHz, Stereo, 8-bit  */
#define WAVE_FORMAT_2M16       0x00000040       /* 22.05  kHz, Mono,   16-bit */
#define WAVE_FORMAT_2S16       0x00000080       /* 22.05  kHz, Stereo, 16-bit */
#define WAVE_FORMAT_4M08       0x00000100       /* 44.1   kHz, Mono,   8-bit  */
#define WAVE_FORMAT_4S08       0x00000200       /* 44.1   kHz, Stereo, 8-bit  */
#define WAVE_FORMAT_4M16       0x00000400       /* 44.1   kHz, Mono,   16-bit */
#define WAVE_FORMAT_4S16       0x00000800       /* 44.1   kHz, Stereo, 16-bit */
#endif

// Sample info structure & flags
typedef struct {
	DWORD freq;		// default playback rate
	DWORD volume;	// default volume (0-100)
	int pan;		// default pan (-100=left, 0=middle, 100=right)
	DWORD flags;	// BASS_SAMPLE_xxx flags
	DWORD length;	// length (in samples, not bytes)
	DWORD max;		// maximum simultaneous playbacks
	DWORD origres;	// original resolution bits
/* The following are the sample's default 3D attributes (if the sample
is 3D, BASS_SAMPLE_3D is in flags) see BASS_ChannelSet3DAttributes */
	DWORD mode3d;	// BASS_3DMODE_xxx mode
	float mindist;	// minimum distance
	float maxdist;	// maximum distance
	DWORD iangle;	// angle of inside projection cone
	DWORD oangle;	// angle of outside projection cone
	DWORD outvol;	// delta-volume outside the projection cone
/* The following are the defaults used if the sample uses the DirectX 7
voice allocation/management features. */
	DWORD vam;		// voice allocation/management flags (BASS_VAM_xxx)
	DWORD priority;	// priority (0=lowest, 0xffffffff=highest)
} BASS_SAMPLE;

#define BASS_SAMPLE_8BITS		1	// 8 bit
#define BASS_SAMPLE_FLOAT		256	// 32-bit floating-point
#define BASS_SAMPLE_MONO		2	// mono, else stereo
#define BASS_SAMPLE_LOOP		4	// looped
#define BASS_SAMPLE_3D			8	// 3D functionality enabled
#define BASS_SAMPLE_SOFTWARE	16	// it's NOT using hardware mixing
#define BASS_SAMPLE_MUTEMAX		32	// muted at max distance (3D only)
#define BASS_SAMPLE_VAM			64	// uses the DX7 voice allocation & management
#define BASS_SAMPLE_FX			128	// old implementation of DX8 effects are enabled
#define BASS_SAMPLE_OVER_VOL	0x10000	// override lowest volume
#define BASS_SAMPLE_OVER_POS	0x20000	// override longest playing
#define BASS_SAMPLE_OVER_DIST	0x30000 // override furthest from listener (3D only)

#define BASS_MP3_SETPOS			0x20000 // enable pin-point seeking on the MP3/MP2/MP1

#define BASS_STREAM_AUTOFREE	0x40000	// automatically free the stream when it stop/ends
#define BASS_STREAM_RESTRATE	0x80000	// restrict the download rate of internet file streams
#define BASS_STREAM_BLOCK		0x100000// download/play internet file stream in small blocks
#define BASS_STREAM_DECODE		0x200000// don't play the stream, only decode (BASS_ChannelGetData)
#define BASS_STREAM_META		0x400000// request metadata from a Shoutcast stream
#define BASS_STREAM_STATUS		0x800000// give server status info (HTTP/ICY tags) in DOWNLOADPROC

#define BASS_MUSIC_FLOAT		BASS_SAMPLE_FLOAT // 32-bit floating-point
#define BASS_MUSIC_MONO			BASS_SAMPLE_MONO // force mono mixing (less CPU usage)
#define BASS_MUSIC_LOOP			BASS_SAMPLE_LOOP // loop music
#define BASS_MUSIC_3D			BASS_SAMPLE_3D // enable 3D functionality
#define BASS_MUSIC_FX			BASS_SAMPLE_FX // enable old implementation of DX8 effects
#define BASS_MUSIC_AUTOFREE		BASS_STREAM_AUTOFREE // automatically free the music when it stop/ends
#define BASS_MUSIC_DECODE		BASS_STREAM_DECODE // don't play the music, only decode (BASS_ChannelGetData)
#define BASS_MUSIC_RAMP			0x200	// normal ramping
#define BASS_MUSIC_RAMPS		0x400	// sensitive ramping
#define BASS_MUSIC_SURROUND		0x800	// surround sound
#define BASS_MUSIC_SURROUND2	0x1000	// surround sound (mode 2)
#define BASS_MUSIC_FT2MOD		0x2000	// play .MOD as FastTracker 2 does
#define BASS_MUSIC_PT1MOD		0x4000	// play .MOD as ProTracker 1 does
#define BASS_MUSIC_CALCLEN		0x8000	// calculate playback length
#define BASS_MUSIC_NONINTER		0x10000	// non-interpolated mixing
#define BASS_MUSIC_POSRESET		0x20000	// stop all notes when moving position
#define BASS_MUSIC_POSRESETEX	0x400000// stop all notes and reset bmp/etc when moving position
#define BASS_MUSIC_STOPBACK		0x80000	// stop the music on a backwards jump effect
#define BASS_MUSIC_NOSAMPLE		0x100000// don't load the samples

// Speaker assignment flags
#define BASS_SPEAKER_FRONT	0x1000000	// front speakers
#define BASS_SPEAKER_REAR	0x2000000	// rear/side speakers
#define BASS_SPEAKER_CENLFE	0x3000000	// center & LFE speakers (5.1)
#define BASS_SPEAKER_REAR2	0x4000000	// rear center speakers (7.1)
#define BASS_SPEAKER_N(n)	((n)<<24)	// n'th pair of speakers (max 15)
#define BASS_SPEAKER_LEFT	0x10000000	// modifier: left
#define BASS_SPEAKER_RIGHT	0x20000000	// modifier: right
#define BASS_SPEAKER_FRONTLEFT	BASS_SPEAKER_FRONT|BASS_SPEAKER_LEFT
#define BASS_SPEAKER_FRONTRIGHT	BASS_SPEAKER_FRONT|BASS_SPEAKER_RIGHT
#define BASS_SPEAKER_REARLEFT	BASS_SPEAKER_REAR|BASS_SPEAKER_LEFT
#define BASS_SPEAKER_REARRIGHT	BASS_SPEAKER_REAR|BASS_SPEAKER_RIGHT
#define BASS_SPEAKER_CENTER		BASS_SPEAKER_CENLFE|BASS_SPEAKER_LEFT
#define BASS_SPEAKER_LFE		BASS_SPEAKER_CENLFE|BASS_SPEAKER_RIGHT
#define BASS_SPEAKER_REAR2LEFT	BASS_SPEAKER_REAR2|BASS_SPEAKER_LEFT
#define BASS_SPEAKER_REAR2RIGHT	BASS_SPEAKER_REAR2|BASS_SPEAKER_RIGHT

#define BASS_UNICODE			0x80000000

#define BASS_RECORD_PAUSE		0x8000	// start recording paused

// DX7 voice allocation flags
#define BASS_VAM_HARDWARE		1
/* Play the sample in hardware. If no hardware voices are available then
the "play" call will fail */
#define BASS_VAM_SOFTWARE		2
/* Play the sample in software (ie. non-accelerated). No other VAM flags
may be used together with this flag. */

// DX7 voice management flags
/* These flags enable hardware resource stealing... if the hardware has no
available voices, a currently playing buffer will be stopped to make room for
the new buffer. NOTE: only samples loaded/created with the BASS_SAMPLE_VAM
flag are considered for termination by the DX7 voice management. */
#define BASS_VAM_TERM_TIME		4
/* If there are no free hardware voices, the buffer to be terminated will be
the one with the least time left to play. */
#define BASS_VAM_TERM_DIST		8
/* If there are no free hardware voices, the buffer to be terminated will be
one that was loaded/created with the BASS_SAMPLE_MUTEMAX flag and is beyond
it's max distance. If there are no buffers that match this criteria, then the
"play" call will fail. */
#define BASS_VAM_TERM_PRIO		16
/* If there are no free hardware voices, the buffer to be terminated will be
the one with the lowest priority. */

typedef struct {

	DWORD freq;		// default playback rate
	DWORD chans;	// channels
	DWORD flags;	// BASS_SAMPLE/STREAM/MUSIC/SPEAKER flags
	DWORD ctype;	// type of channel
	DWORD origres;	// original resolution
} BASS_CHANNELINFO;

// BASS_CHANNELINFO types
#define BASS_CTYPE_SAMPLE		1
#define BASS_CTYPE_RECORD		2
#define BASS_CTYPE_STREAM		0x10000
#define BASS_CTYPE_STREAM_WAV	0x10001
#define BASS_CTYPE_STREAM_OGG	0x10002
#define BASS_CTYPE_STREAM_MP1	0x10003
#define BASS_CTYPE_STREAM_MP2	0x10004
#define BASS_CTYPE_STREAM_MP3	0x10005
#define BASS_CTYPE_MUSIC_MOD	0x20000
#define BASS_CTYPE_MUSIC_MTM	0x20001
#define BASS_CTYPE_MUSIC_S3M	0x20002
#define BASS_CTYPE_MUSIC_XM		0x20003
#define BASS_CTYPE_MUSIC_IT		0x20004
#define BASS_CTYPE_MUSIC_MO3	0x00100 // mo3 flag

// 3D vector (for 3D positions/velocities/orientations)
typedef struct BASS_3DVECTOR {
#ifdef __cplusplus
	BASS_3DVECTOR() {};
	BASS_3DVECTOR(float _x, float _y, float _z) : x(_x), y(_y), z(_z) {};
#endif
	float x;	// +=right, -=left
	float y;	// +=up, -=down
	float z;	// +=front, -=behind
} BASS_3DVECTOR;

// 3D channel modes
#define BASS_3DMODE_NORMAL		0
/* normal 3D processing */
#define BASS_3DMODE_RELATIVE	1
/* The channel's 3D position (position/velocity/orientation) are relative to
the listener. When the listener's position/velocity/orientation is changed
with BASS_Set3DPosition, the channel's position relative to the listener does
not change. */
#define BASS_3DMODE_OFF			2
/* Turn off 3D processing on the channel, the sound will be played
in the center. */

// EAX environments, use with BASS_SetEAXParameters
enum
{
    EAX_ENVIRONMENT_GENERIC,
    EAX_ENVIRONMENT_PADDEDCELL,
    EAX_ENVIRONMENT_ROOM,
    EAX_ENVIRONMENT_BATHROOM,
    EAX_ENVIRONMENT_LIVINGROOM,
    EAX_ENVIRONMENT_STONEROOM,
    EAX_ENVIRONMENT_AUDITORIUM,
    EAX_ENVIRONMENT_CONCERTHALL,
    EAX_ENVIRONMENT_CAVE,
    EAX_ENVIRONMENT_ARENA,
    EAX_ENVIRONMENT_HANGAR,
    EAX_ENVIRONMENT_CARPETEDHALLWAY,
    EAX_ENVIRONMENT_HALLWAY,
    EAX_ENVIRONMENT_STONECORRIDOR,
    EAX_ENVIRONMENT_ALLEY,
    EAX_ENVIRONMENT_FOREST,
    EAX_ENVIRONMENT_CITY,
    EAX_ENVIRONMENT_MOUNTAINS,
    EAX_ENVIRONMENT_QUARRY,
    EAX_ENVIRONMENT_PLAIN,
    EAX_ENVIRONMENT_PARKINGLOT,
    EAX_ENVIRONMENT_SEWERPIPE,
    EAX_ENVIRONMENT_UNDERWATER,
    EAX_ENVIRONMENT_DRUGGED,
    EAX_ENVIRONMENT_DIZZY,
    EAX_ENVIRONMENT_PSYCHOTIC,

    EAX_ENVIRONMENT_COUNT			// total number of environments
};

// EAX presets, usage: BASS_SetEAXParameters(EAX_PRESET_xxx)
#define EAX_PRESET_GENERIC         EAX_ENVIRONMENT_GENERIC,0.5F,1.493F,0.5F
#define EAX_PRESET_PADDEDCELL      EAX_ENVIRONMENT_PADDEDCELL,0.25F,0.1F,0.0F
#define EAX_PRESET_ROOM            EAX_ENVIRONMENT_ROOM,0.417F,0.4F,0.666F
#define EAX_PRESET_BATHROOM        EAX_ENVIRONMENT_BATHROOM,0.653F,1.499F,0.166F
#define EAX_PRESET_LIVINGROOM      EAX_ENVIRONMENT_LIVINGROOM,0.208F,0.478F,0.0F
#define EAX_PRESET_STONEROOM       EAX_ENVIRONMENT_STONEROOM,0.5F,2.309F,0.888F
#define EAX_PRESET_AUDITORIUM      EAX_ENVIRONMENT_AUDITORIUM,0.403F,4.279F,0.5F
#define EAX_PRESET_CONCERTHALL     EAX_ENVIRONMENT_CONCERTHALL,0.5F,3.961F,0.5F
#define EAX_PRESET_CAVE            EAX_ENVIRONMENT_CAVE,0.5F,2.886F,1.304F
#define EAX_PRESET_ARENA           EAX_ENVIRONMENT_ARENA,0.361F,7.284F,0.332F
#define EAX_PRESET_HANGAR          EAX_ENVIRONMENT_HANGAR,0.5F,10.0F,0.3F
#define EAX_PRESET_CARPETEDHALLWAY EAX_ENVIRONMENT_CARPETEDHALLWAY,0.153F,0.259F,2.0F
#define EAX_PRESET_HALLWAY         EAX_ENVIRONMENT_HALLWAY,0.361F,1.493F,0.0F
#define EAX_PRESET_STONECORRIDOR   EAX_ENVIRONMENT_STONECORRIDOR,0.444F,2.697F,0.638F
#define EAX_PRESET_ALLEY           EAX_ENVIRONMENT_ALLEY,0.25F,1.752F,0.776F
#define EAX_PRESET_FOREST          EAX_ENVIRONMENT_FOREST,0.111F,3.145F,0.472F
#define EAX_PRESET_CITY            EAX_ENVIRONMENT_CITY,0.111F,2.767F,0.224F
#define EAX_PRESET_MOUNTAINS       EAX_ENVIRONMENT_MOUNTAINS,0.194F,7.841F,0.472F
#define EAX_PRESET_QUARRY          EAX_ENVIRONMENT_QUARRY,1.0F,1.499F,0.5F
#define EAX_PRESET_PLAIN           EAX_ENVIRONMENT_PLAIN,0.097F,2.767F,0.224F
#define EAX_PRESET_PARKINGLOT      EAX_ENVIRONMENT_PARKINGLOT,0.208F,1.652F,1.5F
#define EAX_PRESET_SEWERPIPE       EAX_ENVIRONMENT_SEWERPIPE,0.652F,2.886F,0.25F
#define EAX_PRESET_UNDERWATER      EAX_ENVIRONMENT_UNDERWATER,1.0F,1.499F,0.0F
#define EAX_PRESET_DRUGGED         EAX_ENVIRONMENT_DRUGGED,0.875F,8.392F,1.388F
#define EAX_PRESET_DIZZY           EAX_ENVIRONMENT_DIZZY,0.139F,17.234F,0.666F
#define EAX_PRESET_PSYCHOTIC       EAX_ENVIRONMENT_PSYCHOTIC,0.486F,7.563F,0.806F

// software 3D mixing algorithm modes (used with BASS_Set3DAlgorithm)
#define BASS_3DALG_DEFAULT	0
/* default algorithm (currently translates to BASS_3DALG_OFF) */
#define BASS_3DALG_OFF		1
/* Uses normal left and right panning. The vertical axis is ignored except for
scaling of volume due to distance. Doppler shift and volume scaling are still
applied, but the 3D filtering is not performed. This is the most CPU efficient
software implementation, but provides no virtual 3D audio effect. Head Related
Transfer Function processing will not be done. Since only normal stereo panning
is used, a channel using this algorithm may be accelerated by a 2D hardware
voice if no free 3D hardware voices are available. */
#define BASS_3DALG_FULL		2
/* This algorithm gives the highest quality 3D audio effect, but uses more CPU.
Requires Windows 98 2nd Edition or Windows 2000 that uses WDM drivers, if this
mode is not available then BASS_3DALG_OFF will be used instead. */
#define BASS_3DALG_LIGHT	3
/* This algorithm gives a good 3D audio effect, and uses less CPU than the FULL
mode. Requires Windows 98 2nd Edition or Windows 2000 that uses WDM drivers, if
this mode is not available then BASS_3DALG_OFF will be used instead. */

typedef DWORD (CALLBACK STREAMPROC)(HSTREAM handle, void *buffer, DWORD length, DWORD user);
/* User stream callback function. NOTE: A stream function should obviously be as quick
as possible, other streams (and MOD musics) can't be mixed until it's finished.
handle : The stream that needs writing
buffer : Buffer to write the samples in
length : Number of bytes to write
user   : The 'user' parameter value given when calling BASS_StreamCreate
RETURN : Number of bytes written. Set the BASS_STREAMPROC_END flag to end
         the stream. */

#define BASS_STREAMPROC_END		0x80000000	// end of user stream flag

// BASS_StreamGetFilePosition modes
#define BASS_FILEPOS_DECODE		0
#define BASS_FILEPOS_DOWNLOAD	1
#define BASS_FILEPOS_END		2
#define BASS_FILEPOS_START		3

// STREAMFILEPROC actions
#define BASS_FILE_CLOSE		0
#define BASS_FILE_READ		1
#define BASS_FILE_QUERY		2
#define BASS_FILE_LEN		3
#define BASS_FILE_SEEK		4

typedef DWORD (CALLBACK STREAMFILEPROC)(DWORD action, DWORD param1, DWORD param2, DWORD user);
/* User file stream callback function.
action : The action to perform, one of BASS_FILE_xxx values.
param1 : Depends on "action"
param2 : Depends on "action"
user   : The 'user' parameter value given when calling BASS_StreamCreate
RETURN : Depends on "action" */

typedef void (CALLBACK DOWNLOADPROC)(void *buffer, DWORD length, DWORD user);
/* Internet stream download callback function.
buffer : Buffer containing the downloaded data... NULL=end of download
length : Number of bytes in the buffer
user   : The 'user' parameter value given when calling BASS_StreamCreateURL */

/* Sync types (with BASS_ChannelSetSync "param" and SYNCPROC "data"
definitions) & flags. */
#define BASS_SYNC_MUSICPOS	0
#define BASS_SYNC_POS		0
/* Sync when a channel reaches a position.
if HMUSIC...
param: LOWORD=order (0=first, -1=all) HIWORD=row (0=first, -1=all)
data : LOWORD=order HIWORD=row
if HSTREAM...
param: position in bytes
data : not used */
#define BASS_SYNC_MUSICINST	1
/* Sync when an instrument (sample for the non-instrument based formats)
is played in a music (not including retrigs).
param: LOWORD=instrument (1=first) HIWORD=note (0=c0...119=b9, -1=all)
data : LOWORD=note HIWORD=volume (0-64) */
#define BASS_SYNC_END		2
/* Sync when a channel reaches the end.
param: not used
data : 1 = the sync is triggered by a backward jump in a MOD music, otherwise not used */
#define BASS_SYNC_MUSICFX	3
/* Sync when the "sync" effect (XM/MTM/MOD: E8x/Wxx, IT/S3M: S2x) is used.
param: 0:data=pos, 1:data="x" value
data : param=0: LOWORD=order HIWORD=row, param=1: "x" value */
#define BASS_SYNC_META		4
/* Sync when metadata is received in a Shoutcast stream.
param: not used
data : pointer to the metadata */
#define BASS_SYNC_SLIDE		5
/* Sync when an attribute slide is completed.
param: not used
data : the type of slide completed (one of the BASS_SLIDE_xxx values) */
#define BASS_SYNC_STALL		6
/* Sync when playback has stalled.
param: not used
data : 0=stalled, 1=resumed */
#define BASS_SYNC_DOWNLOAD	7
/* Sync when downloading of an internet (or "buffered" user file) stream has ended.
param: not used
data : not used */
#define BASS_SYNC_FREE	8
/* Sync when a channel is freed.
param: not used
data : not used */
#define BASS_SYNC_MESSAGE	0x20000000	// FLAG: post a Windows message (instead of callback)
/* When using a window message "callback", the message to post is given in the "proc"
parameter of BASS_ChannelSetSync, and is posted to the window specified in the BASS_Init
call. The message parameters are: WPARAM = data, LPARAM = user. */
#define BASS_SYNC_MIXTIME	0x40000000	// FLAG: sync at mixtime, else at playtime
#define BASS_SYNC_ONETIME	0x80000000	// FLAG: sync only once, else continuously

typedef void (CALLBACK SYNCPROC)(HSYNC handle, DWORD channel, DWORD data, DWORD user);
/* Sync callback function. NOTE: a sync callback function should be very
quick as other syncs can't be processed until it has finished. If the sync
is a "mixtime" sync, then other streams and MOD musics can't be mixed until
it's finished either.
handle : The sync that has occured
channel: Channel that the sync occured in
data   : Additional data associated with the sync's occurance
user   : The 'user' parameter given when calling BASS_ChannelSetSync */

typedef void (CALLBACK DSPPROC)(HDSP handle, DWORD channel, void *buffer, DWORD length, DWORD user);
/* DSP callback function. NOTE: A DSP function should obviously be as quick as
possible... other DSP functions, streams and MOD musics can not be processed
until it's finished.
handle : The DSP handle
channel: Channel that the DSP is being applied to
buffer : Buffer to apply the DSP to
length : Number of bytes in the buffer
user   : The 'user' parameter given when calling BASS_ChannelSetDSP */

typedef BOOL (CALLBACK RECORDPROC)(HRECORD handle, void *buffer, DWORD length, DWORD user);
/* Recording callback function.
handle : The recording handle
buffer : Buffer containing the recorded sample data
length : Number of bytes
user   : The 'user' parameter value given when calling BASS_RecordStart
RETURN : TRUE = continue recording, FALSE = stop */

// BASS_ChannelGetData flags
#define BASS_DATA_AVAILABLE	0			// query how much data is buffered
#define BASS_DATA_FFT512	0x80000000	// 512 sample FFT
#define BASS_DATA_FFT1024	0x80000001	// 1024 FFT
#define BASS_DATA_FFT2048	0x80000002	// 2048 FFT
#define BASS_DATA_FFT4096	0x80000003	// 4096 FFT
#define BASS_DATA_FFT_INDIVIDUAL 0x10	// FFT flag: FFT for each channel, else all combined
#define BASS_DATA_FFT_NOWINDOW	0x20	// FFT flag: no Hanning window

// BASS_StreamGetTags types : what's returned
#define BASS_TAG_ID3		0	// ID3v1 tags : 128 byte block
#define BASS_TAG_ID3V2		1	// ID3v2 tags : variable length block
#define BASS_TAG_OGG		2	// OGG comments : array of null-terminated strings
#define BASS_TAG_HTTP		3	// HTTP headers : array of null-terminated strings
#define BASS_TAG_ICY		4	// ICY headers : array of null-terminated strings
#define BASS_TAG_META		5	// ICY metadata : null-terminated string

// BASS_MusicSet/GetAttribute options
#define BASS_MUSIC_ATTRIB_AMPLIFY	0
#define BASS_MUSIC_ATTRIB_PANSEP	1
#define BASS_MUSIC_ATTRIB_PSCALER	2
#define BASS_MUSIC_ATTRIB_BPM		3
#define BASS_MUSIC_ATTRIB_SPEED		4
#define BASS_MUSIC_ATTRIB_VOL_GLOBAL 5
#define BASS_MUSIC_ATTRIB_VOL_CHAN	0x100 // + channel #
#define BASS_MUSIC_ATTRIB_VOL_INST	0x200 // + instrument #

// DX8 effect types, use with BASS_ChannelSetFX
enum
{
	BASS_FX_CHORUS,			// GUID_DSFX_STANDARD_CHORUS
	BASS_FX_COMPRESSOR,		// GUID_DSFX_STANDARD_COMPRESSOR
	BASS_FX_DISTORTION,		// GUID_DSFX_STANDARD_DISTORTION
	BASS_FX_ECHO,			// GUID_DSFX_STANDARD_ECHO
	BASS_FX_FLANGER,		// GUID_DSFX_STANDARD_FLANGER
	BASS_FX_GARGLE,			// GUID_DSFX_STANDARD_GARGLE
	BASS_FX_I3DL2REVERB,	// GUID_DSFX_STANDARD_I3DL2REVERB
	BASS_FX_PARAMEQ,		// GUID_DSFX_STANDARD_PARAMEQ
	BASS_FX_REVERB			// GUID_DSFX_WAVES_REVERB
};

typedef struct {
    float       fWetDryMix;
    float       fDepth;
    float       fFeedback;
    float       fFrequency;
    DWORD       lWaveform;	// 0=triangle, 1=sine
    float       fDelay;
    DWORD       lPhase;		// BASS_FX_PHASE_xxx
} BASS_FXCHORUS;		// DSFXChorus

typedef struct {
    float   fGain;
    float   fAttack;
    float   fRelease;
    float   fThreshold;
    float   fRatio;
    float   fPredelay;
} BASS_FXCOMPRESSOR;	// DSFXCompressor

typedef struct {
    float   fGain;
    float   fEdge;
    float   fPostEQCenterFrequency;
    float   fPostEQBandwidth;
    float   fPreLowpassCutoff;
} BASS_FXDISTORTION;	// DSFXDistortion

typedef struct {
    float   fWetDryMix;
    float   fFeedback;
    float   fLeftDelay;
    float   fRightDelay;
    BOOL    lPanDelay;
} BASS_FXECHO;			// DSFXEcho

typedef struct {
    float       fWetDryMix;
    float       fDepth;
    float       fFeedback;
    float       fFrequency;
    DWORD       lWaveform;	// 0=triangle, 1=sine
    float       fDelay;
    DWORD       lPhase;		// BASS_FX_PHASE_xxx
} BASS_FXFLANGER;		// DSFXFlanger

typedef struct {
    DWORD       dwRateHz;               // Rate of modulation in hz
    DWORD       dwWaveShape;            // 0=triangle, 1=square
} BASS_FXGARGLE;		// DSFXGargle

typedef struct {
    int     lRoom;                  // [-10000, 0]      default: -1000 mB
    int     lRoomHF;                // [-10000, 0]      default: 0 mB
    float   flRoomRolloffFactor;    // [0.0, 10.0]      default: 0.0
    float   flDecayTime;            // [0.1, 20.0]      default: 1.49s
    float   flDecayHFRatio;         // [0.1, 2.0]       default: 0.83
    int     lReflections;           // [-10000, 1000]   default: -2602 mB
    float   flReflectionsDelay;     // [0.0, 0.3]       default: 0.007 s
    int     lReverb;                // [-10000, 2000]   default: 200 mB
    float   flReverbDelay;          // [0.0, 0.1]       default: 0.011 s
    float   flDiffusion;            // [0.0, 100.0]     default: 100.0 %
    float   flDensity;              // [0.0, 100.0]     default: 100.0 %
    float   flHFReference;          // [20.0, 20000.0]  default: 5000.0 Hz
} BASS_FXI3DL2REVERB;	// DSFXI3DL2Reverb

typedef struct {
    float   fCenter;
    float   fBandwidth;
    float   fGain;
} BASS_FXPARAMEQ;		// DSFXParamEq

typedef struct {
    float   fInGain;                // [-96.0,0.0]            default: 0.0 dB
    float   fReverbMix;             // [-96.0,0.0]            default: 0.0 db
    float   fReverbTime;            // [0.001,3000.0]         default: 1000.0 ms
    float   fHighFreqRTRatio;       // [0.001,0.999]          default: 0.001
} BASS_FXREVERB;		// DSFXWavesReverb

#define BASS_FX_PHASE_NEG_180        0
#define BASS_FX_PHASE_NEG_90         1
#define BASS_FX_PHASE_ZERO           2
#define BASS_FX_PHASE_90             3
#define BASS_FX_PHASE_180            4

// BASS_ChannelIsActive return values
#define BASS_ACTIVE_STOPPED	0
#define BASS_ACTIVE_PLAYING	1
#define BASS_ACTIVE_STALLED	2
#define BASS_ACTIVE_PAUSED	3

// BASS_ChannelIsSliding return flags
#define BASS_SLIDE_FREQ	1
#define BASS_SLIDE_VOL	2
#define BASS_SLIDE_PAN	4

// BASS_RecordSetInput flags
#define BASS_INPUT_OFF		0x10000
#define BASS_INPUT_ON		0x20000
#define BASS_INPUT_LEVEL	0x40000

#define BASS_INPUT_TYPE_MASK		0xff000000
#define BASS_INPUT_TYPE_UNDEF		0x00000000
#define BASS_INPUT_TYPE_DIGITAL		0x01000000
#define BASS_INPUT_TYPE_LINE		0x02000000
#define BASS_INPUT_TYPE_MIC			0x03000000
#define BASS_INPUT_TYPE_SYNTH		0x04000000
#define BASS_INPUT_TYPE_CD			0x05000000
#define BASS_INPUT_TYPE_PHONE		0x06000000
#define BASS_INPUT_TYPE_SPEAKER		0x07000000
#define BASS_INPUT_TYPE_WAVE		0x08000000
#define BASS_INPUT_TYPE_AUX			0x09000000
#define BASS_INPUT_TYPE_ANALOG		0x0a000000

// BASS_Set/GetConfig options
#define BASS_CONFIG_BUFFER			0
#define BASS_CONFIG_UPDATEPERIOD	1
#define BASS_CONFIG_MAXVOL			3
#define BASS_CONFIG_GVOL_SAMPLE		4
#define BASS_CONFIG_GVOL_STREAM		5
#define BASS_CONFIG_GVOL_MUSIC		6
#define BASS_CONFIG_CURVE_VOL		7
#define BASS_CONFIG_CURVE_PAN		8
#define BASS_CONFIG_FLOATDSP		9
#define BASS_CONFIG_3DALGORITHM		10
#define BASS_CONFIG_NET_TIMEOUT		11
#define BASS_CONFIG_NET_BUFFER		12
#define BASS_CONFIG_PAUSE_NOPLAY	13
#define BASS_CONFIG_NET_NOPROXY		14
#define BASS_CONFIG_NET_PREBUF		15

DWORD BASSDEF(BASS_SetConfig)(DWORD option, DWORD value);
DWORD BASSDEF(BASS_GetConfig)(DWORD option);
DWORD BASSDEF(BASS_GetVersion)();
char *BASSDEF(BASS_GetDeviceDescription)(DWORD device);
DWORD BASSDEF(BASS_ErrorGetCode)();
BOOL BASSDEF(BASS_Init)(DWORD device, DWORD freq, DWORD flags, HWND win, const GUID *dsguid);
BOOL BASSDEF(BASS_SetDevice)(DWORD device);
DWORD BASSDEF(BASS_GetDevice)();
BOOL BASSDEF(BASS_Free)();
void *BASSDEF(BASS_GetDSoundObject)(DWORD object);
BOOL BASSDEF(BASS_GetInfo)(BASS_INFO *info);
BOOL BASSDEF(BASS_Update)();
float BASSDEF(BASS_GetCPU)();
BOOL BASSDEF(BASS_Start)();
BOOL BASSDEF(BASS_Stop)();
BOOL BASSDEF(BASS_Pause)();
BOOL BASSDEF(BASS_SetVolume)(DWORD volume);
DWORD BASSDEF(BASS_GetVolume)();

BOOL BASSDEF(BASS_Set3DFactors)(float distf, float rollf, float doppf);
BOOL BASSDEF(BASS_Get3DFactors)(float *distf, float *rollf, float *doppf);
BOOL BASSDEF(BASS_Set3DPosition)(const BASS_3DVECTOR *pos, const BASS_3DVECTOR *vel, const BASS_3DVECTOR *front, const BASS_3DVECTOR *top);
BOOL BASSDEF(BASS_Get3DPosition)(BASS_3DVECTOR *pos, BASS_3DVECTOR *vel, BASS_3DVECTOR *front, BASS_3DVECTOR *top);
void BASSDEF(BASS_Apply3D)();
BOOL BASSDEF(BASS_SetEAXParameters)(int env, float vol, float decay, float damp);
BOOL BASSDEF(BASS_GetEAXParameters)(DWORD *env, float *vol, float *decay, float *damp);

HMUSIC BASSDEF(BASS_MusicLoad)(BOOL mem, const void *file, DWORD offset, DWORD length, DWORD flags, DWORD freq);
void BASSDEF(BASS_MusicFree)(HMUSIC handle);
char *BASSDEF(BASS_MusicGetName)(HMUSIC handle);
DWORD BASSDEF(BASS_MusicGetLength)(HMUSIC handle, BOOL playlen);
DWORD BASSDEF(BASS_MusicSetAttribute)(HMUSIC handle, DWORD attrib, DWORD value);
DWORD BASSDEF(BASS_MusicGetAttribute)(HMUSIC handle, DWORD attrib);

HSAMPLE BASSDEF(BASS_SampleLoad)(BOOL mem, const void *file, DWORD offset, DWORD length, DWORD max, DWORD flags);
void* BASSDEF(BASS_SampleCreate)(DWORD length, DWORD freq, DWORD max, DWORD flags);
HSAMPLE BASSDEF(BASS_SampleCreateDone)();
void BASSDEF(BASS_SampleFree)(HSAMPLE handle);
BOOL BASSDEF(BASS_SampleGetInfo)(HSAMPLE handle, BASS_SAMPLE *info);
BOOL BASSDEF(BASS_SampleSetInfo)(HSAMPLE handle, const BASS_SAMPLE *info);
HCHANNEL BASSDEF(BASS_SampleGetChannel)(HSAMPLE handle, BOOL onlynew);
BOOL BASSDEF(BASS_SampleStop)(HSAMPLE handle);

HSTREAM BASSDEF(BASS_StreamCreate)(DWORD freq, DWORD chans, DWORD flags, STREAMPROC *proc, DWORD user);
HSTREAM BASSDEF(BASS_StreamCreateFile)(BOOL mem, const void *file, DWORD offset, DWORD length, DWORD flags);
HSTREAM BASSDEF(BASS_StreamCreateURL)(const char *url, DWORD offset, DWORD flags, DOWNLOADPROC *proc, DWORD user);
HSTREAM BASSDEF(BASS_StreamCreateFileUser)(BOOL buffered, DWORD flags, STREAMFILEPROC *proc, DWORD user);
void BASSDEF(BASS_StreamFree)(HSTREAM handle);
QWORD BASSDEF(BASS_StreamGetLength)(HSTREAM handle);
char *BASSDEF(BASS_StreamGetTags)(HSTREAM handle, DWORD tags);
DWORD BASSDEF(BASS_StreamGetFilePosition)(HSTREAM handle, DWORD mode);

char *BASSDEF(BASS_RecordGetDeviceDescription)(DWORD device);
BOOL BASSDEF(BASS_RecordInit)(DWORD device);
BOOL BASSDEF(BASS_RecordSetDevice)(DWORD device);
DWORD BASSDEF(BASS_RecordGetDevice)();
BOOL BASSDEF(BASS_RecordFree)();
BOOL BASSDEF(BASS_RecordGetInfo)(BASS_RECORDINFO *info);
char *BASSDEF(BASS_RecordGetInputName)(DWORD input);
BOOL BASSDEF(BASS_RecordSetInput)(DWORD input, DWORD setting);
DWORD BASSDEF(BASS_RecordGetInput)(DWORD input);
HRECORD BASSDEF(BASS_RecordStart)(DWORD freq, DWORD chans, DWORD flags, RECORDPROC *proc, DWORD user);

float BASSDEF(BASS_ChannelBytes2Seconds)(DWORD handle, QWORD pos);
QWORD BASSDEF(BASS_ChannelSeconds2Bytes)(DWORD handle, float pos);
DWORD BASSDEF(BASS_ChannelGetDevice)(DWORD handle);
DWORD BASSDEF(BASS_ChannelIsActive)(DWORD handle);
BOOL BASSDEF(BASS_ChannelGetInfo)(DWORD handle, BASS_CHANNELINFO *info);
BOOL BASSDEF(BASS_ChannelSetFlags)(DWORD handle, DWORD flags);
BOOL BASSDEF(BASS_ChannelPreBuf)(DWORD handle);
BOOL BASSDEF(BASS_ChannelPlay)(DWORD handle, BOOL restart);
BOOL BASSDEF(BASS_ChannelStop)(DWORD handle);
BOOL BASSDEF(BASS_ChannelPause)(DWORD handle);
BOOL BASSDEF(BASS_ChannelSetAttributes)(DWORD handle, int freq, int volume, int pan);
BOOL BASSDEF(BASS_ChannelGetAttributes)(DWORD handle, DWORD *freq, DWORD *volume, int *pan);
BOOL BASSDEF(BASS_ChannelSlideAttributes)(DWORD handle, int freq, int volume, int pan, DWORD time);
DWORD BASSDEF(BASS_ChannelIsSliding)(DWORD handle);
BOOL BASSDEF(BASS_ChannelSet3DAttributes)(DWORD handle, int mode, float min, float max, int iangle, int oangle, int outvol);
BOOL BASSDEF(BASS_ChannelGet3DAttributes)(DWORD handle, DWORD *mode, float *min, float *max, DWORD *iangle, DWORD *oangle, DWORD *outvol);
BOOL BASSDEF(BASS_ChannelSet3DPosition)(DWORD handle, const BASS_3DVECTOR *pos, const BASS_3DVECTOR *orient, const BASS_3DVECTOR *vel);
BOOL BASSDEF(BASS_ChannelGet3DPosition)(DWORD handle, BASS_3DVECTOR *pos, BASS_3DVECTOR *orient, BASS_3DVECTOR *vel);
BOOL BASSDEF(BASS_ChannelSetPosition)(DWORD handle, QWORD pos);
QWORD BASSDEF(BASS_ChannelGetPosition)(DWORD handle);
DWORD BASSDEF(BASS_ChannelGetLevel)(DWORD handle);
DWORD BASSDEF(BASS_ChannelGetData)(DWORD handle, void *buffer, DWORD length);
HSYNC BASSDEF(BASS_ChannelSetSync)(DWORD handle, DWORD type, QWORD param, SYNCPROC *proc, DWORD user);
BOOL BASSDEF(BASS_ChannelRemoveSync)(DWORD handle, HSYNC sync);
HDSP BASSDEF(BASS_ChannelSetDSP)(DWORD handle, DSPPROC *proc, DWORD user, int priority);
BOOL BASSDEF(BASS_ChannelRemoveDSP)(DWORD handle, HDSP dsp);
HFX BASSDEF(BASS_ChannelSetFX)(DWORD handle, DWORD type, DWORD priority);
BOOL BASSDEF(BASS_ChannelRemoveFX)(DWORD handle, HFX fx);
BOOL BASSDEF(BASS_ChannelSetEAXMix)(DWORD handle, float mix);
BOOL BASSDEF(BASS_ChannelGetEAXMix)(DWORD handle, float *mix);
BOOL BASSDEF(BASS_ChannelSetLink)(DWORD handle, DWORD chan);
BOOL BASSDEF(BASS_ChannelRemoveLink)(DWORD handle, DWORD chan);

BOOL BASSDEF(BASS_FXSetParameters)(HFX handle, const void *par);
BOOL BASSDEF(BASS_FXGetParameters)(HFX handle, void *par);

#ifdef __cplusplus
}
#endif

#endif


I have uploaded the whole (empty) mod at http://www.intermediaware.de/bassmod.zip

Great job, if you continue ! :)

Okay, I've found some other source in this forum that helped me. The following code without mod works fine:

Local dll:Int = LoadLibraryA("bass.dll") 

If (dll=0) Then RuntimeError "Bass.DLL not found"

Local addr:Int = Int(GetProcAddress(dll,"BASS_Init"))
Global BASS_Init:Int(device:Int, freq:Int, flags:Int, win:Int, clsid:Int) "win32" 
(Int Ptr(Varptr(BASS_Init)))[0]=addr 

If Not Bass_Init(0,44100,0,0,0)
	Print "ERROR!"
Else
	Print "OK!"
End If

WaitKey
End


but, the following mod-source doesn't work:

Strict

Module imw.Bass

ModuleInfo "Name: Bass BlitzMax Module"
ModuleInfo "Description: Wrapper Moduler for BASS Audio Engine"

Import "libbass.a"

Extern "win32"
	Function BASS_Init:Int(device:Int, freq:Int, flags:Int, win:Int, clsid:Int)
End Extern


Does somebody know why? When I compile the module everthing seems okay, but then when I try to compile an BlitzMax-App I get the following error:

Compiling:test.bmx
flat assembler version 1.51
3 passes, 3649 bytes.
Linking:test.debug.exe
C:/Dokumente und Einstellungen/Jochen/Desktop/BMax/bin/ld.exe: cannot find

Could you upload a zip.

hi.
I cant find a libbass.a File with google. Ok, 1 death Link.
Check whether " Extern "C" " works.
Mfg Suco

oh, i see your LoadLibrary Code. If you work with DLL and LoadLibrary, see this :

strict 

const  DllName:string = "bass.dll"
local DllHandle = LoadLibraryA(DllName)

global BASS_Init:int(devive:int, freq:int, flags:int, win:int, clsid:int)"Win32" = GetProcAddress(DllHandle,"BASS_Init")


function FunctionExist(Func:byte ptr)
	if Int(Func)
		return true
	endif 
	return false 
end function 



print FunctionExist(BASS_Init)


If Not Bass_Init(0,44100,0,0,0)
	Print "ERROR!"
Else
	Print "OK!"
End If



I think that Code is a bit better to read and Use.
Mfg Suco

The Libfile is in the ZIP on my server. Download it at: http://www.intermediaware.de/bassmod.zip

But the module in the archive is empty, because I still don't know how to export the functions from the lib to BMax.

@suco: Thank you for the code. You're right - this is much more readable!

This seems to work

Strict

Module imw.Bass

ModuleInfo "Name: Bass BlitzMax Module"
ModuleInfo "Description: Wrapper Moduler for BASS Audio Engine"

Import "libbass.a"

Extern "C"
	Function BASS_GetCPU()
	Function BASS_Init(device, freq, flags, win, dsguid)
End Extern


and use the commandline "Bmk makemods -a imw.bass"

Sorry that dosent work i forgot to try the second one BASS_Int

Ok, I will go on with that LoadLibrary-Stuff. It seems that this works fine.

But - of course - the next problem suddenly appeared :-)

The following sample source, loads the bass.dll and plays a shoutcast radio stream. In C++ I can define a CallBack Function, for example to display an FFT Analyzer. Is it possible to pass a BlitzMax Function as Callback?

Here is the sample source:

Strict 

Const  DllName:String = "bass.dll"
Local DllHandle = LoadLibraryA(DllName)

Global BASS_Init:Int(device:Int, freq:Int, flags:Int, win:Int, clsid:Int)"Win32" = GetProcAddress(DllHandle,"BASS_Init")
Global BASS_GetVersion:Long()"Win32" = GetProcAddress(DllHandle,"BASS_GetVersion")
Global BASS_Free:Int()"Win32" = GetProcAddress(DllHandle,"BASS_Free")
Global BASS_MusicLoad:Int(mem:Int, file:Byte Ptr, offset:Int, length:Int, flags:Int, freq:Int)"Win32" = GetProcAddress(DllHandle,"BASS_MusicLoad")
Global BASS_ChannelPlay:Int(handle:Int,restart:Int)"Win32" = GetProcAddress(DllHandle,"BASS_ChannelPlay")
Global BASS_StreamCreateURL:Int(url:Byte Ptr, offset:Int, flags:Int, proc:Byte Ptr, user:Int)"Win32" = GetProcAddress(DllHandle,"BASS_StreamCreateURL")

If Not Bass_Init(1,44100,0,0,0)

	Print "ERROR"

Else

	Print "BASS_VERSION: "+BASS_GetVersion()

	Local MyUrl:String = "http://64.236.34.196:80/stream/1040"
	Print "Loading Stream...."

	Local Stream:Int = Bass_StreamCreateURL(MyURL.ToCString(),0,0,Null,0)
	BASS_ChannelPlay(Stream,0)

	Print "Playing Stream..."
	WaitKey

	Bass_FREE()	

End If

Function CallBack(buffer:Byte Ptr, length:Int, user:Int)
	Print "called..."
End Function


You mean that?

Strict 

Const  DllName:String = "bass.dll"
Local DllHandle = LoadLibraryA(DllName)

Global BASS_Init:Int(device:Int, freq:Int, flags:Int, win:Int, clsid:Int)"Win32" = GetProcAddress(DllHandle,"BASS_Init")
Global BASS_GetVersion:Long()"Win32" = GetProcAddress(DllHandle,"BASS_GetVersion")
Global BASS_Free:Int()"Win32" = GetProcAddress(DllHandle,"BASS_Free")
Global BASS_MusicLoad:Int(mem:Int, file:Byte Ptr, offset:Int, length:Int, flags:Int, freq:Int)"Win32" = GetProcAddress(DllHandle,"BASS_MusicLoad")
Global BASS_ChannelPlay:Int(handle:Int,restart:Int)"Win32" = GetProcAddress(DllHandle,"BASS_ChannelPlay")
Global BASS_StreamCreateURL:Int(url:Byte Ptr, offset:Int, flags:Int, proc:Byte Ptr, user:Int)"Win32" = GetProcAddress(DllHandle,"BASS_StreamCreateURL")
flushmem()

If Not Bass_Init(1,44100,0,0,0)

	Print "ERROR"

Else

	Print "BASS_VERSION: "+BASS_GetVersion()

	Local MyUrl:String = "http://64.236.34.196:80/stream/1040"
	Print "Loading Stream...."

	Local Stream:Int = Bass_StreamCreateURL(MyURL.ToCString(),0,0,CallBack,0)
	BASS_ChannelPlay(Stream,0)

	Print "Playing Stream..."
	WaitKey

	Bass_FREE()	

End If


Function CallBack(buffer:Byte Ptr, length:Int, user:Int)"Win32"
	Print "called..."
End Function

rem 
'Gives an Error. 
Function CallBack(buffer:Byte Ptr, length:Int, user:Int)
	Print "called..."
End Function

end rem 




Without Win32 on CallBack Function i get an error.
But dont Ask me why ;)
Mfg Suco

Oh, cool. Everything works fine. Thank you very much Suco !!!!!

Hi maverick :) do you continue you wrapper ? and it is free ?

@filax: I didn't work on the wrapper currently, but as soon as I have a little more time left I will continue work.

However, with the code snipplet above it should be easy for everyone to include his own BASS-Calls (for example to play a XM-Module).

Ok :)

Hi
Ok, here is the bass include for BlitzMax.
Nice lib.

bass.bmx

Rem
Bass.dll Version 2.1 Blitz Max Portierung von Suco-X
Sollten Fehler gefunden werden, bitte bei mir im BlitzForum Melden(PN oder im bass Thread)
Version 1.1
Mfg Suco
End Rem




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

' Initialization flags
Const BASS_DEVICE_8BITS    = 1   ' use 8 bit resolution, Else 16 bit
Const BASS_DEVICE_MONO    = 2   ' use mono, Else stereo
Const BASS_DEVICE_3D    =   4   ' enable 3D functionality

Rem
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.
End Rem

Const BASS_DEVICE_LATENCY   = 256   ' calculate device latency (BASS_INFO struct)
Const BASS_DEVICE_SPEAKERS = 2048   ' force enabling of speaker assignment

' DirectSound interfaces (For use with BASS_GetDSoundObject)
Const BASS_OBJECT_DS   =   1   ' IDirectSound
Const BASS_OBJECT_DS3DL   =   2   ' IDirectSound3DListener

Type BASS_INFO
   Field size:Int      ' size of this struct (set this before calling the Function)
   Field flags:Int   ' device capabilities (DSCAPS_xxx flags)
   Field hwsize:Int   ' size of total device hardware memory
   Field hwfree:Int   ' size of free device hardware memory
   Field freesam:Int   ' number of free sample slots in the hardware
   Field free3d:Int   ' number of free 3D sample slots in the hardware
   Field minrate:Int   ' Min sample rate supported by the hardware
   Field maxrate:Int   ' Max sample rate supported by the hardware
   Field eax:Byte      ' device supports EAX? (always False If BASS_DEVICE_3D was Not used)
   Field minbuf:Int   ' recommended minimum buffer length in ms (requires BASS_DEVICE_LATENCY)
   Field dsver:Int   ' DirectSound version
   Field latency:Int   ' Delay (in ms) before start of playback (requires BASS_DEVICE_LATENCY)
   Field initflags:Int ' "flags" parameter of BASS_Init call
   Field speakers:Int ' number of speakers available
   Field driver:Byte Ptr   ' driver
End Type


' BASS_INFO flags (from DSOUND.H)
Const DSCAPS_CONTINUOUSRATE   = $00000010
Rem
supports all sample rates between Min/maxrate
End Rem
Const DSCAPS_EMULDRIVER      =$00000020
Rem
device does Not have hardware DirectSound support
End Rem
Const DSCAPS_CERTIFIED   =   $00000040
Rem
device driver has been certified by Microsoft
End Rem
Rem
The following flags tell what Type of samples are supported by HARDWARE
mixing, all these formats are supported by SOFTWARE mixing
End Rem
Const DSCAPS_SECONDARYMONO   =$00000100   ' mono
Const DSCAPS_SECONDARYSTEREO   =$00000200   ' stereo
Const DSCAPS_SECONDARY8BIT   =$00000400   ' 8 bit
Const DSCAPS_SECONDARY16BIT=   $00000800   ' 16 bit

Type BASS_RECORDINFO
   Field size:Int      ' size of this struct (set this before calling the Function)
   Field flags:Int   ' device capabilities (DSCCAPS_xxx flags)
   Field formats:Int   ' supported standard formats (WAVE_FORMAT_xxx flags)
   Field inputs:Int   ' number of inputs
   Field singlein:Byte   ' True = only 1 Input can be set at a time
   Field driver:Byte Ptr   ' driver
End Type


' BASS_RECORDINFO flags (from DSOUND.H)
Const DSCCAPS_EMULDRIVER   = DSCAPS_EMULDRIVER
Rem
device does Not have hardware DirectSound recording support
End Rem
Const DSCCAPS_CERTIFIED =    DSCAPS_CERTIFIED
Rem
device driver has been certified by Microsoft
End Rem

' defines For formats Field of BASS_RECORDINFO (from MMSYSTEM.H)

Const WAVE_FORMAT_1M08   =    $00000001       ' 11.025 kHz, Mono,   8-bit 
Const WAVE_FORMAT_1S08   =    $00000002       ' 11.025 kHz, Stereo, 8-bit 
Const WAVE_FORMAT_1M16   =    $00000004       ' 11.025 kHz, Mono,   16-bit
Const WAVE_FORMAT_1S16    =   $00000008       ' 11.025 kHz, Stereo, 16-bit
Const WAVE_FORMAT_2M08   =    $00000010       ' 22.05  kHz, Mono,   8-bit   
Const WAVE_FORMAT_2S08  =     $00000020       ' 22.05  kHz, Stereo, 8-bit 
Const WAVE_FORMAT_2M16   =    $00000040       ' 22.05  kHz, Mono,   16-bit
Const WAVE_FORMAT_2S16   =    $00000080       ' 22.05  kHz, Stereo, 16-bit
Const WAVE_FORMAT_4M08   =    $00000100       ' 44.1   kHz, Mono,   8-bit
Const WAVE_FORMAT_4S08   =    $00000200       ' 44.1   kHz, Stereo, 8-bit   
Const WAVE_FORMAT_4M16   =    $00000400       ' 44.1   kHz, Mono,   16-bit 
Const WAVE_FORMAT_4S16   =    $00000800       ' 44.1   kHz, Stereo, 16-bit 


' Sample info structure & flags

Type BASS_SAMPLE
   Field freq:Int      ' Default playback rate
   Field volume:Int   ' Default volume (0-100)
   Field Pan:Int      ' Default pan (-100=Left, 0=middle, 100=Right)
   Field flags:Int   ' BASS_SAMPLE_xxx flags
   Field length:Int   ' length (in samples, Not bytes)
   Field Max_:Int      ' maximum simultaneous playbacks
   Field origres:Int   ' original resolution bits
Rem
The following are the sample's default 3D attributes (if the sample
is 3D, BASS_SAMPLE_3D is in flags) see BASS_ChannelSet3DAttributes
End Rem
   Field mode3d:Int   ' BASS_3DMODE_xxx mode
   Field mindist:Float   ' minimum distance
   Field maxdist:Float   ' maximum distance
   Field iangle:Int   ' angle of inside projection cone
   Field oangle:Int   ' angle of outside projection cone
   Field outvol:Int   ' delta-volume outside the projection cone
Rem
The following are the defaults used If the sample uses the DirectX 7
voice allocation/management features.
End Rem
   Field vam:Int      ' voice allocation/management flags (BASS_VAM_xxx)
   Field priority:Int   ' priority (0=lowest, $ffffffff=highest)
End Type


Const BASS_SAMPLE_8BITS    =   1   ' 8 bit
Const BASS_SAMPLE_FLOAT   =   256   ' 32-bit floating-point
Const BASS_SAMPLE_MONO   =   2   ' mono, Else stereo
Const BASS_SAMPLE_LOOP   =   4   ' looped
Const BASS_SAMPLE_3D      =   8   ' 3D functionality enabled
Const BASS_SAMPLE_SOFTWARE   =16   ' it's NOT using hardware mixing
Const BASS_SAMPLE_MUTEMAX   =   32   ' muted at Max distance (3D only)
Const BASS_SAMPLE_VAM      =   64   ' uses the DX7 voice allocation & management
Const BASS_SAMPLE_FX      =   128   ' old implementation of DX8 effects are enabled
Const BASS_SAMPLE_OVER_VOL =   $10000   ' override lowest volume
Const BASS_SAMPLE_OVER_POS   = $20000   ' override longest playing
Const BASS_SAMPLE_OVER_DIST =   $30000 ' override furthest from listener (3D only)

Const BASS_MP3_SETPOS      =   $20000 ' enable pin-point seeking on the MP3/MP2/MP1

Const BASS_STREAM_AUTOFREE   =$40000   ' automatically free the stream when it stop/ends
Const BASS_STREAM_RESTRATE   =$80000   ' restrict the download rate of internet file streams
Const BASS_STREAM_BLOCK      =$100000' download/play internet file stream in small blocks
Const BASS_STREAM_DECODE   =   $200000' don't play the stream, only decode (BASS_ChannelGetData)
Const BASS_STREAM_META      =$400000' request metadata from a Shoutcast stream
Const BASS_STREAM_STATUS      =$800000' give server status info (HTTP/ICY tags) in DOWNLOADPROC

Const BASS_MUSIC_FLOAT   =   BASS_SAMPLE_FLOAT ' 32-bit floating-point
Const BASS_MUSIC_MONO      =   BASS_SAMPLE_MONO ' force mono mixing (less CPU usage)
Const BASS_MUSIC_LOOP      =   BASS_SAMPLE_LOOP ' loop music
Const BASS_MUSIC_3D      =   BASS_SAMPLE_3D ' enable 3D functionality
Const BASS_MUSIC_FX      =   BASS_SAMPLE_FX ' enable old implementation of DX8 effects
Const BASS_MUSIC_AUTOFREE   =   BASS_STREAM_AUTOFREE ' automatically free the music when it stop/ends
Const BASS_MUSIC_DECODE      =BASS_STREAM_DECODE ' don't play the music, only decode (BASS_ChannelGetData)
Const BASS_MUSIC_RAMP      =   $200   ' normal ramping
Const BASS_MUSIC_RAMPS      =$400   ' sensitive ramping
Const BASS_MUSIC_SURROUND   =   $800   ' surround sound
Const BASS_MUSIC_SURROUND2=   $1000   ' surround sound (mode 2)
Const BASS_MUSIC_FT2MOD      =$2000   ' play .Mod as FastTracker 2 does
Const BASS_MUSIC_PT1MOD      =$4000   ' play .Mod as ProTracker 1 does
Const BASS_MUSIC_CALCLEN   =   $8000   ' calculate playback length
Const BASS_MUSIC_NONINTER      =$10000   ' non-interpolated mixing
Const BASS_MUSIC_POSRESET      =$20000   ' stop all notes when moving position
Const BASS_MUSIC_POSRESETEX   =$400000' stop all notes And reset bmp/etc when moving position
Const BASS_MUSIC_STOPBACK   =   $80000   ' stop the music on a backwards jump effect
Const BASS_MUSIC_NOSAMPLE      =$100000' don't load the samples

' Speaker assignment flags
Const BASS_SPEAKER_FRONT   =$1000000   ' front speakers
Const BASS_SPEAKER_REAR   =$2000000   ' rear/side speakers
Const BASS_SPEAKER_CENLFE   =$3000000   ' center & LFE speakers (5.1)
Const BASS_SPEAKER_REAR2   =$4000000   ' rear center speakers (7.1)
'Const BASS_SPEAKER_N(n)   ((n)<<24)   ' n'th pair of speakers (max 15)
Const BASS_SPEAKER_LEFT   =$10000000   ' modifier: Left
Const BASS_SPEAKER_RIGHT   =$20000000   ' modifier: Right
Const BASS_SPEAKER_FRONTLEFT   =BASS_SPEAKER_FRONT|BASS_SPEAKER_LEFT
Const BASS_SPEAKER_FRONTRIGHT   =BASS_SPEAKER_FRONT|BASS_SPEAKER_RIGHT
Const BASS_SPEAKER_REARLEFT   =BASS_SPEAKER_REAR|BASS_SPEAKER_LEFT
Const BASS_SPEAKER_REARRIGHT   =BASS_SPEAKER_REAR|BASS_SPEAKER_RIGHT
Const BASS_SPEAKER_CENTER      =BASS_SPEAKER_CENLFE|BASS_SPEAKER_LEFT
Const BASS_SPEAKER_LFE      =BASS_SPEAKER_CENLFE|BASS_SPEAKER_RIGHT
Const BASS_SPEAKER_REAR2LEFT   =BASS_SPEAKER_REAR2|BASS_SPEAKER_LEFT
Const BASS_SPEAKER_REAR2RIGHT   =BASS_SPEAKER_REAR2|BASS_SPEAKER_RIGHT

Const BASS_UNICODE         =$80000000

Const BASS_RECORD_PAUSE      =$8000   ' start recording paused

' DX7 voice allocation flags
Const BASS_VAM_HARDWARE   =   1
Rem
Play the sample in hardware. If no hardware voices are available Then
the "play" call will fail
End Rem
Const BASS_VAM_SOFTWARE      =2
Rem
Play the sample in software (ie. non-accelerated). No other VAM flags
may be used together with this flag.
End Rem

' DX7 voice management flags
Rem
These flags enable hardware resource stealing... If the hardware has no
available voices, a currently playing buffer will be stopped To make room For
the New buffer. NOTE: only samples loaded/created with the BASS_SAMPLE_VAM
flag are considered For termination by the DX7 voice management.
End Rem
Const BASS_VAM_TERM_TIME   =   4
Rem
If there are no free hardware voices, the buffer To be terminated will be
the one with the least time Left To play.
End Rem
Const BASS_VAM_TERM_DIST   =   8
Rem
If there are no free hardware voices, the buffer To be terminated will be
one that was loaded/created with the BASS_SAMPLE_MUTEMAX flag And is beyond
it's max distance. If there are no buffers that match this criteria, then the
"play" call will fail.
End Rem
Const BASS_VAM_TERM_PRIO   =   16
Rem
If there are no free hardware voices, the buffer To be terminated will be

the one with the lowest priority.
End Rem

Type BASS_CHANNELINFO
   Field freq:Int      ' Default playback rate
   Field chans:Int   ' channels
   Field flags:Int   ' BASS_SAMPLE/STREAM/MUSIC/SPEAKER flags
   Field ctype:Int   ' Type of channel
   Field origres:Int   ' original resolution
End Type

' BASS_CHANNELINFO types
Const BASS_CTYPE_SAMPLE    =   1
Const BASS_CTYPE_RECORD   =   2
Const BASS_CTYPE_STREAM      =$10000
Const BASS_CTYPE_STREAM_WAV   =$10001
Const BASS_CTYPE_STREAM_OGG   =$10002
Const BASS_CTYPE_STREAM_MP1   =$10003
Const BASS_CTYPE_STREAM_MP2   =$10004
Const BASS_CTYPE_STREAM_MP3=   $10005
Const BASS_CTYPE_MUSIC_MOD   =$20000
Const BASS_CTYPE_MUSIC_MTM   =$20001
Const BASS_CTYPE_MUSIC_S3M   =$20002
Const BASS_CTYPE_MUSIC_XM      =$20003
Const BASS_CTYPE_MUSIC_IT      =$20004
Const BASS_CTYPE_MUSIC_MO3   =$00100 ' mo3 flag

' 3D vector (For 3D positions/velocities/orientations)
Type BASS_3DVECTOR
   Field x:Float   ' +=Right, -=Left
   Field y:Float   ' +=up, -=down
   Field z:Float   ' +=front, -=behind
End Type


' 3D channel modes
Const BASS_3DMODE_NORMAL   =   0
Rem
normal 3D processing end rem
Const BASS_3DMODE_RELATIVE   1
rem The channel's 3D position (position/velocity/orientation) are relative to
the listener. When the listener's position/velocity/orientation is changed
with BASS_Set3DPosition, the channel's position relative to the listener does
Not change.
End Rem
Const BASS_3DMODE_OFF      =   2
Rem
Turn off 3D processing on the channel, the sound will be played
in the center.
End Rem


Rem
' EAX environments, use with BASS_SetEAXParameters
enum
{
    EAX_ENVIRONMENT_GENERIC,
    EAX_ENVIRONMENT_PADDEDCELL,
    EAX_ENVIRONMENT_ROOM,
    EAX_ENVIRONMENT_BATHROOM,
    EAX_ENVIRONMENT_LIVINGROOM,
    EAX_ENVIRONMENT_STONEROOM,
    EAX_ENVIRONMENT_AUDITORIUM,
    EAX_ENVIRONMENT_CONCERTHALL,
    EAX_ENVIRONMENT_CAVE,
    EAX_ENVIRONMENT_ARENA,
    EAX_ENVIRONMENT_HANGAR,
    EAX_ENVIRONMENT_CARPETEDHALLWAY,
    EAX_ENVIRONMENT_HALLWAY,
    EAX_ENVIRONMENT_STONECORRIDOR,
    EAX_ENVIRONMENT_ALLEY,
    EAX_ENVIRONMENT_FOREST,
    EAX_ENVIRONMENT_CITY,
    EAX_ENVIRONMENT_MOUNTAINS,
    EAX_ENVIRONMENT_QUARRY,
    EAX_ENVIRONMENT_PLAIN,
    EAX_ENVIRONMENT_PARKINGLOT,
    EAX_ENVIRONMENT_SEWERPIPE,
    EAX_ENVIRONMENT_UNDERWATER,
    EAX_ENVIRONMENT_DRUGGED,
    EAX_ENVIRONMENT_DIZZY,
    EAX_ENVIRONMENT_PSYCHOTIC,

    EAX_ENVIRONMENT_COUNT         ' total number of environments
};

End Rem


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      ' total number of environments


Rem

' EAX presets, usage: BASS_SetEAXParameters(EAX_PRESET_xxx)
Const EAX_PRESET_GENERIC         EAX_ENVIRONMENT_GENERIC,0.5F,1.493F,0.5F
Const EAX_PRESET_PADDEDCELL      EAX_ENVIRONMENT_PADDEDCELL,0.25F,0.1F,0.0F
Const EAX_PRESET_ROOM            EAX_ENVIRONMENT_ROOM,0.417F,0.4F,0.666F
Const EAX_PRESET_BATHROOM        EAX_ENVIRONMENT_BATHROOM,0.653F,1.499F,0.166F
Const EAX_PRESET_LIVINGROOM      EAX_ENVIRONMENT_LIVINGROOM,0.208F,0.478F,0.0F
Const EAX_PRESET_STONEROOM       EAX_ENVIRONMENT_STONEROOM,0.5F,2.309F,0.888F
Const EAX_PRESET_AUDITORIUM      EAX_ENVIRONMENT_AUDITORIUM,0.403F,4.279F,0.5F
Const EAX_PRESET_CONCERTHALL     EAX_ENVIRONMENT_CONCERTHALL,0.5F,3.961F,0.5F
Const EAX_PRESET_CAVE            EAX_ENVIRONMENT_CAVE,0.5F,2.886F,1.304F
Const EAX_PRESET_ARENA           EAX_ENVIRONMENT_ARENA,0.361F,7.284F,0.332F
Const EAX_PRESET_HANGAR          EAX_ENVIRONMENT_HANGAR,0.5F,10.0F,0.3F
Const EAX_PRESET_CARPETEDHALLWAY EAX_ENVIRONMENT_CARPETEDHALLWAY,0.153F,0.259F,2.0F
Const EAX_PRESET_HALLWAY         EAX_ENVIRONMENT_HALLWAY,0.361F,1.493F,0.0F
Const EAX_PRESET_STONECORRIDOR   EAX_ENVIRONMENT_STONECORRIDOR,0.444F,2.697F,0.638F
Const EAX_PRESET_ALLEY           EAX_ENVIRONMENT_ALLEY,0.25F,1.752F,0.776F
Const EAX_PRESET_FOREST          EAX_ENVIRONMENT_FOREST,0.111F,3.145F,0.472F
Const EAX_PRESET_CITY            EAX_ENVIRONMENT_CITY,0.111F,2.767F,0.224F
Const EAX_PRESET_MOUNTAINS       EAX_ENVIRONMENT_MOUNTAINS,0.194F,7.841F,0.472F
Const EAX_PRESET_QUARRY          EAX_ENVIRONMENT_QUARRY,1.0F,1.499F,0.5F
Const EAX_PRESET_PLAIN           EAX_ENVIRONMENT_PLAIN,0.097F,2.767F,0.224F
Const EAX_PRESET_PARKINGLOT      EAX_ENVIRONMENT_PARKINGLOT,0.208F,1.652F,1.5F
Const EAX_PRESET_SEWERPIPE       EAX_ENVIRONMENT_SEWERPIPE,0.652F,2.886F,0.25F
Const EAX_PRESET_UNDERWATER      EAX_ENVIRONMENT_UNDERWATER,1.0F,1.499F,0.0F
Const EAX_PRESET_DRUGGED         EAX_ENVIRONMENT_DRUGGED,0.875F,8.392F,1.388F
Const EAX_PRESET_DIZZY           EAX_ENVIRONMENT_DIZZY,0.139F,17.234F,0.666F
Const EAX_PRESET_PSYCHOTIC       EAX_ENVIRONMENT_PSYCHOTIC,0.486F,7.563F,0.806F
End Rem
' software 3D mixing algorithm modes (used with BASS_Set3DAlgorithm)
Const BASS_3DALG_DEFAULT   = 0

Rem

Default algorithm (currently translates To BASS_3DALG_OFF)
End Rem

Const BASS_3DALG_OFF   =   1
Rem
Uses normal Left And Right panning. The vertical axis is ignored except For
scaling of volume due To distance. Doppler shift And volume scaling are still
applied, but the 3D filtering is Not performed. This is the most CPU efficient
software implementation, but provides no virtual 3D audio effect. Head Related
Transfer Function processing will Not be done. Since only normal stereo panning
is used, a channel using this algorithm may be accelerated by a 2D hardware
voice If no free 3D hardware voices are available.
End Rem
Const BASS_3DALG_FULL   =   2
Rem
This algorithm gives the highest quality 3D audio effect, but uses more CPU.
Requires Windows 98 2nd Edition Or Windows 2000 that uses WDM drivers, If this
mode is Not available Then BASS_3DALG_OFF will be used instead.
End Rem
Const BASS_3DALG_LIGHT =   3
Rem
This algorithm gives a good 3D audio effect, And uses less CPU than the FULL
mode. Requires Windows 98 2nd Edition Or Windows 2000 that uses WDM drivers, If
this mode is Not available Then BASS_3DALG_OFF will be used instead.
End Rem

'typedef DWORD (CALLBACK STREAMPROC)(HSTREAM handle, void *buffer, DWORD length, DWORD user)

Rem
User stream callback function. NOTE: A stream Function should obviously be as quick
as possible, other streams (And Mod musics) can't be mixed until it's finished.
handle : The stream that needs writing
buffer : Buffer To write the samples in
length : Number of bytes To write
user   : The 'user' parameter value given when calling BASS_StreamCreate
Return : Number of bytes written. Set the BASS_STREAMPROC_END flag To End
         the stream.
 End Rem

Const BASS_STREAMPROC_END   =   $80000000   ' End of user stream flag

' BASS_StreamGetFilePosition modes
Const BASS_FILEPOS_DECODE   =   0
Const BASS_FILEPOS_DOWNLOAD=   1
Const BASS_FILEPOS_END      =2
Const BASS_FILEPOS_START      =3

' STREAMFILEPROC actions
Const BASS_FILE_CLOSE   =   0
Const BASS_FILE_READ      =1
Const BASS_FILE_QUERY      =2
Const BASS_FILE_LEN      =3
Const BASS_FILE_SEEK      =4

'typedef DWORD (CALLBACK STREAMFILEPROC)(DWORD action, DWORD param1, DWORD param2, DWORD user);
Rem
User file stream callback function.
action : The action To perform, one of BASS_FILE_xxx values.
param1 : Depends on "action"
param2 : Depends on "action"
user   : The 'user' parameter value given when calling BASS_StreamCreate
Return : Depends on "action"
End Rem

'typedef void (CALLBACK DOWNLOADPROC)(void *buffer, DWORD length, DWORD user);
Rem
Internet stream download callback function.
buffer : Buffer containing the downloaded data... Null=End of download
length : Number of bytes in the buffer
user   : The 'user' parameter value given when calling BASS_StreamCreateURL
End Rem

Rem
Sync types (with BASS_ChannelSetSync "param" And SYNCPROC "data"
definitions) & flags.
End Rem
Const BASS_SYNC_MUSICPOS =   0
Const BASS_SYNC_POS    =   0
Rem
Sync when a channel reaches a position.
If HMUSIC...
param: LOWORD=order (0=first, -1=all) HIWORD=row (0=first, -1=all)
data : LOWORD=order HIWORD=row
If HSTREAM...
param: position in bytes
data : Not used
End Rem
Const BASS_SYNC_MUSICINST   =1
Rem
Sync when an instrument (sample For the non-instrument based formats)
is played in a music (Not including retrigs).
param: LOWORD=instrument (1=first) HIWORD=note (0=c0...119=b9, -1=all)
data : LOWORD=note HIWORD=volume (0-64)
End Rem
Const BASS_SYNC_END      =2
Rem
Sync when a channel reaches the end.
param: Not used
data : 1 = the sync is triggered by a backward jump in a Mod music, otherwise Not used
End Rem
Const BASS_SYNC_MUSICFX   =3
Rem
Sync when the "sync" effect (XM/MTM/Mod: E8x/Wxx, IT/S3M: S2x) is used.
param: 0:data=pos, 1:data="x" value
data : param=0: LOWORD=order HIWORD=row, param=1: "x" value
End Rem
Const BASS_SYNC_META   =   4
Rem
Sync when metadata is received in a Shoutcast stream.
param: Not used
data : pointer To the metadata
End Rem
Const BASS_SYNC_SLIDE   =   5
Rem
Sync when an attribute slide is completed.
param: Not used
data : the Type of slide completed (one of the BASS_SLIDE_xxx values)
End Rem
Const BASS_SYNC_STALL   =   6
Rem
Sync when playback has stalled.
param: Not used
data : 0=stalled, 1=resumed
End Rem
Const BASS_SYNC_DOWNLOAD   =7
Rem
Sync when downloading of an internet (Or "buffered" user file) stream has ended.
param: Not used
data : Not used
End Rem
Const BASS_SYNC_FREE =   8
Rem
Sync when a channel is freed.
param: Not used
data : Not used
End Rem
Const BASS_SYNC_MESSAGE   =$20000000   ' FLAG: post a Windows message (instead of callback)
Rem
When using a window message "callback", the message To post is given in the "proc"
parameter of BASS_ChannelSetSync, And is posted To the window specified in the BASS_Init
call. The message parameters are: WPARAM = data, LPARAM = user.
 End Rem
Const BASS_SYNC_MIXTIME   =$40000000   ' FLAG: sync at mixtime, Else at playtime
Const BASS_SYNC_ONETIME   =$80000000   ' FLAG: sync only once, Else continuously

'typedef void (CALLBACK SYNCPROC)(HSYNC handle, DWORD channel, DWORD data, DWORD user);
Rem
Sync callback function. NOTE: a sync callback Function should be very
quick as other syncs can't be processed until it has finished. If the sync
is a "mixtime" sync, Then other streams And Mod musics can't be mixed until
it's finished either.
handle : The sync that has occured
channel: Channel that the sync occured in
data   : Additional data associated with the sync's occurance
user   : The 'user' parameter given when calling BASS_ChannelSetSync
End Rem

'typedef void (CALLBACK DSPPROC)(HDSP handle, DWORD channel, void *buffer, DWORD length, DWORD user);
Rem
DSP callback function. NOTE: A DSP Function should obviously be as quick as
possible... other DSP functions, streams And Mod musics can Not be processed
Until it's finished.
handle : The DSP handle
channel: Channel that the DSP is being applied To
buffer : Buffer To apply the DSP To
length : Number of bytes in the buffer
user   : The 'user' parameter given when calling BASS_ChannelSetDSP
End Rem

'typedef BOOL (CALLBACK RECORDPROC)(HRECORD handle, void *buffer, DWORD length, DWORD user);
Rem
Recording callback function.
handle : The recording handle
buffer : Buffer containing the recorded sample data
length : Number of bytes
user   : The 'user' parameter value given when calling BASS_RecordStart
Return : True = Continue recording, False = stop
End Rem

' BASS_ChannelGetData flags
Const BASS_DATA_AVAILABLE   =0         ' query how much data is buffered
Const BASS_DATA_FFT512   =$80000000   ' 512 sample FFT
Const BASS_DATA_FFT1024   =$80000001   ' 1024 FFT
Const BASS_DATA_FFT2048   =$80000002   ' 2048 FFT
Const BASS_DATA_FFT4096 =   $80000003   ' 4096 FFT
Const BASS_DATA_FFT_INDIVIDUAL =$10   ' FFT flag: FFT For each channel, Else all combined
Const BASS_DATA_FFT_NOWINDOW   =$20   ' FFT flag: no Hanning window

' BASS_StreamGetTags types : what's returned
Const BASS_TAG_ID3      =0   ' ID3v1 tags : 128 Byte block
Const BASS_TAG_ID3V2      =1   ' ID3v2 tags : variable length block
Const BASS_TAG_OGG      =2   ' OGG comments : array of Null-terminated strings
Const BASS_TAG_HTTP      =3   ' HTTP headers : array of Null-terminated strings
Const BASS_TAG_ICY      =4   ' ICY headers : array of Null-terminated strings
Const BASS_TAG_META      =5   ' ICY metadata : Null-terminated String

' BASS_MusicSet/GetAttribute options
Const BASS_MUSIC_ATTRIB_AMPLIFY=   0
Const BASS_MUSIC_ATTRIB_PANSEP   =1
Const BASS_MUSIC_ATTRIB_PSCALER   =2
Const BASS_MUSIC_ATTRIB_BPM      =3
Const BASS_MUSIC_ATTRIB_SPEED   =   4
Const BASS_MUSIC_ATTRIB_VOL_GLOBAL =5
Const BASS_MUSIC_ATTRIB_VOL_CHAN   =$100 ' + channel #
Const BASS_MUSIC_ATTRIB_VOL_INST   =$200 ' + instrument #


Rem
' DX8 effect types, use with BASS_ChannelSetFX
enum
{
   BASS_FX_CHORUS,         ' GUID_DSFX_STANDARD_CHORUS
   BASS_FX_COMPRESSOR,      ' GUID_DSFX_STANDARD_COMPRESSOR
   BASS_FX_DISTORTION,      ' GUID_DSFX_STANDARD_DISTORTION
   BASS_FX_ECHO,         ' GUID_DSFX_STANDARD_ECHO
   BASS_FX_FLANGER,      ' GUID_DSFX_STANDARD_FLANGER
   BASS_FX_GARGLE,         ' GUID_DSFX_STANDARD_GARGLE
   BASS_FX_I3DL2REVERB,   ' GUID_DSFX_STANDARD_I3DL2REVERB
   BASS_FX_PARAMEQ,      ' GUID_DSFX_STANDARD_PARAMEQ
   BASS_FX_REVERB         ' GUID_DSFX_WAVES_REVERB
};
End Rem


Const    BASS_FX_CHORUS = 0         ' GUID_DSFX_STANDARD_CHORUS
Const   BASS_FX_COMPRESSOR = 1      ' GUID_DSFX_STANDARD_COMPRESSOR
Const   BASS_FX_DISTORTION = 2      ' GUID_DSFX_STANDARD_DISTORTION
Const   BASS_FX_ECHO = 3         ' GUID_DSFX_STANDARD_ECHO
Const   BASS_FX_FLANGER = 4      ' GUID_DSFX_STANDARD_FLANGER
Const   BASS_FX_GARGLE = 5         ' GUID_DSFX_STANDARD_GARGLE
Const   BASS_FX_I3DL2REVERB = 6   ' GUID_DSFX_STANDARD_I3DL2REVERB
Const   BASS_FX_PARAMEQ = 7      ' GUID_DSFX_STANDARD_PARAMEQ
Const   BASS_FX_REVERB = 8         ' GUID_DSFX_WAVES_REVERB


Type BASS_FXCHORUS
    Field      fWetDryMix:Float
    Field      fDepth:Float
    Field      fFeedback:Float
    Field      fFrequency:Float
    Field      lWaveform:Int   ' 0=triangle, 1=sine
    Field      fDelay:Float
    Field      lPhase:Int      ' BASS_FX_PHASE_xxx
End Type

Type BASS_FXCOMPRESSOR
    Field    fGain:Float
    Field    fAttack:Float
    Field    fRelease:Float
    Field    fThreshold:Float
    Field    fRatio:Float
    Field    fPredelay:Float
End Type

Type BASS_FXDISTORTION
    Field    fGain:Float
    Field    fEdge:Float
    Field    fPostEQCenterFrequency:Float
    Field    fPostEQBandwidth:Float
    Field    fPreLowpassCutoff:Float
End Type



Type BASS_FXECHO
    Field   fWetDryMix:Float
    Field   fFeedback:Float
    Field   fLeftDelay:Float
    Field   fRightDelay:Float
    Field   lPanDelay:Byte
End Type

Type BASS_FXFLANGER
    Field      fWetDryMix:Float
    Field       fDepth:Float
    Field       fFeedback:Float
    Field       fFrequency:Float
    Field       lWaveform:Int   ' 0=triangle, 1=sine
    Field       fDelay:Float
    Field      lPhase:Int      ' BASS_FX_PHASE_xxx
End Type


Type BASS_FXGARGLE
    Field       dwRateHz:Int               ' Rate of modulation in hz
    Field       dwWaveShape:Int            ' 0=triangle, 1=square
End Type   ' DSFXGargle

Type BASS_FXI3DL2REVERB
    Field     lRoom:Int                  ' [-10000, 0]      Default: -1000 mB
    Field     lRoomHF:Int               ' [-10000, 0]      Default: 0 mB
    Field   flRoomRolloffFactor:Float    ' [0.0, 10.0]      Default: 0.0
    Field   flDecayTime:Float            ' [0.1, 20.0]      Default: 1.49s
    Field   flDecayHFRatio:Float         ' [0.1, 2.0]       Default: 0.83
    Field     lReflections:Int           ' [-10000, 1000]   Default: -2602 mB
    Field   flReflectionsDelay:Float     ' [0.0, 0.3]       Default: 0.007 s
    Field     lReverb:Int                ' [-10000, 2000]   Default: 200 mB
    Field   flReverbDelay:Float          ' [0.0, 0.1]       Default: 0.011 s
    Field   flDiffusion:Float            ' [0.0, 100.0]     Default: 100.0 %
    Field   flDensity:Float              ' [0.0, 100.0]     Default: 100.0 %
    Field   flHFReference:Float          ' [20.0, 20000.0]  Default: 5000.0 Hz
End Type    ' DSFXI3DL2Reverb

Type BASS_FXPARAMEQ
    Field   fCenter:Float
    Field   fBandwidth:Float
    Field   fGain:Float
End Type       ' DSFXParamEq

Type BASS_FXREVERB
    Field   fInGain:Float                ' [-96.0,0.0]            Default: 0.0 dB
    Field   fReverbMix:Float             ' [-96.0,0.0]            Default: 0.0 db
    Field   fReverbTime:Float            ' [0.001,3000.0]         Default: 1000.0 ms
    Field   fHighFreqRTRatio:Float       ' [0.001,0.999]          Default: 0.001
End Type       ' DSFXWavesReverb

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_ChannelIsActive Return values
Const BASS_ACTIVE_STOPPED   =0
Const BASS_ACTIVE_PLAYING   =1
Const BASS_ACTIVE_STALLED   =2
Const BASS_ACTIVE_PAUSED   =3

' BASS_ChannelIsSliding Return flags
Const BASS_SLIDE_FREQ   =1
Const BASS_SLIDE_VOL   =2
Const BASS_SLIDE_PAN   =4

' BASS_RecordSetInput flags
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

' BASS_Set/GetConfig options
Const BASS_CONFIG_BUFFER      =   0
Const BASS_CONFIG_UPDATEPERIOD   =1
Const BASS_CONFIG_MAXVOL      =   3
Const BASS_CONFIG_GVOL_SAMPLE      =4
Const BASS_CONFIG_GVOL_STREAM      =5
Const BASS_CONFIG_GVOL_MUSIC      =6
Const BASS_CONFIG_CURVE_VOL      =7
Const BASS_CONFIG_CURVE_PAN      =8
Const BASS_CONFIG_FLOATDSP      =9
Const BASS_CONFIG_3DALGORITHM      =10
Const BASS_CONFIG_NET_TIMEOUT      =11
Const BASS_CONFIG_NET_BUFFER      =12
Const BASS_CONFIG_PAUSE_NOPLAY   =13
Const BASS_CONFIG_NET_NOPROXY      =14
Const BASS_CONFIG_NET_PREBUF      =15


Const DllName:String = "bass.dll"
Local DllHandle = LoadLibraryA(DllName)


If DLLhandle = 0
   Assert DLLHandle, "BASS.DLL konnte nicht geladen werden"
EndIf


Global BASS_SetConfig(option:Int, value:Int)"Win32" = GetProcAddress(DllHandle,"BASS_SetConfig")

'DWORD BASSDEF(BASS_SetConfig)(DWORD option, DWORD value);

Global BASS_GetConfig(option:Int)"Win32" = GetProcAddress(DllHandle,"BASS_GetConfig")

'DWORD BASSDEF(BASS_GetConfig)(DWORD option);

Global BASS_GetVersion()"Win32" = GetProcAddress(DllHandle,"BASS_GetVersion")

'DWORD BASSDEF(BASS_GetVersion)();


Global BASS_GetDeviceDescription:Byte Ptr(device:Int)"Win32" = GetProcAddress(DllHandle,"BASS_GetDeviceDescription")

'char *BASSDEF(BASS_GetDeviceDescription)(DWORD device);


Global BASS_ErrorGetCode()"Win32" = GetProcAddress(DllHandle,"BASS_ErrorGetCode")

'DWORD BASSDEF(BASS_ErrorGetCode)();



Global BASS_Init(device:Int, freq:Int, flags:Int, hwnd:Int, dsguid:Byte Ptr)"Win32" = GetProcAddress(DllHandle,"BASS_Init")

'BOOL BASSDEF(BASS_Init)(DWORD device, DWORD freq, DWORD flags, HWND win, Const GUID *dsguid);

Global BASS_SetDevice(device:Int)"Win32" = GetProcAddress(DllHandle,"BASS_SetDevice")

'BOOL BASSDEF(BASS_SetDevice)(DWORD device);


Global BASS_GetDevice()"Win32" = GetProcAddress(DllHandle,"BASS_GetDevice")

'DWORD BASSDEF(BASS_GetDevice)();


Global BASS_Free()"Win32" = GetProcAddress(DllHandle,"BASS_Free")

'BOOL BASSDEF(BASS_Free)();



Global BASS_GetDSoundObject:Byte Ptr(obj:Int)"Win32" = GetProcAddress(DllHandle,"BASS_GetDSoundObject")

'void *BASSDEF(BASS_GetDSoundObject)(DWORD Object);




Global BASS_GetInfo(BASS_INFO_Info:Byte Ptr)"Win32" = GetProcAddress(DllHandle,"BASS_GetInfo")

'BOOL BASSDEF(BASS_GetInfo)(BASS_INFO *info);


Global BASS_Update()"Win32" = GetProcAddress(DllHandle,"BASS_Update")

'BOOL BASSDEF(BASS_Update)();




Global BASS_GetCPU:Float()"Win32" = GetProcAddress(DllHandle,"BASS_GetCPU")

'Float BASSDEF(BASS_GetCPU)();



Global BASS_Start()"Win32" = GetProcAddress(DllHandle,"BASS_Start")

'BOOL BASSDEF(BASS_Start)();



Global BASS_Stop()"Win32" = GetProcAddress(DllHandle,"BASS_Stop")

'BOOL BASSDEF(BASS_Stop)();



Global BASS_Pause()"Win32" = GetProcAddress(DllHandle,"BASS_Pause")

'BOOL BASSDEF(BASS_Pause)();


Global BASS_SetVolume(volume:Int)"Win32" = GetProcAddress(DllHandle,"BASS_SetVolume")

'BOOL BASSDEF(BASS_SetVolume)(DWORD volume);


Global BASS_GetVolume()"Win32" = GetProcAddress(DllHandle,"BASS_GetVolume")

'DWORD BASSDEF(BASS_GetVolume)();


Global BASS_Set3DFactors(distf:Float,rollf:Float, doppf:Float)"Win32" = GetProcAddress(DllHandle,"BASS_Set3DFactors")

'BOOL BASSDEF(BASS_Set3DFactors)(Float distf, Float rollf, Float doppf);



Global BASS_Get3DFactors(distf:Float Ptr, rollf:Float Ptr, doppf:Float Ptr)"Win32" = GetProcAddress(DllHandle,"BASS_Get3DFactors")

'BOOL BASSDEF(BASS_Get3DFactors)(Float *distf, Float *rollf, Float *doppf);



Global BASS_Set3DPosition(BASS_3DVECTOR_Pos:Byte Ptr , BASS_3DVECTOR_Vel:Byte Ptr,  BASS_3DVECTOR_Front:Byte Ptr, BASS_3DVECTOR_Top:Byte Ptr)"Win32" = GetProcAddress(DllHandle,"BASS_Set3DPosition")

'BOOL BASSDEF(BASS_Set3DPosition)(Const BASS_3DVECTOR *pos, Const BASS_3DVECTOR *vel, Const BASS_3DVECTOR *front, Const BASS_3DVECTOR *top);





Global BASS_Get3DPosition(BASS_3DVECTOR_Pos:Byte Ptr , BASS_3DVECTOR_Vel:Byte Ptr,  BASS_3DVECTOR_Front:Byte Ptr, BASS_3DVECTOR_Top:Byte Ptr)"Win32" = GetProcAddress(DllHandle,"BASS_Get3DPosition")


'BOOL BASSDEF(BASS_Get3DPosition)(BASS_3DVECTOR *pos, BASS_3DVECTOR *vel, BASS_3DVECTOR *front, BASS_3DVECTOR *top);




Global BASS_Apply3D()"Win32" = GetProcAddress(DllHandle,"BASS_Apply3D")

'void BASSDEF(BASS_Apply3D)();



Global BASS_SetEAXParameters(env:Int, vol:Float, decay:Float, damp:Float)"Win32" = GetProcAddress(DllHandle,"BASS_SetEAXParameters")

'BOOL BASSDEF(BASS_SetEAXParameters)(Int env, Float vol, Float decay, Float damp);




Global BASS_GetEAXParameters(env:Int Ptr, vol:Float Ptr, decay:Float Ptr, damp:Float Ptr)"Win32" = GetProcAddress(DllHandle,"BASS_GetEAXParameters")

'BOOL BASSDEF(BASS_GetEAXParameters)(DWORD *env, Float *vol, Float *decay, Float *damp);






Global BASS_MusicLoad(mem:Int, file:Byte Ptr, offset:Int, length:Int, flags:Int, freq:Int)"Win32" = GetProcAddress(DllHandle,"BASS_MusicLoad")

'HMUSIC BASSDEF(BASS_MusicLoad)(BOOL mem, Const void *file, DWORD offset, DWORD length, DWORD flags, DWORD freq);



Global BASS_MusicFree(handle:Int)"Win32" = GetProcAddress(DllHandle,"BASS_MusicFree")

'BOOL BASSDEF(BASS_MusicFree)(HMUSIC handle);




Global BASS_MusicGetName:Byte Ptr(handle:Int)"Win32" = GetProcAddress(DllHandle,"BASS_MusicGetName")

'char *BASSDEF(BASS_MusicGetName)(HMUSIC handle);



Global BASS_MusicGetLength(handle:Int, playlen:Int)"Win32" = GetProcAddress(DllHandle,"BASS_MusicGetLength")

'DWORD BASSDEF(BASS_MusicGetLength)(HMUSIC handle, BOOL playlen);



Global BASS_MusicSetAttribute(handle:Int, attrib:Int, value:Int)"Win32" = GetProcAddress(DllHandle,"BASS_MusicSetAttribute")


'DWORD BASSDEF(BASS_MusicSetAttribute)(HMUSIC handle, DWORD attrib, DWORD value);




Global BASS_MusicGetAttribute(handle:Int, attrib:Int)"Win32" = GetProcAddress(DllHandle,"BASS_MusicGetAttribute")

'DWORD BASSDEF(BASS_MusicGetAttribute)(HMUSIC handle, DWORD attrib);





Global BASS_SampleLoad(mem:Int, file:Byte Ptr, offset:Int, length:Int, Max_:Int, flags:Int)"Win32" = GetProcAddress(DllHandle,"BASS_SampleLoad")

'HSAMPLE BASSDEF(BASS_SampleLoad)(BOOL mem, Const void *file, DWORD offset, DWORD length, DWORD Max, DWORD flags);




Global BASS_SampleCreate:Byte Ptr(length:Int, freq:Int, Max_:Int, flags:Int)"Win32" = GetProcAddress(DllHandle,"BASS_SampleCreate")

'void* BASSDEF(BASS_SampleCreate)(DWORD length, DWORD freq, DWORD Max, DWORD flags);



Global BASS_SampleCreateDone()"Win32" = GetProcAddress(DllHandle,"BASS_SampleCreateDone")

'HSAMPLE BASSDEF(BASS_SampleCreateDone)();




Global BASS_SampleFree(handle:Int)"Win32" = GetProcAddress(DllHandle,"BASS_SampleFree")

'BOOL BASSDEF(BASS_SampleFree)(HSAMPLE handle);





Global BASS_SampleGetInfo(handle:Int, BASS_SAMPLE_Info:Byte Ptr)"Win32" = GetProcAddress(DllHandle,"BASS_SampleGetInfo")

'BOOL BASSDEF(BASS_SampleGetInfo)(HSAMPLE handle, BASS_SAMPLE *info);





Global BASS_SampleSetInfo(handle:Int, BASS_SAMPLE_Info:Byte Ptr)"Win32" = GetProcAddress(DllHandle,"BASS_SampleSetInfo")

'BOOL BASSDEF(BASS_SampleSetInfo)(HSAMPLE handle, Const BASS_SAMPLE *info);



Global BASS_SampleGetChannel(handle:Int, onlynew:Int)"Win32" = GetProcAddress(DllHandle,"BASS_SampleGetChannel")

'HCHANNEL BASSDEF(BASS_SampleGetChannel)(HSAMPLE handle, BOOL onlynew);




Global BASS_SampleStop(handle:Int)"Win32" = GetProcAddress(DllHandle,"BASS_SampleStop")

'BOOL BASSDEF(BASS_SampleStop)(HSAMPLE handle);





Global BASS_StreamCreate(freq:Int, chans:Int, flags:Int, proc:Byte Ptr, user:Int)"Win32" = GetProcAddress(DllHandle,"BASS_StreamCreate")

'HSTREAM BASSDEF(BASS_StreamCreate)(DWORD freq, DWORD chans, DWORD flags, STREAMPROC *proc, DWORD user);




Global BASS_StreamCreateFile(mem:Int, file:Byte Ptr, offset:Int, length:Int, flags:Int)"Win32" = GetProcAddress(DllHandle,"BASS_StreamCreateFile")

'HSTREAM BASSDEF(BASS_StreamCreateFile)(BOOL mem, Const void *file, DWORD offset, DWORD length, DWORD flags);




Global BASS_StreamCreateURL(url$z, offset:Int, flags:Int, proc:Byte Ptr, user:Int)"Win32" = GetProcAddress(DllHandle,"BASS_StreamCreateURL")

'HSTREAM BASSDEF(BASS_StreamCreateURL)(Const char *url, DWORD offset, DWORD flags, DOWNLOADPROC *proc, DWORD user);




Global BASS_StreamCreateFileUser(buffered:Int, flags:Int, proc:Byte Ptr, user:Int)"Win32" = GetProcAddress(DllHandle,"BASS_StreamCreateFileUser")

'HSTREAM BASSDEF(BASS_StreamCreateFileUser)(BOOL buffered, DWORD flags, STREAMFILEPROC *proc, DWORD user);





Global BASS_StreamFree(handle:Int)"Win32" = GetProcAddress(DllHandle,"BASS_StreamFree")

'BOOL BASSDEF(BASS_StreamFree)(HSTREAM handle);






Global BASS_StreamGetLength:Long(handle:Int)"Win32" = GetProcAddress(DllHandle,"BASS_StreamGetLength")

'QWORD BASSDEF(BASS_StreamGetLength)(HSTREAM handle);




Global BASS_StreamGetTags:Byte Ptr(handle:Int, tags:Int)"Win32" = GetProcAddress(DllHandle,"BASS_StreamGetTags")

'char *BASSDEF(BASS_StreamGetTags)(HSTREAM handle, DWORD tags);



Global BASS_StreamGetFilePosition(handle:Int, mode:Int)"Win32" = GetProcAddress(DllHandle,"BASS_StreamGetFilePosition")

'DWORD BASSDEF(BASS_StreamGetFilePosition)(HSTREAM handle, DWORD mode);




Global BASS_RecordGetDeviceDescription:Byte Ptr(device:Int)"Win32" = GetProcAddress(DllHandle,"BASS_RecordGetDeviceDescription")

'char *BASSDEF(BASS_RecordGetDeviceDescription)(DWORD device);




Global BASS_RecordInit(device:Int)"Win32" = GetProcAddress(DllHandle,"BASS_RecordInit")

'BOOL BASSDEF(BASS_RecordInit)(DWORD device);






Global BASS_RecordSetDevice(device:Int)"Win32" = GetProcAddress(DllHandle,"BASS_RecordSetDevice")

'BOOL BASSDEF(BASS_RecordSetDevice)(DWORD device);





Global BASS_RecordGetDevice()"Win32" = GetProcAddress(DllHandle,"BASS_RecordGetDevice")

'DWORD BASSDEF(BASS_RecordGetDevice)();



Global BASS_RecordFree()"Win32" = GetProcAddress(DllHandle,"BASS_RecordFree")

'BOOL BASSDEF(BASS_RecordFree)();




Global BASS_RecordGetInfo(BASS_RECORDINFO_Info:Byte Ptr)"Win32" = GetProcAddress(DllHandle,"BASS_RecordGetInfo")

'BOOL BASSDEF(BASS_RecordGetInfo)(BASS_RECORDINFO *info);





Global BASS_RecordGetInputName:Byte Ptr(Input_:Int)"Win32" = GetProcAddress(DllHandle,"BASS_RecordGetInputName")

'char *BASSDEF(BASS_RecordGetInputName)(DWORD Input);





Global BASS_RecordSetInput(Input_:Int, setting:Int)"Win32" = GetProcAddress(DllHandle,"BASS_RecordSetInput")


'BOOL BASSDEF(BASS_RecordSetInput)(DWORD Input, DWORD setting);






Global BASS_RecordGetInput(Input_:Int)"Win32" = GetProcAddress(DllHandle,"BASS_RecordGetInput")

'DWORD BASSDEF(BASS_RecordGetInput)(DWORD Input);




Global BASS_RecordStart(freq:Int, chans:Int, flags:Int, proc:Byte Ptr, user:Int)"Win32" = GetProcAddress(DllHandle,"BASS_RecordStart")

'HRECORD BASSDEF(BASS_RecordStart)(DWORD freq, DWORD chans, DWORD flags, RECORDPROC *proc, DWORD user);






Global BASS_ChannelBytes2Seconds:Float(handle:Int, pos:Long)"Win32" = GetProcAddress(DllHandle,"BASS_ChannelBytes2Seconds")

'Float BASSDEF(BASS_ChannelBytes2Seconds)(DWORD handle, QWORD pos);





Global BASS_ChannelSeconds2Bytes:Long(handle:Int, pos:Float)"Win32" = GetProcAddress(DllHandle,"BASS_ChannelSeconds2Bytes")

'QWORD BASSDEF(BASS_ChannelSeconds2Bytes)(DWORD handle, Float pos);






Global BASS_ChannelGetDevice(handle:Int)"Win32" = GetProcAddress(DllHandle,"BASS_ChannelGetDevice")

'DWORD BASSDEF(BASS_ChannelGetDevice)(DWORD handle);






Global BASS_ChannelIsActive(handle:Int)"Win32" = GetProcAddress(DllHandle,"BASS_ChannelIsActive")

'DWORD BASSDEF(BASS_ChannelIsActive)(DWORD handle);




Global BASS_ChannelGetInfo(handle:Int, BASS_CHANNELINFO_Info:Byte Ptr)"Win32" = GetProcAddress(DllHandle,"BASS_ChannelGetInfo")

'BOOL BASSDEF(BASS_ChannelGetInfo)(DWORD handle, BASS_CHANNELINFO *info);






Global BASS_ChannelSetFlags(handle:Int, flags:Int)"Win32" = GetProcAddress(DllHandle,"BASS_ChannelSetFlags")

'BOOL BASSDEF(BASS_ChannelSetFlags)(DWORD handle, DWORD flags);




Global BASS_ChannelPreBuf(handle:Int)"Win32" = GetProcAddress(DllHandle,"BASS_ChannelPreBuf")

'BOOL BASSDEF(BASS_ChannelPreBuf)(DWORD handle);




Global BASS_ChannelPlay(handle:Int, restart:Int)"Win32" = GetProcAddress(DllHandle,"BASS_ChannelPlay")


'BOOL BASSDEF(BASS_ChannelPlay)(DWORD handle, BOOL restart);





Global BASS_ChannelStop(handle:Int)"Win32" = GetProcAddress(DllHandle,"BASS_ChannelStop")

'BOOL BASSDEF(BASS_ChannelStop)(DWORD handle);





Global BASS_ChannelPause(handle:Int)"Win32" = GetProcAddress(DllHandle,"BASS_ChannelPause")

'BOOL BASSDEF(BASS_ChannelPause)(DWORD handle);






Global BASS_ChannelSetAttributes(handle:Int, freq:Int, volume:Int, pan:Int)"Win32" = GetProcAddress(DllHandle,"BASS_ChannelSetAttributes")

'BOOL BASSDEF(BASS_ChannelSetAttributes)(DWORD handle, Int freq, Int volume, Int pan);






Global BASS_ChannelGetAttributes(handle:Int, freq:Int Ptr, volume:Int Ptr, pan:Int Ptr)"Win32" = GetProcAddress(DllHandle,"BASS_ChannelGetAttributes")

'BOOL BASSDEF(BASS_ChannelGetAttributes)(DWORD handle, DWORD *freq, DWORD *volume, Int *pan);






Global BASS_ChannelSlideAttributes(handle:Int, freq:Int, volume:Int , pan:Int, time:Int)"Win32" = GetProcAddress(DllHandle,"BASS_ChannelSlideAttributes")

'BOOL BASSDEF(BASS_ChannelSlideAttributes)(DWORD handle, Int freq, Int volume, Int pan, DWORD time);




Global BASS_ChannelIsSliding(handle:Int)"Win32" = GetProcAddress(DllHandle,"BASS_ChannelIsSliding")

'DWORD BASSDEF(BASS_ChannelIsSliding)(DWORD handle);






Global BASS_ChannelSet3DAttributes(handle:Int, mode:Int, Min_:Float, Max_:Float, iangle:Int, oangle:Int, outvol:Int)"Win32" = GetProcAddress(DllHandle,"BASS_ChannelSet3DAttributes")

'BOOL BASSDEF(BASS_ChannelSet3DAttributes)(DWORD handle, Int mode, Float Min, Float Max, Int iangle, Int oangle, Int outvol);






Global BASS_ChannelGet3DAttributes(handle:Int, mode:Int Ptr, Min_:Float Ptr, Max_:Float Ptr, iangle:Int Ptr, oangle:Int Ptr, outvol:Int Ptr)"Win32" = GetProcAddress(DllHandle,"BASS_ChannelGet3DAttributes")

'BOOL BASSDEF(BASS_ChannelGet3DAttributes)(DWORD handle, DWORD *mode, Float *Min, Float *Max, DWORD *iangle, DWORD *oangle, DWORD *outvol);





Global BASS_ChannelSet3DPosition(handle:Int, BASS_3DVECTOR_Pos:Byte Ptr, BASS_3DVECTOR_Orient:Byte Ptr, BASS_3DVECTOR_Vel:Byte Ptr)"Win32" = GetProcAddress(DllHandle,"BASS_ChannelSet3DPosition")

'BOOL BASSDEF(BASS_ChannelSet3DPosition)(DWORD handle, Const BASS_3DVECTOR *pos, Const BASS_3DVECTOR *orient, Const BASS_3DVECTOR *vel);



Global BASS_ChannelGet3DPosition(handle:Int, BASS_3DVECTOR_Pos:Byte Ptr, BASS_3DVECTOR_Orient:Byte Ptr, BASS_3DVECTOR_Vel:Byte Ptr)"Win32" = GetProcAddress(DllHandle,"BASS_ChannelGet3DPosition")

'BOOL BASSDEF(BASS_ChannelGet3DPosition)(DWORD handle, BASS_3DVECTOR *pos, BASS_3DVECTOR *orient, BASS_3DVECTOR *vel);




Global BASS_ChannelSetPosition(handle:Int, pos:Long)"Win32" = GetProcAddress(DllHandle,"BASS_ChannelSetPosition")

'BOOL BASSDEF(BASS_ChannelSetPosition)(DWORD handle, QWORD pos);



Global BASS_ChannelGetPosition:Long(handle:Int)"Win32" = GetProcAddress(DllHandle,"BASS_ChannelGetPosition")

'QWORD BASSDEF(BASS_ChannelGetPosition)(DWORD handle);





Global BASS_ChannelGetLevel(handle:Int)"Win32" = GetProcAddress(DllHandle,"BASS_ChannelGetLevel")

'DWORD BASSDEF(BASS_ChannelGetLevel)(DWORD handle);




Global BASS_ChannelGetData(handle:Int, buffer:Byte Ptr, length:Int)"Win32" = GetProcAddress(DllHandle,"BASS_ChannelGetData")

'DWORD BASSDEF(BASS_ChannelGetData)(DWORD handle, void *buffer, DWORD length);





Global BASS_ChannelSetSync(handle:Int, Type_:Int, param:Long, proc:Byte Ptr, user:Int)"Win32" = GetProcAddress(DllHandle,"BASS_ChannelSetSync")

'HSYNC BASSDEF(BASS_ChannelSetSync)(DWORD handle, DWORD Type, QWORD param, SYNCPROC *proc, DWORD user);




Global BASS_ChannelRemoveSync(handle:Int, sync:Int)"Win32" = GetProcAddress(DllHandle,"BASS_ChannelRemoveSync")

'BOOL BASSDEF(BASS_ChannelRemoveSync)(DWORD handle, HSYNC sync);




Global BASS_ChannelSetDSP(handle:Int, proc:Byte Ptr, user:Int, priority:Int)"Win32" = GetProcAddress(DllHandle,"BASS_ChannelSetDSP")

'HDSP BASSDEF(BASS_ChannelSetDSP)(DWORD handle, DSPPROC *proc, DWORD user, Int priority);




Global BASS_ChannelRemoveDSP(handle:Int, dsp:Int)"Win32" = GetProcAddress(DllHandle,"BASS_ChannelRemoveDSP")

'BOOL BASSDEF(BASS_ChannelRemoveDSP)(DWORD handle, HDSP dsp);




Global BASS_ChannelSetFX(handle:Int, type_:Int, priority:Int)"Win32" = GetProcAddress(DllHandle,"BASS_ChannelSetFX")

'HFX BASSDEF(BASS_ChannelSetFX)(DWORD handle, DWORD Type, DWORD priority);






Global BASS_ChannelRemoveFX(handle:Int, fx:Int)"Win32" = GetProcAddress(DllHandle,"BASS_ChannelRemoveFX")

'BOOL BASSDEF(BASS_ChannelRemoveFX)(DWORD handle, HFX fx);



Global BASS_ChannelSetEAXMix(handle:Int, mix:Float)"Win32" = GetProcAddress(DllHandle,"BASS_ChannelSetEAXMix")

'BOOL BASSDEF(BASS_ChannelSetEAXMix)(DWORD handle, Float mix);




Global BASS_ChannelGetEAXMix(handle:Int, mix:Float Ptr)"Win32" = GetProcAddress(DllHandle,"BASS_ChannelGetEAXMix")

'BOOL BASSDEF(BASS_ChannelGetEAXMix)(DWORD handle, Float *mix);




Global BASS_ChannelSetLink(handle:Int, chan:Int)"Win32" = GetProcAddress(DllHandle,"BASS_ChannelSetLink")

'BOOL BASSDEF(BASS_ChannelSetLink)(DWORD handle, DWORD chan);



Global BASS_ChannelRemoveLink(handle:Int, chan:Int)"Win32" = GetProcAddress(DllHandle,"BASS_ChannelRemoveLink")

'BOOL BASSDEF(BASS_ChannelRemoveLink)(DWORD handle, DWORD chan);



Global BASS_FXSetParameters(handle:Int, par:Byte Ptr)"Win32" = GetProcAddress(DllHandle,"BASS_FXSetParameters")

'BOOL BASSDEF(BASS_FXSetParameters)(HFX handle, Const void *par);



Global BASS_FXGetParameters(handle:Int, par:Byte Ptr)"Win32" = GetProcAddress(DllHandle,"BASS_FXGetParameters")

'BOOL BASSDEF(BASS_FXGetParameters)(HFX handle, void *par);





Function LoWord:Short(Value:Int)
   Return Value & $0000FFFF
End Function


Function HiWord:Short(Value:Int)
   Return (Value & $FFFF0000) Shr 16
End Function



Function StripTags:String[](Data:Byte Ptr)
   
   Local TempArray:String[]
   Local TempChar
   Local NewString:String
   
   For Local i:Int = 0 Until 128
   
      If Data[i] = 0
         Continue
      EndIf
      
      NewString = ""
      
      Repeat
         TempChar = Data[i]
      
         If TempChar = 0
            Exit
         EndIf
         
         NewString:+Chr(TempChar)
         
         i:+1
      Forever TempChar=0
      
      NewString = Trim(NewString)
      
      If NewString.length>0
         TempArray = TempArray[..TempArray.length+1]
         TempArray[TempArray.length-1] = NewString
      EndIf
      
   Next
   
   Return TempArray
End Function 



And a small sample with Online streams

Strict

Import "bass.bmx"

'Ohne Win32 hinter der Funktion gibt es einen Absturz da sich die Aufrufkonventionen sonst unterscheiden
Function SaveMusicCallback(buffer:Byte Ptr, length:Int, user:Int)"Win32"
   Global FileStream:TStream
   
   If FileStream = Null
      FileStream = WriteFile("c:\dateidownload.mp3")
   EndIf
   
   If Buffer = Null
      CloseFile(FileStream)
   Else
      For Local i:Int = 0 Until length
         WriteByte(FileStream, buffer[i])
      Next
   EndIf
   
End Function



Graphics 640,480,0


If Not BASS_Init(1, 44100, 0, 0, Null)
   Notify("Fehler bei der Initialisierung")
   End
EndIf




'Beliebige MP3, MP2, MP1, OGG oder WAV Datei kann geladen werden

Global MusicStream:Int = BASS_StreamCreateUrl("http://www.rektor.no/filarkiv/princesstream.mp3",0, BASS_STREAM_META|BASS_STREAM_STATUS,SaveMusicCallback,0)


If MusicStream = 0
   Notify("Musik konnte nicht geladen werden")
   End
EndIf

BASS_ChannelPlay(MusicStream,0)      


Repeat
   Cls
   
   Local Level:Int = BASS_ChannelGetLevel(MusicStream)
   Local LeftLevel:Float = LoWord(Level)/100.0
   Local RightLevel:Float = HiWord(Level)/100.0
   
   
   
   SetColor 255,0,0
   DrawRect 30,GraphicsHeight()-50, 100, -LeftLevel
   
   SetColor 0,255,0
   DrawRect GraphicsWidth()-160,GraphicsHeight()-50, 100, -RightLevel
   
   
   
   SetColor 255,255,255
   DrawText "BASS CPU: "+BASS_GetCPU(),10,10
   DrawText "Linker Level: "+LoWord(Level),10,30
   DrawText "Rechter Level: "+HiWord(Level),10, 50
   
   Flip
   FlushMem()
Until KeyDown(KEY_ESCAPE) 


Mfg Suco

Nice work Suco ;)

Great !!!

I have a question i have try to modify a music (MOD) volume with

BASS_ChannelSetAttributes(ID,0,Volume,0)

But this function return an error ? any idea ? It is the good command ?

The old command : BASS_MusicSetVolume(MusicStream,50)

Seem to be forget ?

And another question :

I have try to check the data channel with this stuff :

Global MYBANK:TBank=CreateBank(1024)
BASS_ChannelGetData(MusicStream,MYBANK,BASS_DATA_FFT1024)

But the program crash ?

Seem crash with blitzmax 1.22, after a while :( any idea ?


Strict

Import "bass.bmx"

'Ohne Win32 hinter der Funktion gibt es einen Absturz da sich die Aufrufkonventionen sonst unterscheiden
Function SaveMusicCallback(buffer:Byte Ptr, length:Int, user:Int)"Win32"
   Global FileStream:TStream
   
   If FileStream = Null
      FileStream = WriteFile("c:\dateidownload.mp3")
   EndIf
   
   If buffer = Null
      CloseFile(FileStream)
   Else
      For Local i:Int = 0 Until length
         WriteByte(FileStream, buffer[i])
      Next
   EndIf
   
End Function



Graphics 640,480,0


If not BASS_Init(1, 44100, 0, 0, Null)
   Notify("Fehler bei der Initialisierung")
   End
EndIf




'Beliebige MP3, MP2, MP1, OGG oder WAV Datei kann geladen werden

'Global MusicStream:Int = BASS_StreamCreateUrl("http://www.rektor.no/filarkiv/princesstream.mp3",0, BASS_STREAM_META|BASS_STREAM_STATUS,SaveMusicCallback,0)
Global MusicStream:Int = BASS_StreamCreateUrl("http://64.236.34.4:80/stream/1018",0, BASS_STREAM_META|BASS_STREAM_STATUS,SaveMusicCallback,0)
'Global MusicStream:Int = BASS_StreamCreateUrl("http://www.blitz3dfr.com/tempo/Andreas%20Vollenweider%20-%20Ascent%20From%20The%20Circle.mp3",0, BASS_STREAM_META|BASS_STREAM_STATUS,SaveMusicCallback,0)

If MusicStream = 0
   Notify("Musik konnte nicht geladen werden")
   End
EndIf

BASS_ChannelPlay(MusicStream,0)      


Repeat
   Cls
   
   Local Level:Int = BASS_ChannelGetLevel(MusicStream)
   Local LeftLevel:Float = LoWord(Level)/100.0
   Local RightLevel:Float = HiWord(Level)/100.0
   
   
   
   SetColor 255,0,0
   DrawRect 30,GraphicsHeight()-50, 100, -LeftLevel
   
   SetColor 0,255,0
   DrawRect GraphicsWidth()-160,GraphicsHeight()-50, 100, -RightLevel
   
   
   
   SetColor 255,255,255
   DrawText "BASS CPU: "+BASS_GetCPU(),10,10
   DrawText "Linker Level: "+LoWord(Level),10,30
   DrawText "Rechter Level: "+HiWord(Level),10, 50
   
   Flip
Until KeyDown(KEY_ESCAPE) 


flax: can you check that your compile was without debug and try it again. This worked for me using portmidi the problem seemed to be a callback handler and debug output?

Is anyone going to worl on a mac verison of this. Would be very useull as part of my pushy port to the MAC!