BASS audio library v2.4.11 and PureBasic 5.31 includes

Developed or developing a new product in PureBasic? Tell the world about it.
User avatar
Rescator
Addict
Addict
Posts: 1769
Joined: Sat Feb 19, 2005 5:05 pm
Location: Norway

BASS audio library v2.4.11 and PureBasic 5.31 includes

Post by Rescator »

http://www.un4seen.com/
Click on BASS in the menu on the left, then scroll down to "Other APIs" and there you should find a download link for "Pure Basic API".
BASS is an audio library for use in Windows and Mac OSX software. Its purpose is to provide developers with powerful and efficient sample, stream (MP3, MP2, MP1, OGG, WAV, AIFF, custom generated, and more via add-ons), MOD music (XM, IT, S3M, MOD, MTM, UMX), MO3 music (MP3/OGG compressed MODs), and recording functions. All in a tiny DLL, under 100KB* in size.

On Windows, BASS requires DirectX 3 or above for output, and takes advantage of DirectSound and DirectSound3D hardware accelerated drivers, when available. On OSX, BASS uses CoreAudio for output, and OSX 10.3 or above is recommended. Both PowerPC and Intel Macs are supported.

C/C++, Delphi, Visual Basic, and MASM APIs are provided, with several examples to get you started. .Net and other APIs are also available.
The PureBasic API includes support for BASS, the BASSenc and BASSmix add-ons and constants for BASS Opus decoder and BASS AAC decoder. I will update these and any other future includes I create on a "as I need to basis", so if anyone else wish to submit includes for other BASS plugins. Or even port some of the examples to PureBasic, by all means go ahead and Ian will add those to the current PureBasic API download, just make sure to post about it on the forum so I and others are aware of it as updates to API/include packages on the BASS site is not announced normally.

Only the includes are included (pun intended), they have the constants, structures, the odd macro, some comments, and a the prototypes for the BASS fucntions, there is also a test program that shows how to get/check the version of the library and how to dynamically load the library and it's functions. The includes contains some commented C code stuff that was not directly "portable", mostly callback definitions and similar messy stuff.

Also note that BASS uses a special unicode flag on certain functions, the rest of BASS is ansi, so pay attention when passing strings to/from BASS functions as you may be juggling Unicode UTF-16 or Unicode UTF-8 or ASCII (7bit).

Personally I have found that BASS plays nicely (pun intended) with PureBasic. There is also a MacOS/Linux/Android version available but as I do not have any of those I could not check if the includes work on them, these includes are mainly Windows OS centric.


Note! I Did some changes compared to the previous includes, it should be easier to maintain the new ones as they are a little closer to the official C includes now.
User avatar
oryaaaaa
Enthusiast
Enthusiast
Posts: 791
Joined: Mon Jan 12, 2004 11:40 pm
Location: Okazaki, JAPAN

Re: BASS audio library v2.4.11 and PureBasic 5.31 includes

Post by oryaaaaa »

Bug head Emperor use follows code.

Code: Select all

CompilerIf #PB_Compiler_OS = #PB_Compiler_Unicode
  #BASS_UNICODE = $80000000
  #BASS_CONFIG_UNICODE = 42
CompilerElse
  #BASS_UNICODE = 0
  #BASS_CONFIG_UNICODE = 0
CompilerEndIf

Code: Select all

