FreeBasic
Вы хотите отреагировать на этот пост ? Создайте аккаунт всего в несколько кликов или войдите на форум.

Библиотека BASS - заголовочные файлы + примеры

Участников: 2

Перейти вниз

Библиотека BASS - заголовочные файлы + примеры Empty Библиотека BASS - заголовочные файлы + примеры

Сообщение  electrik Пн Янв 09, 2012 9:54 pm

Недавно вышла новая версия библиотеки BASS 2.4.
при помощи этой библиотеки, можно воспроизводить любые форматы файлов, создавать свои звуковые потоки и т.д.
библиотека поддерживает 3D, eax и т.д.
подробно можете почитать в документации или погуглить.
я предлагаю новые заголовочные файлы + пару примеров адаптированных под FreeBasic.
сборку адаптированную под FreeBasic можно скачать по ссылке:
http://svalka-spb.narod.ru/soft/bass24.zip
создатели сайтов посвященным FreeBasic, могут выкладывать данный материал на своих ресурсах.

код заголовочного файла bass.bi

Код:

/'
   BASS 2.4 FreeBasic header file
   Copyright (c) 1999-2011 Un4seen Developments Ltd.
*** adapted for FreeBasic by  electrik

   See the BASS.CHM file for more detailed documentation
'/

#ifndef __bass_bi__
#define __bass_bi__
#inclib "bass"
#ifdef __FB_WIN32__
# include once "win/wtypes.bi"
#else
type BYTE as ubyte
type WORD as ushort
type DWORD as uinteger
type BOOL as integer
type float as single
# define TRUE 1
# define FALSE 0
#define MAKEWORD(a,b) cushort( cubyte(a) or (cushort(cubyte(b)) shl 8) )
#define MAKELONG(a,b) cint( cushort(a) or (cuint(cushort(b)) shl 16) )
#endif '' __FB_WIN32__


type QWORD as ulongint

#define BASSVERSION         &h204   ' API version
#define BASSVERSIONTEXT      "2.4"


type as DWORD HMUSIC      ' MOD music handle
type as DWORD HSAMPLE      ' sample handle
type as DWORD HCHANNEL      ' playing sample's channel handle
type as DWORD HSTREAM      ' sample stream handle
type as DWORD HRECORD      ' recording handle
type as DWORD HSYNC      ' synchronizer handle
type as DWORD HDSP         ' DSP handle
type as DWORD HFX         ' DX8 effect handle
type as DWORD HPLUGIN      ' Plugin handle

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

' BASS_SetConfig options
#define BASS_CONFIG_BUFFER         0
#define BASS_CONFIG_UPDATEPERIOD   1
#define BASS_CONFIG_GVOL_SAMPLE      4
#define BASS_CONFIG_GVOL_STREAM      5
#define BASS_CONFIG_GVOL_MUSIC      6
#define BASS_CONFIG_CURVE_VOL      7
#define BASS_CONFIG_CURVE_PAN      8
#define BASS_CONFIG_FLOATDSP      9
#define BASS_CONFIG_3DALGORITHM      10
#define BASS_CONFIG_NET_TIMEOUT      11
#define BASS_CONFIG_NET_BUFFER      12
#define BASS_CONFIG_PAUSE_NOPLAY   13
#define BASS_CONFIG_NET_PREBUF      15
#define BASS_CONFIG_NET_PASSIVE      18
#define BASS_CONFIG_REC_BUFFER      19
#define BASS_CONFIG_NET_PLAYLIST   21
#define BASS_CONFIG_MUSIC_VIRTUAL   22
#define BASS_CONFIG_VERIFY         23
#define BASS_CONFIG_UPDATETHREADS   24
#define BASS_CONFIG_DEV_BUFFER      27
#define BASS_CONFIG_IOS_MIXAUDIO   34
#define BASS_CONFIG_DEV_DEFAULT      36
#define BASS_CONFIG_NET_READTIMEOUT   37
#define BASS_CONFIG_IOS_SPEAKER      39

' BASS_SetConfigPtr options
#define BASS_CONFIG_NET_AGENT      16
#define BASS_CONFIG_NET_PROXY      17

' BASS_Init flags
#define BASS_DEVICE_8BITS      1   ' use 8 bit resolution, else 16 bit
#define BASS_DEVICE_MONO      2   ' use mono, else stereo
#define BASS_DEVICE_3D         4   ' enable 3D functionality
#define BASS_DEVICE_LATENCY      256   ' calculate device latency (BASS_INFO struct)
#define BASS_DEVICE_CPSPEAKERS   1024 ' detect speakers via Windows control panel
#define BASS_DEVICE_SPEAKERS   2048 ' force enabling of speaker assignment
#define BASS_DEVICE_NOSPEAKER   4096 ' ignore speaker arrangement
#ifdef __FB_LINUX__
#define BASS_DEVICE_DMIX      8192 ' use ALSA "dmix" plugin
#endif

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

' Device info structure
type BASS_DEVICEINFO
   as const ZString ptr name   ' description
   as const ZString ptr driver   ' driver
as DWORD flags
end type

' BASS_DEVICEINFO flags
#define BASS_DEVICE_ENABLED      1
#define BASS_DEVICE_DEFAULT      2
#define BASS_DEVICE_INIT      4

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

' BASS_INFO flags (from DSOUND.H)
#ifndef __win_dsound_bi__
#define DSCAPS_CONTINUOUSRATE   &h00000010   ' supports all sample rates between min/maxrate
#define DSCAPS_EMULDRIVER      &h00000020   ' device does NOT have hardware DirectSound support
#define DSCAPS_CERTIFIED      &h00000040   ' device driver has been certified by Microsoft
#define DSCAPS_SECONDARYMONO   &h00000100   ' mono
#define DSCAPS_SECONDARYSTEREO   &h00000200   ' stereo
#define DSCAPS_SECONDARY8BIT   &h00000400   ' 8 bit
#define DSCAPS_SECONDARY16BIT   &h00000800   ' 16 bit

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

' Recording device info structure
type BASS_RECORDINFO
as DWORD flags   ' device capabilities (DSCCAPS_xxx flags)
as DWORD formats   ' supported standard formats (WAVE_FORMAT_xxx flags)
as DWORD inputs   ' number of inputs
as BOOL singlein   ' TRUE = only 1 input can be set at a time
as DWORD freq      ' current input rate (Vista/OSX only)
end type

' defines for formats field of BASS_RECORDINFO (from MMSYSTEM.H)
#ifndef WAVE_FORMAT_1M08
#define WAVE_FORMAT_1M08      &h00000001      /' 11.025 kHz, Mono,  8-bit  '/
#define WAVE_FORMAT_1S08      &h00000002      /' 11.025 kHz, Stereo, 8-bit  '/
#define WAVE_FORMAT_1M16      &h00000004      /' 11.025 kHz, Mono,  16-bit '/
#define WAVE_FORMAT_1S16      &h00000008      /' 11.025 kHz, Stereo, 16-bit '/
#define WAVE_FORMAT_2M08      &h00000010      /' 22.05  kHz, Mono,  8-bit  '/
#define WAVE_FORMAT_2S08      &h00000020      /' 22.05  kHz, Stereo, 8-bit  '/
#define WAVE_FORMAT_2M16      &h00000040      /' 22.05  kHz, Mono,  16-bit '/
#define WAVE_FORMAT_2S16      &h00000080      /' 22.05  kHz, Stereo, 16-bit '/
#define WAVE_FORMAT_4M08      &h00000100      /' 44.1  kHz, Mono,  8-bit  '/
#define WAVE_FORMAT_4S08      &h00000200      /' 44.1  kHz, Stereo, 8-bit  '/
#define WAVE_FORMAT_4M16      &h00000400      /' 44.1  kHz, Mono,  16-bit '/
#define WAVE_FORMAT_4S16      &h00000800      /' 44.1  kHz, Stereo, 16-bit '/
#endif

' Sample info structure
type BASS_SAMPLE
as DWORD freq      ' default playback rate
as float volume   ' default volume (0-1)
as float pan      ' default pan (-1=left, 0=middle, 1=right)
as DWORD flags   ' BASS_SAMPLE_xxx flags
as DWORD length   ' length (in bytes)
as DWORD max      ' maximum simultaneous playbacks
as DWORD origres   ' original resolution bits
as DWORD chans   ' number of channels
as DWORD mingap   ' minimum gap (ms) between creating channels
as DWORD mode3d   ' BASS_3DMODE_xxx mode
as float mindist   ' minimum distance
as float maxdist   ' maximum distance
as DWORD iangle   ' angle of inside projection cone
as DWORD oangle   ' angle of outside projection cone
as float outvol   ' delta-volume outside the projection cone
as DWORD vam      ' voice allocation/management flags (BASS_VAM_xxx)
as DWORD priority   ' priority (0=lowest, &hffffffff=highest)
end type

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

#define BASS_STREAM_PRESCAN      &h20000 ' enable pin-point seeking/length (MP3/MP2/MP1)
#define BASS_MP3_SETPOS         BASS_STREAM_PRESCAN
#define BASS_STREAM_AUTOFREE   &h40000   ' automatically free the stream when it stop/ends
#define BASS_STREAM_RESTRATE   &h80000   ' restrict the download rate of internet file streams
#define BASS_STREAM_BLOCK      &h100000 ' download/play internet file stream in small blocks
#define BASS_STREAM_DECODE      &h200000 ' don't play the stream, only decode (BASS_ChannelGetData)
#define BASS_STREAM_STATUS      &h800000 ' give server status info (HTTP/ICY tags) in DOWNLOADPROC

#define BASS_MUSIC_FLOAT      BASS_SAMPLE_FLOAT
#define BASS_MUSIC_MONO         BASS_SAMPLE_MONO
#define BASS_MUSIC_LOOP         BASS_SAMPLE_LOOP
#define BASS_MUSIC_3D         BASS_SAMPLE_3D
#define BASS_MUSIC_FX         BASS_SAMPLE_FX
#define BASS_MUSIC_AUTOFREE      BASS_STREAM_AUTOFREE
#define BASS_MUSIC_DECODE      BASS_STREAM_DECODE
#define BASS_MUSIC_PRESCAN      BASS_STREAM_PRESCAN   ' calculate playback length
#define BASS_MUSIC_CALCLEN      BASS_MUSIC_PRESCAN
#define BASS_MUSIC_RAMP         &h200   ' normal ramping
#define BASS_MUSIC_RAMPS      &h400   ' sensitive ramping
#define BASS_MUSIC_SURROUND      &h800   ' surround sound
#define BASS_MUSIC_SURROUND2   &h1000   ' surround sound (mode 2)
#define BASS_MUSIC_FT2MOD      &h2000   ' play .MOD as FastTracker 2 does
#define BASS_MUSIC_PT1MOD      &h4000   ' play .MOD as ProTracker 1 does
#define BASS_MUSIC_NONINTER      &h10000   ' non-interpolated sample mixing
#define BASS_MUSIC_SINCINTER   &h800000 ' sinc interpolated sample mixing
#define BASS_MUSIC_POSRESET      &h8000   ' stop all notes when moving position
#define BASS_MUSIC_POSRESETEX   &h400000 ' stop all notes and reset bmp/etc when moving position
#define BASS_MUSIC_STOPBACK      &h80000   ' stop the music on a backwards jump effect
#define BASS_MUSIC_NOSAMPLE      &h100000 ' don't load the samples

