
Kenne mich mit bass leider nicht aus.
Bass.pbi:
http://www.un4seen.com/stuff/bass24-pb.zip
Bass DLL:
http://www.un4seen.com/download.php?bass24
Code: Alles auswählen
Structure Sample
l.w
r.w
EndStructure
Procedure UpdateWaveImage(PBImage, *SampleData.Sample, SampleCount)
Protected.i Width, Height, x, VOffsetL, VOffsetR, MUL
Protected.i SamplesPerPixel, sample
Protected.w MinL, MaxL, MinR, MaxR
If *SampleData And SampleCount
StartDrawing(ImageOutput(PBImage))
DrawingMode(#PB_2DDrawing_Transparent)
Width = OutputWidth() : Height = OutputHeight()
VOffsetL = Height >> 2 : VOffsetR = VOffsetL + Height >> 1
MUL = (VOffsetL * $19999) >> 16
Box(0, 0, Width, Height, $FFFFFF)
Line(0, VOffsetL, Width, 1, RGB(255,0,0))
Line(0, VOffsetR, Width, 1, RGB(255,0,0))
SamplesPerPixel = (SampleCount + Width - 1) / Width
If SampleCount
MinL = *SampleData\l : MinR = *SampleData\r : MaxL = MinL : MaxR = MinR
While SampleCount
If *SampleData\l < MinL : MinL = *SampleData\l : ElseIf *SampleData\l > MaxL : MaxL = *SampleData\l : EndIf
If *SampleData\r < MinR : MinR = *SampleData\r : ElseIf *SampleData\r > MaxR : MaxR = *SampleData\r : EndIf
sample + 1 : SampleCount - 1
If sample = SamplesPerPixel Or SampleCount = 0
MinL = (MinL * MUL) >> 16 : MaxL = (MaxL * MUL) >> 16
MinR = (MinR * MUL) >> 16 : MaxR = (MaxR * MUL) >> 16
LineXY(x, VOffsetL - MinL, x, VOffsetL - MaxL, $01D1F5)
LineXY(x, VOffsetR - MinR, x, VOffsetR - MaxR, $AA964C)
MinL = *SampleData\l : MinR = *SampleData\r : MaxL = MinL : MaxR = MinR
x + 1 : sample = 0
EndIf
*SampleData + 4
Wend
EndIf
DrawText((Width/2)-(TextWidth("Linker Kanal")/2), VOffsetL-(TextHeight("Linker Kanal")/2), "Linker Kanal", RGB(0,0,0))
DrawText((Width/2)-(TextWidth("Rechter Kanal")/2), VOffsetR-(TextHeight("Rechter Kanal")/2), "Rechter Kanal", RGB(0,0,0))
StopDrawing()
EndIf
EndProcedure
Global Filename.s, WaveImage, Channel, length, event
BASS_Init(-1, 44100, 0, 0, #Null)
Filename = OpenFileRequester("","","Musik|*.mp3;*.wav",0)
Channel = BASS_StreamCreateFile(#False, @Filename, 0, 0, #BASS_STREAM_PRESCAN|#BASS_STREAM_DECODE|#BASS_UNICODE)
BASS_ChannelSetPosition(Channel, BASS_ChannelSeconds2Bytes(Channel, 0), #BASS_POS_BYTE)
BASS_ChannelBytes2Seconds(Channel, BASS_ChannelGetLength(Channel, #BASS_POS_BYTE))
length = BASS_ChannelSeconds2Bytes(Channel, BASS_ChannelBytes2Seconds(Channel, BASS_ChannelGetLength(Channel, #BASS_POS_BYTE)))
Dim Buffer.Sample(length >> 2) ;Länge durch 4 reicht als Arraygröße
BASS_ChannelGetData(Channel, @Buffer(), length)
WaveImage = CreateImage(#PB_Any, 1900, 150)
UpdateWaveImage(WaveImage, @Buffer(), length >> 2)
UsePNGImageDecoder()
UsePNGImageEncoder()
If SaveImage(WaveImage, GetCurrentDirectory()+"Mp3-Bild.png", #PB_ImagePlugin_PNG)
Debug "Gespeichert !!!"
Else
Debug "Fehler !!!"
EndIf
Code: Alles auswählen
; BASS 2.4 C/C++ header file
; Copyright (c) 1999-2014 Un4seen Developments Ltd.
;
; See the BASS.CHM file for more detailed documentation
;
; BASS v2.4.11.x Windows include for PureBasic v5.31
; C to PB adaption by Roger Hågensen, 2015-03-23, http://forums.purebasic.com/
; Modified by Mijikai 2019-01-18 https://www.purebasic.fr/english/
;
; Changes from last update to the PB include files:
; Things have been moved around some to make maintenance a little easier.
; Some of the macros and assert stuff was a little broken, these have been fixed and moved into bass_test.pb
; BASS_ChannelSetAttributeEx() and BASS_ChannelGetAttributeEx(), BASS_ChannelGetLevelEx() added.
; BASS_MusicLoad() and BASS_SampleLoad() had the wrong number of parameters, missing freq.l and max.l respectively.
; Several constants have been added.
; Special wrappers, file/memory loading macros and prototypes have been removed, definitions/parameters should now match what is in the BASS manual.
; All Unicode prototypes and compiler exceptions removed, this brings the include closer to the original BASS.h file.
;
; General changes when porting from bass.h to bass.pbi:
; As much of the non-Windows platform stuff is kept as possible (iOS, Windows CE, Linux, MacOS) even if PureBasic do not support all those platforms.
; Windows spesific stuff has compiletime check and inclusion to make the include itself as neutral as possible and match BASS.h where possible.
; MacOS and Linux alternatives are left where encountered, some fiddling around may be needed though.
; Any callback definitions are retained but commented out so you can see how they should be made.
; Some C stuff has been dropped when not needed or an alternative implementation added instead.
;C to PB porting hints:
;PureBasic has no direct match for C like typedefs, just treat these as longs instead.
;TRUE is 1 (#TRUE)
;FALSE is 0 (#FALSE)
;BYTE is a byte
;WORD is a word
;DWORD is a long
;QWORD is a quad
;BOOL is a long
;HMUSIC is a long, MOD music handle
;HSAMPLE is a long, sample handle
;HCHANNEL is a long, playing sample's channel handle
;HSTREAM is a long, sample stream handle
;HRECORD is a long, recording handle
;HSYNC is a long, synchronizer handle
;HDSP is a long, DSP handle
;HFX is a long, DX8 effect handle
;HPLUGIN is a long, Plugin handle
;- BASS version constants
#BASSVERSION = $02040A00 ;BASS API version this include was made for.
#BASSVERSIONTEXT = "2.4"
;- BASS Error codes returned by BASS_GetErrorCode
#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 playback 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_ALREADY = 14 ;already initialized
#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 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 error
;- 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_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_SetConfigPtr options
#BASS_CONFIG_NET_AGENT = 16
#BASS_CONFIG_NET_PROXY = 17
#BASS_CONFIG_IOS_NOTIFY = 46
;- BASS_Init flags
#BASS_DEVICE_8BITS = $1 ;use 8 bit resolution, else 16 bit
#BASS_DEVICE_MONO = $2 ;use mono, else stereo
#BASS_DEVICE_3D = $4 ;enable 3D functionality
#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
;- 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
*driver ;driver
flags.l
EndStructure
;- BASS_DEVICEINFO flags
#BASS_DEVICE_ENABLED = $1
#BASS_DEVICE_DEFAULT = $2
#BASS_DEVICE_INIT = $4
#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 bits
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.f ;delta-volume outside the projection cone
vam.l ;voice allocation/management flags (BASS_VAM_xxx)
priority.l ;priority (0=lowest, 0xffffffff=highest)
EndStructure
;- SAMPLE flags
#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)
;- STREAM flags
#BASS_STREAM_PRESCAN = $20000 ;enable pin-point seeking/length (MP3/MP2/MP1)
#BASS_MP3_SETPOS = #BASS_STREAM_PRESCAN
#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
;- MUSIC flags
#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_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 = $01000000 ;front speakers
#BASS_SPEAKER_REAR = $02000000 ;rear/side speakers
#BASS_SPEAKER_CENLFE = $03000000 ;center & LFE speakers (5.1)
#BASS_SPEAKER_REAR2 = $04000000 ;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
;- FILE flags
#BASS_ASYNCFILE = $40000000
#BASS_UNICODE = $80000000
;- RECORD flags
#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
;- BASS Structures
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 handle
sample.l ;sample
*filename ;filename
EndStructure
;- 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_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
CompilerIf #PB_Compiler_OS = #PB_OS_Windows
;- 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_PRESET_GENERIC : #EAX_ENVIRONMENT_GENERIC,0.5F,1.493F,0.5F : EndMacro
Macro EAX_PRESET_PADDEDCELL : #EAX_ENVIRONMENT_PADDEDCELL,0.25F,0.1F,0.0F : EndMacro
Macro EAX_PRESET_ROOM : #EAX_ENVIRONMENT_ROOM,0.417F,0.4F,0.666F : EndMacro
Macro EAX_PRESET_BATHROOM : #EAX_ENVIRONMENT_BATHROOM,0.653F,1.499F,0.166F : EndMacro
Macro EAX_PRESET_LIVINGROOM : #EAX_ENVIRONMENT_LIVINGROOM,0.208F,0.478F,0.0F : EndMacro
Macro EAX_PRESET_STONEROOM : #EAX_ENVIRONMENT_STONEROOM,0.5F,2.309F,0.888F : EndMacro
Macro EAX_PRESET_AUDITORIUM : #EAX_ENVIRONMENT_AUDITORIUM,0.403F,4.279F,0.5F : EndMacro
Macro EAX_PRESET_CONCERTHALL : #EAX_ENVIRONMENT_CONCERTHALL,0.5F,3.961F,0.5F : EndMacro
Macro EAX_PRESET_CAVE : #EAX_ENVIRONMENT_CAVE,0.5F,2.886F,1.304F : EndMacro
Macro EAX_PRESET_ARENA : #EAX_ENVIRONMENT_ARENA,0.361F,7.284F,0.332F : EndMacro
Macro EAX_PRESET_HANGAR : #EAX_ENVIRONMENT_HANGAR,0.5F,10.0F,0.3F : EndMacro
Macro EAX_PRESET_CARPETEDHALLWAY : #EAX_ENVIRONMENT_CARPETEDHALLWAY,0.153F,0.259F,2.0F : EndMacro
Macro EAX_PRESET_HALLWAY : #EAX_ENVIRONMENT_HALLWAY,0.361F,1.493F,0.0F : EndMacro
Macro EAX_PRESET_STONECORRIDOR : #EAX_ENVIRONMENT_STONECORRIDOR,0.444F,2.697F,0.638F : EndMacro
Macro EAX_PRESET_ALLEY : #EAX_ENVIRONMENT_ALLEY,0.25F,1.752F,0.776F : EndMacro
Macro EAX_PRESET_FOREST : #EAX_ENVIRONMENT_FOREST,0.111F,3.145F,0.472F : EndMacro
Macro EAX_PRESET_CITY : #EAX_ENVIRONMENT_CITY,0.111F,2.767F,0.224F : EndMacro
Macro EAX_PRESET_MOUNTAINS : #EAX_ENVIRONMENT_MOUNTAINS,0.194F,7.841F,0.472F : EndMacro
Macro EAX_PRESET_QUARRY : #EAX_ENVIRONMENT_QUARRY,1.0F,1.499F,0.5F : EndMacro
Macro EAX_PRESET_PLAIN : #EAX_ENVIRONMENT_PLAIN,0.097F,2.767F,0.224F : EndMacro
Macro EAX_PRESET_PARKINGLOT : #EAX_ENVIRONMENT_PARKINGLOT,0.208F,1.652F,1.5F : EndMacro
Macro EAX_PRESET_SEWERPIPE : #EAX_ENVIRONMENT_SEWERPIPE,0.652F,2.886F,0.25F : EndMacro
Macro EAX_PRESET_UNDERWATER : #EAX_ENVIRONMENT_UNDERWATER,1.0F,1.499F,0.0F : EndMacro
Macro EAX_PRESET_DRUGGED : #EAX_ENVIRONMENT_DRUGGED,0.875F,8.392F,1.388F : EndMacro
Macro EAX_PRESET_DIZZY : #EAX_ENVIRONMENT_DIZZY,0.139F,17.234F,0.666F : EndMacro
Macro EAX_PRESET_PSYCHOTIC : #EAX_ENVIRONMENT_PSYCHOTIC,0.486F,7.563F,0.806F : EndMacro
CompilerEndIf
;typedef DWORD (CALLBACK STREAMPROC)(HSTREAM handle, void *buffer, DWORD length, void *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
;special STREAMPROCs
#STREAMPROC_DUMMY = 0 ;"dummy" stream
#STREAMPROC_PUSH = -1 ;push stream
;- BASS_StreamCreateFileUser file systems
#STREAMFILE_NOBUFFER = 0
#STREAMFILE_BUFFER = 1
#STREAMFILE_BUFFERPUSH = 2
;- User file stream callback functions
;typedef void (CALLBACK FILECLOSEPROC)(void *user);
;typedef QWORD (CALLBACK FILELENPROC)(void *user);
;typedef DWORD (CALLBACK FILEREADPROC)(void *buffer, DWORD length, void *user);
;typedef BOOL (CALLBACK FILESEEKPROC)(QWORD offset, void *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
;typedef void (CALLBACK DOWNLOADPROC)(const void *buffer, DWORD length, void *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_MIXTIME = $40000000 ;FLAG: sync at mixtime, else at playtime
#BASS_SYNC_ONETIME = $80000000 ;FLAG: sync only once, else continuously
;typedef void (CALLBACK SYNCPROC)(HSYNC handle, DWORD channel, DWORD data, void *user);
;Sync callback function. NOTE: a sync callback function should be very
;quick as other syncs can't be processed until it has finished. If the sync
;is a "mixtime" sync, then other streams and MOD musics can't be mixed until
;it's finished either.
;handle : The sync that has occured
;channel: Channel that the sync occured in
;data : Additional data associated with the sync's occurance
;user : The 'user' parameter given when calling BASS_ChannelSetSync */
;typedef void (CALLBACK DSPPROC)(HDSP handle, DWORD channel, void *buffer, DWORD length, void *user);
;/* DSP callback function. NOTE: A DSP function should obviously be as quick as
;possible... other DSP functions, streams and MOD musics can not be processed
;until it's finished.
;handle : The DSP handle
;channel: Channel that the DSP is being applied to
;buffer : Buffer to apply the DSP to
;length : Number of bytes in the buffer
;user : The 'user' parameter given when calling BASS_ChannelSetDSP */
;typedef BOOL (CALLBACK RECORDPROC)(HRECORD handle, const void *buffer, DWORD length, void *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
;- 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_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_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_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_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_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_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_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_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]
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
;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_INEXACT = $08000000 ;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_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
;DX8 effect types, use with BASS_ChannelSetFX
Enumeration 0
#BASS_FX_DX8_CHORUS
#BASS_FX_DX8_COMPRESSOR
#BASS_FX_DX8_DISTORTION
#BASS_FX_DX8_ECHO
#BASS_FX_DX8_FLANGER
#BASS_FX_DX8_GARGLE
#BASS_FX_DX8_I3DL2REVERB
#BASS_FX_DX8_PARAMEQ
#BASS_FX_DX8_REVERB
EndEnumeration
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.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
; typedef void (CALLBACK IOSNOTIFYPROC)(DWORD status);
; /* iOS notification callback function.
; status : The notification (BASS_IOSNOTIFY_xxx) */
#BASS_IOSNOTIFY_INTERRUPT = 1 ;interruption started
#BASS_IOSNOTIFY_INTERRUPT_END = 2 ;interruption ended
ImportC "bass.lib"
BASS_SetConfig.l(option.l, value.l)
BASS_GetConfig(option.l)
BASS_SetConfigPtr.l(option.l, *value)
BASS_GetConfigPtr.i(option.l)
BASS_GetVersion.l()
BASS_ErrorGetCode.l()
BASS_GetDeviceInfo.l(device.l, *info)
BASS_Init.l(device.l, freq.l, flags.l, *win, *dsguid)
BASS_SetDevice.l(device.l)
BASS_GetDevice.l()
BASS_Free.l()
BASS_GetDSoundObject.i(object.l)
BASS_GetInfo.l(*info)
BASS_Update.l(length.l)
BASS_GetCPU.f()
BASS_Start.l()
BASS_Stop.l()
BASS_Pause.l()
BASS_SetVolume.l(volume.f)
BASS_GetVolume.f()
BASS_PluginLoad.l(*file, flags.l)
BASS_PluginFree.l(handle.l)
BASS_PluginGetInfo.i(handle.l)
BASS_Set3DFactors.l(distf.f, rollf.f, doppf.f)
BASS_Get3DFactors.l(*distf, *rollf, *doppf)
BASS_Set3DPosition.l(*pos, *vel, *front, *top)
BASS_Get3DPosition.l(*pos, *vel, *front, *top)
BASS_Apply3D.i()
BASS_SetEAXParameters.l(env.l, vol.f, decay.f, damp.f)
BASS_GetEAXParameters.l(*env, *vol, *decay, *damp)
BASS_MusicLoad.l(mem.l, *file, offset.q, length.l, flags.l, freq.l)
BASS_MusicFree.l(handle.l)
BASS_SampleLoad.l(mem.l, *file, offset.q, length.l, max.l, flags.l)
BASS_SampleCreate.l(length.l, freq.l, chans.l, max.l, flags.l)
BASS_SampleFree.l(handle.l)
BASS_SampleSetData.l(handle.l, *buffer)
BASS_SampleGetData.l(handle.l, *buffer)
BASS_SampleGetInfo.l(handle.l, *info)
BASS_SampleSetInfo.l(handle.l, *info)
BASS_SampleGetChannel.l(handle.l, onlynew.l)
BASS_SampleGetChannels.l(handle.l, *channels)
BASS_SampleStop.l(handle.l)
BASS_StreamCreate.l(freq.l, chans.l, flags.l, *proc, *user)
BASS_StreamCreateFile.l(mem.l, *file, offset.q, length.q, flags.l)
BASS_StreamCreateURL.l(*url, offset.l, flags.l, *proc, *user)
BASS_StreamCreateFileUser.l(system.l, flags.l, *proc, *user)
BASS_StreamFree.l(handle.l)
BASS_StreamGetFilePosition.q(handle.l, mode.l)
BASS_StreamPutData.l(handle.l, *buffer, length.l)
BASS_StreamPutFileData.l(handle.l, *buffer, length.l)
BASS_RecordGetDeviceInfo.l(device.l, *info)
BASS_RecordInit.l(device.l)
BASS_RecordSetDevice.l(device.l)
BASS_RecordGetDevice.l()
BASS_RecordFree.l()
BASS_RecordGetInfo.l(*info)
BASS_RecordGetInputName.i(input.l)
BASS_RecordSetInput.l(input.l, flags.l, volume.f)
BASS_RecordGetInput.l(input.l, *volume)
BASS_RecordStart.l(freq.l, chans.l, flags.l, *proc, *user)
BASS_ChannelBytes2Seconds.d(handle.l, pos.q)
BASS_ChannelSeconds2Bytes.q(handle.l, pos.d)
BASS_ChannelGetDevice.l(handle.l)
BASS_ChannelSetDevice.l(handle.l, device.l)
BASS_ChannelIsActive.l(handle.l)
BASS_ChannelGetInfo.l(handle.l, *info)
BASS_ChannelGetTags.i(handle.l, tags.l)
BASS_ChannelFlags.l(handle.l, flags.l, mask.l)
BASS_ChannelUpdate.l(handle.l, length.l)
BASS_ChannelLock.l(handle.l, lock.l)
BASS_ChannelPlay.l(handle.l, restart.l)
BASS_ChannelStop.l(handle.l)
BASS_ChannelPause.l(handle.l)
BASS_ChannelSetAttribute.l(handle.l, attrib.l, value.f)
BASS_ChannelGetAttribute.l(handle.l, attrib.l, *value)
BASS_ChannelSlideAttribute.l(handle.l, attrib.l, value.f, time.l)
BASS_ChannelIsSliding(handle.l, attrib.l)
BASS_ChannelSetAttributeEx.l(handle.l, attrib.l, *value, size.l)
BASS_ChannelGetAttributeEx.l(handle.l, attrib.l, *value, size.l)
BASS_ChannelSet3DAttributes.l(handle.l, mode.l, min.f, max.f, iangle.l, oangle.l, outvol.f)
BASS_ChannelGet3DAttributes.l(handle.l, *mode, *min, *max, *iangle, *oangle, *outvol)
BASS_ChannelSet3DPosition.l(handle.l, *pos, *orient, *vel)
BASS_ChannelGet3DPosition.l(handle.l, *pos, *orient, *vel)
BASS_ChannelGetLength.q(handle.l, mode.l)
BASS_ChannelSetPosition.l(handle.l, pos.q, mode.l)
BASS_ChannelGetPosition.q(handle.l, mode.l)
BASS_ChannelGetLevel.l(handle.l)
BASS_ChannelGetLevelEx.l(handle.l, *levels, length.f, flags.l)
BASS_ChannelGetData.l(handle.l, *buffer, length.l)
BASS_ChannelSetSync.l(handle.l, type.l, param.q, *proc, *user)
BASS_ChannelRemoveSync.l(handle.l, sync.l)
BASS_ChannelSetDSP.l(handle.l, *proc, *user, priority.l)
BASS_ChannelRemoveDSP.l(handle.l, dsp.l)
BASS_ChannelSetLink.l(handle.l, chan.l)
BASS_ChannelRemoveLink.l(handle.l, chan.l)
BASS_ChannelSetFX.l(handle.l, type.l, priority.l)
BASS_ChannelRemoveFX.l(handle.l, fx.l)
BASS_FXSetParameters.l(handle.l, *params)
BASS_FXGetParameters.l(handle.l, *params)
BASS_FXReset.l(handle.l)
EndImport
Es scheint so.Mijikai hat geschrieben:Was ich noch nicht ganz verstehe - es gibt ja eine x86 & x64 Version von bass aber nur eine (PureBasic) 'Header-Datei' !
Bleiben alle Variablen (der Funktionen) und Strukturen gleich ?
Code: Alles auswählen
EnableExplicit
IncludeFile "bass.pbi"
;- Prototype Macros
Macro GetFunctionProtoQuote
"
EndMacro
Macro GetFunctionProto(dll, name)
Global name.name
name = GetFunction(dll, GetFunctionProtoQuote#name#GetFunctionProtoQuote)
CompilerIf #PB_Compiler_Debugger ; Only enable assert in debug mode
If name = #Null
Debug "Assert on line " + #PB_Compiler_Line + ", GetFunction(" + GetFunctionProtoQuote#dll#GetFunctionProtoQuote + ", " + GetFunctionProtoQuote#name#GetFunctionProtoQuote + ")"
EndIf
CompilerEndIf
EndMacro
; BASS_Load_Library
Threaded _BASS_Load_Library_DLL_.i
Procedure BASS_Free_Library()
If IsLibrary(_BASS_Load_Library_DLL_)
CloseLibrary(_BASS_Load_Library_DLL_)
EndIf
EndProcedure
Procedure.i BASS_Load_Library(dllpath$)
Protected dll.i, result.i
If IsLibrary(_BASS_Load_Library_DLL_)
ProcedureReturn #False
EndIf
_BASS_Load_Library_DLL_ = OpenLibrary(#PB_Any, dllpath$)
dll = _BASS_Load_Library_DLL_
If IsLibrary(dll) = #False
ProcedureReturn #False
EndIf
GetFunctionProto(dll, BASS_GetVersion)
If BASS_GetVersion = #Null
;BASS_GetVersion() not found, is this really bass.dll ?
BASS_Free_Library()
ProcedureReturn #False
EndIf
;Make sure BASS API and bass.dll are compatible.
result = BASS_GetVersion()
If (result & $FFFF0000) <> (#BASSVERSION & $FFFF0000) Or (result < #BASSVERSION)
BASS_Free_Library()
ProcedureReturn #False
EndIf
;you should only use the GetFunctionProto() for the BASS functions you actually need/use,
;these are macros thus you will save some memory/exe size by removing the functions you don't use,
;during debugging the GetFunctionProto() macro will also check if the BASS function exists in the loaded library to catch wrong library versions.
GetFunctionProto(dll, BASS_SetConfig)
GetFunctionProto(dll, BASS_GetConfig)
GetFunctionProto(dll, BASS_SetConfigPtr)
GetFunctionProto(dll, BASS_GetConfigPtr)
GetFunctionProto(dll, BASS_ErrorGetCode)
GetFunctionProto(dll, BASS_GetDeviceInfo)
GetFunctionProto(dll, BASS_Init)
GetFunctionProto(dll, BASS_SetDevice)
GetFunctionProto(dll, BASS_GetDevice)
GetFunctionProto(dll, BASS_Free)
;GetFunctionProto(dll, BASS_GetDSoundObject)
GetFunctionProto(dll, BASS_GetInfo)
GetFunctionProto(dll, BASS_Update)
GetFunctionProto(dll, BASS_GetCPU)
GetFunctionProto(dll, BASS_Start)
GetFunctionProto(dll, BASS_Stop)
GetFunctionProto(dll, BASS_Pause)
GetFunctionProto(dll, BASS_SetVolume)
GetFunctionProto(dll, BASS_GetVolume)
GetFunctionProto(dll, BASS_PluginLoad)
GetFunctionProto(dll, BASS_PluginFree)
GetFunctionProto(dll, BASS_PluginGetInfo)
GetFunctionProto(dll, BASS_Set3DFactors)
GetFunctionProto(dll, BASS_Get3DFactors)
GetFunctionProto(dll, BASS_Set3DPosition)
GetFunctionProto(dll, BASS_Get3DPosition)
GetFunctionProto(dll, BASS_Apply3D)
CompilerIf #PB_Compiler_OS = #PB_OS_Windows
GetFunctionProto(dll, BASS_SetEAXParameters)
GetFunctionProto(dll, BASS_GetEAXParameters)
CompilerEndIf
GetFunctionProto(dll, BASS_MusicLoad)
GetFunctionProto(dll, BASS_MusicFree)
GetFunctionProto(dll, BASS_SampleLoad)
GetFunctionProto(dll, BASS_SampleCreate)
GetFunctionProto(dll, BASS_SampleFree)
GetFunctionProto(dll, BASS_SampleSetData)
GetFunctionProto(dll, BASS_SampleGetData)
GetFunctionProto(dll, BASS_SampleGetInfo)
GetFunctionProto(dll, BASS_SampleSetInfo)
GetFunctionProto(dll, BASS_SampleGetChannel)
GetFunctionProto(dll, BASS_SampleGetChannels)
GetFunctionProto(dll, BASS_SampleStop)
GetFunctionProto(dll, BASS_StreamCreate)
GetFunctionProto(dll, BASS_StreamCreateFile)
GetFunctionProto(dll, BASS_StreamCreateURL)
GetFunctionProto(dll, BASS_StreamCreateFileUser)
GetFunctionProto(dll, BASS_StreamFree)
GetFunctionProto(dll, BASS_StreamGetFilePosition)
GetFunctionProto(dll, BASS_StreamPutData)
GetFunctionProto(dll, BASS_StreamPutFileData)
GetFunctionProto(dll, BASS_RecordGetDeviceInfo)
GetFunctionProto(dll, BASS_RecordInit)
GetFunctionProto(dll, BASS_RecordSetDevice)
GetFunctionProto(dll, BASS_RecordGetDevice)
GetFunctionProto(dll, BASS_RecordFree)
GetFunctionProto(dll, BASS_RecordGetInfo)
GetFunctionProto(dll, BASS_RecordGetInputName)
GetFunctionProto(dll, BASS_RecordSetInput)
GetFunctionProto(dll, BASS_RecordGetInput)
GetFunctionProto(dll, BASS_RecordStart)
GetFunctionProto(dll, BASS_ChannelBytes2Seconds)
GetFunctionProto(dll, BASS_ChannelSeconds2Bytes)
GetFunctionProto(dll, BASS_ChannelGetDevice)
GetFunctionProto(dll, BASS_ChannelSetDevice)
GetFunctionProto(dll, BASS_ChannelIsActive)
GetFunctionProto(dll, BASS_ChannelGetInfo)
GetFunctionProto(dll, BASS_ChannelGetTags)
GetFunctionProto(dll, BASS_ChannelFlags)
GetFunctionProto(dll, BASS_ChannelUpdate)
GetFunctionProto(dll, BASS_ChannelLock)
GetFunctionProto(dll, BASS_ChannelPlay)
GetFunctionProto(dll, BASS_ChannelStop)
GetFunctionProto(dll, BASS_ChannelPause)
GetFunctionProto(dll, BASS_ChannelSetAttribute)
GetFunctionProto(dll, BASS_ChannelSetAttributeEx)
GetFunctionProto(dll, BASS_ChannelGetAttribute)
GetFunctionProto(dll, BASS_ChannelGetAttributeEx)
GetFunctionProto(dll, BASS_ChannelSlideAttribute)
GetFunctionProto(dll, BASS_ChannelIsSliding)
GetFunctionProto(dll, BASS_ChannelSet3DAttributes)
GetFunctionProto(dll, BASS_ChannelGet3DAttributes)
GetFunctionProto(dll, BASS_ChannelSet3DPosition)
GetFunctionProto(dll, BASS_ChannelGet3DPosition)
GetFunctionProto(dll, BASS_ChannelGetLength)
GetFunctionProto(dll, BASS_ChannelSetPosition)
GetFunctionProto(dll, BASS_ChannelGetPosition)
GetFunctionProto(dll, BASS_ChannelGetLevel)
GetFunctionProto(dll, BASS_ChannelGetLevelEx)
GetFunctionProto(dll, BASS_ChannelGetData)
GetFunctionProto(dll, BASS_ChannelSetSync)
GetFunctionProto(dll, BASS_ChannelRemoveSync)
GetFunctionProto(dll, BASS_ChannelSetDSP)
GetFunctionProto(dll, BASS_ChannelRemoveDSP)
GetFunctionProto(dll, BASS_ChannelSetLink)
GetFunctionProto(dll, BASS_ChannelRemoveLink)
GetFunctionProto(dll, BASS_ChannelSetFX)
GetFunctionProto(dll, BASS_ChannelRemoveFX)
GetFunctionProto(dll, BASS_FXSetParameters)
GetFunctionProto(dll, BASS_FXGetParameters)
GetFunctionProto(dll, BASS_FXReset)
ProcedureReturn #True
EndProcedure
CompilerIf #PB_Compiler_OS = #PB_OS_Windows
If BASS_Load_Library("bass.dll") = #False
Debug "Die bass.dll kann nicht geladen werden."
End
EndIf
CompilerElseIf #PB_Compiler_OS = #PB_OS_Linux
If BASS_Load_Library("libbass.so") = #False
Debug "Die libbass.so kann nicht geladen werden."
End
EndIf
CompilerEndIf
CompilerIf #PB_Compiler_Unicode
#UNICODE=#BASS_Unicode
CompilerElse
#UNICODE=#0
CompilerEndIf
Global Handle
Global Event
Global FileName.s = ""
Global cav, tracki, info, epos, tbp
Global active.b = #False
#SPECWIDTH = 368
#SPECHEIGHT = 127
#TIME_PERIODIC = 1
#MainWin=0
Global specpos = 0, specmode = 1
Enumeration
#BG_Play
#BG_Pause
#BG_Stop
#BG_Load
#BG_Next
EndEnumeration
Procedure IIF(expr,y,n)
If expr
ProcedureReturn y
Else
ProcedureReturn n
EndIf
EndProcedure
Procedure UpdateSpectrum()
Protected x.l, y.l, y1.l
Protected ind.l, w.l, v.l, p.q, u.q, k.q
Protected Dim FFT.f(1024)
Protected Dim specbuf.l(#SPECWIDTH * (#SPECHEIGHT + 1))
BASS_ChannelGetData(Handle,@FFT(),#BASS_DATA_FFT2048)
StartDrawing(CanvasOutput(cav))
Box(0, 0, #SPECWIDTH, #SPECHEIGHT, RGB(255,255,255))
Select specmode
Case 0
For x = 0 To (#SPECWIDTH/2)-1
y = #SPECHEIGHT - ((Sqr(fft(x + 1)) * 3 * #SPECHEIGHT)-4) ; scale it (sqrt to make low values more visible)
;y = #SPECHEIGHT - (fft(x + 1) * 10 * #SPECHEIGHT) ; scale it (linearly)
If y>#SPECHEIGHT : y=#SPECHEIGHT : EndIf
If x
y1 = (y + y1) / 2
y1 = y1 + 1
While (y1 >= 0 And y1 < #SPECHEIGHT)
ind=y1 * #SPECWIDTH + x * 2 - 1
specbuf(ind) = RGB(255-y1, y1+1, 0)
y1 = y1 + 1
Wend
EndIf
y1 = y
y = y + 1
While (y >= 0 And y < #SPECHEIGHT)
ind=y * #SPECWIDTH + x * 2
specbuf(ind) = RGB(255-y, y+1, 0)
y = y + 1
Wend
Next x
Case 1
Define b0.l, BANDS.i
b0 = 0
BANDS = 21
Define sc.l, b1.l, sum.f
For x = 0 To BANDS
sum = 0
b1 = Pow(2, x * 10.0 / BANDS )
If (b1 > 1023) : b1 = 1023 : EndIf
If (b1 <= b0) : b1 = b0 + 1 : EndIf
sc = 10 + b1 - b0
Repeat
sum = sum + fft(1 + b0)
b0 = b0 + 1
Until b0 >= b1
y = #SPECHEIGHT - ((Sqr(sum / Log10(sc)) * 1.7 * #SPECHEIGHT) - 4)
If y > #SPECHEIGHT : y = #SPECHEIGHT : EndIf
y = y + 1
While (y < #SPECHEIGHT And y >= 0)
For w = 0 To 10
specbuf((y * #SPECWIDTH + x * Int(#SPECWIDTH / BANDS))+w) = RGB(255-y, y+1, 0)
Next
y = y + 1
Wend
Next x
Case 2
Dim buf.f(0)
Define c.l, ci.BASS_CHANNELINFO
BASS_ChannelGetInfo(Handle, @ci)
Dim buf(ci\chans * #SPECWIDTH * 4)
BASS_ChannelGetData(Handle, @buf(0), (ci\chans * #SPECWIDTH * 4) | #BASS_DATA_FLOAT)
For c = 0 To ci\chans - 1
For x = 0 To #SPECWIDTH - 1
v = (1 - buf(x * ci\chans + c)) * #SPECHEIGHT / 2
If (v < 0)
v = 0
ElseIf (v >= #SPECHEIGHT)
v = #SPECHEIGHT - 1
EndIf
If (x = 0) : y = v : EndIf
Repeat
If (y < v)
y = y + 1
ElseIf (y > v)
y = y - 1
EndIf
specbuf(y * #SPECWIDTH + x) = IIF(Bool(c And 1), $FF0000, $0000FF)
Until (y = v)
Next x
Next c
EndSelect
p = 0
For u = 0 To #SPECHEIGHT-1
For k = 0 To #SPECWIDTH-1
If specbuf(p) <> 0
Plot(k, u, specbuf(p))
EndIf
p + 1
Next
Next
StopDrawing()
EndProcedure
Procedure Loadfile()
FileName = OpenFileRequester("","","*.*|*.*",0)
If FileName
Handle=BASS_StreamCreateFile(0, @FileName, 0, 0, #UNICODE)
BASS_SetVolume(100)
BASS_ChannelPlay(Handle,0)
active = #True
EndIf
EndProcedure
Procedure RenderSoundInfo()
Protected fPos, aktSec.d, aktMin.d = 0, eTime.d, aktTime.s, endTime.s, tbPos.d
Protected InfoString.s
If Handle And active
fPos = BASS_ChannelGetPosition(Handle, #BASS_POS_BYTE)
ePos = BASS_ChannelGetLength(Handle, #BASS_POS_BYTE)
aktSec = BASS_ChannelBytes2Seconds(Handle, fPos)
eTime = BASS_ChannelBytes2Seconds(Handle, ePos)
aktMin = Int(aktSec / 60)
aktSec = Int(Mod(aktSec, 60))
If aktSec < 10
aktTime = StrD(aktMin) + ":" + "0" + StrD(aktSec)
Else
aktTime = StrD(aktMin) + ":" + StrD(aktSec)
EndIf
If Int(Mod(eTime, 60)) < 10
endTime = StrD(Int(eTime / 60)) + ":" + "0" + StrD(Int(Mod(eTime, 60)))
Else
endTime = StrD(Int(eTime / 60)) + ":" + StrD(Int(Mod(eTime, 60)))
EndIf
InfoString = "File: " + GetFilePart(FileName)
StartDrawing(CanvasOutput(info))
DrawingMode(#PB_2DDrawing_Transparent)
Box(0, 0, GadgetWidth(info), GadgetHeight(info), RGB(100,100,100))
If TextWidth(InfoString) >= GadgetWidth(info)
InfoString = Left(InfoString, 50) + "..."
EndIf
DrawText(0, 0, InfoString)
DrawText(0, TextHeight("File: " + GetFilePart(FileName))*2, "Position: " + aktTime + " Min / " + endTime + " Min")
StopDrawing()
If fPos > 0
tbPos = 100 / ePos * fPos
SetGadgetState(tracki, tbPos)
EndIf
EndIf
EndProcedure
#T_Update = 1
;- START
If OpenWindow(0,50,50,#SPECWIDTH,#SPECHEIGHT+140,"BASS Spectrum example")
ButtonGadget(#BG_Load,50,#SPECHEIGHT+5,50,25,"Load")
ButtonGadget(#BG_Stop,100,#SPECHEIGHT+5,50,25,"Stop")
ButtonGadget(#BG_Play,150,#SPECHEIGHT+5,50,25,"Play")
ButtonGadget(#BG_Pause,200,#SPECHEIGHT+5,50,25,"Pause")
ButtonGadget(#BG_Next,250,#SPECHEIGHT+5,50,25,"Spectrum")
cav = CanvasGadget(#PB_Any, 0, 0, #SPECWIDTH, #SPECHEIGHT)
tracki = TrackBarGadget(#PB_Any, 10, #SPECHEIGHT + 50, #SPECWIDTH - 20, 10, 0, 100)
info = CanvasGadget(#PB_Any, 10, #SPECHEIGHT + 75, #SPECWIDTH - 20, 60, #PB_Canvas_Border)
SetGadgetColor(info, #PB_Gadget_BackColor, RGB(128,128,128))
AddWindowTimer(#MainWin, #T_Update, 25)
BASS_Init(-1, 44100, 0, WindowID(#MainWin), #Null)
Loadfile()
Repeat
Event=WaitWindowEvent(10)
Select Event
Case #PB_Event_Gadget
Select EventGadget()
Case #BG_Load
BASS_StreamFree(Handle)
Loadfile()
Case #BG_Play
BASS_ChannelPlay(Handle,0)
Case #BG_Pause
BASS_ChannelPause(Handle)
Case #BG_Stop
BASS_ChannelStop(Handle)
BASS_ChannelSetPosition(Handle,0,#BASS_POS_ByTE)
Case #BG_Next
specmode=(specmode+1)%3
Case tracki
If Handle And active
active = #False
epos = BASS_ChannelGetLength(Handle, #BASS_POS_BYTE)
If epos > 0
tbp = epos / 100 * GetGadgetState(tracki)
EndIf
BASS_ChannelPause(Handle)
BASS_ChannelSetPosition(Handle, tbp, #BASS_POS_BYTE)
BASS_ChannelPlay(Handle,0)
active = #True
EndIf
EndSelect
Case #PB_Event_Timer
Select EventTimer()
Case #T_Update
UpdateSpectrum()
RenderSoundInfo()
EndSelect
EndSelect
Until Event=#PB_Event_CloseWindow
EndIf
BASS_Free()
End