CompilerIf #PB_Compiler_OS = #PB_Compiler_Unicode
  BASS_ASIO_SetUnicode(#True)
  BASS_SetConfig(#BASS_CONFIG_UNICODE, #True)
CompilerEndIf

Code: Select all

Select dsd_play
  Case 0
    chan =  BASS_DSD_StreamCreateFile(#False, @FileName, 0, 0, #BASS_UNICODE | #BASS_STREAM_DECODE  | #BASS_SAMPLE_FLOAT | #BASS_SAMPLE_SOFTWARE , dsd_freq) 
  Case 1
    chan =  BASS_DSD_StreamCreateFile(#False, @FileName, 0, 0, #BASS_UNICODE | #BASS_STREAM_DECODE  | #BASS_DSD_RAW | #BASS_SAMPLE_SOFTWARE , 0) 
EndSelect
SeregaZ
Enthusiast
Enthusiast
Posts: 617
Joined: Fri Feb 20, 2009 9:24 am
Location: Almaty (Kazakhstan. not Borat, but Triple G)
Contact:

Re: BASS audio library v2.4.11 and PureBasic 5.31 includes

Post by SeregaZ »

can you little hepl with that bass? i didnt understand how to make convert audio. i have wav in a memory PCM, 8bit, 10k frequency. i need almost same, but 5200 frequency and in memory too. i try to read help file, but not find some "encode" command.
User avatar
Roger Hågensen
User
User
Posts: 47
Joined: Wed Mar 25, 2015 1:06 pm
Location: Norway

Re: BASS audio library v2.4.11 and PureBasic 5.31 includes

Post by Roger Hågensen »

You need to do re-sampling. Also this is announcement post.
Might want to post your question in http://www.purebasic.fr/english/viewforum.php?f=13

Or visit the BASS website at http://www.un4seen.com/
In the menu on the right is the forum link for BASS.
The forums there are generally helpful just like here.
4 music albums under CC BY license available for free (any use, even commercial) at Skuldwyrm.no
Aleks_Longard
User
User
Posts: 59
Joined: Mon Dec 24, 2012 9:07 am
Location: Germany, Munich

Re: BASS audio library v2.4.11 and PureBasic 5.31 includes

Post by Aleks_Longard »

I write new include file for last BASS 2.4.14

Code: Select all

; BASS 2.4.14 PureBasic header file
; Copyright (c) 1999-2019 Un4seen Developments Ltd.

#True = 1
#False = 0

#BASSVERSION = $204 ; API version
#BASSVERSIONTEXT = "2.4"

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

; BASS_SetConfig options
#BASS_CONFIG_BUFFER = 0
#BASS_CONFIG_UPDATEPERIOD = 1
#BASS_CONFIG_GVOL_SAMPLE = 4
#BASS_CONFIG_GVOL_STREAM = 5
#BASS_CONFIG_GVOL_MUSIC = 6
#BASS_CONFIG_CURVE_VOL = 7
#BASS_CONFIG_CURVE_PAN = 8
#BASS_CONFIG_FLOATDSP = 9
#BASS_CONFIG_3DALGORITHM = 10
#BASS_CONFIG_NET_TIMEOUT = 11
#BASS_CONFIG_NET_BUFFER = 12
#BASS_CONFIG_PAUSE_NOPLAY = 13
#BASS_CONFIG_NET_PREBUF = 15
#BASS_CONFIG_NET_PASSIVE = 18
#BASS_CONFIG_REC_BUFFER = 19
#BASS_CONFIG_NET_PLAYLIST = 21
#BASS_CONFIG_MUSIC_VIRTUAL = 22
#BASS_CONFIG_VERIFY = 23
#BASS_CONFIG_UPDATETHREADS = 24
#BASS_CONFIG_DEV_BUFFER = 27
#BASS_CONFIG_REC_LOOPBACK = 28
#BASS_CONFIG_VISTA_TRUEPOS = 30
#BASS_CONFIG_IOS_MIXAUDIO = 34
#BASS_CONFIG_DEV_DEFAULT = 36
#BASS_CONFIG_NET_READTIMEOUT = 37
#BASS_CONFIG_VISTA_SPEAKERS = 38
#BASS_CONFIG_IOS_SPEAKER = 39
#BASS_CONFIG_MF_DISABLE = 40
#BASS_CONFIG_HANDLES = 41
#BASS_CONFIG_UNICODE = 42
#BASS_CONFIG_SRC = 43
#BASS_CONFIG_SRC_SAMPLE = 44
#BASS_CONFIG_ASYNCFILE_BUFFER = 45
#BASS_CONFIG_OGG_PRESCAN = 47
#BASS_CONFIG_MF_VIDEO = 48
#BASS_CONFIG_AIRPLAY = 49
#BASS_CONFIG_DEV_NONSTOP = 50
#BASS_CONFIG_IOS_NOCATEGORY = 51
#BASS_CONFIG_VERIFY_NET = 52
#BASS_CONFIG_DEV_PERIOD = 53
#BASS_CONFIG_FLOAT = 54
#BASS_CONFIG_NET_SEEK = 56
#BASS_CONFIG_AM_DISABLE = 58
#BASS_CONFIG_NET_PLAYLIST_DEPTH = 59
#BASS_CONFIG_NET_PREBUF_WAIT = 60
#BASS_CONFIG_WASAPI_PERSIST = 65
#BASS_CONFIG_REC_WASAPI = 66

; BASS_SetConfigPtr options
#BASS_CONFIG_NET_AGENT = 16
#BASS_CONFIG_NET_PROXY = 17
#BASS_CONFIG_IOS_NOTIFY = 46
#BASS_CONFIG_LIBSSL = 64

; BASS_Init flags
#BASS_DEVICE_8BITS = 1 ; 8 bit
#BASS_DEVICE_MONO = 2 ; mono
#BASS_DEVICE_3D = 4 ; enable 3D functionality
#BASS_DEVICE_16BITS = 8 ; limit output To 16 bit
#BASS_DEVICE_LATENCY = $100 ; calculate device latency (BASS_INFO struct)
#BASS_DEVICE_CPSPEAKERS = $400 ; detect speakers via Windows control panel
#BASS_DEVICE_SPEAKERS = $800 ; force enabling of speaker assignment
#BASS_DEVICE_NOSPEAKER = $1000 ; ignore speaker arrangement
#BASS_DEVICE_DMIX = $2000 ; use ALSA "dmix" plugin
#BASS_DEVICE_FREQ = $4000 ; set device sample rate
#BASS_DEVICE_STEREO = $8000 ; limit output To stereo
#BASS_DEVICE_HOG = $10000 ; hog/exclusive mode
#BASS_DEVICE_AUDIOTRACK = $20000 ; use AudioTrack output
#BASS_DEVICE_DSOUND = $40000 ; use DirectSound output

; DirectSound interfaces (For use With BASS_GetDSoundObject)
#BASS_OBJECT_DS = 1 ; IDirectSound
#BASS_OBJECT_DS3DL = 2 ; IDirectSound3DListener

; Device info Structure
Structure BASS_DEVICEINFO
*name ; description (char)
*driver ; driver (char)
flags.l
EndStructure

; BASS_DEVICEINFO flags
#BASS_DEVICE_ENABLED = 1
#BASS_DEVICE_DEFAULT = 2
#BASS_DEVICE_INIT = 4
#BASS_DEVICE_LOOPBACK = 8

#BASS_DEVICE_TYPE_MASK = $ff000000
#BASS_DEVICE_TYPE_NETWORK = $01000000
#BASS_DEVICE_TYPE_SPEAKERS = $02000000
#BASS_DEVICE_TYPE_LINE = $03000000
#BASS_DEVICE_TYPE_HEADPHONES = $04000000
#BASS_DEVICE_TYPE_MICROPHONE = $05000000
#BASS_DEVICE_TYPE_HEADSET = $06000000
#BASS_DEVICE_TYPE_HANDSET = $07000000
#BASS_DEVICE_TYPE_DIGITAL = $08000000
#BASS_DEVICE_TYPE_SPDIF = $09000000
#BASS_DEVICE_TYPE_HDMI = $0a000000
#BASS_DEVICE_TYPE_DISPLAYPORT = $40000000

; BASS_GetDeviceInfo flags
#BASS_DEVICES_AIRPLAY = $1000000

Structure BASS_INFO
flags.l ; device capabilities (DSCAPS_xxx flags)
hwsize.l ; size of total device hardware memory
hwfree.l ; size of free device hardware memory
freesam.l ; number of free sample slots in the hardware
free3d.l ; number of free 3D sample slots in the hardware
minrate.l ; min sample rate supported by the hardware
maxrate.l ; max sample rate supported by the hardware
eax.l ; device supports EAX? (always FALSE if BASS_DEVICE_3D was not used)
minbuf.l ; recommended minimum buffer length in ms (requires BASS_DEVICE_LATENCY)
dsver.l ; DirectSound version
latency.l ; delay (in ms) before start of playback (requires BASS_DEVICE_LATENCY)
initflags.l ; BASS_Init "flags" parameter
speakers.l ; number of speakers available
freq.l ; current output rate
EndStructure

; BASS_INFO flags (from DSOUND.H)
#DSCAPS_CONTINUOUSRATE = $00000010 ; supports all sample rates between min/maxrate
#DSCAPS_EMULDRIVER = $00000020 ; device does Not have hardware DirectSound support
#DSCAPS_CERTIFIED = $00000040 ; device driver has been certified by Microsoft
#DSCAPS_SECONDARYMONO = $00000100 ; mono
#DSCAPS_SECONDARYSTEREO = $00000200 ; stereo
#DSCAPS_SECONDARY8BIT = $00000400 ; 8 bit
#DSCAPS_SECONDARY16BIT = $00000800 ; 16 bit

; Recording device info Structure
Structure BASS_RECORDINFO
flags.l ; device capabilities (DSCCAPS_xxx flags)
formats.l ; supported standard formats (WAVE_FORMAT_xxx flags)
inputs.l ; number of inputs
singlein.l ; TRUE = only 1 input can be set at a time
freq.l ; current input rate
EndStructure

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

; defines For formats field of BASS_RECORDINFO (from MMSYSTEM.H)
#WAVE_FORMAT_1M08 = $00000001 ; 11.025 kHz, Mono, 8-bit */
#WAVE_FORMAT_1S08 = $00000002 ; 11.025 kHz, Stereo, 8-bit */
#WAVE_FORMAT_1M16 = $00000004 ; 11.025 kHz, Mono, 16-bit */
#WAVE_FORMAT_1S16 = $00000008 ; 11.025 kHz, Stereo, 16-bit */
#WAVE_FORMAT_2M08 = $00000010 ; 22.05 kHz, Mono, 8-bit */
#WAVE_FORMAT_2S08 = $00000020 ; 22.05 kHz, Stereo, 8-bit */
#WAVE_FORMAT_2M16 = $00000040 ; 22.05 kHz, Mono, 16-bit */
#WAVE_FORMAT_2S16 = $00000080 ; 22.05 kHz, Stereo, 16-bit */
#WAVE_FORMAT_4M08 = $00000100 ; 44.1 kHz, Mono, 8-bit */
#WAVE_FORMAT_4S08 = $00000200 ; 44.1 kHz, Stereo, 8-bit */
#WAVE_FORMAT_4M16 = $00000400 ; 44.1 kHz, Mono, 16-bit */
#WAVE_FORMAT_4S16 = $00000800 ; 44.1 kHz, Stereo, 16-bit */

; Sample info Structure
Structure BASS_SAMPLE
freq.l ; default playback rate
volume.f ; default volume (0-1)
pan.f ; default pan (-1=left, 0=middle, 1=right)
flags.l ; BASS_SAMPLE_xxx flags
length.l ; length (in bytes)
max.l ; maximum simultaneous playbacks
origres.l ; original resolution
chans.l ; number of channels
mingap.l ; minimum gap (ms) between creating channels
mode3d.l ; BASS_3DMODE_xxx mode
mindist.f ; minimum distance
maxdist.f ; maximum distance
iangle.l ; angle of inside projection cone
oangle.l ; angle of outside projection cone
outvol.l ; delta-volume outside the projection cone
vam.l ; voice allocation/management flags (BASS_VAM_xxx)
priority.l ; priority (0=lowest, 0xffffffff=highest)
EndStructure

#BASS_SAMPLE_8BITS = 1 ; 8 bit
#BASS_SAMPLE_FLOAT = 256 ; 32 bit floating-point
#BASS_SAMPLE_MONO = 2 ; mono
#BASS_SAMPLE_LOOP = 4 ; looped
#BASS_SAMPLE_3D = 8 ; 3D functionality
#BASS_SAMPLE_SOFTWARE = 16 ; Not using hardware mixing
#BASS_SAMPLE_MUTEMAX = 32 ; mute at max distance (3D only)
#BASS_SAMPLE_VAM = 64 ; DX7 voice allocation & management
#BASS_SAMPLE_FX = 128 ; old implementation of DX8 effects
#BASS_SAMPLE_OVER_VOL = $10000 ; override lowest volume
#BASS_SAMPLE_OVER_POS = $20000 ; override longest playing
#BASS_SAMPLE_OVER_DIST = $30000 ; override furthest from listener (3D only)

#BASS_STREAM_PRESCAN = $20000 ; enable pin-point seeking/length (MP3/MP2/MP1)
#BASS_STREAM_AUTOFREE = $40000 ; automatically free the stream when it stop/ends
#BASS_STREAM_RESTRATE = $80000 ; restrict the download rate of internet file streams
#BASS_STREAM_BLOCK = $100000 ; download/play internet file stream in small blocks
#BASS_STREAM_DECODE = $200000 ; don't play the stream, only decode (BASS_ChannelGetData)
#BASS_STREAM_STATUS = $800000 ; give server status info (HTTP/ICY tags) in DOWNLOADPROC

#BASS_MP3_IGNOREDELAY = $200 ; ignore LAME/Xing/VBRI/iTunes delay & padding info
#BASS_MP3_SETPOS = #BASS_STREAM_PRESCAN

#BASS_MUSIC_FLOAT = #BASS_SAMPLE_FLOAT
#BASS_MUSIC_MONO = #BASS_SAMPLE_MONO
#BASS_MUSIC_LOOP = #BASS_SAMPLE_LOOP
#BASS_MUSIC_3D = #BASS_SAMPLE_3D
#BASS_MUSIC_FX = #BASS_SAMPLE_FX
#BASS_MUSIC_AUTOFREE = #BASS_STREAM_AUTOFREE
#BASS_MUSIC_DECODE = #BASS_STREAM_DECODE
#BASS_MUSIC_PRESCAN = #BASS_STREAM_PRESCAN ; calculate playback length
#BASS_MUSIC_CALCLEN = #BASS_MUSIC_PRESCAN
#BASS_MUSIC_RAMP = $200 ; normal ramping
#BASS_MUSIC_RAMPS = $400 ; sensitive ramping
#BASS_MUSIC_SURROUND = $800 ; surround sound
#BASS_MUSIC_SURROUND2 = $1000 ; surround sound (mode 2)
#BASS_MUSIC_FT2PAN = $2000 ; apply FastTracker 2 panning To XM files
#BASS_MUSIC_FT2MOD = $2000 ; play .MOD As FastTracker 2 does
#BASS_MUSIC_PT1MOD = $4000 ; play .MOD As ProTracker 1 does
#BASS_MUSIC_NONINTER = $10000 ; non-interpolated sample mixing
#BASS_MUSIC_SINCINTER = $800000 ; sinc interpolated sample mixing
#BASS_MUSIC_POSRESET = $8000 ; stop all notes when moving position
#BASS_MUSIC_POSRESETEX = $400000 ; stop all notes And reset bmp/etc when moving position
#BASS_MUSIC_STOPBACK = $80000 ; stop the music on a backwards jump effect
#BASS_MUSIC_NOSAMPLE = $100000 ; don't load the samples

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

#BASS_ASYNCFILE = $40000000
#BASS_UNICODE = $80000000

#BASS_RECORD_PAUSE = $8000 ; start recording paused
#BASS_RECORD_ECHOCANCEL = $2000
#BASS_RECORD_AGC = $4000

; DX7 voice allocation & management flags
#BASS_VAM_HARDWARE = 1
#BASS_VAM_SOFTWARE = 2
#BASS_VAM_TERM_TIME = 4
#BASS_VAM_TERM_DIST = 8
#BASS_VAM_TERM_PRIO = 16

; Channel info Structure
Structure BASS_CHANNELINFO
freq.l ; default playback rate
chans.l ; channels
flags.l ; BASS_SAMPLE/STREAM/MUSIC/SPEAKER flags
ctype.l ; type of channel
origres.l ; original resolution
plugin.l ; plugin
sample.l ; sample
*filename ; filename
EndStructure

#BASS_ORIGRES_FLOAT = $10000

; BASS_CHANNELINFO types
#BASS_CTYPE_SAMPLE = 1
#BASS_CTYPE_RECORD = 2
#BASS_CTYPE_STREAM = $10000
#BASS_CTYPE_STREAM_OGG = $10002
#BASS_CTYPE_STREAM_MP1 = $10003
#BASS_CTYPE_STREAM_MP2 = $10004
#BASS_CTYPE_STREAM_MP3 = $10005
#BASS_CTYPE_STREAM_AIFF = $10006
#BASS_CTYPE_STREAM_CA = $10007
#BASS_CTYPE_STREAM_MF = $10008
#BASS_CTYPE_STREAM_AM = $10009
#BASS_CTYPE_STREAM_DUMMY = $18000
#BASS_CTYPE_STREAM_DEVICE = $18001
#BASS_CTYPE_STREAM_WAV = $40000 ; WAVE flag, LOWORD=codec
#BASS_CTYPE_STREAM_WAV_PCM = $50001
#BASS_CTYPE_STREAM_WAV_FLOAT = $50003
#BASS_CTYPE_MUSIC_MOD = $20000
#BASS_CTYPE_MUSIC_MTM = $20001
#BASS_CTYPE_MUSIC_S3M = $20002
#BASS_CTYPE_MUSIC_XM = $20003
#BASS_CTYPE_MUSIC_IT = $20004
#BASS_CTYPE_MUSIC_MO3 = $00100 ; MO3 flag

Structure BASS_PLUGINFORM
ctype.l ; channel type
*name ; format description
*exts ; file extension filter (*.ext1;*.ext2;etc...)
EndStructure

Structure BASS_PLUGININFO
version.l ; version (same form as BASS_GetVersion)
formatc.l ; number of formats
*formats.BASS_PLUGINFORM ; the array of formats
 EndStructure

; 3D vector (For 3D positions/velocities/orientations)
Structure BASS_3DVECTOR
x.f; +=right, -=left
y.f ; +=up, -=down
z.f ; +=front, -=behind
EndStructure

; 3D channel modes
#BASS_3DMODE_NORMAL = 0 ; normal 3D processing
#BASS_3DMODE_RELATIVE = 1 ; position is relative To the listener
#BASS_3DMODE_OFF = 2 ; no 3D processing

; software 3D mixing algorithms (used With BASS_CONFIG_3DALGORITHM)
#BASS_3DALG_DEFAULT = 0
#BASS_3DALG_OFF = 1
#BASS_3DALG_FULL = 2
#BASS_3DALG_LIGHT = 3

; EAX environments, use With BASS_SetEAXParameters
Enumeration 0
#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
EndEnumeration

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

Prototype.l STREAMPROC(handle.l, *buffer, length.l, *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. */

#BASS_STREAMPROC_END = $80000000 ; End of user stream flag

; special STREAMPROCs
; #STREAMPROC_DUMMY (STREAMPROC*)0 ; "dummy" stream
; #STREAMPROC_PUSH (STREAMPROC*)-1 ; push stream
; #STREAMPROC_DEVICE (STREAMPROC*)-2 ; device mix stream
; #STREAMPROC_DEVICE_3D (STREAMPROC*)-3 ; device 3D mix stream

; BASS_StreamCreateFileUser file systems
#STREAMFILE_NOBUFFER = 0
#STREAMFILE_BUFFER = 1
#STREAMFILE_BUFFERPUSH = 2

; User file stream callback functions
Prototype.i FILECLOSEPROC(*user)
Prototype.q FILELENPROC(*user)
Prototype.l FILEREADPROC(*buffer, length.l, *user)
Prototype.l FILESEEKPROC(offset.q, *user)

Structure BASS_FILEPROCS
*close
*length
*Read
*seek
EndStructure
 
; BASS_StreamPutFileData options
#BASS_FILEDATA_END = 0 ; End & close the file

; BASS_StreamGetFilePosition modes
#BASS_FILEPOS_CURRENT = 0
#BASS_FILEPOS_DECODE = #BASS_FILEPOS_CURRENT
#BASS_FILEPOS_DOWNLOAD = 1
#BASS_FILEPOS_END = 2
#BASS_FILEPOS_START = 3
#BASS_FILEPOS_CONNECTED = 4
#BASS_FILEPOS_BUFFER = 5
#BASS_FILEPOS_SOCKET = 6
#BASS_FILEPOS_ASYNCBUF = 7
#BASS_FILEPOS_SIZE = 8
#BASS_FILEPOS_BUFFERING = 9

Prototype.l DOWNLOADPROC(*buffer, length.l, *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 */

; BASS_ChannelSetSync types
#BASS_SYNC_POS = 0
#BASS_SYNC_END = 2
#BASS_SYNC_META = 4
#BASS_SYNC_SLIDE = 5
#BASS_SYNC_STALL = 6
#BASS_SYNC_DOWNLOAD = 7
#BASS_SYNC_FREE = 8
#BASS_SYNC_SETPOS = 11
#BASS_SYNC_MUSICPOS = 10
#BASS_SYNC_MUSICINST = 1
#BASS_SYNC_MUSICFX = 3
#BASS_SYNC_OGG_CHANGE = 12
#BASS_SYNC_DEV_FAIL = 14
#BASS_SYNC_DEV_FORMAT = 15
#BASS_SYNC_MIXTIME = $40000000 ; flag: sync at mixtime, Else at playtime
#BASS_SYNC_ONETIME  = $80000000 ; flag: sync only once, Else continuously

Prototype.i SYNCPROC(handle.l, channel.l, udata.l, *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 */

Prototype.i DSPPROC(handle.l, channel.l, *buffer, length.l, *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 */

Prototype.l RECORDPROC(handle.l, *buffer, length.l, *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_ChannelIsActive Return values
#BASS_ACTIVE_STOPPED = 0
#BASS_ACTIVE_PLAYING = 1
#BASS_ACTIVE_STALLED = 2
#BASS_ACTIVE_PAUSED = 3
#BASS_ACTIVE_PAUSED_DEVICE = 4

; Channel attributes
#BASS_ATTRIB_FREQ = 1
#BASS_ATTRIB_VOL = 2
#BASS_ATTRIB_PAN = 3
#BASS_ATTRIB_EAXMIX = 4
#BASS_ATTRIB_NOBUFFER = 5
#BASS_ATTRIB_VBR = 6
#BASS_ATTRIB_CPU = 7
#BASS_ATTRIB_SRC = 8
#BASS_ATTRIB_NET_RESUME = 9
#BASS_ATTRIB_SCANINFO = 10
#BASS_ATTRIB_NORAMP = 11
#BASS_ATTRIB_BITRATE = 12
#BASS_ATTRIB_BUFFER = 13
#BASS_ATTRIB_MUSIC_AMPLIFY = $100
#BASS_ATTRIB_MUSIC_PANSEP = $101
#BASS_ATTRIB_MUSIC_PSCALER = $102
#BASS_ATTRIB_MUSIC_BPM = $103
#BASS_ATTRIB_MUSIC_SPEED = $104
#BASS_ATTRIB_MUSIC_VOL_GLOBAL = $105
#BASS_ATTRIB_MUSIC_ACTIVE = $106
#BASS_ATTRIB_MUSIC_VOL_CHAN = $200 ; + channel #
#BASS_ATTRIB_MUSIC_VOL_INST = $300 ; + instrument #

; BASS_ChannelSlideAttribute flags
#BASS_SLIDE_LOG = $1000000

; BASS_ChannelGetData flags
#BASS_DATA_AVAILABLE = 0 ; query how much Data is buffered
#BASS_DATA_FIXED = $20000000 ; flag: Return 8.24 fixed-point Data
#BASS_DATA_FLOAT = $40000000 ; flag: Return floating-point sample Data
#BASS_DATA_FFT256 = $80000000 ; 256 sample FFT
#BASS_DATA_FFT512 = $80000001 ; 512 FFT
#BASS_DATA_FFT1024 = $80000002 ; 1024 FFT
#BASS_DATA_FFT2048 = $80000003 ; 2048 FFT
#BASS_DATA_FFT4096 = $80000004 ; 4096 FFT
#BASS_DATA_FFT8192 = $80000005 ; 8192 FFT
#BASS_DATA_FFT16384 = $80000006 ; 16384 FFT
#BASS_DATA_FFT32768 = $80000007 ; 32768 FFT
#BASS_DATA_FFT_INDIVIDUAL = $10 ; FFT flag: FFT For each channel, Else all combined
#BASS_DATA_FFT_NOWINDOW = $20 ; FFT flag: no Hanning window
#BASS_DATA_FFT_REMOVEDC = $40 ; FFT flag: pre-remove DC bias
#BASS_DATA_FFT_COMPLEX = $80 ; FFT flag: Return complex Data
#BASS_DATA_FFT_NYQUIST = $100 ; FFT flag: Return extra Nyquist value

; BASS_ChannelGetLevelEx flags
#BASS_LEVEL_MONO = 1
#BASS_LEVEL_STEREO = 2
#BASS_LEVEL_RMS = 4
#BASS_LEVEL_VOLPAN = 8

; BASS_ChannelGetTags types : what's returned
#BASS_TAG_ID3 = 0 ; ID3v1 tags : TAG_ID3 Structure
#BASS_TAG_ID3V2 = 1 ; ID3v2 tags : variable length block
#BASS_TAG_OGG = 2 ; OGG comments : series of null-terminated UTF-8 strings
#BASS_TAG_HTTP = 3 ; HTTP headers : series of null-terminated ANSI strings
#BASS_TAG_ICY = 4 ; ICY headers : series of null-terminated ANSI strings
#BASS_TAG_META = 5 ; ICY metadata : ANSI string
#BASS_TAG_APE = 6 ; APE tags : series of null-terminated UTF-8 strings
#BASS_TAG_MP4 = 7 ; MP4/iTunes metadata : series of null-terminated UTF-8 strings
#BASS_TAG_WMA = 8 ; WMA tags : series of null-terminated UTF-8 strings
#BASS_TAG_VENDOR = 9 ; OGG encoder : UTF-8 string
#BASS_TAG_LYRICS3 = 10 ; Lyric3v2 tag : ASCII string
#BASS_TAG_CA_CODEC = 11 ; CoreAudio codec info : TAG_CA_CODEC Structure
#BASS_TAG_MF = 13 ; Media Foundation tags : series of null-terminated UTF-8 strings
#BASS_TAG_WAVEFORMAT = 14 ; WAVE format : WAVEFORMATEEX Structure
#BASS_TAG_AM_MIME = 15 ; Android Media MIME type : ASCII string
#BASS_TAG_AM_NAME = 16 ; Android Media codec name : ASCII string
#BASS_TAG_RIFF_INFO = $100 ; RIFF "INFO" tags : series of null-terminated ANSI strings
#BASS_TAG_RIFF_BEXT = $101 ; RIFF/BWF "bext" tags : TAG_BEXT Structure
#BASS_TAG_RIFF_CART = $102 ; RIFF/BWF "cart" tags : TAG_CART Structure
#BASS_TAG_RIFF_DISP = $103 ; RIFF "DISP" text tag : ANSI string
#BASS_TAG_RIFF_CUE = $104 ; RIFF "cue " chunk : TAG_CUE Structure
#BASS_TAG_RIFF_SMPL = $105 ; RIFF "smpl" chunk : TAG_SMPL Structure
#BASS_TAG_APE_BINARY = $1000 ; + index #, binary APE tag : TAG_APE_BINARY Structure
#BASS_TAG_MUSIC_NAME = $10000 ; MOD music name : ANSI string
#BASS_TAG_MUSIC_MESSAGE = $10001 ; MOD message : ANSI string
#BASS_TAG_MUSIC_ORDERS = $10002 ; MOD order List : BYTE Array of pattern numbers
#BASS_TAG_MUSIC_AUTH = $10003 ; MOD author : UTF-8 string
#BASS_TAG_MUSIC_INST = $10100 ; + instrument #, MOD instrument name : ANSI string
#BASS_TAG_MUSIC_SAMPLE = $10300 ; + sample #, MOD sample name : ANSI string

; ID3v1 tag Structure
Structure TAG_ID3
id.a[3]
title.a[30]
artist.a[30]
album.a[30]
year.a[4]
comment.a[30]
genre.b
EndStructure

; Binary APE tag Structure
Structure TAG_APE_BINARY
*key
*Data
length.l
EndStructure

; BWF "bext" tag Structure
Structure TAG_BEXT
Description.a[256] ; description
Originator.a[32] ; name of the originator
OriginatorReference.a[32] ; reference of the originator
OriginationDate.a[10] ; date of creation (yyyy-mm-dd)
OriginationTime.a[8] ; time of creation (hh-mm-ss)
TimeReference.q ; first sample count since midnight (little-endian)
Version.w ; BWF version (little-endian)
UMID.b[64] ; SMPTE UMID
Reserved.b[190]
EndStructure

; BWF "cart" tag structures

Structure TAG_CART_TIMER
dwUsage.l ; FOURCC timer usage ID
dwValue.l ; timer value in samples from head
EndStructure

Structure TAG_CART
Version.a[4] ; version of the data structure
Title.a[64] ; title of cart audio sequence
Artist.a[64] ; artist or creator name
CutID.a[64] ; cut number identification
ClientID.a[64] ; client identification
Category.a[64] ; category ID, PSA, NEWS, etc
Classification.a[64] ; classification or auxiliary key
OutCue.a[64] ; out cue text
StartDate.a[10] ; yyyy-mm-dd
StartTime.a[8] ; hh:mm:ss
EndDate.a[10] ; yyyy-mm-dd
EndTime.a[8] ; hh:mm:ss
ProducerAppID.a[64] ; name of vendor or application
ProducerAppVersion.a[64] ; version of producer application
UserDef.a[64] ; user defined text
dwLevelReference.l ; sample value for 0 dB reference
PostTimer.TAG_CART_TIMER[8] ; 8 time markers after head
Reserved.a[276]
URL.a[1024] ; uniform resource locator
TagText.a[1] ; free form text for scripts or tags
EndStructure

; RIFF "cue " tag structures
Structure TAG_CUE_POINT
dwName.l
dwPosition.l
fccChunk.l
dwChunkStart.l
dwBlockStart.l
dwSampleOffset.l
EndStructure

Structure TAG_CUE
dwCuePoints.l
CuePoints.TAG_CUE_POINT[1]
EndStructure

; RIFF "smpl" tag structures
Structure TAG_SMPL_LOOP
 dwIdentifier.l
dwType.l
dwStart.l
dwEnd.l
dwFraction.l
dwPlayCount.l
EndStructure

Structure TAG_SMPL
dwManufacturer.l
dwProduct.l
dwSamplePeriod.l
dwMIDIUnityNote.l
dwMIDIPitchFraction.l
dwSMPTEFormat.l
dwSMPTEOffset.l
cSampleLoops.l
cbSamplerData.l
SampleLoops.TAG_SMPL_LOOP[1]
EndStructure

; CoreAudio codec info Structure
Structure TAG_CA_CODEC
ftype.l ; file format
atype.l ; audio format
*name ; description
EndStructure

CompilerIf Defined(WAVEFORMATEX, #PB_Structure) = #False
	Structure WAVEFORMATEX
wFormatTag.u
nChannels.u
nSamplesPerSec.l
nAvgBytesPerSec.l
nBlockAlign.u
wBitsPerSample.u
cbSize.u
EndStructure
CompilerEndIf

; BASS_ChannelGetLength/GetPosition/SetPosition modes
#BASS_POS_BYTE = 0 ; byte position
#BASS_POS_MUSIC_ORDER = 1 ; order.row position, MAKELONG(order,row)
#BASS_POS_OGG = 3 ; OGG bitstream number
#BASS_POS_RESET = $2000000 ; flag: reset user file buffers
#BASS_POS_RELATIVE = $4000000 ; flag: seek relative To the current position
#BASS_POS_INEXACT = $8000000 ; flag: allow seeking To inexact position
#BASS_POS_DECODE = $10000000 ; flag: get the decoding (Not playing) position
#BASS_POS_DECODETO = $20000000 ; flag: decode To the position instead of seeking
#BASS_POS_SCAN = $40000000 ; flag: scan To the position

; BASS_ChannelSetDevice/GetDevice option
#BASS_NODEVICE = $20000

; BASS_RecordSetInput flags
#BASS_INPUT_OFF = $10000
#BASS_INPUT_ON = $20000
#BASS_INPUT_TYPE_MASK = $ff000000
#BASS_INPUT_TYPE_UNDEF = $00000000
#BASS_INPUT_TYPE_DIGITAL = $01000000
#BASS_INPUT_TYPE_LINE = $02000000
#BASS_INPUT_TYPE_MIC = $03000000
#BASS_INPUT_TYPE_SYNTH = $04000000
#BASS_INPUT_TYPE_CD = $05000000
#BASS_INPUT_TYPE_PHONE = $06000000
#BASS_INPUT_TYPE_SPEAKER = $07000000
#BASS_INPUT_TYPE_WAVE = $08000000
#BASS_INPUT_TYPE_AUX = $09000000
#BASS_INPUT_TYPE_ANALOG = $0a000000

; BASS_ChannelSetFX effect types
#BASS_FX_DX8_CHORUS = 0
#BASS_FX_DX8_COMPRESSOR = 1
#BASS_FX_DX8_DISTORTION = 2
#BASS_FX_DX8_ECHO = 3
#BASS_FX_DX8_FLANGER = 4
#BASS_FX_DX8_GARGLE = 5
#BASS_FX_DX8_I3DL2REVERB = 6
#BASS_FX_DX8_PARAMEQ = 7
#BASS_FX_DX8_REVERB = 8
#BASS_FX_VOLUME = 9

Structure BASS_DX8_CHORUS
fWetDryMix.f
fDepth.f
fFeedback.f
fFrequency.f
lWaveform.l ; 0=triangle, 1=sine
fDelay.f
lPhase.l ; BASS_DX8_PHASE_xxx
 EndStructure
 
Structure BASS_DX8_COMPRESSOR
fGain.f
fAttack.f
fRelease.f
fThreshold.f
fRatio.f
fPredelay.f
EndStructure

Structure BASS_DX8_DISTORTION
fGain.f
fEdge.f
fPostEQCenterFrequency.f
fPostEQBandwidth.f
fPreLowpassCutoff.f
EndStructure

Structure BASS_DX8_ECHO
fWetDryMix.f
fFeedback.f
fLeftDelay.f
fRightDelay.f
lPanDelay.l
EndStructure

Structure BASS_DX8_FLANGER
fWetDryMix.f
fDepth.f
fFeedback.f
fFrequency.f
lWaveform.l ; 0=triangle, 1=sine
fDelay.f
lPhase.l ; BASS_DX8_PHASE_xxx
EndStructure

Structure BASS_DX8_GARGLE
dwRateHz.l ; Rate of modulation in hz
dwWaveShape.l ; 0=triangle, 1=square
EndStructure

Structure BASS_DX8_I3DL2REVERB
lRoom.i ; [-10000, 0] default: -1000 mB
lRoomHF.i ; [-10000, 0] default: 0 mB
flRoomRolloffFactor.f ; [0.0, 10.0] default: 0.0
flDecayTime.f ; [0.1, 20.0] default: 1.49s
flDecayHFRatio.f ; [0.1, 2.0] default: 0.83
lReflections.i ; [-10000, 1000] default: -2602 mB
flReflectionsDelay.f ; [0.0, 0.3] default: 0.007 s
lReverb.i ; [-10000, 2000] default: 200 mB
flReverbDelay.f ; [0.0, 0.1] default: 0.011 s
flDiffusion.f ; [0.0, 100.0] default: 100.0 %
flDensity.f ; [0.0, 100.0] default: 100.0 %
flHFReference.f ; [20.0, 20000.0] default: 5000.0 Hz
EndStructure

Structure BASS_DX8_PARAMEQ
fCenter.f
fBandwidth.f
fGain.f
EndStructure

Structure BASS_DX8_REVERB
fInGain.f ; [-96.0,0.0] default: 0.0 dB
fReverbMix.f ; [-96.0,0.0] default: 0.0 db
fReverbTime.f ; [0.001,3000.0] default: 1000.0 ms
fHighFreqRTRatio.f ; [0.001,0.999] default: 0.001
EndStructure

#BASS_DX8_PHASE_NEG_180 = 0
#BASS_DX8_PHASE_NEG_90 = 1
#BASS_DX8_PHASE_ZERO = 2
#BASS_DX8_PHASE_90 = 3
#BASS_DX8_PHASE_180 = 4

Structure BASS_FX_VOLUME_PARAM
fTarget.f
fCurrent.f
fTime.f
lCurve.l
EndStructure

Define bass_library_ = OpenLibrary(#PB_Any, "bass.dll")

Prototype.l BASS_SetConfig(option.l, value.l)
Global BASS_SetConfig.BASS_SetConfig = GetFunction(bass_library_, "BASS_SetConfig")

Prototype.l BASS_GetConfig(option.l)
Global BASS_GetConfig.BASS_GetConfig = GetFunction(bass_library_, "BASS_GetConfig")

Prototype.l BASS_SetConfigPtr(option.l, *value)
Global BASS_SetConfigPtr.BASS_SetConfigPtr = GetFunction(bass_library_, "BASS_SetConfigPtr")

Prototype.i BASS_GetConfigPtr(option.l)
Global BASS_GetConfigPtr.BASS_GetConfigPtr = GetFunction(bass_library_, "BASS_GetConfigPtr")

Prototype.l BASS_GetVersion()
Global BASS_GetVersion.BASS_GetVersion = GetFunction(bass_library_, "BASS_GetVersion")

Prototype.l BASS_ErrorGetCode()
Global BASS_ErrorGetCode.BASS_ErrorGetCode = GetFunction(bass_library_, "BASS_ErrorGetCode")

Prototype.l BASS_GetDeviceInfo(device.l, *BASS_DEVICEINFO)
Global BASS_GetDeviceInfo.BASS_GetDeviceInfo = GetFunction(bass_library_, "BASS_GetDeviceInfo")

Prototype.l BASS_Init(device.l, freq.l, flags.l, *win, *dsguid)
Global BASS_Init.BASS_Init = GetFunction(bass_library_, "BASS_Init")

Prototype.l BASS_SetDevice(device.l)
Global BASS_SetDevice.BASS_SetDevice = GetFunction(bass_library_, "BASS_SetDevice")

Prototype.l BASS_GetDevice()
Global BASS_GetDevice.BASS_GetDevice = GetFunction(bass_library_, "BASS_GetDevice")

Prototype.l BASS_Free()
Global BASS_Free.BASS_Free = GetFunction(bass_library_, "BASS_Free")

CompilerIf #PB_Compiler_OS = #PB_OS_Windows
	Prototype.i BASS_GetDSoundObject(object.l)
Global BASS_GetDSoundObject.BASS_GetDSoundObject = GetFunction(bass_library_, "BASS_GetDSoundObject")
CompilerEndIf

Prototype.l BASS_GetInfo(*BASS_INFO)
Global BASS_GetInfo.BASS_GetInfo = GetFunction(bass_library_, "BASS_GetInfo")

Prototype.l BASS_Update(length.l)
Global BASS_Update.BASS_Update = GetFunction(bass_library_, "BASS_Update")

Prototype.f BASS_GetCPU()
Global BASS_GetCPU.BASS_GetCPU = GetFunction(bass_library_, "BASS_GetCPU")

Prototype.l BASS_Start()
Global BASS_Start.BASS_Start = GetFunction(bass_library_, "BASS_Start")

Prototype.l BASS_Stop()
Global BASS_Stop.BASS_Stop = GetFunction(bass_library_, "BASS_Stop")

Prototype.l BASS_Pause()
Global BASS_Pause.BASS_Pause = GetFunction(bass_library_, "BASS_Pause")

Prototype.l BASS_IsStarted()
Global BASS_IsStarted.BASS_IsStarted = GetFunction(bass_library_, "BASS_IsStarted")

Prototype.l BASS_SetVolume(volume.f)
Global BASS_SetVolume.BASS_SetVolume = GetFunction(bass_library_, "BASS_SetVolume")

Prototype.f BASS_GetVolume()
Global BASS_GetVolume.BASS_GetVolume = GetFunction(bass_library_, "BASS_GetVolume")

Prototype.l BASS_PluginLoad(*file, flags.l)
Global BASS_PluginLoad.BASS_PluginLoad = GetFunction(bass_library_, "BASS_PluginLoad")

Prototype.l BASS_PluginFree(handle.l)
Global BASS_PluginFree.BASS_PluginFree = GetFunction(bass_library_, "BASS_PluginFree")

Prototype.i BASS_PluginGetInfo(handle.l)
Global BASS_PluginGetInfo.BASS_PluginGetInfo = GetFunction(bass_library_, "BASS_PluginGetInfo")

Prototype.l BASS_Set3DFactors(distf.f, rollf.f, doppf.f)
Global BASS_Set3DFactors.BASS_Set3DFactors = GetFunction(bass_library_, "BASS_Set3DFactors")

Prototype.l BASS_Get3DFactors(*distf, *rollf, *doppf)
Global BASS_Get3DFactors.BASS_Get3DFactors = GetFunction(bass_library_, "BASS_Get3DFactors")

Prototype.l BASS_Set3DPosition(*pos, *vel, *front, *top)
Global BASS_Set3DPosition.BASS_Set3DPosition = GetFunction(bass_library_, "BASS_Set3DPosition")

Prototype.l BASS_Get3DPosition(*pos, *vel, *front, *top)
Global BASS_Get3DPosition.BASS_Get3DPosition = GetFunction(bass_library_, "BASS_Get3DPosition")

Prototype.i BASS_Apply3D()
Global BASS_Apply3D.BASS_Apply3D = GetFunction(bass_library_, "BASS_Apply3D")

CompilerIf #PB_Compiler_OS = #PB_OS_Windows
Prototype.l BASS_SetEAXParameters(env.l, vol.f, decay.f, damp.f)
Global BASS_SetEAXParameters.BASS_SetEAXParameters = GetFunction(bass_library_, "BASS_SetEAXParameters")

Prototype.l BASS_GetEAXParameters(*env, *vol, *decay, *damp)
Global BASS_GetEAXParameters.BASS_GetEAXParameters = GetFunction(bass_library_, "BASS_GetEAXParameters")
CompilerEndIf

Prototype.l BASS_MusicLoad(mem.l, *file, offset.q, length.l, flags.l, freq.l)
Global BASS_MusicLoad.BASS_MusicLoad = GetFunction(bass_library_, "BASS_MusicLoad")

Prototype.l BASS_MusicFree(handle.l)
Global BASS_MusicFree.BASS_MusicFree = GetFunction(bass_library_, "BASS_MusicFree")

Prototype.l BASS_SampleLoad(mem.l, *file, offset.q, length.l, max.l, flags.l)
Global BASS_SampleLoad.BASS_SampleLoad = GetFunction(bass_library_, "BASS_SampleLoad")

Prototype.l BASS_SampleCreate(length.l, freq.l, chans.l, max.l, flags.l)
Global BASS_SampleCreate.BASS_SampleCreate = GetFunction(bass_library_, "BASS_SampleCreate")

Prototype.l BASS_SampleFree(handle.l)
Global BASS_SampleFree.BASS_SampleFree = GetFunction(bass_library_, "BASS_SampleFree")

Prototype.l BASS_SampleSetData(handle.l, *buffer)
Global BASS_SampleSetData.BASS_SampleSetData = GetFunction(bass_library_, "BASS_SampleSetData")

Prototype.l BASS_SampleGetData(handle.l, *buffer)
Global BASS_SampleGetData.BASS_SampleGetData = GetFunction(bass_library_, "BASS_SampleGetData")

Prototype.l BASS_SampleGetInfo(handle.l, *info);
Global BASS_SampleGetInfo.BASS_SampleGetInfo = GetFunction(bass_library_, "BASS_SampleGetInfo")

Prototype.l BASS_SampleSetInfo(handle.l, *info)
Global BASS_SampleSetInfo.BASS_SampleSetInfo = GetFunction(bass_library_, "BASS_SampleSetInfo")

Prototype.l BASS_SampleGetChannel(handle.l, onlynew.l)
Global BASS_SampleGetChannel.BASS_SampleGetChannel = GetFunction(bass_library_, "BASS_SampleGetChannel")

Prototype.l BASS_SampleGetChannels(handle.l, *channels)
Global BASS_SampleGetChannels.BASS_SampleGetChannels = GetFunction(bass_library_, "BASS_SampleGetChannels")

Prototype.l BASS_SampleStop(handle.l)
Global BASS_SampleStop.BASS_SampleStop = GetFunction(bass_library_, "BASS_SampleStop")

Prototype.l BASS_StreamCreate(freq.l, chans.l, flags.l, *proc, *user)
Global BASS_StreamCreate.BASS_StreamCreate = GetFunction(bass_library_, "BASS_StreamCreate")

Prototype.l BASS_StreamCreateFile(mem.l, *file, offset.q, length.q, flags.l)
Global BASS_StreamCreateFile.BASS_StreamCreateFile = GetFunction(bass_library_, "BASS_StreamCreateFile")

Prototype.l BASS_StreamCreateURL(*url, offset.l, flags.l, *proc, *user)
Global BASS_StreamCreateURL.BASS_StreamCreateURL = GetFunction(bass_library_, "BASS_StreamCreateURL")

Prototype.l BASS_StreamCreateFileUser(system.l, flags.l, *proc, *user)
Global BASS_StreamCreateFileUser.BASS_StreamCreateFileUser = GetFunction(bass_library_, "BASS_StreamCreateFileUser")

Prototype.l BASS_StreamFree(handle.l)
Global BASS_StreamFree.BASS_StreamFree = GetFunction(bass_library_, "BASS_StreamFree")

Prototype.q BASS_StreamGetFilePosition(handle.l, mode.l)
Global BASS_StreamGetFilePosition.BASS_StreamGetFilePosition = GetFunction(bass_library_, "BASS_StreamGetFilePosition")

Prototype.l BASS_StreamPutData(handle.l, *buffer, length.l)
Global BASS_StreamPutData.BASS_StreamPutData = GetFunction(bass_library_, "BASS_StreamPutData")

Prototype.l BASS_StreamPutFileData(handle.l, *buffer, length.l)
Global BASS_StreamPutFileData.BASS_StreamPutFileData = GetFunction(bass_library_, "BASS_StreamPutFileData")

Prototype.l BASS_RecordGetDeviceInfo(device.l, *info)
Global BASS_RecordGetDeviceInfo.BASS_RecordGetDeviceInfo = GetFunction(bass_library_, "BASS_RecordGetDeviceInfo")

Prototype.l BASS_RecordInit(device.l)
Global BASS_RecordInit.BASS_RecordInit = GetFunction(bass_library_, "BASS_RecordInit")

Prototype.l BASS_RecordSetDevice(device.l)
Global BASS_RecordSetDevice.BASS_RecordSetDevice = GetFunction(bass_library_, "BASS_RecordSetDevice")

Prototype.l BASS_RecordGetDevice()
Global BASS_RecordGetDevice.BASS_RecordGetDevice = GetFunction(bass_library_, "BASS_RecordGetDevice")

Prototype.l BASS_RecordFree()
Global BASS_RecordFree.BASS_RecordFree = GetFunction(bass_library_, "BASS_RecordFree")

Prototype.l BASS_RecordGetInfo(*info)
Global BASS_RecordGetInfo.BASS_RecordGetInfo = GetFunction(bass_library_, "BASS_RecordGetInfo")

Prototype.i BASS_RecordGetInputName(input.l)
Global BASS_RecordGetInputName.BASS_RecordGetInputName = GetFunction(bass_library_, "BASS_RecordGetInputName")

Prototype.l BASS_RecordSetInput(input.l, flags.l, volume.f)
Global BASS_RecordSetInput.BASS_RecordSetInput = GetFunction(bass_library_, "BASS_RecordSetInput")

Prototype.l BASS_RecordGetInput(input.l, *volume)
Global BASS_RecordGetInput.BASS_RecordGetInput = GetFunction(bass_library_, "BASS_RecordGetInput")

Prototype.l BASS_RecordStart(freq.l, chans.l, flags.l, *proc, *user)
Global BASS_RecordStart.BASS_RecordStart = GetFunction(bass_library_, "BASS_RecordStart")

Prototype.d BASS_ChannelBytes2Seconds(handle.l, pos.q)
Global BASS_ChannelBytes2Seconds.BASS_ChannelBytes2Seconds = GetFunction(bass_library_, "BASS_ChannelBytes2Seconds")

Prototype.q BASS_ChannelSeconds2Bytes(handle.l, pos.d)
Global BASS_ChannelSeconds2Bytes.BASS_ChannelSeconds2Bytes = GetFunction(bass_library_, "BASS_ChannelSeconds2Bytes")

Prototype.l BASS_ChannelGetDevice(handle.l)
Global BASS_ChannelGetDevice.BASS_ChannelGetDevice = GetFunction(bass_library_, "BASS_ChannelGetDevice")

Prototype.l BASS_ChannelSetDevice(handle.l, device.l)
Global BASS_ChannelSetDevice.BASS_ChannelSetDevice = GetFunction(bass_library_, "BASS_ChannelSetDevice")

Prototype.l BASS_ChannelIsActive(handle.l)
Global BASS_ChannelIsActive.BASS_ChannelIsActive = GetFunction(bass_library_, "BASS_ChannelIsActive")

Prototype.l BASS_ChannelGetInfo(handle.l, *info)
Global BASS_ChannelGetInfo.BASS_ChannelGetInfo = GetFunction(bass_library_, "BASS_ChannelGetInfo")

Prototype.i BASS_ChannelGetTags(handle.l, tags.l)
Global BASS_ChannelGetTags.BASS_ChannelGetTags = GetFunction(bass_library_, "BASS_ChannelGetTags")

Prototype.l BASS_ChannelFlags(handle.l, flags.l, mask.l)
Global BASS_ChannelFlags.BASS_ChannelFlags = GetFunction(bass_library_, "BASS_ChannelFlags")

Prototype.l BASS_ChannelUpdate(handle.l, length.l)
Global BASS_ChannelUpdate.BASS_ChannelUpdate = GetFunction(bass_library_, "BASS_ChannelUpdate")

Prototype.l BASS_ChannelLock(handle.l, lock.l)
Global BASS_ChannelLock.BASS_ChannelLock = GetFunction(bass_library_, "BASS_ChannelLock")

Prototype.l BASS_ChannelPlay(handle.l, restart.l)
Global BASS_ChannelPlay.BASS_ChannelPlay = GetFunction(bass_library_, "BASS_ChannelPlay")

Prototype.l BASS_ChannelStop(handle.l)
Global BASS_ChannelStop.BASS_ChannelStop = GetFunction(bass_library_, "BASS_ChannelStop")

Prototype.l BASS_ChannelPause(handle.l)
Global BASS_ChannelPause.BASS_ChannelPause = GetFunction(bass_library_, "BASS_ChannelPause")

Prototype.l BASS_ChannelSetAttribute(handle.l, attrib.l, value.f)
Global BASS_ChannelSetAttribute.BASS_ChannelSetAttribute = GetFunction(bass_library_, "BASS_ChannelSetAttribute")

Prototype.l BASS_ChannelGetAttribute(handle.l, attrib.l, *value)
Global BASS_ChannelGetAttribute.BASS_ChannelGetAttribute = GetFunction(bass_library_, "BASS_ChannelGetAttribute")

Prototype.l BASS_ChannelSlideAttribute(handle.l, attrib.l, value.f, time.l)
Global BASS_ChannelSlideAttribute.BASS_ChannelSlideAttribute = GetFunction(bass_library_, "BASS_ChannelSlideAttribute")

Prototype.l BASS_ChannelIsSliding(handle.l, attrib.l)
Global BASS_ChannelIsSliding.BASS_ChannelIsSliding = GetFunction( bass_library_, "BASS_ChannelIsSliding")

Prototype.l BASS_ChannelSetAttributeEx(handle.l, attrib.l, *value, size.l)
Global BASS_ChannelSetAttributeEx.BASS_ChannelSetAttributeEx = GetFunction(bass_library_, "BASS_ChannelSetAttributeEx")

Prototype.l BASS_ChannelGetAttributeEx(handle.l, attrib.l, *value, size.l)
Global BASS_ChannelGetAttributeEx.BASS_ChannelGetAttributeEx = GetFunction(bass_library_, "BASS_ChannelGetAttributeEx")

Prototype.l BASS_ChannelSet3DAttributes(handle.l, mode.l, min.f, max.f, iangle.l, oangle.l, outvol.f)
Global BASS_ChannelSet3DAttributes.BASS_ChannelSet3DAttributes = GetFunction(bass_library_, "BASS_ChannelSet3DAttributes")

Prototype.l BASS_ChannelGet3DAttributes(handle.l, *mode, *min, *max, *iangle, *oangle, *outvol)
Global BASS_ChannelGet3DAttributes.BASS_ChannelGet3DAttributes = GetFunction(bass_library_, "BASS_ChannelGet3DAttributes")

Prototype.l BASS_ChannelSet3DPosition(handle.l, *pos, *orient, *vel)
Global BASS_ChannelSet3DPosition.BASS_ChannelSet3DPosition = GetFunction(bass_library_, "BASS_ChannelSet3DPosition")

Prototype.l BASS_ChannelGet3DPosition(handle.l, *pos, *orient, *vel)
Global BASS_ChannelGet3DPosition.BASS_ChannelGet3DPosition = GetFunction(bass_library_, "BASS_ChannelGet3DPosition")

Prototype.q BASS_ChannelGetLength(handle.l, mode.l)
Global BASS_ChannelGetLength.BASS_ChannelGetLength = GetFunction(bass_library_, "BASS_ChannelGetLength")

Prototype.l BASS_ChannelSetPosition(handle.l, pos.q, mode.l)
Global BASS_ChannelSetPosition.BASS_ChannelSetPosition = GetFunction(bass_library_, "BASS_ChannelSetPosition")

Prototype.q BASS_ChannelGetPosition(handle.l, mode.l)
Global BASS_ChannelGetPosition.BASS_ChannelGetPosition = GetFunction(bass_library_, "BASS_ChannelGetPosition")

Prototype.l BASS_ChannelGetLevel(handle.l)
Global BASS_ChannelGetLevel.BASS_ChannelGetLevel = GetFunction(bass_library_, "BASS_ChannelGetLevel")

Prototype.l BASS_ChannelGetLevelEx(handle.l, *levels, length.f, flags.l)
Global BASS_ChannelGetLevelEx.BASS_ChannelGetLevelEx = GetFunction(bass_library_, "BASS_ChannelGetLevelEx")

Prototype.l BASS_ChannelGetData(handle.l, *buffer, length.l)
Global BASS_ChannelGetData.BASS_ChannelGetData = GetFunction(bass_library_, "BASS_ChannelGetData")

Prototype.l BASS_ChannelSetSync(handle.l, type.l, param.q, *proc, *user)
Global BASS_ChannelSetSync.BASS_ChannelSetSync = GetFunction(bass_library_, "BASS_ChannelSetSync")

Prototype.l BASS_ChannelRemoveSync(handle.l, sync.l)
Global BASS_ChannelRemoveSync.BASS_ChannelRemoveSync = GetFunction(bass_library_, "BASS_ChannelRemoveSync")

Prototype.l BASS_ChannelSetDSP(handle.l, *proc, *user, priority.l)
Global BASS_ChannelSetDSP.BASS_ChannelSetDSP = GetFunction(bass_library_, "BASS_ChannelSetDSP")

Prototype.l BASS_ChannelRemoveDSP(handle.l, dsp.l)
Global BASS_ChannelRemoveDSP.BASS_ChannelRemoveDSP = GetFunction(bass_library_, "BASS_ChannelRemoveDSP")

Prototype.l BASS_ChannelSetLink(handle.l, chan.l)
Global BASS_ChannelSetLink.BASS_ChannelSetLink = GetFunction(bass_library_, "BASS_ChannelSetLink")

Prototype.l BASS_ChannelRemoveLink(handle.l, chan.l)
Global BASS_ChannelRemoveLink.BASS_ChannelRemoveLink = GetFunction(bass_library_, "BASS_ChannelRemoveLink")

Prototype.l BASS_ChannelSetFX(handle.l, type.l, priority.l)
Global BASS_ChannelSetFX.BASS_ChannelSetFX = GetFunction(bass_library_, "BASS_ChannelSetFX")

Prototype.l BASS_ChannelRemoveFX(handle.l, fx.l)
Global BASS_ChannelRemoveFX.BASS_ChannelRemoveFX = GetFunction(bass_library_, "BASS_ChannelRemoveFX")

Prototype.l BASS_FXSetParameters(handle.l, *params)
Global BASS_FXSetParameters.BASS_FXSetParameters = GetFunction(bass_library_, "BASS_FXSetParameters")

Prototype.l BASS_FXGetParameters(handle.l, *params)
Global BASS_FXGetParameters.BASS_FXGetParameters = GetFunction(bass_library_, "BASS_FXGetParameters")

Prototype.l BASS_FXReset(handle.l)
Global BASS_FXReset.BASS_FXReset = GetFunction(bass_library_, "BASS_FXReset")

Prototype.l BASS_FXSetPriority(handle.l, priority.l)
Global BASS_FXSetPriority.BASS_FXSetPriority = GetFunction(bass_library_, "BASS_FXSetPriority")

; Debug Hex(BASS_GetVersion())
; Debug BASS_GetConfig(#BASS_CONFIG_UPDATEPERIOD)
; Debug BASS_GetDevice()
; Debug BASS_GetCPU()


; IDE Options = PureBasic 5.70 (Windows - x86)
; Folding = ------
Sory my bad english
Quin
Enthusiast
Enthusiast
Posts: 286
Joined: Thu Mar 31, 2022 7:03 pm
Location: United States
Contact:

Re: BASS audio library v2.4.11 and PureBasic 5.31 includes

Post by Quin »

Does anyone have a header for the latest (2.4.17) version? I tried header converter in the SDK, but it didn't work very well.
PB v5.40/6.10, Windows 10 64-bit.
16-core AMD Ryzen 9 5950X, 128 GB DDR5.
ozzie
Enthusiast
Enthusiast
Posts: 429
Joined: Sun Apr 06, 2008 12:54 pm
Location: Brisbane, Qld, Australia
Contact:

Re: BASS audio library v2.4.11 and PureBasic 5.31 includes

Post by ozzie »

Quin, I can email you what I use, so I've sent you a PM.
infratec
Always Here
Always Here
Posts: 6817
Joined: Sun Sep 07, 2008 12:45 pm
Location: Germany

Re: BASS audio library v2.4.11 and PureBasic 5.31 includes

Post by infratec »

Adapted the latest version:

Code: Select all

; BASS 2.4.17 PureBasic header file
; Copyright (c) 1999-2023 Un4seen Developments Ltd.

#True = 1
#False = 0

Macro LOBYTE(a)
  ((a) & $ff)
EndMacro

Macro HIBYTE(a)
  ((a)>>8)
EndMacro

Macro LOWORD(a)
  ((a) & $ffff)
EndMacro

Macro HIWORD(a)
  ((a)>>16)
EndMacro

Macro MAKEWORD(a, b)
  (((a)&$ff)|((b)<<8))
EndMacro

Macro MAKELONG(a, b)
  (((a)&$ffff)|((b)<<16))
EndMacro


#BASSVERSION = $204 ; API version
#BASSVERSIONTEXT = "2.4"

Macro HMUSIC
  l
EndMacro

Macro HSAMPLE
  l
EndMacro

Macro HCHANNEL
  l
EndMacro

Macro HSTREAM
  l
EndMacro

Macro HRECORD
  l
EndMacro

Macro HSYNC
  l
EndMacro

Macro HDSP
  l
EndMacro

Macro HFX
  l
EndMacro

Macro HPLUGIN
  l
EndMacro



; Error codes returned by BASS_ErrorGetCode
#BASS_OK = 0 ; all is OK
#BASS_ERROR_MEM = 1 ; memory error
#BASS_ERROR_FILEOPEN = 2 ; can't open the file
#BASS_ERROR_DRIVER = 3 ; can't find a free/valid driver
#BASS_ERROR_BUFLOST = 4 ; the sample buffer was lost
#BASS_ERROR_HANDLE = 5 ; invalid handle
#BASS_ERROR_FORMAT = 6 ; unsupported sample format
#BASS_ERROR_POSITION = 7 ; invalid position
#BASS_ERROR_INIT = 8 ; BASS_Init has Not been successfully called
#BASS_ERROR_START = 9 ; BASS_Start has Not been successfully called
#BASS_ERROR_SSL = 10 ; SSL/HTTPS support isn't available
#BASS_ERROR_ALREADY = 14 ; already initialized/paused/whatever
#BASS_ERROR_NOCHAN = 18 ; can't get a free channel
#BASS_ERROR_ILLTYPE = 19 ; an illegal type was specified
#BASS_ERROR_ILLPARAM = 20 ; an illegal parameter was specified
#BASS_ERROR_NO3D = 21 ; no 3D support
#BASS_ERROR_NOEAX = 22 ; no EAX support
#BASS_ERROR_DEVICE = 23 ; illegal device number
#BASS_ERROR_NOPLAY = 24 ; Not playing
#BASS_ERROR_FREQ = 25 ; illegal sample rate
#BASS_ERROR_NOTFILE = 27 ; the stream is Not a file stream
#BASS_ERROR_NOHW = 29 ; no hardware voices available
#BASS_ERROR_EMPTY = 31 ; the MOD music has no sequence Data
#BASS_ERROR_NONET = 32 ; no internet connection could be opened
#BASS_ERROR_CREATE = 33 ; couldn't create the file
#BASS_ERROR_NOFX = 34 ; effects are Not available
#BASS_ERROR_NOTAVAIL = 37 ; requested Data/action is Not available
#BASS_ERROR_DECODE = 38 ; the channel is/isn't a "decoding channel"
#BASS_ERROR_DX = 39 ; a sufficient DirectX version is Not installed
#BASS_ERROR_TIMEOUT = 40 ; connection timedout
#BASS_ERROR_FILEFORM = 41 ; unsupported file format
#BASS_ERROR_SPEAKER = 42 ; unavailable speaker
#BASS_ERROR_VERSION = 43 ; invalid BASS version (used by add-ons)
#BASS_ERROR_CODEC = 44 ; codec is Not available/supported
#BASS_ERROR_ENDED = 45 ; the channel/file has ended
#BASS_ERROR_BUSY = 46  ; the device is busy
#BASS_ERROR_UNSTREAMABLE = 47 ; unstreamable file
#BASS_ERROR_PROTOCOL = 48 ; unsupported protocol
#BASS_ERROR_DENIED = 49 ; access denied
#BASS_ERROR_UNKNOWN = -1 ; some other mystery problem

; BASS_SetConfig options
#BASS_CONFIG_BUFFER = 0
#BASS_CONFIG_UPDATEPERIOD = 1
#BASS_CONFIG_GVOL_SAMPLE = 4
#BASS_CONFIG_GVOL_STREAM = 5
#BASS_CONFIG_GVOL_MUSIC = 6
#BASS_CONFIG_CURVE_VOL = 7
#BASS_CONFIG_CURVE_PAN = 8
#BASS_CONFIG_FLOATDSP = 9
#BASS_CONFIG_3DALGORITHM = 10
#BASS_CONFIG_NET_TIMEOUT = 11
#BASS_CONFIG_NET_BUFFER = 12
#BASS_CONFIG_PAUSE_NOPLAY = 13
#BASS_CONFIG_NET_PREBUF = 15
#BASS_CONFIG_NET_PASSIVE = 18
#BASS_CONFIG_REC_BUFFER = 19
#BASS_CONFIG_NET_PLAYLIST = 21
#BASS_CONFIG_MUSIC_VIRTUAL = 22
#BASS_CONFIG_VERIFY = 23
#BASS_CONFIG_UPDATETHREADS = 24
#BASS_CONFIG_DEV_BUFFER = 27
#BASS_CONFIG_REC_LOOPBACK = 28
#BASS_CONFIG_VISTA_TRUEPOS = 30
#BASS_CONFIG_IOS_MIXAUDIO = 34
#BASS_CONFIG_DEV_DEFAULT = 36
#BASS_CONFIG_NET_READTIMEOUT = 37
#BASS_CONFIG_VISTA_SPEAKERS = 38
#BASS_CONFIG_IOS_SPEAKER = 39
#BASS_CONFIG_MF_DISABLE = 40
#BASS_CONFIG_HANDLES = 41
#BASS_CONFIG_UNICODE = 42
#BASS_CONFIG_SRC = 43
#BASS_CONFIG_SRC_SAMPLE = 44
#BASS_CONFIG_ASYNCFILE_BUFFER = 45
#BASS_CONFIG_OGG_PRESCAN = 47
#BASS_CONFIG_MF_VIDEO = 48
#BASS_CONFIG_AIRPLAY = 49
#BASS_CONFIG_DEV_NONSTOP = 50
#BASS_CONFIG_IOS_NOCATEGORY = 51
#BASS_CONFIG_VERIFY_NET = 52
#BASS_CONFIG_DEV_PERIOD = 53
#BASS_CONFIG_FLOAT = 54
#BASS_CONFIG_NET_SEEK = 56
#BASS_CONFIG_AM_DISABLE = 58
#BASS_CONFIG_NET_PLAYLIST_DEPTH = 59
#BASS_CONFIG_NET_PREBUF_WAIT = 60
#BASS_CONFIG_WASAPI_PERSIST = 65
#BASS_CONFIG_REC_WASAPI = 66
#BASS_CONFIG_ANDROID_AAUDIO	= 67
#BASS_CONFIG_SAMPLE_ONEHANDLE	= 69
#BASS_CONFIG_NET_META = 71
#BASS_CONFIG_NET_RESTRATE = 72
#BASS_CONFIG_REC_DEFAULT = 73
#BASS_CONFIG_NORAMP = 74

; BASS_SetConfigPtr options
#BASS_CONFIG_NET_AGENT = 16
#BASS_CONFIG_NET_PROXY = 17
#BASS_CONFIG_IOS_NOTIFY = 46
#BASS_CONFIG_LIBSSL = 64
#BASS_CONFIG_FILENAME = 75

#BASS_CONFIG_THREAD	= $40000000 ; flag: thread-specific setting

; BASS_CONFIG_IOS_SESSION flags
#BASS_IOS_SESSION_MIX = 1
#BASS_IOS_SESSION_DUCK = 2
#BASS_IOS_SESSION_AMBIENT = 4
#BASS_IOS_SESSION_SPEAKER = 8
#BASS_IOS_SESSION_DISABLE = 16
#BASS_IOS_SESSION_DEACTIVATE = 32
#BASS_IOS_SESSION_AIRPLAY = 64
#BASS_IOS_SESSION_BTHFP = 128
#BASS_IOS_SESSION_BTA2DP = $100

; BASS_Init flags
#BASS_DEVICE_8BITS = 1 ; 8 bit
#BASS_DEVICE_MONO = 2 ; mono
#BASS_DEVICE_3D = 4 ; enable 3D functionality
#BASS_DEVICE_16BITS = 8 ; limit output To 16 bit
#BASS_DEVICE_LATENCY = $100 ; calculate device latency (BASS_INFO struct)
#BASS_DEVICE_CPSPEAKERS = $400 ; detect speakers via Windows control panel
#BASS_DEVICE_SPEAKERS = $800 ; force enabling of speaker assignment
#BASS_DEVICE_NOSPEAKER = $1000 ; ignore speaker arrangement
#BASS_DEVICE_DMIX = $2000 ; use ALSA "dmix" plugin
#BASS_DEVICE_FREQ = $4000 ; set device sample rate
#BASS_DEVICE_STEREO = $8000 ; limit output To stereo
#BASS_DEVICE_HOG = $10000 ; hog/exclusive mode
#BASS_DEVICE_AUDIOTRACK = $20000 ; use AudioTrack output
#BASS_DEVICE_DSOUND = $40000     ; use DirectSound output
#BASS_DEVICE_SOFTWARE = $80000  ; disable hardware/fastpath output


; DirectSound interfaces (For use With BASS_GetDSoundObject)
#BASS_OBJECT_DS = 1 ; IDirectSound
#BASS_OBJECT_DS3DL = 2 ; IDirectSound3DListener

; Device info Structure
Structure BASS_DEVICEINFO
  *name ; description (char)
  *driver ; driver (char)
  flags.l
EndStructure

; BASS_DEVICEINFO flags
#BASS_DEVICE_ENABLED = 1
#BASS_DEVICE_DEFAULT = 2
#BASS_DEVICE_INIT = 4
#BASS_DEVICE_LOOPBACK = 8
#BASS_DEVICE_DEFAULTCOM = 128

#BASS_DEVICE_TYPE_MASK = $ff000000
#BASS_DEVICE_TYPE_NETWORK = $01000000
#BASS_DEVICE_TYPE_SPEAKERS = $02000000
#BASS_DEVICE_TYPE_LINE = $03000000
#BASS_DEVICE_TYPE_HEADPHONES = $04000000
#BASS_DEVICE_TYPE_MICROPHONE = $05000000
#BASS_DEVICE_TYPE_HEADSET = $06000000
#BASS_DEVICE_TYPE_HANDSET = $07000000
#BASS_DEVICE_TYPE_DIGITAL = $08000000
#BASS_DEVICE_TYPE_SPDIF = $09000000
#BASS_DEVICE_TYPE_HDMI = $0a000000
#BASS_DEVICE_TYPE_DISPLAYPORT = $40000000

; BASS_GetDeviceInfo flags
#BASS_DEVICES_AIRPLAY = $1000000

Structure BASS_INFO
  flags.l ; device capabilities (DSCAPS_xxx flags)
  hwsize.l ; size of total device hardware memory
  hwfree.l ; size of free device hardware memory
  freesam.l ; number of free sample slots in the hardware
  free3d.l ; number of free 3D sample slots in the hardware
  minrate.l ; min sample rate supported by the hardware
  maxrate.l ; max sample rate supported by the hardware
  eax.l ; device supports EAX? (always FALSE if BASS_DEVICE_3D was not used)
  minbuf.l ; recommended minimum buffer length in ms (requires BASS_DEVICE_LATENCY)
  dsver.l ; DirectSound version
  latency.l ; delay (in ms) before start of playback (requires BASS_DEVICE_LATENCY)
  initflags.l ; BASS_Init "flags" parameter
  speakers.l ; number of speakers available
  freq.l ; current output rate
EndStructure

; BASS_INFO flags (from DSOUND.H)
#DSCAPS_CONTINUOUSRATE = $00000010 ; supports all sample rates between min/maxrate
#DSCAPS_EMULDRIVER = $00000020 ; device does Not have hardware DirectSound support
#DSCAPS_CERTIFIED = $00000040 ; device driver has been certified by Microsoft
#DSCAPS_SECONDARYMONO = $00000100 ; mono
#DSCAPS_SECONDARYSTEREO = $00000200 ; stereo
#DSCAPS_SECONDARY8BIT = $00000400 ; 8 bit
#DSCAPS_SECONDARY16BIT = $00000800 ; 16 bit

; Recording device info Structure
Structure BASS_RECORDINFO
  flags.l ; device capabilities (DSCCAPS_xxx flags)
  formats.l ; supported standard formats (WAVE_FORMAT_xxx flags)
  inputs.l ; number of inputs
  singlein.l ; TRUE = only 1 input can be set at a time
  freq.l ; current input rate
EndStructure

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

; defines For formats field of BASS_RECORDINFO (from MMSYSTEM.H)
#WAVE_FORMAT_1M08 = $00000001 ; 11.025 kHz, Mono, 8-bit */
#WAVE_FORMAT_1S08 = $00000002 ; 11.025 kHz, Stereo, 8-bit */
#WAVE_FORMAT_1M16 = $00000004 ; 11.025 kHz, Mono, 16-bit */
#WAVE_FORMAT_1S16 = $00000008 ; 11.025 kHz, Stereo, 16-bit */
#WAVE_FORMAT_2M08 = $00000010 ; 22.05 kHz, Mono, 8-bit */
#WAVE_FORMAT_2S08 = $00000020 ; 22.05 kHz, Stereo, 8-bit */
#WAVE_FORMAT_2M16 = $00000040 ; 22.05 kHz, Mono, 16-bit */
#WAVE_FORMAT_2S16 = $00000080 ; 22.05 kHz, Stereo, 16-bit */
#WAVE_FORMAT_4M08 = $00000100 ; 44.1 kHz, Mono, 8-bit */
#WAVE_FORMAT_4S08 = $00000200 ; 44.1 kHz, Stereo, 8-bit */
#WAVE_FORMAT_4M16 = $00000400 ; 44.1 kHz, Mono, 16-bit */
#WAVE_FORMAT_4S16 = $00000800 ; 44.1 kHz, Stereo, 16-bit */

; Sample info Structure
Structure BASS_SAMPLE
  freq.l ; default playback rate
  volume.f ; default volume (0-1)
  pan.f ; default pan (-1=left, 0=middle, 1=right)
  flags.l ; BASS_SAMPLE_xxx flags
  length.l ; length (in bytes)
  max.l ; maximum simultaneous playbacks
  origres.l ; original resolution
  chans.l ; number of channels
  mingap.l ; minimum gap (ms) between creating channels
  mode3d.l ; BASS_3DMODE_xxx mode
  mindist.f ; minimum distance
  maxdist.f ; maximum distance
  iangle.l ; angle of inside projection cone
  oangle.l ; angle of outside projection cone
  outvol.l ; delta-volume outside the projection cone
  vam.l ; voice allocation/management flags (BASS_VAM_xxx)
  priority.l ; priority (0=lowest, 0xffffffff=highest)
EndStructure

#BASS_SAMPLE_8BITS = 1 ; 8 bit
#BASS_SAMPLE_FLOAT = 256 ; 32 bit floating-point
#BASS_SAMPLE_MONO = 2 ; mono
#BASS_SAMPLE_LOOP = 4 ; looped
#BASS_SAMPLE_3D = 8 ; 3D functionality
#BASS_SAMPLE_SOFTWARE = 16 ; Not using hardware mixing
#BASS_SAMPLE_MUTEMAX = 32 ; mute at max distance (3D only)
#BASS_SAMPLE_VAM = 64 ; DX7 voice allocation & management
#BASS_SAMPLE_FX = 128 ; old implementation of DX8 effects
#BASS_SAMPLE_OVER_VOL = $10000 ; override lowest volume
#BASS_SAMPLE_OVER_POS = $20000 ; override longest playing
#BASS_SAMPLE_OVER_DIST = $30000 ; override furthest from listener (3D only)

#BASS_STREAM_PRESCAN = $20000 ; enable pin-point seeking/length (MP3/MP2/MP1)
#BASS_STREAM_AUTOFREE = $40000 ; automatically free the stream when it stop/ends
#BASS_STREAM_RESTRATE = $80000 ; restrict the download rate of internet file streams
#BASS_STREAM_BLOCK = $100000 ; download/play internet file stream in small blocks
#BASS_STREAM_DECODE = $200000 ; don't play the stream, only decode (BASS_ChannelGetData)
#BASS_STREAM_STATUS = $800000 ; give server status info (HTTP/ICY tags) in DOWNLOADPROC

#BASS_MP3_IGNOREDELAY = $200 ; ignore LAME/Xing/VBRI/iTunes delay & padding info
#BASS_MP3_SETPOS = #BASS_STREAM_PRESCAN

#BASS_MUSIC_FLOAT = #BASS_SAMPLE_FLOAT
#BASS_MUSIC_MONO = #BASS_SAMPLE_MONO
#BASS_MUSIC_LOOP = #BASS_SAMPLE_LOOP
#BASS_MUSIC_3D = #BASS_SAMPLE_3D
#BASS_MUSIC_FX = #BASS_SAMPLE_FX
#BASS_MUSIC_AUTOFREE = #BASS_STREAM_AUTOFREE
#BASS_MUSIC_DECODE = #BASS_STREAM_DECODE
#BASS_MUSIC_PRESCAN = #BASS_STREAM_PRESCAN ; calculate playback length
#BASS_MUSIC_CALCLEN = #BASS_MUSIC_PRESCAN
#BASS_MUSIC_RAMP = $200 ; normal ramping
#BASS_MUSIC_RAMPS = $400 ; sensitive ramping
#BASS_MUSIC_SURROUND = $800 ; surround sound
#BASS_MUSIC_SURROUND2 = $1000 ; surround sound (mode 2)
#BASS_MUSIC_FT2PAN = $2000 ; apply FastTracker 2 panning To XM files
#BASS_MUSIC_FT2MOD = $2000 ; play .MOD As FastTracker 2 does
#BASS_MUSIC_PT1MOD = $4000 ; play .MOD As ProTracker 1 does
#BASS_MUSIC_NONINTER = $10000 ; non-interpolated sample mixing
#BASS_MUSIC_SINCINTER = $800000 ; sinc interpolated sample mixing
#BASS_MUSIC_POSRESET = $8000 ; stop all notes when moving position
#BASS_MUSIC_POSRESETEX = $400000 ; stop all notes And reset bmp/etc when moving position
#BASS_MUSIC_STOPBACK = $80000 ; stop the music on a backwards jump effect
#BASS_MUSIC_NOSAMPLE = $100000 ; don't load the samples

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

#BASS_ASYNCFILE = $40000000 ; read file asynchronously
#BASS_UNICODE = $80000000 ; UTF-16

#BASS_RECORD_ECHOCANCEL = $2000
#BASS_RECORD_AGC = $4000
#BASS_RECORD_PAUSE = $8000 ; start recording paused

; voice allocation & management flags
#BASS_VAM_HARDWARE = 1
#BASS_VAM_SOFTWARE = 2
#BASS_VAM_TERM_TIME = 4
#BASS_VAM_TERM_DIST = 8
#BASS_VAM_TERM_PRIO = 16

; Channel info Structure
Structure BASS_CHANNELINFO
  freq.l ; default playback rate
  chans.l ; channels
  flags.l ; BASS_SAMPLE/STREAM/MUSIC/SPEAKER flags
  ctype.l ; type of channel
  origres.l ; original resolution
  plugin.HPLUGIN ; plugin
  sample.HSAMPLE ; sample
  *filename ; filename
EndStructure

#BASS_ORIGRES_FLOAT = $10000

; BASS_CHANNELINFO types
#BASS_CTYPE_SAMPLE = 1
#BASS_CTYPE_RECORD = 2
#BASS_CTYPE_STREAM = $10000
#BASS_CTYPE_STREAM_VORBIS = $10002
#BASS_CTYPE_STREAM_OGG = $10002
#BASS_CTYPE_STREAM_MP1 = $10003
#BASS_CTYPE_STREAM_MP2 = $10004
#BASS_CTYPE_STREAM_MP3 = $10005
#BASS_CTYPE_STREAM_AIFF = $10006
#BASS_CTYPE_STREAM_CA = $10007
#BASS_CTYPE_STREAM_MF = $10008
#BASS_CTYPE_STREAM_AM = $10009
#BASS_CTYPE_STREAM_SAMPLE = $1000a
#BASS_CTYPE_STREAM_DUMMY = $18000
#BASS_CTYPE_STREAM_DEVICE = $18001
#BASS_CTYPE_STREAM_WAV = $40000 ; WAVE flag, LOWORD=codec
#BASS_CTYPE_STREAM_WAV_PCM = $50001
#BASS_CTYPE_STREAM_WAV_FLOAT = $50003
#BASS_CTYPE_MUSIC_MOD = $20000
#BASS_CTYPE_MUSIC_MTM = $20001
#BASS_CTYPE_MUSIC_S3M = $20002
#BASS_CTYPE_MUSIC_XM = $20003
#BASS_CTYPE_MUSIC_IT = $20004
#BASS_CTYPE_MUSIC_MO3 = $00100 ; MO3 flag

; BASS_PluginLoad flags
#BASS_PLUGIN_PROC = 1

Structure BASS_PLUGINFORM
  ctype.l ; channel type
  *name ; format description
  *exts ; file extension filter (*.ext1;*.ext2;etc...)
EndStructure

Structure BASS_PLUGININFO
  version.l ; version (same form as BASS_GetVersion)
  formatc.l ; number of formats
  *formats.BASS_PLUGINFORM ; the array of formats
EndStructure

; 3D vector (For 3D positions/velocities/orientations)
Structure BASS_3DVECTOR
  x.f; +=right, -=left
  y.f ; +=up, -=down
  z.f ; +=front, -=behind
EndStructure

; 3D channel modes
#BASS_3DMODE_NORMAL = 0 ; normal 3D processing
#BASS_3DMODE_RELATIVE = 1 ; position is relative To the listener
#BASS_3DMODE_OFF = 2 ; no 3D processing

; software 3D mixing algorithms (used With BASS_CONFIG_3DALGORITHM)
#BASS_3DALG_DEFAULT = 0
#BASS_3DALG_OFF = 1
#BASS_3DALG_FULL = 2
#BASS_3DALG_LIGHT = 3

; BASS_SampleGetChannel flags
#BASS_SAMCHAN_NEW = 1 ; get a new playback channel
#BASS_SAMCHAN_STREAM = 2  ; create a stream

PrototypeC.l STREAMPROC(handle.HSTREAM, *buffer, length.l, *user)
; User stream callback function.
; 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. */

#BASS_STREAMPROC_END = $80000000  ; End of user stream flag

; Special STREAMPROCs
#STREAMPROC_DUMMY	= 0		; "dummy" stream
#STREAMPROC_PUSH	= -1		; push stream
#STREAMPROC_DEVICE = -2		; device mix stream
#STREAMPROC_DEVICE_3D	= -3		; device 3D mix stream

; BASS_StreamCreateFileUser file systems
#STREAMFILE_NOBUFFER = 0
#STREAMFILE_BUFFER = 1
#STREAMFILE_BUFFERPUSH = 2

; User file stream callback functions
PrototypeC FILECLOSEPROC(*user)
PrototypeC.q FILELENPROC(*user)
PrototypeC.l FILEREADPROC(*buffer, length.l, *user)
PrototypeC.l FILESEEKPROC(offset.q, *user)

Structure BASS_FILEPROCS
	*close.FILECLOSEPROC
	*length.FILELENPROC
	*Read.FILEREADPROC
	*seek.FILESEEKPROC
EndStructure

; BASS_StreamPutFileData options
#BASS_FILEDATA_END = 0  ; End & close the file

; BASS_StreamGetFilePosition modes
#BASS_FILEPOS_CURRENT = 0
#BASS_FILEPOS_DECODE = #BASS_FILEPOS_CURRENT
#BASS_FILEPOS_DOWNLOAD = 1
#BASS_FILEPOS_END = 2
#BASS_FILEPOS_START = 3
#BASS_FILEPOS_CONNECTED = 4
#BASS_FILEPOS_BUFFER = 5
#BASS_FILEPOS_SOCKET = 6
#BASS_FILEPOS_ASYNCBUF = 7
#BASS_FILEPOS_SIZE = 8
#BASS_FILEPOS_BUFFERING = 9
#BASS_FILEPOS_AVAILABLE = 10

PrototypeC DOWNLOADPROC(*buffer, length.l, *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

; BASS_ChannelSetSync types
#BASS_SYNC_POS			= 0
#BASS_SYNC_END			= 2
#BASS_SYNC_META			= 4
#BASS_SYNC_SLIDE		= 5
#BASS_SYNC_STALL		= 6
#BASS_SYNC_DOWNLOAD	= 7
#BASS_SYNC_FREE			= 8
#BASS_SYNC_SETPOS		= 11
#BASS_SYNC_MUSICPOS	= 10
#BASS_SYNC_MUSICINST	= 1
#BASS_SYNC_MUSICFX		= 3
#BASS_SYNC_OGG_CHANGE	= 12
#BASS_SYNC_DEV_FAIL		= 14
#BASS_SYNC_DEV_FORMAT	= 15
#BASS_SYNC_THREAD		= $20000000	; flag: call sync in other thread
#BASS_SYNC_MIXTIME	=	$40000000	; flag: sync at mixtime, Else at playtime
#BASS_SYNC_ONETIME	=	$80000000	; flag: sync only once, Else continuously

PrototypeC SYNCPROC(handle.HSYNC, channel.l, Data_.l, *user)
; Sync callback function.
; 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

PrototypeC DSPPROC(handle.HDSP, channel.l, *buffer, length.l, *user)
; DSP callback function.
; 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

PrototypeC.l RECORDPROC(handle.HRECORD, *buffer, length.l, *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_ChannelIsActive Return values
#BASS_ACTIVE_STOPPED			= 0
#BASS_ACTIVE_PLAYING			= 1
#BASS_ACTIVE_STALLED			= 2
#BASS_ACTIVE_PAUSED			= 3
#BASS_ACTIVE_PAUSED_DEVICE	= 4

; Channel attributes
#BASS_ATTRIB_FREQ			= 1
#BASS_ATTRIB_VOL			= 	2
#BASS_ATTRIB_PAN				= 3
#BASS_ATTRIB_EAXMIX			= 4
#BASS_ATTRIB_NOBUFFER		= 5
#BASS_ATTRIB_VBR				= 6
#BASS_ATTRIB_CPU				= 7
#BASS_ATTRIB_SRC				= 8
#BASS_ATTRIB_NET_RESUME		= 9
#BASS_ATTRIB_SCANINFO		= 10
#BASS_ATTRIB_NORAMP			= 11
#BASS_ATTRIB_BITRATE			= 12
#BASS_ATTRIB_BUFFER			= 13
#BASS_ATTRIB_GRANULE			= 14
#BASS_ATTRIB_USER			= 15
#BASS_ATTRIB_TAIL			= 16
#BASS_ATTRIB_PUSH_LIMIT		= 17
#BASS_ATTRIB_DOWNLOADPROC	= 18
#BASS_ATTRIB_VOLDSP			= 19
#BASS_ATTRIB_VOLDSP_PRIORITY	= 20
#BASS_ATTRIB_MUSIC_AMPLIFY	= $100
#BASS_ATTRIB_MUSIC_PANSEP	= $101
#BASS_ATTRIB_MUSIC_PSCALER	= $102
#BASS_ATTRIB_MUSIC_BPM		= $103
#BASS_ATTRIB_MUSIC_SPEED		= $104
#BASS_ATTRIB_MUSIC_VOL_GLOBAL = $105
#BASS_ATTRIB_MUSIC_ACTIVE	= $106
#BASS_ATTRIB_MUSIC_VOL_CHAN	= $200 ; + channel #
#BASS_ATTRIB_MUSIC_VOL_INST	= $300 ;+ instrument #

; BASS_ChannelSlideAttribute flags
#BASS_SLIDE_LOG				= $1000000

; BASS_ChannelGetData flags
#BASS_DATA_AVAILABLE	= 0			; query how much Data is buffered
#BASS_DATA_NOREMOVE	= $10000000	; flag: don't remove data from recording buffer
#BASS_DATA_FIXED		= $20000000	; unused
#BASS_DATA_FLOAT		= $40000000	; flag: Return floating-point sample Data
#BASS_DATA_FFT256	= $80000000	; 256 sample FFT
#BASS_DATA_FFT512	= $80000001	; 512 FFT
#BASS_DATA_FFT1024	= $80000002	; 1024 FFT
#BASS_DATA_FFT2048	= $80000003	; 2048 FFT
#BASS_DATA_FFT4096	= $80000004	; 4096 FFT
#BASS_DATA_FFT8192	= $80000005	; 8192 FFT
#BASS_DATA_FFT16384	= $80000006	; 16384 FFT
#BASS_DATA_FFT32768	= $80000007	; 32768 FFT
#BASS_DATA_FFT_INDIVIDUAL = $10	; FFT flag: FFT For each channel, Else all combined
#BASS_DATA_FFT_NOWINDOW	= $20	; FFT flag: no Hanning window
#BASS_DATA_FFT_REMOVEDC	= $40	; FFT flag: pre-remove DC bias
#BASS_DATA_FFT_COMPLEX	= $80	; FFT flag: Return complex Data
#BASS_DATA_FFT_NYQUIST	= $100	; FFT flag: Return extra Nyquist value

; BASS_ChannelGetLevelEx flags
#BASS_LEVEL_MONO		= 1	; get mono level
#BASS_LEVEL_STEREO	= 2	; get stereo level
#BASS_LEVEL_RMS		= 4	; get RMS levels
#BASS_LEVEL_VOLPAN	= 8	; apply VOL/PAN attributes To the levels
#BASS_LEVEL_NOREMOVE	= 16	; don't remove data from recording buffer

; BASS_ChannelGetTags types : what's returned
#BASS_TAG_ID3		= 0	; ID3v1 tags : TAG_ID3 Structure
#BASS_TAG_ID3V2		= 1	; ID3v2 tags : variable length block
#BASS_TAG_OGG		= 2	; OGG comments : series of null-terminated UTF-8 strings
#BASS_TAG_HTTP		= 3	; HTTP headers : series of null-terminated ASCII strings
#BASS_TAG_ICY		= 4	; ICY headers : series of null-terminated ANSI strings
#BASS_TAG_META		= 5	; ICY metadata : ANSI string
#BASS_TAG_APE		= 6	; APE tags : series of null-terminated UTF-8 strings
#BASS_TAG_MP4 		= 7	; MP4/iTunes metadata : series of null-terminated UTF-8 strings
#BASS_TAG_WMA		= 8	; WMA tags : series of null-terminated UTF-8 strings
#BASS_TAG_VENDOR		= 9	; OGG encoder : UTF-8 string
#BASS_TAG_LYRICS3	= 10	; Lyric3v2 tag : ASCII string
#BASS_TAG_CA_CODEC	= 11	; CoreAudio codec info : TAG_CA_CODEC Structure
#BASS_TAG_MF			= 13	; Media Foundation tags : series of null-terminated UTF-8 strings
#BASS_TAG_WAVEFORMAT	= 14	; WAVE format : WAVEFORMATEEX Structure
#BASS_TAG_AM_NAME	= 16	; Android Media codec name : ASCII string
#BASS_TAG_ID3V2_2	= 17	; ID3v2 tags (2nd block) : variable length block
#BASS_TAG_AM_MIME	= 18	; Android Media MIME type : ASCII string
#BASS_TAG_LOCATION	= 19	; redirected URL : ASCII string
#BASS_TAG_RIFF_INFO	= $100 ; RIFF "INFO" tags : series of null-terminated ANSI strings
#BASS_TAG_RIFF_BEXT	= $101 ; RIFF/BWF "bext" tags : TAG_BEXT Structure
#BASS_TAG_RIFF_CART	= $102 ; RIFF/BWF "cart" tags : TAG_CART Structure
#BASS_TAG_RIFF_DISP	= $103 ; RIFF "DISP" text tag : ANSI string
#BASS_TAG_RIFF_CUE	= $104 ; RIFF "cue " chunk : TAG_CUE Structure
#BASS_TAG_RIFF_SMPL	= $105 ; RIFF "smpl" chunk : TAG_SMPL Structure
#BASS_TAG_APE_BINARY	= $1000	; + index #, binary APE tag : TAG_APE_BINARY Structure
#BASS_TAG_MUSIC_NAME		= $10000	; MOD music name : ANSI string
#BASS_TAG_MUSIC_MESSAGE	= $10001	; MOD message : ANSI string
#BASS_TAG_MUSIC_ORDERS	= $10002	; MOD order List : BYTE Array of pattern numbers
#BASS_TAG_MUSIC_AUTH		= $10003	; MOD author : UTF-8 string
#BASS_TAG_MUSIC_INST		= $10100	; + instrument #, MOD instrument name : ANSI string
#BASS_TAG_MUSIC_CHAN		= $10200	; + channel #, MOD channel name : ANSI string
#BASS_TAG_MUSIC_SAMPLE	= $10300	; + sample #, MOD sample name : ANSI string

; ID3v1 tag Structure
Structure TAG_ID3
	id.a[3]
	title.a[30]
	artist.a[30]
	album.a[30]
	year.a[4]
	comment.a[30]
	genre.a
EndStructure

; Binary APE tag Structure
Structure TAG_APE_BINARY
	*key
	*Data
	length.l
EndStructure

Structure TAG_BEXT
	Description.a[256];			// description
	Originator.a[32];			// name of the originator
	OriginatorReference.a[32];	// reference of the originator
	OriginationDate.a[10];		// date of creation (yyyy-mm-dd)
	OriginationTime.a[8];		// time of creation (hh-mm-ss)
	TimeReference.q;			// first sample count since midnight (little-endian)
	Version.u;					// BWF version (little-endian)
	UMID.a[64];					// SMPTE UMID
	Reserved.a[190];
	CodingHistory.a[0];			// history
EndStructure

; BWF "cart" tag structures
Structure TAG_CART_TIMER
	dwUsage.l;					// FOURCC timer usage ID
	dwValue.l;					// timer value in samples from head
EndStructure

Structure TAG_CART
	Version.a[4];				// version of the data structure
	Title.a[64];					// title of cart audio sequence
	Artist.a[64];				// artist or creator name
	CutID.a[64];					// cut number identification
	ClientID.a[64];				// client identification
	Category.a[64];				// category ID, PSA, NEWS, etc
	Classification.a[64];		// classification or auxiliary key
	OutCue.a[64];				// out cue text
	StartDate.a[10];				// yyyy-mm-dd
	StartTime.a[8];				// hh:mm:ss
	EndDate.a[10];				// yyyy-mm-dd
	EndTime.a[8];				// hh:mm:ss
	ProducerAppID.a[64];			// name of vendor or application
	ProducerAppVersion.a[64];	// version of producer application
	UserDef.a[64];				// user defined text
	dwLevelReference.l;			// sample value for 0 dB reference
	PostTimer.TAG_CART_TIMER[8];	// 8 time markers after head
	Reserved.a[276];
	URL.a[1024];					// uniform resource locator
	TagText.a[0];				// free form text for scripts or tags
EndStructure ;

; RIFF "cue " tag structures
Structure TAG_CUE_POINT
	dwName.l
	dwPosition.l
	fccChunk.l
	dwChunkStart.l
	dwBlockStart.l
	dwSampleOffset.l
EndStructure

Structure TAG_CUE
	dwCuePoints.l
	CuePoints.TAG_CUE_POINT[0]
EndStructure

; RIFF "smpl" tag structures
Structure TAG_SMPL_LOOP
	dwIdentifier.l
	dwType.l
	dwStart.l
	dwEnd.l
	dwFraction.l
	dwPlayCount.l
EndStructure

Structure TAG_SMPL
	dwManufacturer.l
	dwProduct.l
	dwSamplePeriod.l
	dwMIDIUnityNote.l
	dwMIDIPitchFraction.l
	dwSMPTEFormat.l
	dwSMPTEOffset.l
	cSampleLoops.l
	cbSamplerData.l
	SampleLoops.TAG_SMPL_LOOP[0]
EndStructure

; CoreAudio codec info Structure
Structure TAG_CA_CODEC
	ftype.l;					// file format
	atype.l;					// audio format
	*name;				// description
EndStructure

Structure tWAVEFORMATEX
	wFormatTag.u
	nChannels.u
	nSamplesPerSec.l
	nAvgBytesPerSec.l
	nBlockAlign.u
	wBitsPerSample.u
	cbSize.u
EndStructure

; BASS_ChannelGetLength/GetPosition/SetPosition modes
#BASS_POS_BYTE			= 0		; byte position
#BASS_POS_MUSIC_ORDER	= 1		; order.row position, MAKELONG(order,row)
#BASS_POS_OGG			= 3		; OGG bitstream number
#BASS_POS_END			= $10	; trimmed End position
#BASS_POS_LOOP			= $11	; loop start positiom
#BASS_POS_FLUSH			= $1000000 ; flag: flush decoder/FX buffers
#BASS_POS_RESET			= $2000000 ; flag: reset user file buffers
#BASS_POS_RELATIVE		= $4000000 ; flag: seek relative To the current position
#BASS_POS_INEXACT		= $8000000 ; flag: allow seeking To inexact position
#BASS_POS_DECODE			= $10000000 ; flag: get the decoding (Not playing) position
#BASS_POS_DECODETO		= $20000000 ; flag: decode To the position instead of seeking
#BASS_POS_SCAN			= $40000000 ; flag: scan To the position

; BASS_ChannelSetDevice/GetDevice option
#BASS_NODEVICE		= $20000

; BASS_RecordSetInput flags
#BASS_INPUT_OFF		= $10000
#BASS_INPUT_ON		= $20000

#BASS_INPUT_TYPE_MASK		  = $ff000000
#BASS_INPUT_TYPE_UNDEF		= $00000000
#BASS_INPUT_TYPE_DIGITAL	= $01000000
#BASS_INPUT_TYPE_LINE		  = $02000000
#BASS_INPUT_TYPE_MIC			= $03000000
#BASS_INPUT_TYPE_SYNTH		= $04000000
#BASS_INPUT_TYPE_CD			  = $05000000
#BASS_INPUT_TYPE_PHONE		= $06000000
#BASS_INPUT_TYPE_SPEAKER	= $07000000
#BASS_INPUT_TYPE_WAVE		  = $08000000
#BASS_INPUT_TYPE_AUX			= $09000000
#BASS_INPUT_TYPE_ANALOG		= $0a000000

; BASS_ChannelSetFX effect types
#BASS_FX_DX8_CHORUS			  = 0
#BASS_FX_DX8_COMPRESSOR	  = 1
#BASS_FX_DX8_DISTORTION	  = 2
#BASS_FX_DX8_ECHO			    = 3
#BASS_FX_DX8_FLANGER		  = 4
#BASS_FX_DX8_GARGLE			  = 5
#BASS_FX_DX8_I3DL2REVERB  = 6
#BASS_FX_DX8_PARAMEQ			= 7
#BASS_FX_DX8_REVERB			  = 8
#BASS_FX_VOLUME				    = 9

Structure BASS_DX8_CHORUS
	fWetDryMix.f
	fDepth.f
	fFeedback.f
	fFrequency.f
	lWaveform.l;	// 0=triangle, 1=sine
	fDelay.f;
	lPhase.l;		// BASS_DX8_PHASE_xxx
EndStructure

Structure BASS_DX8_COMPRESSOR
	fGain.f
	fAttack.f
	fRelease.f
	fThreshold.f
	fRatio.f
	fPredelay.f
EndStructure

Structure BASS_DX8_DISTORTION
	fGain.f
	fEdge.f
	fPostEQCenterFrequency.f
	fPostEQBandwidth.f
	fPreLowpassCutoff.f
EndStructure

Structure BASS_DX8_ECHO
	fWetDryMix.f
	fFeedback.f
	fLeftDelay.f
	fRightDelay.f
	lPanDelay.l
EndStructure

Structure BASS_DX8_FLANGER
	fWetDryMix.f
	fDepth.f
	fFeedback.f
	fFrequency.f
	lWaveform.l;	// 0=triangle, 1=sine
	fDelay.f
	lPhase.f;		// BASS_DX8_PHASE_xxx
EndStructure

Structure BASS_DX8_GARGLE
	dwRateHz.l;               // Rate of modulation in hz
	dwWaveShape.l;            // 0=triangle, 1=square
EndStructure

Structure BASS_DX8_I3DL2REVERB
	lRoom.l;                  // [-10000, 0]      default: -1000 mB
	lRoomHF.l;                // [-10000, 0]      default: 0 mB
	flRoomRolloffFactor.f;    // [0.0, 10.0]      default: 0.0
	flDecayTime.f;            // [0.1, 20.0]      default: 1.49s
	flDecayHFRatio.f;         // [0.1, 2.0]       default: 0.83
	lReflections.l;           // [-10000, 1000]   default: -2602 mB
	flReflectionsDelay.f;     // [0.0, 0.3]       default: 0.007 s
	lReverb.l;                // [-10000, 2000]   default: 200 mB
	flReverbDelay.f;          // [0.0, 0.1]       default: 0.011 s
	flDiffusion.f;            // [0.0, 100.0]     default: 100.0 %
	flDensity.f;              // [0.0, 100.0]     default: 100.0 %
	flHFReference.f;          // [20.0, 20000.0]  default: 5000.0 Hz
EndStructure

Structure BASS_DX8_PARAMEQ
	fCenter.f
	fBandwidth.f
	fGain.f
EndStructure

Structure BASS_DX8_REVERB
	fInGain.f;                // [-96.0,0.0]            default: 0.0 dB
	fReverbMix.f;             // [-96.0,0.0]            default: 0.0 db
	fReverbTime.f;            // [0.001,3000.0]         default: 1000.0 ms
	fHighFreqRTRatio.f;       // [0.001,0.999]          default: 0.001
EndStructure

#BASS_DX8_PHASE_NEG_180        = 0
#BASS_DX8_PHASE_NEG_90         = 1
#BASS_DX8_PHASE_ZERO           = 2
#BASS_DX8_PHASE_90             = 3
#BASS_DX8_PHASE_180            = 4

Structure BASS_FX_VOLUME_PARAM
	fTarget.f
	fCurrent.f
	fTime.f
	lCurve.l
EndStructure

PrototypeC IOSNOTIFYPROC(status.l)
; iOS notification callback function.
; status : The notification (BASS_IOSNOTIFY_xxx)

#BASS_IOSNOTIFY_INTERRUPT	=	1	    ; interruption started
#BASS_IOSNOTIFY_INTERRUPT_END	= 2	; interruption ended


Define bass_library_ = OpenLibrary(#PB_Any, "bass.dll")

Prototype.l BASS_SetConfig(option.l, value.l)
Global BASS_SetConfig.BASS_SetConfig = GetFunction(bass_library_, "BASS_SetConfig")

Prototype.l BASS_GetConfig(option.l)
Global BASS_GetConfig.BASS_GetConfig = GetFunction(bass_library_, "BASS_GetConfig")

Prototype.l BASS_SetConfigPtr(option.l, *value)
Global BASS_SetConfigPtr.BASS_SetConfigPtr = GetFunction(bass_library_, "BASS_SetConfigPtr")

Prototype.i BASS_GetConfigPtr(option.l)
Global BASS_GetConfigPtr.BASS_GetConfigPtr = GetFunction(bass_library_, "BASS_GetConfigPtr")

Prototype.l BASS_GetVersion()
Global BASS_GetVersion.BASS_GetVersion = GetFunction(bass_library_, "BASS_GetVersion")

Prototype.l BASS_ErrorGetCode()
Global BASS_ErrorGetCode.BASS_ErrorGetCode = GetFunction(bass_library_, "BASS_ErrorGetCode")

Prototype.l BASS_GetDeviceInfo(device.l, *BASS_DEVICEINFO)
Global BASS_GetDeviceInfo.BASS_GetDeviceInfo = GetFunction(bass_library_, "BASS_GetDeviceInfo")

Prototype.l BASS_Init(device.l, freq.l, flags.l, *win, *dsguid)
Global BASS_Init.BASS_Init = GetFunction(bass_library_, "BASS_Init")

Prototype.l BASS_Free()
Global BASS_Free.BASS_Free = GetFunction(bass_library_, "BASS_Free")

Prototype.l BASS_SetDevice(device.l)
Global BASS_SetDevice.BASS_SetDevice = GetFunction(bass_library_, "BASS_SetDevice")

Prototype.l BASS_GetDevice()
Global BASS_GetDevice.BASS_GetDevice = GetFunction(bass_library_, "BASS_GetDevice")

Prototype.l BASS_GetInfo(*BASS_INFO)
Global BASS_GetInfo.BASS_GetInfo = GetFunction(bass_library_, "BASS_GetInfo")

Prototype.l BASS_Start()
Global BASS_Start.BASS_Start = GetFunction(bass_library_, "BASS_Start")

Prototype.l BASS_Stop()
Global BASS_Stop.BASS_Stop = GetFunction(bass_library_, "BASS_Stop")

Prototype.l BASS_Pause()
Global BASS_Pause.BASS_Pause = GetFunction(bass_library_, "BASS_Pause")

Prototype.l BASS_IsStarted()
Global BASS_IsStarted.BASS_IsStarted = GetFunction(bass_library_, "BASS_IsStarted")

Prototype.l BASS_Update(length.l)
Global BASS_Update.BASS_Update = GetFunction(bass_library_, "BASS_Update")

Prototype.f BASS_GetCPU()
Global BASS_GetCPU.BASS_GetCPU = GetFunction(bass_library_, "BASS_GetCPU")

Prototype.l BASS_SetVolume(volume.f)
Global BASS_SetVolume.BASS_SetVolume = GetFunction(bass_library_, "BASS_SetVolume")

Prototype.f BASS_GetVolume()
Global BASS_GetVolume.BASS_GetVolume = GetFunction(bass_library_, "BASS_GetVolume")

CompilerIf #PB_Compiler_OS = #PB_OS_Windows
	Prototype.i BASS_GetDSoundObject(object.l)
Global BASS_GetDSoundObject.BASS_GetDSoundObject = GetFunction(bass_library_, "BASS_GetDSoundObject")
CompilerEndIf


Prototype.l BASS_Set3DFactors(distf.f, rollf.f, doppf.f)
Global BASS_Set3DFactors.BASS_Set3DFactors = GetFunction(bass_library_, "BASS_Set3DFactors")

Prototype.l BASS_Get3DFactors(*distf, *rollf, *doppf)
Global BASS_Get3DFactors.BASS_Get3DFactors = GetFunction(bass_library_, "BASS_Get3DFactors")

Prototype.l BASS_Set3DPosition(*pos, *vel, *front, *top)
Global BASS_Set3DPosition.BASS_Set3DPosition = GetFunction(bass_library_, "BASS_Set3DPosition")

Prototype.l BASS_Get3DPosition(*pos, *vel, *front, *top)
Global BASS_Get3DPosition.BASS_Get3DPosition = GetFunction(bass_library_, "BASS_Get3DPosition")

Prototype.i BASS_Apply3D()
Global BASS_Apply3D.BASS_Apply3D = GetFunction(bass_library_, "BASS_Apply3D")


Prototype.HPLUGIN BASS_PluginLoad(*file, flags.l)
Global BASS_PluginLoad.BASS_PluginLoad = GetFunction(bass_library_, "BASS_PluginLoad")

Prototype.l BASS_PluginFree(handle.HPLUGIN)
Global BASS_PluginFree.BASS_PluginFree = GetFunction(bass_library_, "BASS_PluginFree")

Prototype.i BASS_PluginGetInfo(handle.HPLUGIN)
Global BASS_PluginGetInfo.BASS_PluginGetInfo = GetFunction(bass_library_, "BASS_PluginGetInfo")


Prototype.l BASS_SampleLoad(mem.l, *file, offset.q, length.l, max.l, flags.l)
Global BASS_SampleLoad.BASS_SampleLoad = GetFunction(bass_library_, "BASS_SampleLoad")

Prototype.l BASS_SampleCreate(length.l, freq.l, chans.l, max.l, flags.l)
Global BASS_SampleCreate.BASS_SampleCreate = GetFunction(bass_library_, "BASS_SampleCreate")

Prototype.l BASS_SampleFree(handle.HSAMPLE)
Global BASS_SampleFree.BASS_SampleFree = GetFunction(bass_library_, "BASS_SampleFree")

Prototype.l BASS_SampleSetData(handle.HSAMPLE, *buffer)
Global BASS_SampleSetData.BASS_SampleSetData = GetFunction(bass_library_, "BASS_SampleSetData")

Prototype.l BASS_SampleGetData(handle.HSAMPLE, *buffer)
Global BASS_SampleGetData.BASS_SampleGetData = GetFunction(bass_library_, "BASS_SampleGetData")

Prototype.l BASS_SampleGetInfo(handle.HSAMPLE, *info);
Global BASS_SampleGetInfo.BASS_SampleGetInfo = GetFunction(bass_library_, "BASS_SampleGetInfo")

Prototype.l BASS_SampleSetInfo(handle.HSAMPLE, *info)
Global BASS_SampleSetInfo.BASS_SampleSetInfo = GetFunction(bass_library_, "BASS_SampleSetInfo")

Prototype.l BASS_SampleGetChannel(handle.HSAMPLE, onlynew.l)
Global BASS_SampleGetChannel.BASS_SampleGetChannel = GetFunction(bass_library_, "BASS_SampleGetChannel")

Prototype.l BASS_SampleGetChannels(handle.HSAMPLE, *channels)
Global BASS_SampleGetChannels.BASS_SampleGetChannels = GetFunction(bass_library_, "BASS_SampleGetChannels")

Prototype.l BASS_SampleStop(handle.HSAMPLE)
Global BASS_SampleStop.BASS_SampleStop = GetFunction(bass_library_, "BASS_SampleStop")


Prototype.l BASS_StreamCreate(freq.l, chans.l, flags.l, *proc, *user)
Global BASS_StreamCreate.BASS_StreamCreate = GetFunction(bass_library_, "BASS_StreamCreate")

Prototype.l BASS_StreamCreateFile(mem.l, *file, offset.q, length.q, flags.l)
Global BASS_StreamCreateFile.BASS_StreamCreateFile = GetFunction(bass_library_, "BASS_StreamCreateFile")

Prototype.l BASS_StreamCreateURL(*url, offset.l, flags.l, *proc, *user)
Global BASS_StreamCreateURL.BASS_StreamCreateURL = GetFunction(bass_library_, "BASS_StreamCreateURL")

Prototype.l BASS_StreamCreateFileUser(system.l, flags.l, *proc, *user)
Global BASS_StreamCreateFileUser.BASS_StreamCreateFileUser = GetFunction(bass_library_, "BASS_StreamCreateFileUser")

Prototype.l BASS_StreamFree(handle.HSTREAM)
Global BASS_StreamFree.BASS_StreamFree = GetFunction(bass_library_, "BASS_StreamFree")

Prototype.q BASS_StreamGetFilePosition(handle.HSTREAM, mode.l)
Global BASS_StreamGetFilePosition.BASS_StreamGetFilePosition = GetFunction(bass_library_, "BASS_StreamGetFilePosition")

Prototype.l BASS_StreamPutData(handle.HSTREAM, *buffer, length.l)
Global BASS_StreamPutData.BASS_StreamPutData = GetFunction(bass_library_, "BASS_StreamPutData")

Prototype.l BASS_StreamPutFileData(handle.HSTREAM, *buffer, length.l)
Global BASS_StreamPutFileData.BASS_StreamPutFileData = GetFunction(bass_library_, "BASS_StreamPutFileData")


Prototype.l BASS_MusicLoad(mem.l, *file, offset.q, length.l, flags.l, freq.l)
Global BASS_MusicLoad.BASS_MusicLoad = GetFunction(bass_library_, "BASS_MusicLoad")

Prototype.l BASS_MusicFree(handle.HMUSIC)
Global BASS_MusicFree.BASS_MusicFree = GetFunction(bass_library_, "BASS_MusicFree")


Prototype.l BASS_RecordGetDeviceInfo(device.l, *info)
Global BASS_RecordGetDeviceInfo.BASS_RecordGetDeviceInfo = GetFunction(bass_library_, "BASS_RecordGetDeviceInfo")

Prototype.l BASS_RecordInit(device.l)
Global BASS_RecordInit.BASS_RecordInit = GetFunction(bass_library_, "BASS_RecordInit")

Prototype.l BASS_RecordSetDevice(device.l)
Global BASS_RecordSetDevice.BASS_RecordSetDevice = GetFunction(bass_library_, "BASS_RecordSetDevice")

Prototype.l BASS_RecordGetDevice()
Global BASS_RecordGetDevice.BASS_RecordGetDevice = GetFunction(bass_library_, "BASS_RecordGetDevice")

Prototype.l BASS_RecordFree()
Global BASS_RecordFree.BASS_RecordFree = GetFunction(bass_library_, "BASS_RecordFree")

Prototype.l BASS_RecordGetInfo(*info)
Global BASS_RecordGetInfo.BASS_RecordGetInfo = GetFunction(bass_library_, "BASS_RecordGetInfo")

Prototype.i BASS_RecordGetInputName(input.l)
Global BASS_RecordGetInputName.BASS_RecordGetInputName = GetFunction(bass_library_, "BASS_RecordGetInputName")

Prototype.l BASS_RecordSetInput(input.l, flags.l, volume.f)
Global BASS_RecordSetInput.BASS_RecordSetInput = GetFunction(bass_library_, "BASS_RecordSetInput")

Prototype.l BASS_RecordGetInput(input.l, *volume)
Global BASS_RecordGetInput.BASS_RecordGetInput = GetFunction(bass_library_, "BASS_RecordGetInput")

Prototype.l BASS_RecordStart(freq.l, chans.l, flags.l, *proc, *user)
Global BASS_RecordStart.BASS_RecordStart = GetFunction(bass_library_, "BASS_RecordStart")


Prototype.d BASS_ChannelBytes2Seconds(handle.l, pos.q)
Global BASS_ChannelBytes2Seconds.BASS_ChannelBytes2Seconds = GetFunction(bass_library_, "BASS_ChannelBytes2Seconds")

Prototype.q BASS_ChannelSeconds2Bytes(handle.l, pos.d)
Global BASS_ChannelSeconds2Bytes.BASS_ChannelSeconds2Bytes = GetFunction(bass_library_, "BASS_ChannelSeconds2Bytes")

Prototype.l BASS_ChannelGetDevice(handle.l)
Global BASS_ChannelGetDevice.BASS_ChannelGetDevice = GetFunction(bass_library_, "BASS_ChannelGetDevice")

Prototype.l BASS_ChannelSetDevice(handle.l, device.l)
Global BASS_ChannelSetDevice.BASS_ChannelSetDevice = GetFunction(bass_library_, "BASS_ChannelSetDevice")

Prototype.l BASS_ChannelIsActive(handle.l)
Global BASS_ChannelIsActive.BASS_ChannelIsActive = GetFunction(bass_library_, "BASS_ChannelIsActive")

Prototype.l BASS_ChannelGetInfo(handle.l, *info)
Global BASS_ChannelGetInfo.BASS_ChannelGetInfo = GetFunction(bass_library_, "BASS_ChannelGetInfo")

Prototype.i BASS_ChannelGetTags(handle.l, tags.l)
Global BASS_ChannelGetTags.BASS_ChannelGetTags = GetFunction(bass_library_, "BASS_ChannelGetTags")

Prototype.l BASS_ChannelFlags(handle.l, flags.l, mask.l)
Global BASS_ChannelFlags.BASS_ChannelFlags = GetFunction(bass_library_, "BASS_ChannelFlags")

Prototype.l BASS_ChannelLock(handle.l, lock.l)
Global BASS_ChannelLock.BASS_ChannelLock = GetFunction(bass_library_, "BASS_ChannelLock")

Prototype.l BASS_ChannelFree(handle.l)
Global BASS_ChannelFree.BASS_ChannelFree = GetFunction(bass_library_, "BASS_ChannelFree")

Prototype.l BASS_ChannelPlay(handle.l, restart.l)
Global BASS_ChannelPlay.BASS_ChannelPlay = GetFunction(bass_library_, "BASS_ChannelPlay")

Prototype.l BASS_ChannelStart(handle.l, restart.l)
Global BASS_ChannelStart.BASS_ChannelPlay = GetFunction(bass_library_, "BASS_ChannelStart")

Prototype.l BASS_ChannelStop(handle.l)
Global BASS_ChannelStop.BASS_ChannelStop = GetFunction(bass_library_, "BASS_ChannelStop")

Prototype.l BASS_ChannelPause(handle.l)
Global BASS_ChannelPause.BASS_ChannelPause = GetFunction(bass_library_, "BASS_ChannelPause")

Prototype.l BASS_ChannelUpdate(handle.l, length.l)
Global BASS_ChannelUpdate.BASS_ChannelUpdate = GetFunction(bass_library_, "BASS_ChannelUpdate")

Prototype.l BASS_ChannelSetAttribute(handle.l, attrib.l, value.f)
Global BASS_ChannelSetAttribute.BASS_ChannelSetAttribute = GetFunction(bass_library_, "BASS_ChannelSetAttribute")

Prototype.l BASS_ChannelGetAttribute(handle.l, attrib.l, *value)
Global BASS_ChannelGetAttribute.BASS_ChannelGetAttribute = GetFunction(bass_library_, "BASS_ChannelGetAttribute")

Prototype.l BASS_ChannelSlideAttribute(handle.l, attrib.l, value.f, time.l)
Global BASS_ChannelSlideAttribute.BASS_ChannelSlideAttribute = GetFunction(bass_library_, "BASS_ChannelSlideAttribute")

Prototype.l BASS_ChannelIsSliding(handle.l, attrib.l)
Global BASS_ChannelIsSliding.BASS_ChannelIsSliding = GetFunction( bass_library_, "BASS_ChannelIsSliding")

Prototype.l BASS_ChannelSetAttributeEx(handle.l, attrib.l, *value, size.l)
Global BASS_ChannelSetAttributeEx.BASS_ChannelSetAttributeEx = GetFunction(bass_library_, "BASS_ChannelSetAttributeEx")

Prototype.l BASS_ChannelGetAttributeEx(handle.l, attrib.l, *value, size.l)
Global BASS_ChannelGetAttributeEx.BASS_ChannelGetAttributeEx = GetFunction(bass_library_, "BASS_ChannelGetAttributeEx")

Prototype.l BASS_ChannelSet3DAttributes(handle.l, mode.l, min.f, max.f, iangle.l, oangle.l, outvol.f)
Global BASS_ChannelSet3DAttributes.BASS_ChannelSet3DAttributes = GetFunction(bass_library_, "BASS_ChannelSet3DAttributes")

Prototype.l BASS_ChannelGet3DAttributes(handle.l, *mode, *min, *max, *iangle, *oangle, *outvol)
Global BASS_ChannelGet3DAttributes.BASS_ChannelGet3DAttributes = GetFunction(bass_library_, "BASS_ChannelGet3DAttributes")

Prototype.l BASS_ChannelSet3DPosition(handle.l, *pos, *orient, *vel)
Global BASS_ChannelSet3DPosition.BASS_ChannelSet3DPosition = GetFunction(bass_library_, "BASS_ChannelSet3DPosition")

Prototype.l BASS_ChannelGet3DPosition(handle.l, *pos, *orient, *vel)
Global BASS_ChannelGet3DPosition.BASS_ChannelGet3DPosition = GetFunction(bass_library_, "BASS_ChannelGet3DPosition")

Prototype.q BASS_ChannelGetLength(handle.l, mode.l)
Global BASS_ChannelGetLength.BASS_ChannelGetLength = GetFunction(bass_library_, "BASS_ChannelGetLength")

Prototype.l BASS_ChannelSetPosition(handle.l, pos.q, mode.l)
Global BASS_ChannelSetPosition.BASS_ChannelSetPosition = GetFunction(bass_library_, "BASS_ChannelSetPosition")

Prototype.q BASS_ChannelGetPosition(handle.l, mode.l)
Global BASS_ChannelGetPosition.BASS_ChannelGetPosition = GetFunction(bass_library_, "BASS_ChannelGetPosition")

Prototype.l BASS_ChannelGetLevel(handle.l)
Global BASS_ChannelGetLevel.BASS_ChannelGetLevel = GetFunction(bass_library_, "BASS_ChannelGetLevel")

Prototype.l BASS_ChannelGetLevelEx(handle.l, *levels, length.f, flags.l)
Global BASS_ChannelGetLevelEx.BASS_ChannelGetLevelEx = GetFunction(bass_library_, "BASS_ChannelGetLevelEx")

Prototype.l BASS_ChannelGetData(handle.l, *buffer, length.l)
Global BASS_ChannelGetData.BASS_ChannelGetData = GetFunction(bass_library_, "BASS_ChannelGetData")

Prototype.l BASS_ChannelSetSync(handle.l, type.l, param.q, *proc, *user)
Global BASS_ChannelSetSync.BASS_ChannelSetSync = GetFunction(bass_library_, "BASS_ChannelSetSync")

Prototype.l BASS_ChannelRemoveSync(handle.l, sync.l)
Global BASS_ChannelRemoveSync.BASS_ChannelRemoveSync = GetFunction(bass_library_, "BASS_ChannelRemoveSync")

Prototype.l BASS_ChannelSetDSP(handle.l, *proc, *user, priority.l)
Global BASS_ChannelSetDSP.BASS_ChannelSetDSP = GetFunction(bass_library_, "BASS_ChannelSetDSP")

Prototype.l BASS_ChannelRemoveDSP(handle.l, dsp.l)
Global BASS_ChannelRemoveDSP.BASS_ChannelRemoveDSP = GetFunction(bass_library_, "BASS_ChannelRemoveDSP")

Prototype.l BASS_ChannelSetLink(handle.l, chan.l)
Global BASS_ChannelSetLink.BASS_ChannelSetLink = GetFunction(bass_library_, "BASS_ChannelSetLink")

Prototype.l BASS_ChannelRemoveLink(handle.l, chan.l)
Global BASS_ChannelRemoveLink.BASS_ChannelRemoveLink = GetFunction(bass_library_, "BASS_ChannelRemoveLink")

Prototype.l BASS_ChannelSetFX(handle.l, type.l, priority.l)
Global BASS_ChannelSetFX.BASS_ChannelSetFX = GetFunction(bass_library_, "BASS_ChannelSetFX")

Prototype.l BASS_ChannelRemoveFX(handle.l, fx.l)
Global BASS_ChannelRemoveFX.BASS_ChannelRemoveFX = GetFunction(bass_library_, "BASS_ChannelRemoveFX")


Prototype.l BASS_FXSetParameters(handle.l, *params)
Global BASS_FXSetParameters.BASS_FXSetParameters = GetFunction(bass_library_, "BASS_FXSetParameters")

Prototype.l BASS_FXGetParameters(handle.l, *params)
Global BASS_FXGetParameters.BASS_FXGetParameters = GetFunction(bass_library_, "BASS_FXGetParameters")

Prototype.l BASS_FXSetPriority(handle.l, priority.l)
Global BASS_FXSetPriority.BASS_FXSetPriority = GetFunction(bass_library_, "BASS_FXSetPriority")

Prototype.l BASS_FXReset(handle.l)
Global BASS_FXReset.BASS_FXReset = GetFunction(bass_library_, "BASS_FXReset")


CompilerIf #PB_Compiler_OS = #PB_OS_Windows
Prototype.l BASS_SetEAXParameters(env.l, vol.f, decay.f, damp.f)
Global BASS_SetEAXParameters.BASS_SetEAXParameters = GetFunction(bass_library_, "BASS_SetEAXParameters")

Prototype.l BASS_GetEAXParameters(*env, *vol, *decay, *damp)
Global BASS_GetEAXParameters.BASS_GetEAXParameters = GetFunction(bass_library_, "BASS_GetEAXParameters")
CompilerEndIf
infratec
Always Here
Always Here
Posts: 6817
Joined: Sun Sep 07, 2008 12:45 pm
Location: Germany

Re: BASS audio library v2.4.11 and PureBasic 5.31 includes

Post by infratec »

And the synth example:

Code: Select all

;
;	BASS simple synth
;	Copyright (c) 2001-2021 Un4seen Developments Ltd.
;

CompilerIf Not #PB_Compiler_Thread
  CompilerError "Please enable Thread Safe option"
CompilerEndIf

EnableExplicit

IncludeFile "bass.pbi"


Global Info.BASS_INFO

; display error messages
Procedure Error(text$)
  
  Debug "Error(" + Str(BASS_ErrorGetCode()) + "): " + text$
  BASS_Free()
  End 0
EndProcedure


Structure unsignedShortArray_Structure
  u.u[0]
EndStructure

Structure floatArray_Structure
  f.f[0]
EndStructure


#KEYS = 20
DataSection
  keys:
  Data.u 'Q', '2', 'W', '3', 'E', 'R', '5', 'T', '6', 'Y', '7', 'U', 'I', '9', 'O', '0', 'P', 219, 187, 221
EndDataSection
#MAXVOL = 0.22
#DECAY = (#MAXVOL / 4000)

Global Dim vol.f(#KEYS) ; key volume
Global Dim pos.f(#KEYS) ; key position/phase


Procedure.l StreamProc(handle.HSTREAM, *buffer.floatArray_Structure, length.l, *user)
  
  Protected k.i, c.i, omega.f
  
  
  FillMemory(*buffer, length, 0)
  For k = 0 To #KEYS - 1
    If vol(k) = 0
      Continue
    EndIf
    omega = 2 * #PI * Pow(2.0, (k + 3) / 12.0) * 440.0 / info\freq
    For c = 0 To length / SizeOf(float) - SizeOf(float) Step 8
      *buffer\f[c] + Sin(pos(k)) * vol(k)
      *buffer\f[c + 1] = *buffer\f[c]; // left and right channels are the same
      pos(k) + omega
      If vol(k) < #MAXVOL
        vol(k) - #DECAY
        If vol(k) <= 0  ; faded-out
          vol(k) = 0
          Break
        EndIf
      EndIf
    Next c
    pos(k) = Mod(pos(k), 2 * #PI)
  Next k
  
  ProcedureReturn length
  
EndProcedure


Define Stream.HSTREAM
Dim fxname.s(8)
fxname(0) = "CHORUS"
fxname(1) = "COMPRESSOR"
fxname(2) = "DISTORTION"
fxname(3) = "ECHO"
fxname(4) = "FLANGER"
fxname(5) = "GARGLE"
fxname(6) = "I3DL2REVERB"
fxname(7) = "PARAMEQ"
fxname(8) = "REVERB"
Dim fx.HFX(8)

Define key$, key.i, n.i, *key.unsignedShortArray_Structure, r.l
Define keyin.INPUT_RECORD

*key = ?keys

OpenConsole()

PrintN("BASS simple synth")
PrintN("-----------------")


; check the correct BASS was loaded
If HIWORD(BASS_GetVersion()) <> #BASSVERSION
  PrintN("An incorrect version of BASS.DLL was loaded")
  End 0
EndIf

; initialize Default output device
If Not BASS_Init(-1, 44100, 0, 0, #Null)
  Error("Can't initialize device")
EndIf

BASS_GetInfo(@info)
stream = BASS_StreamCreate(info\freq, 2, #BASS_SAMPLE_FLOAT, @StreamProc(), 0); // create a stream (stereo for effects)
BASS_ChannelSetAttribute(stream, #BASS_ATTRIB_BUFFER, 0)                      ; // disable buffering for minimum latency
BASS_ChannelPlay(stream, #False)                                              ; // start it

If info\dsver < 8
  PrintN("ds version: " + StrD(info\dsver) + " (effects disabled)")
Else
  PrintN("ds version: " + StrD(info\dsver) + " (effects enabled)")
EndIf
PrintN("press these keys to play:")
PrintN("  2 3  5 6 7  9 0  =")
PrintN(" Q W ER T Y UI O P[ ]")
PrintN("press spacebar to quit")

If info\dsver >= 8 ; DX8 effects available
  PrintN("press F1-F9 to toggle effects")
EndIf

vol(0) = #MAXVOL - 1


While (ReadConsoleInput_(GetStdHandle_(#STD_INPUT_HANDLE), @keyin, 1, @r))
  
  If keyin\EventType <> #KEY_EVENT
    Continue
  EndIf
  
  If keyin\Event\KeyEvent\wVirtualKeyCode = #VK_SPACE
    Break
  EndIf
  
  If keyin\Event\KeyEvent\bKeyDown
    If keyin\Event\KeyEvent\wVirtualKeyCode >= #VK_F1 And keyin\Event\KeyEvent\wVirtualKeyCode <= #VK_F9
      n = keyin\Event\KeyEvent\wVirtualKeyCode - #VK_F1
      If fx(n)
        BASS_ChannelRemoveFX(stream, fx(n))
        fx(n) = 0
        PrintN("effect " + fxname(n) + " = OFF")
      Else
        ; set the effect, Not bothering With parameters (use defaults)
        fx(n) = BASS_ChannelSetFX(stream, #BASS_FX_DX8_CHORUS + n, 0)
        If fx(n)
          PrintN("effect " + fxname(n) + " = ON")
        EndIf
      EndIf
    EndIf	  
  EndIf
  
  For key = 0 To #KEYS - 1
    If keyin\Event\KeyEvent\wVirtualKeyCode = *key\u[key]
      If keyin\Event\KeyEvent\bKeyDown And vol(key) < #MAXVOL
        pos(key) = 0
        vol(key) = #MAXVOL + #DECAY / 2 ; start key (setting "vol" slightly higher than MAXVOL to cover any rounding-down)
      ElseIf Not keyin\Event\KeyEvent\bKeyDown And vol(key)
        vol(key) - #DECAY ; trigger key fadeout
        Break
      EndIf
    EndIf
  Next key
  
Wend

BASS_Free()

End 0
infratec
Always Here
Always Here
Posts: 6817
Joined: Sun Sep 07, 2008 12:45 pm
Location: Germany

Re: BASS audio library v2.4.11 and PureBasic 5.31 includes

Post by infratec »

basswasapi.pbi

Code: Select all

;
;	BASSWASAPI 2.4 C/C++ header file
;	Copyright (c) 2009-2020 Un4seen Developments Ltd.
;
;	See the BASSWASAPI.CHM file For more detailed documentation
;


XIncludeFile "bass.pbi"


; Additional error codes returned by BASS_ErrorGetCode
#BASS_ERROR_WASAPI			    = 5000	; no WASAPI
#BASS_ERROR_WASAPI_BUFFER	  = 5001	; buffer size is invalid
#BASS_ERROR_WASAPI_CATEGORY = 5002	; can't set category
#BASS_ERROR_WASAPI_DENIED	  = 5003	; access denied

; Device info Structure
Structure BASS_WASAPI_DEVICEINFO
	*name
	*id
	type.l
	flags.l
	minperiod.f
	defperiod.f
	mixfreq.l
	mixchans.l
EndStructure

Structure BASS_WASAPI_INFO
	initflags.l
	freq.l
	chans.l
	format.l
	buflen.l
	volmax.f
	volmin.f
	volstep.f
EndStructure

; BASS_WASAPI_DEVICEINFO "type"
#BASS_WASAPI_TYPE_NETWORKDEVICE	= 0
#BASS_WASAPI_TYPE_SPEAKERS		  = 1
#BASS_WASAPI_TYPE_LINELEVEL		  = 2
#BASS_WASAPI_TYPE_HEADPHONES	  = 3
#BASS_WASAPI_TYPE_MICROPHONE    = 4
#BASS_WASAPI_TYPE_HEADSET		    = 5
#BASS_WASAPI_TYPE_HANDSET		    = 6
#BASS_WASAPI_TYPE_DIGITAL		    = 7
#BASS_WASAPI_TYPE_SPDIF			    = 8
#BASS_WASAPI_TYPE_HDMI			    = 9
#BASS_WASAPI_TYPE_UNKNOWN		    = 10

; BASS_WASAPI_DEVICEINFO flags
#BASS_DEVICE_ENABLED		= 1
#BASS_DEVICE_DEFAULT		= 2
#BASS_DEVICE_INIT		    = 4
#BASS_DEVICE_LOOPBACK	  = 8
#BASS_DEVICE_INPUT		  = 16
#BASS_DEVICE_UNPLUGGED	= 32
#BASS_DEVICE_DISABLED	  = 64

; BASS_WASAPI_Init flags
#BASS_WASAPI_EXCLUSIVE	= 1
#BASS_WASAPI_AUTOFORMAT	= 2
#BASS_WASAPI_BUFFER		  = 4
#BASS_WASAPI_EVENT	  	= 16
#BASS_WASAPI_SAMPLES		= 32
#BASS_WASAPI_DITHER		  = 64
#BASS_WASAPI_RAW			  = 128
#BASS_WASAPI_ASYNC		  = $100

#BASS_WASAPI_CATEGORY_MASK					          = $f000
#BASS_WASAPI_CATEGORY_OTHER					          = $0000
#BASS_WASAPI_CATEGORY_FOREGROUNDONLYMEDIA	    = $1000
#BASS_WASAPI_CATEGORY_BACKGROUNDCAPABLEMEDIA  = $2000
#BASS_WASAPI_CATEGORY_COMMUNICATIONS			    = $3000
#BASS_WASAPI_CATEGORY_ALERTS					        = $4000
#BASS_WASAPI_CATEGORY_SOUNDEFFECTS			      = $5000
#BASS_WASAPI_CATEGORY_GAMEEFFECTS			        = $6000
#BASS_WASAPI_CATEGORY_GAMEMEDIA				        = $7000
#BASS_WASAPI_CATEGORY_GAMECHAT				        = $8000
#BASS_WASAPI_CATEGORY_SPEECH					        = $9000
#BASS_WASAPI_CATEGORY_MOVIE					          = $a000
#BASS_WASAPI_CATEGORY_MEDIA					          = $b000

; BASS_WASAPI_INFO "format"
#BASS_WASAPI_FORMAT_FLOAT	= 0
#BASS_WASAPI_FORMAT_8BIT	= 1
#BASS_WASAPI_FORMAT_16BIT	= 2
#BASS_WASAPI_FORMAT_24BIT	= 3
#BASS_WASAPI_FORMAT_32BIT	= 4

; BASS_WASAPI_Set/GetVolume modes
#BASS_WASAPI_CURVE_DB		    = 0
#BASS_WASAPI_CURVE_LINEAR	  = 1
#BASS_WASAPI_CURVE_WINDOWS  = 2
#BASS_WASAPI_VOL_SESSION		= 8

PrototypeC.l WASAPIPROC(*buffer, length.l, *user)
; WASAPI callback function.
; buffer : Buffer containing the sample Data
; length : Number of bytes
; user   : The 'user' parameter given when calling BASS_WASAPI_Init
; Return : The number of bytes written (output devices), 0/1 = stop/Continue (input devices)

; Special WASAPIPROCs
#WASAPIPROC_PUSH = 0		; push output
#WASAPIPROC_BASS = -1		; BASS channel

PrototypeC WASAPINOTIFYPROC(notify.l, device.l, *user)
; WASAPI device notification callback function.
; notify : The notification (BASS_WASAPI_NOTIFY_xxx)
; device : Device that the notification applies To
; user   : The 'user' parameter given when calling BASS_WASAPI_SetNotify

; Device notifications
#BASS_WASAPI_NOTIFY_ENABLED		= 0
#BASS_WASAPI_NOTIFY_DISABLED	= 1
#BASS_WASAPI_NOTIFY_DEFOUTPUT	= 2
#BASS_WASAPI_NOTIFY_DEFINPUT	= 3
#BASS_WASAPI_NOTIFY_FAIL			= $100

Define basswasapi_library_ = OpenLibrary(#PB_Any, "basswasapi.dll")

Prototype.l BASS_WASAPI_GetVersion()
Global BASS_WASAPI_GetVersion.BASS_WASAPI_GetVersion = GetFunction(basswasapi_library_, "BASS_WASAPI_GetVersion")

Prototype.i BASS_WASAPI_SetNotify(proc.WASAPINOTIFYPROC, *user)
Global BASS_WASAPI_SetNotify.BASS_WASAPI_SetNotify = GetFunction(basswasapi_library_, "BASS_WASAPI_SetNotify")

Prototype.i BASS_WASAPI_GetDeviceInfo(device.l, *info.BASS_WASAPI_DEVICEINFO)
Global BASS_WASAPI_GetDeviceInfo.BASS_WASAPI_GetDeviceInfo = GetFunction(basswasapi_library_, "BASS_WASAPI_GetDeviceInfo")

Prototype.f BASS_WASAPI_GetDeviceLevel(device.l, chan.l)
Global BASS_WASAPI_GetDeviceLevel.BASS_WASAPI_GetDeviceLevel = GetFunction(basswasapi_library_, "BASS_WASAPI_GetDeviceLevel")

Prototype.i BASS_WASAPI_SetDevice(device.l)
Global BASS_WASAPI_SetDevice.BASS_WASAPI_SetDevice = GetFunction(basswasapi_library_, "BASS_WASAPI_SetDevice")

Prototype.l BASS_WASAPI_GetDevice()
Global BASS_WASAPI_GetDevice.BASS_WASAPI_GetDevice = GetFunction(basswasapi_library_, "BASS_WASAPI_GetDevice")

Prototype.l BASS_WASAPI_CheckFormat(device.l, freq.l, chans.l, flags.l)
Global BASS_WASAPI_CheckFormat.BASS_WASAPI_CheckFormat = GetFunction(basswasapi_library_, "BASS_WASAPI_CheckFormat")

Prototype.i BASS_WASAPI_Init(device.l, freq.l, chans.l, flags.l, buffer.f, period.f, proc.WASAPIPROC, *user)
Global BASS_WASAPI_Init.BASS_WASAPI_Init = GetFunction(basswasapi_library_, "BASS_WASAPI_Init")

Prototype.i BASS_WASAPI_Free()
Global BASS_WASAPI_Free.BASS_WASAPI_Free = GetFunction(basswasapi_library_, "BASS_WASAPI_Free")

Prototype.i BASS_WASAPI_GetInfo(*info.BASS_WASAPI_INFO)
Global BASS_WASAPI_GetInfo.BASS_WASAPI_GetInfo = GetFunction(basswasapi_library_, "BASS_WASAPI_GetInfo")

Prototype.f BASS_WASAPI_GetCPU()
Global BASS_WASAPI_GetCPU.BASS_WASAPI_GetCPU = GetFunction(basswasapi_library_, "BASS_WASAPI_GetCPU")

Prototype.i BASS_WASAPI_Lock(lock.i)
Global BASS_WASAPI_Lock.BASS_WASAPI_Lock = GetFunction(basswasapi_library_, "BASS_WASAPI_Lock")

Prototype.i BASS_WASAPI_Start()
Global BASS_WASAPI_Start.BASS_WASAPI_Start = GetFunction(basswasapi_library_, "BASS_WASAPI_Start")

Prototype.i BASS_WASAPI_Stop(reset.i)
Global BASS_WASAPI_Stop.BASS_WASAPI_Stop = GetFunction(basswasapi_library_, "BASS_WASAPI_Stop")

Prototype.i BASS_WASAPI_IsStarted()
Global BASS_WASAPI_IsStarted.BASS_WASAPI_IsStarted = GetFunction(basswasapi_library_, "BASS_WASAPI_IsStarted")

Prototype.i BASS_WASAPI_SetVolume(mode.l, volume.f)
Global BASS_WASAPI_SetVolume.BASS_WASAPI_SetVolume = GetFunction(basswasapi_library_, "BASS_WASAPI_SetVolume")

Prototype.f BASS_WASAPI_GetVolume(mode.l)
Global BASS_WASAPI_GetVolume.BASS_WASAPI_GetVolume = GetFunction(basswasapi_library_, "BASS_WASAPI_GetVolume")

Prototype.i BASS_WASAPI_SetMute(mode.l, mute.i)
Global BASS_WASAPI_SetMute.BASS_WASAPI_SetMute = GetFunction(basswasapi_library_, "BASS_WASAPI_SetMute")

Prototype.i BASS_WASAPI_GetMute(mode.l)
Global BASS_WASAPI_GetMute.BASS_WASAPI_GetMute = GetFunction(basswasapi_library_, "BASS_WASAPI_GetMute")

Prototype.i BASS_WASAPI_PutData(*buffer, length.l)
Global BASS_WASAPI_PutData.BASS_WASAPI_PutData = GetFunction(basswasapi_library_, "BASS_WASAPI_PutData")

Prototype.l BASS_WASAPI_GetData(*buffer, length.l)
Global BASS_WASAPI_GetData.BASS_WASAPI_GetData = GetFunction(basswasapi_library_, "BASS_WASAPI_GetData")

Prototype.l BASS_WASAPI_GetLevel()
Global BASS_WASAPI_GetLevel.BASS_WASAPI_GetLevel = GetFunction(basswasapi_library_, "BASS_WASAPI_GetLevel")

Prototype.i BASS_WASAPI_GetLevelEx(*levels, length.f, flags.l)
Global BASS_WASAPI_GetLevelEx.BASS_WASAPI_GetLevelEx = GetFunction(basswasapi_library_, "BASS_WASAPI_GetLevelEx")
Last edited by infratec on Sat Dec 23, 2023 10:21 pm, edited 1 time in total.
infratec
Always Here
Always Here
Posts: 6817
Joined: Sun Sep 07, 2008 12:45 pm
Location: Germany

Re: BASS audio library v2.4.11 and PureBasic 5.31 includes

Post by infratec »

And the synth with bass wasapi:

Code: Select all

;
;	BASS simple synth
;	Copyright (c) 2001-2021 Un4seen Developments Ltd.
;

CompilerIf Not #PB_Compiler_Thread
  CompilerError "Please enable Thread Safe option"
CompilerEndIf

EnableExplicit

IncludeFile "basswasapi.pbi"


; display error messages
Procedure Error(text$)
  
  Debug "Error(" + Str(BASS_ErrorGetCode()) + "): " + text$
  BASS_WASAPI_Free()
  BASS_Free()
  
  CompilerIf #PB_Compiler_Debugger
    Input()
  CompilerEndIf
  
  End 0
EndProcedure


Structure unsignedShortArray_Structure
  u.u[0]
EndStructure

Structure floatArray_Structure
  f.f[0]
EndStructure

#TABLESIZE = 2048
Global Dim sinetable.f(#TABLESIZE);	// sine table

#KEYS = 20
DataSection
  keys:
  Data.u 'Q', '2', 'W', '3', 'E', 'R', '5', 'T', '6', 'Y', '7', 'U', 'I', '9', 'O', '0', 'P', 219, 187, 221
EndDataSection
#MAXVOL = 4000

Global Dim vol.l(#KEYS) ; key volume
Global Dim pos.l(#KEYS) ; key position/phase

Global samrate.f
Global chan.HSTREAM

; WASAPI function
Procedure.l WasapiProc(*buffer, length.l, *user)
  
  ProcedureReturn BASS_ChannelGetData(chan, *buffer, length)
EndProcedure


; STREAMPROC function
Procedure.l SynthStreamProc(handle.HSTREAM, *buffer, length.l, *user)
  
  Protected *b.floatArray_Structure
  Protected n.i, c.i, f.f, s.f
  
  
  *b = *buffer
  FillMemory(*b, length, 0)
  For n = 0 To #KEYS - 1
    If vol(n) = 0
      Continue
    EndIf
    f =  Pow(2.0, (n + 3) / 12.0) * #TABLESIZE * 440.0 / samrate
    While c < length / 4 / 2 And vol(n)
      s = sinetable(Int(pos(n) * f) & (#TABLESIZE - 1)) * vol(n) / #MAXVOL
      pos(n) + 1
      s + *b\f[c * 2]
      *b\f[c * 2] = s; // left and right channels are the same
      *b\f[c * 2 + 1] = s
      If vol(n) < #MAXVOL
        vol(n) - 1
      EndIf
      
      c + 1
    Wend
    
  Next n
  
  ProcedureReturn length
  
EndProcedure


Define info.BASS_WASAPI_INFO
Dim fxname.s(8)
fxname(0) = "CHORUS"
fxname(1) = "COMPRESSOR"
fxname(2) = "DISTORTION"
fxname(3) = "ECHO"
fxname(4) = "FLANGER"
fxname(5) = "GARGLE"
fxname(6) = "I3DL2REVERB"
fxname(7) = "PARAMEQ"
fxname(8) = "REVERB"
Dim fx.HFX(8)

Define keyin.INPUT_RECORD
Define r.l
Define flags.l
Define buflen.f
Define key$, key.i, n.i, *key.unsignedShortArray_Structure
Define oldbuf.f, tries.l

flags = #BASS_WASAPI_EVENT  ; default initialization flags


*key = ?keys

OpenConsole()

PrintN("BASS+WASAPI Simple Sinewave Synth")
PrintN("---------------------------------")


; check the correct BASS was loaded
If HIWORD(BASS_GetVersion()) <> #BASSVERSION
  PrintN("An incorrect version of BASS was loaded")
  End 0
EndIf

; initialize default WASAPI device in shared mode with minimal buffer
If Not BASS_WASAPI_Init(-1, 0, 0, flags, 0, 0, @WasapiProc(), #Null)
  Error("Can't initialize device")
EndIf

; get the output details
BASS_WASAPI_GetInfo(@info)
If info\chans <> 2
  Error("Need stereo ouput (see Sound control panel)")
EndIf
buflen = 1000.0 * info\buflen / (info\freq * info\chans * SizeOf(float))
samrate = info\freq

; not playing anything via BASS, so don't need an update thread
BASS_SetConfig(#BASS_CONFIG_UPDATEPERIOD, 0)
; setup BASS - "no sound" device
BASS_Init(0, 48000, 0, 0, #Null)

; build sine table
For r = 0 To #TABLESIZE - 1
  sinetable(r) = Sin(2.0 * #PI * r / #TABLESIZE) * 0.2
Next r

; create a stream, stereo so that effects sound nice
chan = BASS_StreamCreate(samrate, 2, #BASS_STREAM_DECODE | #BASS_SAMPLE_FLOAT, @SynthStreamProc(), 0)

; start the WASAPI device
If Not BASS_WASAPI_Start()
  Error("Can't start output")
EndIf

Print(~"press these keys to play:\n\n")
PrintN("  2 3  5 6 7  9 0  =")
PrintN(" Q W ER T Y UI O P[ ]")
PrintN("press -/+ to de/increase the buffer")
PrintN("press X to toggle exclusive mode")
PrintN("press F1-F9 to toggle effects")
PrintN("press spacebar to quit")
Print("using a " + StrF(buflen, 1) + "ms buffer ")
If flags & #BASS_WASAPI_EXCLUSIVE
  PrintN("(exclusive mode)")
Else
  PrintN("(shared mode)")
EndIf


While ReadConsoleInput_(GetStdHandle_(#STD_INPUT_HANDLE), @keyin, 1, @r)
  
  If keyin\EventType <> #KEY_EVENT
    Continue
  EndIf
  
  If keyin\Event\KeyEvent\wVirtualKeyCode = #VK_SPACE
    Break
  EndIf
  
  If keyin\Event\KeyEvent\bKeyDown
    If keyin\Event\KeyEvent\wVirtualKeyCode >= #VK_F1 And keyin\Event\KeyEvent\wVirtualKeyCode <= #VK_F9
      r = keyin\Event\KeyEvent\wVirtualKeyCode - #VK_F1
      If fx(r)
        BASS_ChannelRemoveFX(chan, fx(r))
        fx(r) = 0
        PrintN("effect " + fxname(r) + " = OFF")
      Else
        ; set the effect, Not bothering With parameters (use defaults)
        fx(r) = BASS_ChannelSetFX(chan, #BASS_FX_DX8_CHORUS + r, 0)
        If fx(n)
          PrintN("effect " + fxname(r) + " = ON")
        EndIf
      EndIf
    EndIf	 
    If keyin\Event\KeyEvent\wVirtualKeyCode = #VK_SUBTRACT Or keyin\Event\KeyEvent\wVirtualKeyCode = #VK_ADD Or keyin\Event\KeyEvent\wVirtualKeyCode = 'X'
      ; reinitialize With smaller/larger buffer Or exclusive/Shared mode
			oldbuf = buflen
			tries = 0
			BASS_WASAPI_Free()
			buflen = Int(buflen)
			If keyin\Event\KeyEvent\wVirtualKeyCode = #VK_SUBTRACT
				buflen - 1  ; smaller buffer
			ElseIf keyin\Event\KeyEvent\wVirtualKeyCode = #VK_ADD
				buflen + 1  ; larger buffer
			Else
				flags ! #BASS_WASAPI_EXCLUSIVE; // switch exclusive/shared mode
			EndIf
			
			Repeat
			  ; reinitialize Default WASAPI device (event-driven exclusive mode = 2 buffers)
			  If flags & #BASS_WASAPI_EXCLUSIVE
				  If Not BASS_WASAPI_Init(-1, samrate, 2, flags, buflen / 1000 / 2, 0, @WasapiProc(), #Null)
				    Error("Can't initialize device")
				  EndIf
				Else
				  If Not BASS_WASAPI_Init(-1, samrate, 2, flags, buflen / 1000 / 1, 0, @WasapiProc(), #Null)
				    Error("Can't initialize device")
				  EndIf
				EndIf
				BASS_WASAPI_GetInfo(@info)
				If flags & #BASS_WASAPI_EXCLUSIVE
				  buflen = 1000.0 * info\buflen / (info\freq * info\chans * SizeOf(float)) * 2
				Else
				  buflen = 1000.0 * info\buflen / (info\freq * info\chans * SizeOf(float)) * 1
				EndIf
				If keyin\Event\KeyEvent\wVirtualKeyCode = #VK_SUBTRACT And buflen = oldbuf And buflen - tries > 2 And (flags & #BASS_WASAPI_EXCLUSIVE)
					; got the same buffer, try reducing it more in Case the device's buffer granularity is higher than 1ms
					tries + 1
					buflen = Int(oldbuf) - 1 - tries
					BASS_WASAPI_Free()
					Continue
				EndIf
				Break
			ForEver
			If Not BASS_WASAPI_Start()
			  Error("Can't start output")
			EndIf
			Print("using a " + StrF(buflen, 1) + "ms buffer ")
      If flags & #BASS_WASAPI_EXCLUSIVE
        PrintN("(exclusive mode)")
      Else
        PrintN("(shared mode)")
      EndIf
			
    EndIf
  EndIf
  
  For key = 0 To #KEYS - 1
    If keyin\Event\KeyEvent\wVirtualKeyCode = *key\u[key]
      Break
    EndIf
  Next key
  
  If key = #KEYS
    Continue
  EndIf
    
  If keyin\Event\KeyEvent\bKeyDown And vol(key) <> #MAXVOL
    pos(key) = 0
    vol(key) = #MAXVOL
  ElseIf Not keyin\Event\KeyEvent\bKeyDown And vol(key)
    vol(key) - 1 ; trigger key fadeout
  EndIf
  
Wend

CompilerIf #PB_Compiler_Debugger
  Print("Press return to end: ")
  Input()
CompilerEndIf

BASS_Free()

End 0
infratec
Always Here
Always Here
Posts: 6817
Joined: Sun Sep 07, 2008 12:45 pm
Location: Germany

Re: BASS audio library v2.4.11 and PureBasic 5.31 includes

Post by infratec »

bassmix

Code: Select all

;
;	BASSmix 2.4 C/C++ header file
;	Copyright (c) 2005-2022 Un4seen Developments Ltd.
;
;	See the BASSMIX.CHM file For more detailed documentation
;

XIncludeFile "bass.pbi"

CompilerIf #BASSVERSION <> $204
  CompilerError "conflicting BASS And BASSmix versions"
CompilerEndIf


; Additional BASS_SetConfig options
#BASS_CONFIG_MIXER_BUFFER	= $10601
#BASS_CONFIG_MIXER_POSEX	= $10602
#BASS_CONFIG_SPLIT_BUFFER = $10610

; BASS_Mixer_StreamCreate flags
#BASS_MIXER_RESUME		= $1000	; resume stalled immediately upon new/unpaused source
#BASS_MIXER_POSEX			= $2000	; enable BASS_Mixer_ChannelGetPositionEx support
#BASS_MIXER_NOSPEAKER	= $4000	; ignore speaker arrangement
#BASS_MIXER_QUEUE			= $8000	; queue sources
#BASS_MIXER_END				= $10000	; End the stream when there are no sources
#BASS_MIXER_NONSTOP		= $20000	; don't stall when there are no sources

; BASS_Mixer_StreamAddChannel/Ex flags
#BASS_MIXER_CHAN_ABSOLUTE	= $1000	; start is an absolute position
#BASS_MIXER_CHAN_BUFFER		= $2000	; buffer Data For BASS_Mixer_ChannelGetData/Level
#BASS_MIXER_CHAN_LIMIT		= $4000	; limit mixer processing To the amount available from this source
#BASS_MIXER_CHAN_MATRIX		= $10000	; matrix mixing
#BASS_MIXER_CHAN_PAUSE		= $20000	; don't process the source
#BASS_MIXER_CHAN_DOWNMIX	= $400000 ; downmix To stereo/mono
#BASS_MIXER_CHAN_NORAMPIN	= $800000 ; don't ramp-in the start
#BASS_MIXER_BUFFER		    = #BASS_MIXER_CHAN_BUFFER
#BASS_MIXER_LIMIT		      = #BASS_MIXER_CHAN_LIMIT
#BASS_MIXER_MATRIX		    = #BASS_MIXER_CHAN_MATRIX
#BASS_MIXER_PAUSE		      = #BASS_MIXER_CHAN_PAUSE
#BASS_MIXER_DOWNMIX		    = #BASS_MIXER_CHAN_DOWNMIX
#BASS_MIXER_NORAMPIN		  = #BASS_MIXER_CHAN_NORAMPIN

; Mixer attributes
#BASS_ATTRIB_MIXER_LATENCY  = $15000
#BASS_ATTRIB_MIXER_THREADS	= $15001
#BASS_ATTRIB_MIXER_VOL		  = $15002

; Additional BASS_Mixer_ChannelIsActive Return values
#BASS_ACTIVE_WAITING  = 5
#BASS_ACTIVE_QUEUED   = 6

; BASS_Split_StreamCreate flags
#BASS_SPLIT_SLAVE	= $1000	; only Read buffered Data
#BASS_SPLIT_POS		= $2000

; Splitter attributes
#BASS_ATTRIB_SPLIT_ASYNCBUFFER  = $15010
#BASS_ATTRIB_SPLIT_ASYNCPERIOD	= $15011

; Envelope node
Structure BASS_MIXER_NODE
	pos.q
	value.f
EndStructure

; Envelope types
#BASS_MIXER_ENV_FREQ    = 1
#BASS_MIXER_ENV_VOL		  = 2
#BASS_MIXER_ENV_PAN		  = 3
#BASS_MIXER_ENV_LOOP	  =	$10000 ; flag: loop
#BASS_MIXER_ENV_REMOVE  = $20000 ; flag: remove at End

; Additional sync types
#BASS_SYNC_MIXER_ENVELOPE		    = $10200
#BASS_SYNC_MIXER_ENVELOPE_NODE	= $10201
#BASS_SYNC_MIXER_QUEUE			    = $10202

; Additional BASS_Mixer_ChannelSetPosition flag
#BASS_POS_MIXER_RESET	= $10000 ; flag: clear mixer's playback buffer

; Additional BASS_Mixer_ChannelGetPosition mode
#BASS_POS_MIXER_DELAY	= 5

; BASS_CHANNELINFO types
#BASS_CTYPE_STREAM_MIXER	= $10800
#BASS_CTYPE_STREAM_SPLIT	= $10801


Define bassmixer_library_ = OpenLibrary(#PB_Any, "bassmix.dll")

Prototype.l BASS_Mixer_GetVersion()
Global BASS_Mixer_GetVersion.BASS_Mixer_GetVersion = GetFunction(bassmixer_library_, "BASS_Mixer_GetVersion")

Prototype.HSTREAM BASS_Mixer_StreamCreate(freq.l, chans.l, flags.l)
Global BASS_Mixer_StreamCreate.BASS_Mixer_StreamCreate = GetFunction(bassmixer_library_, "BASS_Mixer_StreamCreate")

Prototype.l BASS_Mixer_StreamAddChannel(handle.HSTREAM, channel.l, flags.l)
Global BASS_Mixer_StreamAddChannel.BASS_Mixer_StreamAddChannel = GetFunction(bassmixer_library_, "BASS_Mixer_StreamAddChannel")

Prototype.l BASS_Mixer_StreamAddChannelEx(handle.HSTREAM, channel.l, flags.l, start.q, length.q)
Global BASS_Mixer_StreamAddChannelEx.BASS_Mixer_StreamAddChannelEx = GetFunction(bassmixer_library_, "BASS_Mixer_StreamAddChannelEx")

Prototype.l BASS_Mixer_StreamGetChannels(handle.HSTREAM, *channels, count.l)
Global BASS_Mixer_StreamGetChannels.BASS_Mixer_StreamGetChannels = GetFunction(bassmixer_library_, "BASS_Mixer_StreamGetChannels")

Prototype.HSTREAM BASS_Mixer_ChannelGetMixer(handle.l)
Global BASS_Mixer_ChannelGetMixer.BASS_Mixer_ChannelGetMixer = GetFunction(bassmixer_library_, "BASS_Mixer_ChannelGetMixer")

Prototype.l BASS_Mixer_ChannelIsActive(handle.l)
Global BASS_Mixer_ChannelIsActive.BASS_Mixer_ChannelIsActive = GetFunction(bassmixer_library_, "BASS_Mixer_ChannelIsActive")

Prototype.l BASS_Mixer_ChannelFlags(handle.l, flags.l, mask.l)
Global BASS_Mixer_ChannelFlags.BASS_Mixer_ChannelFlags = GetFunction(bassmixer_library_, "BASS_Mixer_ChannelFlags")

Prototype.l BASS_Mixer_ChannelRemove(handle.l)
Global BASS_Mixer_ChannelRemove.BASS_Mixer_ChannelRemove = GetFunction(bassmixer_library_, "BASS_Mixer_ChannelRemove")

Prototype.l BASS_Mixer_ChannelSetPosition(handle.l, pos.q, mode.l)
Global BASS_Mixer_ChannelSetPosition.BASS_Mixer_ChannelSetPosition = GetFunction(bassmixer_library_, "BASS_Mixer_ChannelSetPosition")

Prototype.q BASS_Mixer_ChannelGetPosition(handle.l, mode.l)
Global BASS_Mixer_ChannelGetPosition.BASS_Mixer_ChannelGetPosition = GetFunction(bassmixer_library_, "BASS_Mixer_ChannelGetPosition")

Prototype.q BASS_Mixer_ChannelGetPositionEx(channel.l, mode.l, delay.l)
Global BASS_Mixer_ChannelGetPositionEx.BASS_Mixer_ChannelGetPositionEx = GetFunction(bassmixer_library_, "BASS_Mixer_ChannelGetPositionEx")

Prototype.l BASS_Mixer_ChannelGetLevel(handle.l)
Global BASS_Mixer_ChannelGetLevel.BASS_Mixer_ChannelGetLevel = GetFunction(bassmixer_library_, "BASS_Mixer_ChannelGetLevel")

Prototype.l BASS_Mixer_ChannelGetLevelEx(handle.l, *levels, length.f, flags.l)
Global BASS_Mixer_ChannelGetLevelEx.BASS_Mixer_ChannelGetLevelEx = GetFunction(bassmixer_library_, "BASS_Mixer_ChannelGetLevelEx")

Prototype.l BASS_Mixer_ChannelGetData(handle.l, *buffer, length.l)
Global BASS_Mixer_ChannelGetData.BASS_Mixer_ChannelGetData = GetFunction(bassmixer_library_, "BASS_Mixer_ChannelGetData")

Prototype.HSYNC BASS_Mixer_ChannelSetSync(handle.l, type.l, param.q, proc.SYNCPROC, *user)
Global BASS_Mixer_ChannelSetSync.BASS_Mixer_ChannelSetSync = GetFunction(bassmixer_library_, "BASS_Mixer_ChannelSetSync")

Prototype.l BASS_Mixer_ChannelRemoveSync(channel.l, sync.HSYNC)
Global BASS_Mixer_ChannelRemoveSync.BASS_Mixer_ChannelRemoveSync = GetFunction(bassmixer_library_, "BASS_Mixer_ChannelRemoveSync")

Prototype.l BASS_Mixer_ChannelSetMatrix(handle.l, *matrix)
Global BASS_Mixer_ChannelSetMatrix.BASS_Mixer_ChannelSetMatrix = GetFunction(bassmixer_library_, "BASS_Mixer_ChannelSetMatrix")

Prototype.l BASS_Mixer_ChannelSetMatrixEx(handle.l, *matrix, time.f)
Global BASS_Mixer_ChannelSetMatrixEx.BASS_Mixer_ChannelSetMatrixEx = GetFunction(bassmixer_library_, "BASS_Mixer_ChannelSetMatrixEx")

Prototype.l BASS_Mixer_ChannelGetMatrix(handle.l, *matrix)
Global BASS_Mixer_ChannelGetMatrix.BASS_Mixer_ChannelGetMatrix = GetFunction(bassmixer_library_, "BASS_Mixer_ChannelGetMatrix")

Prototype.l BASS_Mixer_ChannelSetEnvelope(handle.l, type.l, *nodes.BASS_MIXER_NODE, count.l)
Global BASS_Mixer_ChannelSetEnvelope.BASS_Mixer_ChannelSetEnvelope = GetFunction(bassmixer_library_, "BASS_Mixer_ChannelSetEnvelope")

Prototype.l BASS_Mixer_ChannelSetEnvelopePos(handle.l, type.l, pos.q)
Global BASS_Mixer_ChannelSetEnvelopePos.BASS_Mixer_ChannelSetEnvelopePos = GetFunction(bassmixer_library_, "BASS_Mixer_ChannelSetEnvelopePos")

Prototype.q BASS_Mixer_ChannelGetEnvelopePos(handle.l, type.l, *value)
Global BASS_Mixer_ChannelGetEnvelopePos.BASS_Mixer_ChannelGetEnvelopePos = GetFunction(bassmixer_library_, "BASS_Mixer_ChannelGetEnvelopePos")

Prototype.HSTREAM BASS_Split_StreamCreate(channel.l, flags.l, *chanmap)
Global BASS_Split_StreamCreate.BASS_Split_StreamCreate = GetFunction(bassmixer_library_, "BASS_Split_StreamCreate")

Prototype.l BASS_Split_StreamGetSource(handle.HSTREAM)
Global BASS_Split_StreamGetSource.BASS_Split_StreamGetSource = GetFunction(bassmixer_library_, "BASS_Split_StreamGetSource")

Prototype.l BASS_Split_StreamGetSplits(handle.l, *splits, count.l)
Global BASS_Split_StreamGetSplits.BASS_Split_StreamGetSplits = GetFunction(bassmixer_library_, "BASS_Split_StreamGetSplits")

Prototype.l BASS_Split_StreamReset(handle.l)
Global BASS_Split_StreamReset.BASS_Split_StreamReset = GetFunction(bassmixer_library_, "BASS_Split_StreamReset")

Prototype.l BASS_Split_StreamResetEx(handle.l, offset.l)
Global BASS_Split_StreamResetEx.BASS_Split_StreamResetEx = GetFunction(bassmixer_library_, "BASS_Split_StreamResetEx")

Prototype.l BASS_Split_StreamGetAvailable(handle.l)
Global BASS_Split_StreamGetAvailable.BASS_Split_StreamGetAvailable = GetFunction(bassmixer_library_, "BASS_Split_StreamGetAvailable")
Quin
Enthusiast
Enthusiast
Posts: 286
Joined: Thu Mar 31, 2022 7:03 pm
Location: United States
Contact:

Re: BASS audio library v2.4.11 and PureBasic 5.31 includes

Post by Quin »

Thanks, Infratec! :)
PB v5.40/6.10, Windows 10 64-bit.
16-core AMD Ryzen 9 5950X, 128 GB DDR5.
Post Reply