' Speaker assignment flags
#define BASS_SPEAKER_FRONT   &h1000000   ' front speakers
#define BASS_SPEAKER_REAR   &h2000000   ' rear/side speakers
#define BASS_SPEAKER_CENLFE   &h3000000   ' center & LFE speakers (5.1)
#define BASS_SPEAKER_REAR2   &h4000000   ' rear center speakers (7.1)
#define BASS_SPEAKER_N(n)   ((n) shl 24)   ' 'n'th pair of speakers (max 15)
#define BASS_SPEAKER_LEFT   &h10000000   ' modifier: left
#define BASS_SPEAKER_RIGHT   &h20000000   ' modifier: right
#define BASS_SPEAKER_FRONTLEFT   BASS_SPEAKER_FRONT or BASS_SPEAKER_LEFT
#define BASS_SPEAKER_FRONTRIGHT   BASS_SPEAKER_FRONT or BASS_SPEAKER_RIGHT
#define BASS_SPEAKER_REARLEFT   BASS_SPEAKER_REAR or BASS_SPEAKER_LEFT
#define BASS_SPEAKER_REARRIGHT   BASS_SPEAKER_REAR or BASS_SPEAKER_RIGHT
#define BASS_SPEAKER_CENTER      BASS_SPEAKER_CENLFE or BASS_SPEAKER_LEFT
#define BASS_SPEAKER_LFE      BASS_SPEAKER_CENLFE or BASS_SPEAKER_RIGHT
#define BASS_SPEAKER_REAR2LEFT   BASS_SPEAKER_REAR2 or BASS_SPEAKER_LEFT
#define BASS_SPEAKER_REAR2RIGHT   BASS_SPEAKER_REAR2 or BASS_SPEAKER_RIGHT

#define BASS_UNICODE         &h80000000

#define BASS_RECORD_PAUSE      &h8000   ' start recording paused

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

' Channel info structure
type BASS_CHANNELINFO
as DWORD freq      ' default playback rate
as DWORD chans   ' channels
as DWORD flags   ' BASS_SAMPLE/STREAM/MUSIC/SPEAKER flags
as DWORD ctype   ' type of channel
as DWORD origres   ' original resolution
as HPLUGIN plugin   ' plugin
as HSAMPLE sample ' sample
as const ZString ptr filename ' filename
end type

' BASS_CHANNELINFO types
#define BASS_CTYPE_SAMPLE      1
#define BASS_CTYPE_RECORD      2
#define BASS_CTYPE_STREAM      &h10000
#define BASS_CTYPE_STREAM_OGG   &h10002
#define BASS_CTYPE_STREAM_MP1   &h10003
#define BASS_CTYPE_STREAM_MP2   &h10004
#define BASS_CTYPE_STREAM_MP3   &h10005
#define BASS_CTYPE_STREAM_AIFF   &h10006
#define BASS_CTYPE_STREAM_CA   &h10007
#define BASS_CTYPE_STREAM_MF   &h10008
#define BASS_CTYPE_STREAM_WAV   &h40000 ' WAVE flag, LOWORD=codec
#define BASS_CTYPE_STREAM_WAV_PCM   &h50001
#define BASS_CTYPE_STREAM_WAV_FLOAT   &h50003
#define BASS_CTYPE_MUSIC_MOD   &h20000
#define BASS_CTYPE_MUSIC_MTM   &h20001
#define BASS_CTYPE_MUSIC_S3M   &h20002
#define BASS_CTYPE_MUSIC_XM      &h20003
#define BASS_CTYPE_MUSIC_IT      &h20004
#define BASS_CTYPE_MUSIC_MO3   &h00100 ' MO3 flag

type BASS_PLUGINFORM
as DWORD ctype      ' channel type
as const ZString ptr name   ' format description
as const ZString ptr exts   ' file extension filter (*.ext1*.ext2etc...)
end type

type BASS_PLUGININFO
as DWORD version               ' version (same form as BASS_GetVersion)
as DWORD formatc               ' number of formats
as const BASS_PLUGINFORM ptr formats   ' the array of formats
end type

' 3D vector (for 3D positions/velocities/orientations)
type BASS_3DVECTOR
as float x   ' +=right, -=left
as float y   ' +=up, -=down
as float z   ' +=front, -=behind
end type

' 3D channel modes
#define BASS_3DMODE_NORMAL      0   ' normal 3D processing
#define BASS_3DMODE_RELATIVE   1   ' position is relative to the listener
#define BASS_3DMODE_OFF         2   ' no 3D processing

' software 3D mixing algorithms (used with BASS_CONFIG_3DALGORITHM)
#define BASS_3DALG_DEFAULT   0
#define BASS_3DALG_OFF      1
#define BASS_3DALG_FULL      2
#define BASS_3DALG_LIGHT   3

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

    EAX_ENVIRONMENT_COUNT         ' total number of environments
end enum

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

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

#define BASS_STREAMPROC_END      &h80000000   ' end of user stream flag

' special STREAMPROCs
#define STREAMPROC_DUMMY      0      ' "dummy" stream
#define STREAMPROC_PUSH         -1      ' push stream

' BASS_StreamCreateFileUser file systems
#define STREAMFILE_NOBUFFER      0
#define STREAMFILE_BUFFER      1
#define STREAMFILE_BUFFERPUSH   2

' User file stream callback functions
type  FILECLOSEPROC as sub (byval user as any ptr)
type FILELENPROC as function (byval user as any ptr) as QWORD
type FILEREADPROC as function (byval buffer as any ptr, length as DWORD, byval user as any ptr) as DWORD
type FILESEEKPROC as function (byval offset as QWORD , byval user as any ptr) as BOOL

type BASS_FILEPROCS
   as FILECLOSEPROC ptr close
   as FILELENPROC ptr length
   as FILEREADPROC ptr read
   as FILESEEKPROC ptr seek
end type

' BASS_StreamPutFileData options
#define BASS_FILEDATA_END      0   ' end & close the file

' BASS_StreamGetFilePosition modes
#define BASS_FILEPOS_CURRENT   0
#define BASS_FILEPOS_DECODE      BASS_FILEPOS_CURRENT
#define BASS_FILEPOS_DOWNLOAD   1
#define BASS_FILEPOS_END      2
#define BASS_FILEPOS_START      3
#define BASS_FILEPOS_CONNECTED   4
#define BASS_FILEPOS_BUFFER      5
#define BASS_FILEPOS_SOCKET      6

type DOWNLOADPROC as sub (byval buffer as const any ptr, byval length as DWORD, byval user as any ptr)
/' 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
#define BASS_SYNC_POS         0
#define BASS_SYNC_END         2
#define BASS_SYNC_META         4
#define BASS_SYNC_SLIDE         5
#define BASS_SYNC_STALL         6
#define BASS_SYNC_DOWNLOAD      7
#define BASS_SYNC_FREE         8
#define BASS_SYNC_SETPOS      11
#define BASS_SYNC_MUSICPOS      10
#define BASS_SYNC_MUSICINST      1
#define BASS_SYNC_MUSICFX      3
#define BASS_SYNC_OGG_CHANGE   12
#define BASS_SYNC_MIXTIME      &h40000000   ' FLAG: sync at mixtime, else at playtime
#define BASS_SYNC_ONETIME      &h80000000   ' FLAG: sync only once, else continuously

type SYNCPROC as sub (byval HSYNC  as handle, byval channel as DWORD , byval data as DWORD, byval user as any ptr)
/' 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 '/

type DSPPROC as sub(byval handle as HDSP, byval channel as DWORD, byval buffer as any ptr, byval length as DWORD, byval user as any ptr)
/' 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 '/

type RECORDPROC as function (byval handle as HRECORD, byval buffer as const any ptr, byval length as DWORD, byval user as any ptr) as BOOL
/' 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
#define BASS_ACTIVE_STOPPED   0
#define BASS_ACTIVE_PLAYING   1
#define BASS_ACTIVE_STALLED   2
#define BASS_ACTIVE_PAUSED   3

' Channel attributes
#define BASS_ATTRIB_FREQ         1
#define BASS_ATTRIB_VOL            2
#define BASS_ATTRIB_PAN            3
#define BASS_ATTRIB_EAXMIX         4
#define BASS_ATTRIB_NOBUFFER      5
#define BASS_ATTRIB_CPU            7
#define BASS_ATTRIB_MUSIC_AMPLIFY   &h100
#define BASS_ATTRIB_MUSIC_PANSEP   &h101
#define BASS_ATTRIB_MUSIC_PSCALER   &h102
#define BASS_ATTRIB_MUSIC_BPM      &h103
#define BASS_ATTRIB_MUSIC_SPEED      &h104
#define BASS_ATTRIB_MUSIC_VOL_GLOBAL &h105
#define BASS_ATTRIB_MUSIC_VOL_CHAN   &h200 ' + channel #
#define BASS_ATTRIB_MUSIC_VOL_INST   &h300 ' + instrument #

' BASS_ChannelGetData flags
#define BASS_DATA_AVAILABLE   0         ' query how much data is buffered
#define BASS_DATA_FLOAT      &h40000000   ' flag: return floating-point sample data
#define BASS_DATA_FFT256   &h80000000   ' 256 sample FFT
#define BASS_DATA_FFT512   &h80000001   ' 512 FFT
#define BASS_DATA_FFT1024   &h80000002   ' 1024 FFT
#define BASS_DATA_FFT2048   &h80000003   ' 2048 FFT
#define BASS_DATA_FFT4096   &h80000004   ' 4096 FFT
#define BASS_DATA_FFT8192   &h80000005   ' 8192 FFT
#define BASS_DATA_FFT16384   &h80000006   ' 16384 FFT
#define BASS_DATA_FFT_INDIVIDUAL &h10   ' FFT flag: FFT for each channel, else all combined
#define BASS_DATA_FFT_NOWINDOW   &h20   ' FFT flag: no Hanning window
#define BASS_DATA_FFT_REMOVEDC   &h40   ' FFT flag: pre-remove DC bias

' BASS_ChannelGetTags types : what's returned
#define BASS_TAG_ID3      0   ' ID3v1 tags : TAG_ID3 structure
#define BASS_TAG_ID3V2      1   ' ID3v2 tags : variable length block
#define BASS_TAG_OGG      2   ' OGG comments : series of null-terminated UTF-8 strings
#define BASS_TAG_HTTP      3   ' HTTP headers : series of null-terminated ANSI strings
#define BASS_TAG_ICY      4   ' ICY headers : series of null-terminated ANSI strings
#define BASS_TAG_META      5   ' ICY metadata : ANSI string
#define BASS_TAG_APE      6   ' APE tags : series of null-terminated UTF-8 strings
#define BASS_TAG_MP4       7   ' MP4/iTunes metadata : series of null-terminated UTF-8 strings
#define BASS_TAG_VENDOR      9   ' OGG encoder : UTF-8 string
#define BASS_TAG_LYRICS3   10   ' Lyric3v2 tag : ASCII string
#define BASS_TAG_CA_CODEC   11   ' CoreAudio codec info : TAG_CA_CODEC structure
#define BASS_TAG_MF         13   ' Media Foundation tags : series of null-terminated UTF-8 strings
#define BASS_TAG_WAVEFORMAT   14   ' WAVE format : WAVEFORMATEEX structure
#define BASS_TAG_RIFF_INFO   &h100 ' RIFF "INFO" tags : series of null-terminated ANSI strings
#define BASS_TAG_RIFF_BEXT   &h101 ' RIFF/BWF "bext" tags : TAG_BEXT structure
#define BASS_TAG_RIFF_CART   &h102 ' RIFF/BWF "cart" tags : TAG_CART structure
#define BASS_TAG_RIFF_DISP   &h103 ' RIFF "DISP" text tag : ANSI string
#define BASS_TAG_APE_BINARY   &h1000   ' + index #, binary APE tag : TAG_APE_BINARY structure
#define BASS_TAG_MUSIC_NAME      &h10000   ' MOD music name : ANSI string
#define BASS_TAG_MUSIC_MESSAGE   &h10001   ' MOD message : ANSI string
#define BASS_TAG_MUSIC_ORDERS   &h10002   ' MOD order list : BYTE array of pattern numbers
#define BASS_TAG_MUSIC_INST      &h10100   ' + instrument #, MOD instrument name : ANSI string
#define BASS_TAG_MUSIC_SAMPLE   &h10300   ' + sample #, MOD sample name : ANSI string

' ID3v1 tag structure
type TAG_ID3
   as zstring * 3 id
   as zstring * 30 title
   as zstring * 30 artist
   as zstring * 30 album
   as zstring * 4 year
   as zstring * 30 comment
   as BYTE genre
end type

' Binary APE tag structure
type TAG_APE_BINARY
as    const zstring ptr key
   as const any ptr data
   as DWORD length
end type

' BWF "bext" tag structure
type TAG_BEXT
   as zstring * 256 Description         ' description
   as zstring * 32 Originator         ' name of the originator
   as zstring * 32 OriginatorReference   ' reference of the originator
   as zstring * 10 OriginationDate      ' date of creation (yyyy-mm-dd)
   as zstring * 8 OriginationTime      ' time of creation (hh-mm-ss)
   as QWORD TimeReference         ' first sample count since midnight (little-endian)
   as WORD Version               ' BWF version (little-endian)
   as BYTE UMID(64-1)               ' SMPTE UMID
   as BYTE Reserved(190-1)
   as zstring * 1 CodingHistory         ' history
end type

' BWF "cart" tag structures
type TAG_CART_TIMER
   as DWORD dwUsage               ' FOURCC timer usage ID
   as DWORD dwValue               ' timer value in samples from head
end type

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

' CoreAudio codec info structure
type TAG_CA_CODEC
   as DWORD ftype               ' file format
   as DWORD atype               ' audio format
   as const zstring ptr name            ' description
end type

' BASS_ChannelGetLength/GetPosition/SetPosition modes
#define BASS_POS_BYTE         0      ' byte position
#define BASS_POS_MUSIC_ORDER   1      ' order.row position, MAKELONG(order,row)
#define BASS_POS_DECODE         &h10000000 ' flag: get the decoding (not playing) position
#define BASS_POS_DECODETO      &h20000000 ' flag: decode to the position instead of seeking

' BASS_RecordSetInput flags
#define BASS_INPUT_OFF      &h10000
#define BASS_INPUT_ON      &h20000

#define BASS_INPUT_TYPE_MASK      &hff000000
#define BASS_INPUT_TYPE_UNDEF      &h00000000
#define BASS_INPUT_TYPE_DIGITAL      &h01000000
#define BASS_INPUT_TYPE_LINE      &h02000000
#define BASS_INPUT_TYPE_MIC         &h03000000
#define BASS_INPUT_TYPE_SYNTH      &h04000000
#define BASS_INPUT_TYPE_CD         &h05000000
#define BASS_INPUT_TYPE_PHONE      &h06000000
#define BASS_INPUT_TYPE_SPEAKER      &h07000000
#define BASS_INPUT_TYPE_WAVE      &h08000000
#define BASS_INPUT_TYPE_AUX         &h09000000
#define BASS_INPUT_TYPE_ANALOG      &h0a000000

' DX8 effect types, use with BASS_ChannelSetFX
enum
   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
end enum

type BASS_DX8_CHORUS
 as  float      fWetDryMix
 as    float      fDepth
 as    float      fFeedback
 as    float      fFrequency
 as    DWORD      lWaveform   ' 0=triangle, 1=sine
 as    float      fDelay
 as    DWORD      lPhase      ' BASS_DX8_PHASE_xxx
end type

type BASS_DX8_COMPRESSOR
as    float  fGain
as    float  fAttack
as    float  fRelease
as    float  fThreshold
as    float  fRatio
as    float  fPredelay
end type

type BASS_DX8_DISTORTION
as    float  fGain
as    float  fEdge
as    float  fPostEQCenterFrequency
as    float  fPostEQBandwidth
as    float  fPreLowpassCutoff
end type

type BASS_DX8_ECHO
as    float  fWetDryMix
as    float  fFeedback
as    float  fLeftDelay
as    float  fRightDelay
as    BOOL    lPanDelay
end type

type BASS_DX8_FLANGER
as    float      fWetDryMix
as    float      fDepth
as    float      fFeedback
as    float      fFrequency
as    DWORD      lWaveform   ' 0=triangle, 1=sine
as    float      fDelay
as    DWORD      lPhase      ' BASS_DX8_PHASE_xxx
end type

type BASS_DX8_GARGLE
as    DWORD      dwRateHz              ' Rate of modulation in hz
as    DWORD      dwWaveShape            ' 0=triangle, 1=square
end type

type BASS_DX8_I3DL2REVERB
as    integer    lRoom                  ' [-10000, 0]      default: -1000 mB
as    integer    lRoomHF                ' [-10000, 0]      default: 0 mB
as    float  flRoomRolloffFactor    ' [0.0, 10.0]      default: 0.0
as    float  flDecayTime            ' [0.1, 20.0]      default: 1.49s
as    float  flDecayHFRatio        ' [0.1, 2.0]      default: 0.83
as    integer    lReflections          ' [-10000, 1000]  default: -2602 mB
as    float  flReflectionsDelay    ' [0.0, 0.3]      default: 0.007 s
as    integer    lReverb                ' [-10000, 2000]  default: 200 mB
as    float  flReverbDelay          ' [0.0, 0.1]      default: 0.011 s
as    float  flDiffusion            ' [0.0, 100.0]    default: 100.0 %
as    float  flDensity              ' [0.0, 100.0]    default: 100.0 %
as    float  flHFReference          ' [20.0, 20000.0]  default: 5000.0 Hz
end type

type BASS_DX8_PARAMEQ
as    float  fCenter
as    float  fBandwidth
as    float  fGain
end type

type BASS_DX8_REVERB
as    float  fInGain                ' [-96.0,0.0]            default: 0.0 dB
as    float  fReverbMix            ' [-96.0,0.0]            default: 0.0 db
as    float  fReverbTime            ' [0.001,3000.0]        default: 1000.0 ms
as    float  fHighFreqRTRatio      ' [0.001,0.999]          default: 0.001
end type

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


declare function BASS_SetConfig alias "BASS_SetConfig"(byval option as DWORD, byval value as DWORD ) as BOOL
declare function BASS_GetConfig alias "BASS_GetConfig"(byval option as DWORD ) as DWORD
declare function BASS_SetConfigPtr alias "BASS_SetConfigPtr"(byval option as DWORD, byval value as any ptr) as BOOL
declare function BASS_GetConfigPtr alias "BASS_GetConfigPtr"(byval option as DWORD) as any ptr
declare function BASS_GetVersion alias "BASS_GetVersion"() as DWORD
declare function BASS_ErrorGetCode alias "BASS_ErrorGetCode"() as integer
declare function BASS_GetDeviceInfo alias "BASS_GetDeviceInfo"(byval device as DWORD, byval info as BASS_DEVICEINFO ptr) as BOOL 
#ifdef __FB_WIN32__
declare function BASS_Init alias "BASS_Init"(byval device as integer, byval freq as DWORD, byval flags as DWORD, byval win as HWND, byval dsguid as const GUID ptr) as BOOL
#else
declare function BASS_Init alias "BASS_Init"(byval device as integer, byval freq as DWORD , byval flags as DWORD , byval win as any ptr, byval dsguid as any ptr) as BOOL
#endif
declare function BASS_SetDevice alias "BASS_SetDevice"(byval device as DWORD) as BOOL
declare function BASS_GetDevice alias "BASS_GetDevice"() as DWORD
declare function BASS_Free alias "BASS_Free"() as BOOL
#ifdef __FB_WIN32__
declare function BASS_GetDSoundObject alias "BASS_GetDSoundObject"(byval object as DWORD) as any ptr
#endif
declare function BASS_GetInfo alias "BASS_GetInfo"(byval info as BASS_INFO  ptr) as BOOL
declare function BASS_Update alias "BASS_Update"(byval length as DWORD) as BOOL
declare function BASS_GetCPU alias "BASS_GetCPU"() as float
declare function BASS_Start alias "BASS_Start"() as BOOL
declare function BASS_Stop alias "BASS_Stop"() as BOOL
declare function BASS_Pause alias "BASS_Pause"() as BOOL
declare function BASS_SetVolume alias "BASS_SetVolume"(byval volume as float ) as BOOL
declare function BASS_GetVolume alias "BASS_GetVolume"() as float

declare function BASS_PluginLoad alias "BASS_PluginLoad"(byval file as const any ptr, byval flags as DWORD) as HPLUGIN
declare function BASS_PluginFree alias "BASS_PluginFree"(byval handle as HPLUGIN) as BOOL
declare function BASS_PluginGetInfo alias "BASS_PluginGetInfo"(byval handle as HPLUGIN) as const BASS_PLUGININFO ptr

declare function BASS_Set3DFactors alias "BASS_Set3DFactors"(byval distf as FLOAT, byval rollf as float, byval doppf as float ) as BOOL
declare function BASS_Get3DFactors alias "BASS_Get3DFactors"(byval distf as float ptr, byval rollf as float ptr, byval doppf as float ptr) as BOOL
declare function BASS_Set3DPosition alias "BASS_Set3DPosition"(byval pos as const BASS_3DVECTOR ptr, byval vel as const BASS_3DVECTOR ptr, byval front as const BASS_3DVECTOR ptr, byval top as const BASS_3DVECTOR ptr) as BOOL
declare function BASS_Get3DPosition alias "BASS_Get3DPosition"(byval pos as BASS_3DVECTOR ptr, byval vel as BASS_3DVECTOR ptr, byval front as BASS_3DVECTOR ptr, byval top as BASS_3DVECTOR ptr) as BOOL
declare sub  BASS_Apply3D alias "BASS_Apply3D"()
#ifdef __FB_WIN32__
declare function BASS_SetEAXParameters alias "BASS_SetEAXParameters"(byval env as integer, byval vol as float, byval decay as float, byval damp as float) as BOOL
declare function BASS_GetEAXParameters alias "BASS_GetEAXParameters"(byval env as DWORD ptr, byval vol as float ptr, byval decay as float ptr, byval damp as float ptr) as BOOL
#endif

declare function BASS_MusicLoad alias "BASS_MusicLoad"(byval mem as BOOL, byval file as const any ptr, byval offset as QWORD, byval length as DWORD, byval flags as DWORD, byval freq as DWORD) as HMUSIC
declare function BASS_MusicFree alias "BASS_MusicFree"(byval handle as HMUSIC) as BOOL

declare function BASS_SampleLoad alias "BASS_SampleLoad"(byval mem as BOOL, byval file as const any ptr, byval offset as QWORD, byval length as DWORD, byval max as DWORD , byval flags as DWORD) as HSAMPLE
declare function BASS_SampleCreate alias "BASS_SampleCreate"(byval length as DWORD, byval freq as DWORD, byval chans as DWORD , byval max as DWORD, byval flags as DWORD) as HSAMPLE
declare function BASS_SampleFree alias "BASS_SampleFree"(byval handle as HSAMPLE) as BOOL
declare function BASS_SampleSetData alias "BASS_SampleSetData"(byval handle as HSAMPLE , byval buffer as const any ptr) as BOOL
declare function BASS_SampleGetData alias "BASS_SampleGetData"(byval handle as HSAMPLE, byval buffer as any ptr) as BOOL
declare function BASS_SampleGetInfo alias "BASS_SampleGetInfo"(byval handle as HSAMPLE, byval info as BASS_SAMPLE ptr) as BOOL
declare function BASS_SampleSetInfo alias "BASS_SampleSetInfo"(byval handle as HSAMPLE, byval info as const BASS_SAMPLE ptr) as BOOL
declare function BASS_SampleGetChannel alias "BASS_SampleGetChannel"(byval handle as HSAMPLE, byval onlynew as BOOL) as HCHANNEL
declare function BASS_SampleGetChannels alias "BASS_SampleGetChannels"(byval handle as HSAMPLE, byval channels as HCHANNEL ptr) as DWORD
declare function BASS_SampleStop alias "BASS_SampleStop"(byval handle as HSAMPLE) as BOOL

declare function BASS_StreamCreate alias "BASS_StreamCreate"(byval freq as DWORD, byval chans as DWORD, byval flags as DWORD , byval proc as STREAMPROC ptr, byval user as any ptr) as HSTREAM
declare function BASS_StreamCreateFile alias "BASS_StreamCreateFile"(byval mem as BOOL , byval file as any ptr, byval offset as QWORD, byval length as QWORD, byval flags as DWORD ) as HSTREAM
declare function BASS_StreamCreateURL alias "BASS_StreamCreateURL"(byval url as zstring ptr, byval offset as DWORD, byval flags as DWORD, byval proc as DOWNLOADPROC ptr, byval user as any ptr) as HSTREAM
declare function BASS_StreamCreateFileUser alias "BASS_StreamCreateFileUser"(byval system as DWORD, byval flags as DWORD, byval proc as const BASS_FILEPROCS ptr, byval user as any ptr) as HSTREAM
declare function BASS_StreamFree alias "BASS_StreamFree"(byval handle as HSTREAM) as BOOL

declare function BASS_StreamGetFilePosition alias "BASS_StreamGetFilePosition"(byval handle as HSTREAM, byval mode as DWORD) as QWORD
declare function BASS_StreamPutData alias "BASS_StreamPutData"(byval handle as HSTREAM, byval buffer as any ptr, byval length as DWORD) as DWORD
declare function BASS_StreamPutFileData alias "BASS_StreamPutFileData"(byval handle as HSTREAM, byval buffer as const any ptr, byval length as DWORD) as DWORD

declare function BASS_RecordGetDeviceInfo alias "BASS_RecordGetDeviceInfo"(byval device as DWORD , byval info as BASS_DEVICEINFO ptr) as BOOL
declare function BASS_RecordInit alias "BASS_RecordInit"(byval device as integer) as BOOL
declare function BASS_RecordSetDevice alias "BASS_RecordSetDevice"(byval device as DWORD) as BOOL
declare function BASS_RecordGetDevice alias "BASS_RecordGetDevice"() as DWORD
declare function BASS_RecordFree alias "BASS_RecordFree"() as BOOL
declare function BASS_RecordGetInfo alias "BASS_RecordGetInfo"(byval info as BASS_RECORDINFO ptr) as BOOL
declare function BASS_RecordGetInputName alias "BASS_RecordGetInputName"(byval input as integer) as zstring ptr
declare function BASS_RecordSetInput alias "BASS_RecordSetInput"(byval input as integer, byval flags as DWORD, byval volume as float) as BOOL
declare function BASS_RecordGetInput alias "BASS_RecordGetInput"(byval input as integer, byval volume as float ptr) as DWORD
declare function BASS_RecordStart alias "BASS_RecordStart"(byval freq as DWORD, byval chans as DWORD, byval flags as DWORD, byval proc as RECORDPROC ptr, byval user as any ptr) as HRECORD

declare function BASS_ChannelBytes2Seconds alias "BASS_ChannelBytes2Seconds"(byval handle as DWORD , byval pos as QWORD) as double
declare function BASS_ChannelSeconds2Bytes alias "BASS_ChannelSeconds2Bytes"(byval handle as DWORD, byval pos as double) as QWORD
declare function BASS_ChannelGetDevice alias "BASS_ChannelGetDevice"(byval handle as DWORD) as DWORD
declare function BASS_ChannelSetDevice alias "BASS_ChannelSetDevice"(byval handle as DWORD, byval device as DWORD) as BOOL
declare function BASS_ChannelIsActive alias "BASS_ChannelIsActive"(byval handle as DWORD) as DWORD
declare function BASS_ChannelGetInfo alias "BASS_ChannelGetInfo"(byval handle as DWORD, byval info as BASS_CHANNELINFO ptr) as BOOL
declare function BASS_ChannelGetTags alias "BASS_ChannelGetTags"(byval handle as DWORD, byval tags as DWORD) as zstring ptr
declare function BASS_ChannelFlags alias "BASS_ChannelFlags"(byval handle as DWORD, byval flags as DWORD, byval mask as DWORD) as DWORD
declare function BASS_ChannelUpdate alias "BASS_ChannelUpdate"(byval handle as DWORD, byval length as DWORD) as BOOL
declare function BASS_ChannelLock alias "BASS_ChannelLock"(byval handle as DWORD, byval lock as BOOL) as BOOL
declare function BASS_ChannelPlay alias "BASS_ChannelPlay"(byval handle as DWORD, byval restart as BOOL) as BOOL
declare function BASS_ChannelStop alias "BASS_ChannelStop"(byval handle as DWORD) as BOOL
declare function BASS_ChannelPause alias "BASS_ChannelPause"(byval handle as DWORD) as BOOL
declare function BASS_ChannelSetAttribute alias "BASS_ChannelSetAttribute"(byval handle as DWORD, byval attrib as DWORD, byval value as float) as BOOL
declare function BASS_ChannelGetAttribute alias "BASS_ChannelGetAttribute"(byval handle as DWORD, byval attrib as DWORD, byval value as float ptr) as BOOL
declare function BASS_ChannelSlideAttribute alias "BASS_ChannelSlideAttribute"(byval handle as DWORD, byval attrib as DWORD, byval value as float, byval time as DWORD) as BOOL
declare function BASS_ChannelIsSliding alias "BASS_ChannelIsSliding"(byval handle as DWORD, byval attrib as DWORD) as BOOL
declare function BASS_ChannelSet3DAttributes alias "BASS_ChannelSet3DAttributes"(byval handle as DWORD, byval mode as integer, byval min as float, byval max as float, byval iangle as integer, byval oangle as integer, byval outvol as float) as BOOL
declare function BASS_ChannelGet3DAttributes alias "BASS_ChannelGet3DAttributes"(byval handle as DWORD, byval mode as DWORD ptr, byval min as float ptr, byval max as float ptr, byval iangle as DWORD ptr, byval oangle as DWORD ptr, byval outvol as float ptr) as BOOL
declare function BASS_ChannelSet3DPosition alias "BASS_ChannelSet3DPosition"(byval handle as DWORD, byval pos as const BASS_3DVECTOR ptr, byval orient as const BASS_3DVECTOR ptr, byval vel as const BASS_3DVECTOR ptr) as BOOL
declare function BASS_ChannelGet3DPosition alias "BASS_ChannelGet3DPosition"(byval handle as DWORD, byval pos as BASS_3DVECTOR ptr, byval orient as BASS_3DVECTOR ptr, byval vel as BASS_3DVECTOR ptr) as BOOL
declare function BASS_ChannelGetLength alias "BASS_ChannelGetLength"(byval handle as DWORD, byval mode as DWORD) as QWORD
declare function BASS_ChannelSetPosition alias "BASS_ChannelSetPosition"(byval handle as DWORD, byval pos as QWORD, byval mode as DWORD) as BOOL
declare function BASS_ChannelGetPosition alias "BASS_ChannelGetPosition"(byval handle as DWORD, byval mode as DWORD) as QWORD
declare function BASS_ChannelGetLevel alias "BASS_ChannelGetLevel"(byval handle as DWORD) as DWORD
declare function BASS_ChannelGetData alias "BASS_ChannelGetData"(byval handle as DWORD, byval buffer as any ptr, byval length as DWORD) as DWORD
declare function BASS_ChannelSetSync alias "BASS_ChannelSetSync"(byval handle as DWORD, byval type as DWORD, byval param as QWORD, byval proc as SYNCPROC ptr, byval user as any ptr) as HSYNC
declare function BASS_ChannelRemoveSync alias "BASS_ChannelRemoveSync"(byval handle as DWORD, byval sync as HSYNC) as BOOL
declare function BASS_ChannelSetDSP alias "BASS_ChannelSetDSP"(byval handle as DWORD, byval proc as DSPPROC ptr, byval user as any ptr, byval priority as integer) as HDSP
declare function BASS_ChannelRemoveDSP alias "BASS_ChannelRemoveDSP"(byval handle as DWORD, byval dsp as HDSP) as BOOL
declare function BASS_ChannelSetLink alias "BASS_ChannelSetLink"(byval handle as DWORD , byval chan as DWORD) as BOOL
declare function BASS_ChannelRemoveLink alias "BASS_ChannelRemoveLink"(byval handle as DWORD, byval chan as DWORD) as BOOL
declare function BASS_ChannelSetFX alias "BASS_ChannelSetFX"(byval handle as DWORD, byval type as DWORD, byval priority as integer) as HFX
declare function BASS_ChannelRemoveFX alias "BASS_ChannelRemoveFX"(byval handle as DWORD, byval fx as HFX) as BOOL

declare function BASS_FXSetParameters alias "BASS_FXSetParameters"(byval handle as HFX, byval params as const any ptr) as BOOL
declare function BASS_FXGetParameters alias "BASS_FXGetParameters"(byval handle as HFX, byval params as any ptr) as BOOL
declare function BASS_FXReset alias "BASS_FXReset"(byval handle as HFX) as BOOL

#endif


Последний раз редактировалось: electrik (Ср Янв 11, 2012 10:29 pm), всего редактировалось 2 раз(а)

electrik

Сообщения : 391
Дата регистрации : 2008-09-02
Возраст : 43
Откуда : галактика Млечный путь, система Солнечная, планета Земля, страна россия, город Санкт Петербург

Вернуться к началу Перейти вниз

Библиотека BASS - заголовочные файлы + примеры Empty Re: Библиотека BASS - заголовочные файлы + примеры

Сообщение  electrik Пн Янв 09, 2012 10:02 pm

эта программа демонстрирует работу с 3D звуком при помощи библиотеки BASS.
программа открывает не только wav файлы, но и трекерные модули.
загружаем один из типов файлов, wav/aif/mo3/xm/mod/s3m/it/mtm/umx и тестим.

файл 3dtest.bas
Код:

/'
   BASS 3D test
   Copyright (c) 1999-2008 Un4seen Developments Ltd.
*** adapted for FreeBasic by electrik
'/

#include "windows.bi"
#include "win/commctrl.bi"
#include "win/commdlg.bi"
#include "crt.bi"
#include "bass.bi"

dim shared as HWND win=NULL

' channel (sample/music) info structure
type Channel
as    DWORD channel         ' the channel
as    BASS_3DVECTOR pos,vel   ' position,velocity
end type

dim shared as Channel ptr chans=NULL      ' the channels
dim shared as integer chanc=0,chan=-1      ' number of channels, current channel

#define TIMERPERIOD   50      ' timer period (ms)
#define MAXDIST      50      ' maximum distance of the channels (m)
#define SPEED      12      ' speed of the channels' movement (m/s)

' Display error dialogs
sub mError(byval es as const zstring ptr)
   dim as zstring * 200 mes
   wsprintf(mes,"%s\n(error code: %d)",es,BASS_ErrorGetCode())
   MessageBox(win,mes,0,0)
end sub

' Messaging macros
#define ITEM(id) GetDlgItem(win,id)
#define MESS(id,m,w,l) SendDlgItemMessage(win,id,m,cast(WPARAM,w),cast(LPARAM,l))
#define LM(m,w,l) MESS(10,m,w,l)
#define EM(m,w,l) MESS(22,m,w,l)

sub Update(byval win as HWND, byval m as UINT, byval i as UINT, byval t as DWORD)
dim as    HDC dc = any
dim as    RECT r = any
dim as integer c,x,y,cx,cy = any
dim as    HBRUSH red=CreateSolidBrush(&hff)
   win=ITEM(30)
   dc=GetDC(win)
   GetClientRect(win,@r)
   cx=r.right/2
   cy=r.bottom/2

   ' clear the display
   FillRect(dc,@r,GetStockObject(WHITE_BRUSH))

   ' Draw the listener
   SelectObject(dc,GetStockObject(GRAY_BRUSH))
   Ellipse(dc,cx-4,cy-4,cx+4,cy+4)

   for c as integer =0 to chanc-1
      ' If the channel's playing then update it's position
      if BASS_ChannelIsActive(chans[c].channel) = BASS_ACTIVE_PLAYING then
         ' Check if channel has reached the max distance
         if chans[c].pos.z >= MAXDIST or chans[c].pos.z <= -MAXDIST then
            chans[c].vel.z=-chans[c].vel.z
end if
         if chans[c].pos.x>=MAXDIST or chans[c].pos.x<=-MAXDIST then
            chans[c].vel.x=-chans[c].vel.x
end if
         ' Update channel position
         chans[c].pos.z+=chans[c].vel.z*TIMERPERIOD/1000
         chans[c].pos.x+=chans[c].vel.x*TIMERPERIOD/1000
         BASS_ChannelSet3DPosition(chans[c].channel,@chans[c].pos,NULL,@chans[c].vel)
end if
      ' Draw the channel position indicator
      x=cx+int((cx-10)*chans[c].pos.x/MAXDIST)
      y=cy-int((cy-10)*chans[c].pos.z/MAXDIST)
      SelectObject(dc,iif(chan =c, red,GetStockObject(WHITE_BRUSH)))
      Ellipse(dc,x-4,y-4,x+4,y+4)
next
   ' Apply the 3D changes
   BASS_Apply3D()

   ReleaseDC(win,dc)
   DeleteObject(red)   
end sub

' Update the button states
sub UpdateButtons()
   for a as integer = 12 to 17
      EnableWindow(ITEM(a),iif(chan=-1,FALSE,TRUE))
next
   if chan <> -1 then
      SetDlgItemInt(win,15,abs(int(chans[chan].vel.x)),FALSE)
      SetDlgItemInt(win,16,abs(int(chans[chan].vel.z)),FALSE)
end if
end sub

function  dialogproc(byval h as HWND  ,byval m as UINT ,byval w as WPARAM,byval l as LPARAM ) as BOOL

   static ofn as OPENFILENAME

select case m
      case WM_COMMAND:
         select case LOWORD(w)
            case 10: ' change the selected channel
               if HIWORD(w) = LBN_SELCHANGE then
               chan=LM(LB_GETCURSEL,0,0)
               if chan=LB_ERR then chan=-1
               UpdateButtons()
end if
            case 11: ' add a channel
                  dim as zstring * MAX_PATH file
                  dim as DWORD newchan = any
                  ofn.lpstrFile=@file
                  if (GetOpenFileName(@ofn)) then
                     ' Load a music or sample from "file"
newchan=BASS_MusicLoad(FALSE,@file,0,0,BASS_MUSIC_RAMP or BASS_SAMPLE_LOOP or BASS_SAMPLE_3D,0)
if newchan = 0 then newchan = BASS_SampleLoad(FALSE,@file,0,0,1,BASS_SAMPLE_LOOP or BASS_SAMPLE_3D or BASS_SAMPLE_MONO)
if newchan then
                        dim as Channel ptr c = any
                        chanc+=1
                        chans=cast(channel ptr,reallocate(chans,chanc*sizeof(Channel)))
                        c=chans+chanc-1
                        clear(*c,0,sizeof(Channel))
                        c->channel=newchan
                        BASS_SampleGetChannel(newchan,FALSE) ' initialize sample channel
                        LM(LB_ADDSTRING,0,strrchr(file,92)+1)' 92 - backslash
                     else
                        mError("Can't load file (note samples must be mono)")
end if
end if
            case 12: ' remove a channel
                  dim as Channel ptr c=chans+chan
                  BASS_SampleFree(c->channel)
                  BASS_MusicFree(c->channel)
                  memmove(c,c+1,(chanc-chan-1)*sizeof(Channel))
                  chanc-=1
                  LM(LB_DELETESTRING,chan,0)
                  chan=-1
                  UpdateButtons()
            case 13:
               BASS_ChannelPlay(chans[chan].channel,FALSE)
            case 14:
               BASS_ChannelPause(chans[chan].channel)
            case 15: ' X velocity
               if HIWORD(w) = EN_CHANGE then
dim as integer v=GetDlgItemInt(win,15,0,FALSE)
                  if abs(int(chans[chan].vel.x)) <>v then chans[chan].vel.x=v
end if
            case 16: ' Z velocity
               if HIWORD(w) = EN_CHANGE then 
dim as integer v=GetDlgItemInt(win,16,0,FALSE)
                  if abs(int(chans[chan].vel.z)) <> v then chans[chan].vel.z=v
end if
            case 17: ' reset the position and velocity to 0
               clear(chans[chan].pos,0,sizeof(chans[chan].pos))
               clear(chans[chan].vel,0,sizeof(chans[chan].vel))
               UpdateButtons()
            case 22: ' change the EAX environment
               if HIWORD(w) = CBN_SELCHANGE then
dim as integer s=EM(CB_GETCURSEL,0,0)
                  if  s = 0 then
                     BASS_SetEAXParameters(-1,0,-1,-1) ' off (volume=0)
                  else
                     BASS_SetEAXParameters(s-1,-1,-1,-1)
end if
end if
            case IDCANCEL:
               DestroyWindow(h)
end select

      case WM_HSCROLL:
         if l then
dim as integer cpos=SendMessage(cast(HWND,l),TBM_GETPOS,0,0)
select case GetDlgCtrlID(cast(HWND,l))
               case 20: ' change the rolloff factor
                  BASS_Set3DFactors(-1,pow(2,(cpos-10)/5.0),-1)
               case 21: ' change the doppler factor
                  BASS_Set3DFactors(-1,-1,pow(2,(cpos-10)/5.0))
end select
end if
      case WM_INITDIALOG:
         win=h

         EM(CB_ADDSTRING,0,@"Off")
         EM(CB_ADDSTRING,0,@"Generic")
         EM(CB_ADDSTRING,0,@"Padded Cell")
         EM(CB_ADDSTRING,0,@"Room")
         EM(CB_ADDSTRING,0,@"Bathroom")
         EM(CB_ADDSTRING,0,@"Living Room")
         EM(CB_ADDSTRING,0,@"Stone Room")
         EM(CB_ADDSTRING,0,@"Auditorium")
         EM(CB_ADDSTRING,0,@"Concert Hall")
         EM(CB_ADDSTRING,0,@"Cave")
         EM(CB_ADDSTRING,0,@"Arena")
         EM(CB_ADDSTRING,0,@"Hangar")
         EM(CB_ADDSTRING,0,@"Carpeted Hallway")
         EM(CB_ADDSTRING,0,@"Hallway")
         EM(CB_ADDSTRING,0,@"Stone Corridor")
         EM(CB_ADDSTRING,0,@"Alley")
         EM(CB_ADDSTRING,0,@"Forest")
         EM(CB_ADDSTRING,0,@"City")
         EM(CB_ADDSTRING,0,@"Mountains")
         EM(CB_ADDSTRING,0,@"Quarry")
         EM(CB_ADDSTRING,0,@"Plain")
         EM(CB_ADDSTRING,0,@"Parking Lot")
         EM(CB_ADDSTRING,0,@"Sewer Pipe")
         EM(CB_ADDSTRING,0,@"Under Water")
         EM(CB_ADDSTRING,0,@"Drugged")
         EM(CB_ADDSTRING,0,@"Dizzy")
         EM(CB_ADDSTRING,0,@"Psychotic")
         EM(CB_SETCURSEL,0,0)

         MESS(20,TBM_SETRANGE,FALSE,MAKELONG(0,20))
         MESS(20,TBM_SETPOS,TRUE,10)
         MESS(21,TBM_SETRANGE,FALSE,MAKELONG(0,20))
         MESS(21,TBM_SETPOS,TRUE,10)

         SetTimer(h,1,TIMERPERIOD,@Update)
clear(ofn,0,sizeof(OPENFILENAME))
         ofn.lStructSize=sizeof(ofn)
         ofn.hwndOwner=h
         ofn.nMaxFile=MAX_PATH
         ofn.Flags=OFN_HIDEREADONLY or OFN_EXPLORER
         ofn.lpstrFilter=@!"wav/aif/mo3/xm/mod/s3m/it/mtm/umx\0*.wav;*.aif;*.mo3;*.xm;*.mod;*.s3m;*.it;*.mtm;*.umx\0All files\0*.*\0\0"
         return 1
      case WM_DESTROY:
         KillTimer(h,1)
         if chans then free(chans)
         PostQuitMessage(0)
end select

   return 0
end function

function WinMain(byval hInstance as HINSTANCE, byval hPrevInstance as HINSTANCE,byval lpCmdLine as LPSTR , byval nCmdShow as integer) as integer
dim as    MSG msg = any

   ' check the correct BASS was loaded
   if (HIWORD(BASS_GetVersion()) <> BASSVERSION) then
      MessageBox(0,"An incorrect version of BASS.DLL was loaded",0,MB_ICONERROR)
      return 0
end if

    ' enable trackbar support
dim       as INITCOMMONCONTROLSEX cc=type(sizeof(cc),ICC_BAR_CLASSES)
      InitCommonControlsEx(@cc)

   ' Create the main window
   if CreateDialog(hInstance,MAKEINTRESOURCE(1000),NULL,@dialogproc) = 0 then
      mError("Can't create window")
      return 0
end if

   ' Initialize the default output device with 3D support
   if BASS_Init(-1,44100,BASS_DEVICE_3D,win,NULL) = 0 then
      mError("Can't initialize output device")
      EndDialog(win,0)
      return 0
end if

   ' Use meters as distance unit, real world rolloff, real doppler effect
   BASS_Set3DFactors(1,1,1)
   ' Turn EAX off (volume=0), if error then EAX is not supported
   if BASS_SetEAXParameters(-1,0,-1,-1)then EnableWindow(GetDlgItem(win,22),TRUE)
   while GetMessage(@msg,NULL,0,0) <> FALSE
      if IsDialogMessage(win,@msg) =  FALSE then
         TranslateMessage(@msg)
         DispatchMessage(@msg)
end if
wend
   BASS_Free()
   return 0
end function

end WinMain(GetModuleHandle(NULL),0,GetCommandLine(),SW_NORMAL )

файл 3dtest.rc
Код:

1000 DIALOG DISCARDABLE  100, 100, 245, 165
STYLE WS_MINIMIZEBOX | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
CAPTION "BASS - 3D Test"
FONT 8, "MS Sans Serif"
BEGIN
    GROUPBOX        "Channels (sample/music)",-1,5,0,110,127
    LISTBOX        10,10,9,100,51,LBS_NOINTEGRALHEIGHT | WS_VSCROLL |
                    WS_TABSTOP
    PUSHBUTTON      "Add ...",11,10,65,48,12
    PUSHBUTTON      "Remove",12,62,65,48,12,WS_DISABLED
    PUSHBUTTON      "Play",13,10,81,48,12,WS_DISABLED
    PUSHBUTTON      "Stop",14,62,81,48,12,WS_DISABLED
    GROUPBOX        "Movement",-1,5,96,110,31
    LTEXT          "x:",-1,13,109,8,8
    EDITTEXT        15,22,107,15,13,ES_NUMBER | WS_DISABLED
    LTEXT          "z:",-1,43,109,8,8
    EDITTEXT        16,52,107,15,13,ES_NUMBER | WS_DISABLED
    PUSHBUTTON      "reset",17,78,108,30,11,WS_DISABLED
    GROUPBOX        "EAX environment",-1,5,130,110,30
    COMBOBOX        22,10,141,100,65,CBS_DROPDOWNLIST | WS_DISABLED |
                    WS_VSCROLL | WS_TABSTOP
    GROUPBOX        "Rolloff factor",-1,120,113,120,23
    CONTROL        "",20,"msctls_trackbar32",TBS_BOTH | TBS_NOTICKS |
                    WS_TABSTOP,130,123,100,10
    GROUPBOX        "Doppler factor",-1,120,137,120,23
    CONTROL        "",21,"msctls_trackbar32",TBS_BOTH | TBS_NOTICKS |
                    WS_TABSTOP,130,147,100,10
    GROUPBOX        "",-1,120,0,120,111
    LTEXT          "",30,125,9,109,96,SS_SUNKEN
END


Последний раз редактировалось: electrik (Ср Янв 11, 2012 10:36 pm), всего редактировалось 1 раз(а)

electrik

Сообщения : 391
Дата регистрации : 2008-09-02
Возраст : 43
Откуда : галактика Млечный путь, система Солнечная, планета Земля, страна россия, город Санкт Петербург

Вернуться к началу Перейти вниз

Библиотека BASS - заголовочные файлы + примеры Empty Re: Библиотека BASS - заголовочные файлы + примеры

Сообщение  electrik Пн Янв 09, 2012 10:10 pm

эта программа, демонстрирует как при помощи BASS, написать простой звуковой синтезатор.
я чуток добавил новых функций, а именно:
выбор wave волны- формулы взяты из разных источников, поэтому, неточности исправляем и пишем сюда.
добавлено выбор октав, * и / на цифровом блоке.
в отличии от оригинальной версии, для игры нот используется вся компьютерная клавиатура.

Код:

/'
   BASS simple synth
   Copyright (c) 2001-2008 Un4seen Developments Ltd.
***  адаптед for FreeBasic and add new functions by electrik
'/

#include "windows.bi"
#include "crt.bi"
#include "bass.bi"

' display error messages
sub dError(byval text as zString ptr)
   printf(!"Error(%d): %s\n",BASS_ErrorGetCode(),text)
   BASS_Free()
end
end sub


const as double PI = 3.14159265358979323846
#define TABLESIZE 2048
dim shared as integer   sinetable(TABLESIZE) ' sine table
#define nKEYS 37
dim shared as WORD keys(nKEYS) = _
{VK_Z,VK_S,VK_X,VK_D,VK_C,VK_V,VK_G,VK_B,VK_H,VK_N,VK_J,VK_M,VK_OEM_COMMA,VK_L,VK_OEM_PERIOD,VK_OEM_1,VK_OEM_2,VK_Q,VK_2, _
VK_W,VK_3,VK_E,VK_R,VK_5,VK_T,VK_6,VK_Y,VK_7,VK_U,VK_I,VK_9,VK_O,VK_0,VK_P,VK_OEM_4,VK_OEM_PLUS,VK_OEM_6}
#define MAXVOL   4000.0   ' higher value = longer fadeout

' keys' volume & pos
dim shared as single vol(nKEYS-5)
dim shared as integer bpos(nKEYS-5)
dim shared as single BaseOctave = 220.0

' stream writer
function WriteStream(byval handle as HSTREAM , byval buffer as short  ptr, byval length as DWORD, byval user as any ptr) as DWORD
   dim as integer n,s = any
   dim as DWORD c= any
dim as single f = any

   memset(buffer,0,length)
   for n =0 to nKEYS-1-5
      if vol(n) = 0.0 then continue for
f=2.0 ^ ((n+3)/12)*TABLESIZE*baseOctave/44100.0

      for c=0 to (length/4-1)
      if vol(n) = 0.0 then continue for
bpos(n) +=1
         s=int(sinetable(int(bpos(n)*f) and (TABLESIZE-1))*vol(n)/MAXVOL)

         s+=buffer[c*2]
         if s>32767 then
s=32767
         elseIf s<-32768 then s=-32768
end if

 ' left and right channels are the same
         buffer[c*2+1]=s
buffer[c*2]=s
         if vol(n) < MAXVOL then vol(n)-=0.5

next
next
return length
end function


dim as    BASS_INFO info
dim as    HSTREAM stream
   dim as const zstring ptr fxname(9)={@"CHORUS",@"COMPRESSOR",@"DISTORTION",@"ECHO",@"FLANGER",@"GARGLE",@"I3DL2REVERB",@"PARAMEQ",@"REVERB"}
   dim as HFX fx(9)={0} ' effect handles
   dim as INPUT_RECORD keyin
dim as    DWORD r,buflen
dim as integer supKeys
dim as integer tWave = 1

   printf(!"BASS Simple Sinewave Synth\n" _
         !"--------------------------\n")

   ' check the correct BASS was loaded
   if HIWORD(BASS_GetVersion()) <> BASSVERSION then
      printf("An incorrect version of BASS.DLL was loaded")
end
end if

   ' 10ms update period
   BASS_SetConfig(BASS_CONFIG_UPDATEPERIOD,10)

   ' setup output - get latency
   if BASS_Init(-1,44100,BASS_DEVICE_LATENCY,0,NULL) = 0 then
      dError(@"Can't initialize device")
end if

   ' build sine table
   for r=0 to TABLESIZE-1
      sinetable(r) = int(sin(2.0 * PI * r / TABLESIZE) * 7000.0)
next
   BASS_GetInfo(@info)
   printf(!"device latency: %dms\n",info.latency)
   printf(!"device minbuf: %dms\n",info.minbuf)
   printf(!"ds version: %d (effects %s)\n",info.dsver,iif(info.dsver<8,@"disabled",@"enabled"))

   ' default buffer size = update period + 'minbuf'
   BASS_SetConfig(BASS_CONFIG_BUFFER,10+info.minbuf)
   buflen=BASS_GetConfig(BASS_CONFIG_BUFFER)

   ' create a stream, stereo so that effects sound nice
   stream=BASS_StreamCreate(44100,2,0,cast(STREAMPROC ptr,@WriteStream),0)
   printf(!"press these keys to play:\n\n" _
         !"  2 3  5 6 7  9 0  =\n" _
         !" Q W ER T Y UI O P[ ]\n" _
!"S D G H J L ;\n" _
!"Z X C V B N M , . /\n\n" _
         !"press -/+ to de/increase the buffer\n" _
!"press F12 to change waveform\n" _
!"press  numpad * or / to change octave\n" _
         !"press esc to quit\n\n")

   if info.dsver>=8 then ' DX8 effects available
      printf(!"press F1-F9 to toggle effects\n\n")
end if

   printf(!"using a %dms buffer\r",buflen)

   BASS_ChannelPlay(stream,FALSE)

   while ReadConsoleInput(GetStdHandle(STD_INPUT_HANDLE),@keyin,1,@r)
      dim as integer key
      if keyin.EventType <> KEY_EVENT then continue while
      if keyin.Event.KeyEvent.wVirtualKeyCode = VK_ESCAPE then exit while
      if keyin.Event.KeyEvent.bKeyDown then
         if keyin.Event.KeyEvent.wVirtualKeyCode = VK_SUBTRACT _
            or keyin.Event.KeyEvent.wVirtualKeyCode = VK_ADD then

            ' recreate stream with smaller/larger buffer
            BASS_StreamFree(stream)
            if keyin.Event.KeyEvent.wVirtualKeyCode = VK_SUBTRACT then
               BASS_SetConfig(BASS_CONFIG_BUFFER,buflen-1) ' smaller buffer
            else
               BASS_SetConfig(BASS_CONFIG_BUFFER,buflen+1) ' larger buffer
end if
            buflen=BASS_GetConfig(BASS_CONFIG_BUFFER)
            printf(!"using a %dms buffer\t\t\r",buflen)
            stream = BASS_StreamCreate(44100,2,0,cast(STREAMPROC ptr,@WriteStream),0)
            ' set effects on the new stream
            for r=0 to 8
 if fx(r) then  fx(r)=BASS_ChannelSetFX(stream,BASS_FX_DX8_CHORUS+r,0)
next
            BASS_ChannelPlay(stream,FALSE)

end if
         if keyin.Event.KeyEvent.wVirtualKeyCode >= VK_F1 _
            and keyin.Event.KeyEvent.wVirtualKeyCode<=VK_F9 then
            r=keyin.Event.KeyEvent.wVirtualKeyCode-VK_F1
            if fx(r) then
               BASS_ChannelRemoveFX(stream,fx(r))
               fx(r)=0
               printf(!"effect %s = OFF\t\t\r",fxname(r))
 else
               ' set the effect, not bothering with parameters (use defaults)
fx(r) = BASS_ChannelSetFX(stream,BASS_FX_DX8_CHORUS+r,0)
               if fx(r)then
                  printf(!"effect %s = ON\t\t\r",fxname(r))
end if
end if
end if
         if keyin.Event.KeyEvent.wVirtualKeyCode = VK_MULTIPLY then
baseOctave *=2
if baseOctave > 1760 then baseOctave = 1760
end if
         if keyin.Event.KeyEvent.wVirtualKeyCode = VK_DIVIDE then
baseOctave /=2
if baseOctave < 3.4375 then baseOctave = 3.4375
end if
         if keyin.Event.KeyEvent.wVirtualKeyCode = VK_F12 then
   for r=0 to TABLESIZE-1
select case tWave
case 0
      sinetable(r) = int(sin(2.0 * PI * r / TABLESIZE) * 7000.0)
case 1
sinetable(r) = int((2/pi)*asin(sin(2.0 * PI * r / TABLESIZE)) * 7000.0)
case 2
sinetable(r) = int(-2 *((r/tablesize)-0.5) * 7000)
case 3
      sinetable(r) = iif(frac(r/tablesize) < 0.5,7000.0,-7000.0)
case 4
sinetable(r) =  int(sgn(sin(2.0 * PI * r / TABLESIZE/2)-0.5) * 7000)
case 5
sinetable(r) =  int(sgn(sin(2.0 * PI * r / TABLESIZE/2)-0.25) * 7000)
end select
next
tWave+=1
if tWave > 5 then tWave = 0
end if
end if
      for key = 0 to nKEYS-1
         if keyin.Event.KeyEvent.wVirtualKeyCode = keys(key) then
supKeys=iif(key>16,5,0)
            if keyin.Event.KeyEvent.bKeyDown and vol(key-supKeys) <> MAXVOL then
               bpos(key-supKeys) = 0
               vol(key-supKeys) = MAXVOL ' start key
 elseIf keyin.Event.KeyEvent.bKeyDown = 0 and vol(key-supKeys) then vol(key-supKeys) -=0.5 ' trigger key fadeout
end if
end if
next
wend

   BASS_Free()


electrik

Сообщения : 391
Дата регистрации : 2008-09-02
Возраст : 43
Откуда : галактика Млечный путь, система Солнечная, планета Земля, страна россия, город Санкт Петербург

Вернуться к началу Перейти вниз

Библиотека BASS - заголовочные файлы + примеры Empty Re: Библиотека BASS - заголовочные файлы + примеры

Сообщение  trew Вт Янв 10, 2012 8:37 am

Синтезатор работает. Пример с 3D звуком не запускается:

Сильно не вглядывался , но вроде как файла ресурсов не хватает.

Вообще за новые заголовки библиотеки спасибо, позднее потестирую как следует. Wink

---------------------------------------------------------------------------------------

Добавлено позже:

Файл ресурсов (3dtest.rc), взял из оригинального архива BASS:

Код:
1000 DIALOG DISCARDABLE  100, 100, 245, 165
STYLE WS_MINIMIZEBOX | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
CAPTION "BASS - 3D Test"
FONT 8, "MS Sans Serif"
BEGIN
    GROUPBOX        "Channels (sample/music)",-1,5,0,110,127
    LISTBOX        10,10,9,100,51,LBS_NOINTEGRALHEIGHT | WS_VSCROLL |
                    WS_TABSTOP
    PUSHBUTTON      "Add ...",11,10,65,48,12
    PUSHBUTTON      "Remove",12,62,65,48,12,WS_DISABLED
    PUSHBUTTON      "Play",13,10,81,48,12,WS_DISABLED
    PUSHBUTTON      "Stop",14,62,81,48,12,WS_DISABLED
    GROUPBOX        "Movement",-1,5,96,110,31
    LTEXT          "x:",-1,13,109,8,8
    EDITTEXT        15,22,107,15,13,ES_NUMBER | WS_DISABLED
    LTEXT          "z:",-1,43,109,8,8
    EDITTEXT        16,52,107,15,13,ES_NUMBER | WS_DISABLED
    PUSHBUTTON      "reset",17,78,108,30,11,WS_DISABLED
    GROUPBOX        "EAX environment",-1,5,130,110,30
    COMBOBOX        22,10,141,100,65,CBS_DROPDOWNLIST | WS_DISABLED |
                    WS_VSCROLL | WS_TABSTOP
    GROUPBOX        "Rolloff factor",-1,120,113,120,23
    CONTROL        "",20,"msctls_trackbar32",TBS_BOTH | TBS_NOTICKS |
                    WS_TABSTOP,130,123,100,10
    GROUPBOX        "Doppler factor",-1,120,137,120,23
    CONTROL        "",21,"msctls_trackbar32",TBS_BOTH | TBS_NOTICKS |
                    WS_TABSTOP,130,147,100,10
    GROUPBOX        "",-1,120,0,120,111
    LTEXT          "",30,125,9,109,96,SS_SUNKEN
END


------------------------------------------------------------

Добавлено еще позже Very Happy

DSCAPS_CONTINUOUSRATE in '#define DSCAPS_CONTINUOUSRATE &h00000010
DSCAPS_EMULDRIVER in '#define DSCAPS_EMULDRIVER &h00000020
DSCAPS_CERTIFIED in '#define DSCAPS_CERTIFIED &h00000040
DSCAPS_SECONDARYMONO in '#define DSCAPS_SECONDARYMONO &h00000100
DSCAPS_SECONDARYSTEREO in '#define DSCAPS_SECONDARYSTEREO &h00000200
DSCAPS_SECONDARY8BIT in '#define DSCAPS_SECONDARY8BIT &h00000400
DSCAPS_SECONDARY16BIT in '#define DSCAPS_SECONDARY16BIT &h00000800
DSCCAPS_EMULDRIVER in '#define DSCCAPS_EMULDRIVER DSCAPS_EMULDRIVER
DSCCAPS_CERTIFIED in '#define DSCCAPS_CERTIFIED DSCAPS_CERTIFIED

константы выше лучше записать в условную компиляцию, поскольку они уже объявлены в файле win\dsound.bi

trew

Сообщения : 331
Дата регистрации : 2010-10-14

Вернуться к началу Перейти вниз

Библиотека BASS - заголовочные файлы + примеры Empty Re: Библиотека BASS - заголовочные файлы + примеры

Сообщение  electrik Ср Янв 11, 2012 3:37 pm

ой, прошу прощения за rc файл. приду домой переложу архив.
поповоду констант, посмотрю как в bass.h.
вродь ни чего не убирал.
ну если они пересекаются, тогда сделаем условную компиляцию.
я так понимаю что-то наподобе:
ifndef dsound_bi
константы
#endif

electrik

Сообщения : 391
Дата регистрации : 2008-09-02
Возраст : 43
Откуда : галактика Млечный путь, система Солнечная, планета Земля, страна россия, город Санкт Петербург

Вернуться к началу Перейти вниз

Библиотека BASS - заголовочные файлы + примеры Empty Re: Библиотека BASS - заголовочные файлы + примеры

Сообщение  trew Ср Янв 11, 2012 6:34 pm

electrik пишет:ой, прошу прощения за rc файл. приду домой переложу архив.
поповоду констант, посмотрю как в bass.h.
вродь ни чего не убирал.
ну если они пересекаются, тогда сделаем условную компиляцию.
я так понимаю что-то наподобе:
ifndef dsound_bi
константы
#endif

#Ifndef __win_dsound_bi__
....
#EndIf

trew

Сообщения : 331
Дата регистрации : 2010-10-14

Вернуться к началу Перейти вниз

Библиотека BASS - заголовочные файлы + примеры Empty Re: Библиотека BASS - заголовочные файлы + примеры

Сообщение  electrik Ср Янв 11, 2012 10:38 pm

все поправлено. можете качать или копировать с форума.
если кто уже скачал архив, перекачайте, так как там неправильная папка.
вместо inc, было include.

electrik

Сообщения : 391
Дата регистрации : 2008-09-02
Возраст : 43
Откуда : галактика Млечный путь, система Солнечная, планета Земля, страна россия, город Санкт Петербург

Вернуться к началу Перейти вниз

Библиотека BASS - заголовочные файлы + примеры Empty Re: Библиотека BASS - заголовочные файлы + примеры

Сообщение  electrik Вс Мар 31, 2013 11:12 pm

Этот пример показывает, как использовать функции DSP в библиотеке bass.
думаю, что многие ставили себе в плееры дополнительные DSP плагины,
например, для улучшения звука или вообще для различных его изменений.
DSP- означает: Digital signal processing - цифровая обработка сигнала.
надеюсь, что данный пример поможет не только разобраться с использованием DSP функций в bass, но и также вы узнаете, как программно сделать
простые эффекты, эхо, флэнжер и вращение звука.

файл dsptest.bas
Код:

/'
   BASS simple DSP test
   Copyright (c) 2000-2012 Un4seen Developments Ltd.
'/
' *** adapted for FreeBasic by electrik

#include "windows.bi"
#include "win/commdlg.bi"
#include "crt/stdio.bi"
#include "bass.bi"

#ifndef M_PI
#define M_PI 3.14159265358979323846
#endif

dim shared as HWND win=NULL

dim shared as DWORD floatable ' floating-point channel support?
dim shared as DWORD chan   ' the channel... HMUSIC or HSTREAM

dim shared as OPENFILENAME ofn

' display error messages
sub ErrorMess(byval es as const zstring ptr)
   dim as zstring  * 200 mes
   sprintf(mes,@"%s\n(error code: %d)",es,BASS_ErrorGetCode())
   MessageBox(win,mes,0,0)
end sub

' macro-command fmod
#define fmod(a,b) ((a) - Fix((a) / (b)) * (b))

' "rotate"
dim shared as HDSP rotdsp=0   ' DSP handle
dim shared as single rotpos   ' cur.pos
sub Rotate(byval handle as HDSP, byval channel as DWORD, byval buffer as any ptr, byval length as DWORD, byval user as any ptr)
   dim as single ptr d=buffer
   dim as DWORD a

   for a=0 to length/4-1 step 2
       d[a]*=abs(sin(rotpos))
      d[a+1]*=abs(cos(rotpos))
      rotpos+=0.00003
   next
   rotpos = fmod(rotpos,2*M_PI)
end sub

' "echo"
dim shared as HDSP echdsp=0   ' DSP handle
#define ECHBUFLEN 1200   ' buffer length
dim shared as float echbuf(ECHBUFLEN-1,1)   ' buffer
dim shared as integer echpos   ' cur.pos
sub Echo(byval handle as HDSP, byval channel as DWORD , byval buffer as any ptr, byval length as DWORD, byval user as any ptr)
   dim as single ptr d=buffer
   dim as DWORD a

   for a=0 to length/4-1 step 2
      dim as single l=d[a]+(echbuf(echpos,1)/2)
      dim as float r=d[a+1]+(echbuf(echpos,0)/2)
#if 1 ' 0=echo, 1=basic "bathroom" reverb
      echbuf(echpos,0)=l
d[a]=l
      echbuf(echpos,1)=r
d[a+1]=r
#else
      echbuf(echpos,0)=d[a]
      echbuf(echpos,1)=d[a+1]
      d[a]=l
      d[a+1]=r
#endif
      echpos +=1
      if (echpos = ECHBUFLEN) then echpos=0
   next
end sub

' "flanger"
dim shared as HDSP fladsp=0   ' DSP handle
#define FLABUFLEN 350   ' buffer length
dim shared as float flabuf(FLABUFLEN,1)   ' buffer
dim shared as integer flapos   ' cur.pos
dim shared as float flas,flasinc   ' sweep pos/increment
sub Flange(byval handle as HDSP, byval channel as DWORD, byval buffer as any ptr, byval length as DWORD, byval user as any ptr)
   dim as single ptr d=buffer
   dim as DWORD a

   for a=0 to length/4-1 step 2
      dim as integer p1=(flapos+int(flas)) mod FLABUFLEN
      dim as integer p2=(p1+1) mod FLABUFLEN
      dim as single f=flas-int(flas)
      dim as single s

      s=(d[a]+((flabuf(p1,0)*(1-f))+(flabuf(p2,0)*f)))*0.7
      flabuf(flapos,0)=d[a]
      d[a]=s

      s=(d[a+1]+((flabuf(p1,1)*(1-f))+(flabuf(p2,1)*f)))*0.7
      flabuf(flapos,1)=d[a+1]
      d[a+1]=s

      flapos +=1
      if (flapos = FLABUFLEN) then flapos=0
      flas+=flasinc
      if (flas<0 or flas>FLABUFLEN-1) then
         flasinc=-flasinc
         flas+=flasinc
      end if
   next
end sub


#define MESS(id,m,w,l) SendDlgItemMessage(win,id,m,w,cast(lparam,l))

function dialogproc(byval h as HWND, byval m as uinteger, byval w as WPARAM, byval l as LPARAM) as BOOL
   select case m
      case WM_COMMAND
select case LOWORD(w)
            case IDCANCEL
               DestroyWindow(h)
            case 10:
                  dim as BASS_CHANNELINFO info
                  dim as zstring * MAX_PATH filename
                  ofn.lpstrFilter=@!"playable files\0*.mo3;*.xm;*.mod;*.s3m;*.it;*.mtm;*.umx;*.mp3;*.mp2;*.mp1;*.ogg;*.wav;*.aif\0All files\0*.*\0\0"
                  ofn.lpstrFile=@filename
                  if (GetOpenFileName(@ofn)) then
                     ' free both MOD and stream, it must be one of them! :)
                     BASS_MusicFree(chan)
                     BASS_StreamFree(chan)

chan=BASS_StreamCreateFile(FALSE,@filename,0,0,BASS_SAMPLE_LOOP or floatable)
if chan = 0 then
chan=BASS_MusicLoad(FALSE,@filename,0,0,BASS_SAMPLE_LOOP or BASS_MUSIC_RAMPS or floatable,1)
if chan = 0 then
                     ' whatever it is, it ain't playable
                        MESS(10,WM_SETTEXT,0,"click here to open a file...")
                        Errormess("Can't play the file")
exit select
                     end if
end if
                     
                     BASS_ChannelGetInfo(chan,@info)
                     if (info.chans <> 2) then
 ' only stereo is allowed
                        MESS(10,WM_SETTEXT,0,"click here to open a file...")
                        BASS_MusicFree(chan)
                        BASS_StreamFree(chan)
                        ErrorMess("only stereo sources are supported")
                        exit select
                     end if
                     MESS(10,WM_SETTEXT,0,@filename)
                     ' setup DSPs on new channel and play it
                     SendMessage(win,WM_COMMAND,11,0)
                     SendMessage(win,WM_COMMAND,12,0)
                     SendMessage(win,WM_COMMAND,13,0)
                     BASS_ChannelPlay(chan,FALSE)
                  end if
            case 11 ' toggle "rotate"
               if (MESS(11,BM_GETCHECK,0,0)) then
                  rotpos=0.7853981f
                  rotdsp=BASS_ChannelSetDSP(chan,@Rotate,0,2)
                else
                  BASS_ChannelRemoveDSP(chan,rotdsp)
end if
                           case 12 ' toggle "echo"
               if (MESS(12,BM_GETCHECK,0,0)) then
erase(echbuf)
                  echpos=0
                  echdsp=BASS_ChannelSetDSP(chan,@Echo,0,1)
               else
                  BASS_ChannelRemoveDSP(chan,echdsp)
               end if
            case 13 ' toggle "flanger"
               if (MESS(13,BM_GETCHECK,0,0)) then
erase(flabuf)
                  flapos=0
                   flas=FLABUFLEN/2
                   flasinc=0.002f
                  fladsp=BASS_ChannelSetDSP(chan,@Flange,0,0)
               else
                  BASS_ChannelRemoveDSP(chan,fladsp)
end if
         end select
               case WM_INITDIALOG
         win=h
         clear(ofn,0,sizeof(ofn))
         ofn.lStructSize=sizeof(ofn)
         ofn.hwndOwner=h
         ofn.nMaxFile=MAX_PATH
         ofn.Flags=OFN_HIDEREADONLY or OFN_EXPLORER
         ' enable floating-point DSP
         BASS_SetConfig(BASS_CONFIG_FLOATDSP,TRUE)
         ' initialize - default device
         if (BASS_Init(-1,44100,0,win,NULL)) = 0 then
            ErrorMess("Can't initialize device")
            DestroyWindow(win)
exit select
         end if
         ' check for floating-point capability
         floatable=BASS_StreamCreate(44100,2,BASS_SAMPLE_FLOAT,NULL,0)
         if (floatable) then ' woohoo!
            BASS_StreamFree(floatable)
            floatable=BASS_SAMPLE_FLOAT
         end if
      case WM_DESTROY:
         BASS_Free()
      case else
return FALSE
   end select
   return TRUE
end function

   ' check the correct BASS was loaded
   if (HIWORD(BASS_GetVersion()) <> BASSVERSION) then
      MessageBox(0,"An incorrect version of BASS.DLL was loaded",0,MB_ICONERROR)
      end
end if
dim as HANDLE hModule = GetModuleHandle(NULL)
   end DialogBox(hModule,cast(zstring ptr,1000),0,@dialogproc)

файл dsptest.rc
Код:

#include "windows.h"

1000 DIALOG DISCARDABLE  100, 100, 200, 49
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "BASS simple DSP test"
FONT 8, "MS Sans Serif"
BEGIN
    PUSHBUTTON      "click here to open a file...",10,5,5,190,14
    CONTROL        "rotate",11,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,40,30,
                    35,10
    CONTROL        "echo",12,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,80,30,35,
                    10
    CONTROL        "flanger",13,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,120,
                    30,35,10
END

electrik

Сообщения : 391
Дата регистрации : 2008-09-02
Возраст : 43
Откуда : галактика Млечный путь, система Солнечная, планета Земля, страна россия, город Санкт Петербург

Вернуться к началу Перейти вниз

Библиотека BASS - заголовочные файлы + примеры Empty Re: Библиотека BASS - заголовочные файлы + примеры

Сообщение  trew Пн Апр 01, 2013 8:18 am

Да пример не сложный, спасибо. Эффект rotate выделяется среди других. flanger добавляет шумы , получается что-то типа пролетающего самолета . А третий вообще не понял, по названию должно быть эхо, но либо надо музыку под него подобрать, либо у меня колонки уже от многолетней работы не доносят до меня, либо просто слух поганый.

trew

Сообщения : 331
Дата регистрации : 2010-10-14

Вернуться к началу Перейти вниз

Библиотека BASS - заголовочные файлы + примеры Empty Re: Библиотека BASS - заголовочные файлы + примеры

Сообщение  electrik Пн Апр 01, 2013 8:59 pm

привет. нет, слух не поганый, просто там задержка эхо маленькая. включи rotate и echo, будет эффект как в комнате что-то летает. я, правда, в наушниках юзал.
с параметрами помудрить надо.
а флэнжер, он так и должен звучать. это супер пупер в электронной музыке.
я другой эффект хочу накрутить. как в старом jungle, там голос прикольно растягивали. знаю, как оно делается. главное, чтоб небыло щелчков.
алгоритм работы, опишу на цифрах.
есть семпл
123456789
чтоб его растянуть с кислотным звучанием, надо делать так
12323434545656767878989
то есть, смещаем позицию семпла.

надо срезать пики на склейках, чтоб щелчков небыло.
но эт ладно, может как-нибудь замучу.

в свое время в impulse tracker, такое мутил. там можно было выставлять позицию начала звучания семпла. ставим в паттерне на каждый шаг свою позицию, а потом увеличиваем темп, и получалось как в старом jungle, ну или Klubbheads.

electrik

Сообщения : 391
Дата регистрации : 2008-09-02
Возраст : 43
Откуда : галактика Млечный путь, система Солнечная, планета Земля, страна россия, город Санкт Петербург

Вернуться к началу Перейти вниз

Библиотека BASS - заголовочные файлы + примеры Empty Re: Библиотека BASS - заголовочные файлы + примеры

Сообщение  trew Вт Апр 02, 2013 5:54 am

electrik пишет:включи rotate и echo, будет эффект как в комнате что-то летает.

Да попробовал, при связке этих двух, эффект echo ощущается.


trew

Сообщения : 331
Дата регистрации : 2010-10-14

Вернуться к началу Перейти вниз

Библиотека BASS - заголовочные файлы + примеры Empty Re: Библиотека BASS - заголовочные файлы + примеры

Сообщение  electrik Вс Июл 07, 2013 3:42 pm

обновил заголовочные файлы и библиотеку до версии 2.4.10. качаем:
ftp://el-zone.spb.ru/freebasic/libs/bass24.7z

electrik

Сообщения : 391
Дата регистрации : 2008-09-02
Возраст : 43
Откуда : галактика Млечный путь, система Солнечная, планета Земля, страна россия, город Санкт Петербург

Вернуться к началу Перейти вниз

Библиотека BASS - заголовочные файлы + примеры Empty Re: Библиотека BASS - заголовочные файлы + примеры

Сообщение  trew Вс Июл 07, 2013 7:25 pm

electrik пишет:обновил заголовочные файлы и библиотеку до версии 2.4.10. качаем:
ftp://el-zone.spb.ru/freebasic/libs/bass24.7z

Привет!

Серега, на последней версии компиля пример 3DTest не заведется. Причина макрос IIF. Что там они нахимичили с ним, но я уже не с первым исходником сталкиваюсь с подобной проблемой.

А вообще для своей сборки обновлюсь твоими заголовками. Те что пихают в основной состав мягко сказать несостоятельны. И откуда ты взял себе неплохой фтпэшник?

trew

Сообщения : 331
Дата регистрации : 2010-10-14

Вернуться к началу Перейти вниз

Библиотека BASS - заголовочные файлы + примеры Empty Re: Библиотека BASS - заголовочные файлы + примеры

Сообщение  electrik Вс Июл 07, 2013 9:44 pm

все исправил, и в последней версии FreeBasic, работает. а намудрили они с iif, нельзя возвращать значения разных типов. я замутил приведения типа, и все ок.
ftp - это на моём домашнем компе стоит. думаю, может и сайт туда перенесу. а то на народе учудили с ucos, теперь надо разбираться ийти, читать всякую хрень, поновой пароль переделывать, а то я по ftp туда забраться не могу.
а сервак у меня filezilla server
очень быстрый сервак, по сравнению с gene6, летает.

electrik

Сообщения : 391
Дата регистрации : 2008-09-02
Возраст : 43
Откуда : галактика Млечный путь, система Солнечная, планета Земля, страна россия, город Санкт Петербург

Вернуться к началу Перейти вниз

Вернуться к началу

- Похожие темы

 
Права доступа к этому форуму:
Вы не можете отвечать на сообщения