bass.h
来自「Ion Team Lord Of The Rings Demo 模拟指环王的3」· C头文件 代码 · 共 1,189 行 · 第 1/4 页
H
1,189 行
/* BASS 1.5a C/C++ header file, copyright (c) 1999-2002 Ian Luck.
Please report bugs/suggestions/etc... to bass@un4seen.com
See the BASS.CHM file for more complete documentation */
#ifndef BASS_H
#define BASS_H
#include <wtypes.h>
#ifdef __cplusplus
extern "C" {
#endif
#ifndef BASSDEF
#define BASSDEF(f) WINAPI f
#endif
typedef DWORD HMUSIC; // MOD music handle
typedef DWORD HSAMPLE; // sample handle
typedef DWORD HCHANNEL; // playing sample's channel handle
typedef DWORD HSTREAM; // sample stream handle
typedef DWORD HSYNC; // synchronizer handle
typedef DWORD HDSP; // DSP handle
typedef DWORD HFX; // DX8 effect handle
// Error codes returned by BASS_GetErrorCode()
#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 - please report this!
#define BASS_ERROR_HANDLE 5 // invalid handle
#define BASS_ERROR_FORMAT 6 // unsupported format
#define BASS_ERROR_POSITION 7 // invalid playback position
#define BASS_ERROR_INIT 8 // BASS_Init has not been successfully called
#define BASS_ERROR_START 9 // BASS_Start has not been successfully called
#define BASS_ERROR_INITCD 10 // can't initialize CD
#define BASS_ERROR_CDINIT 11 // BASS_CDInit has not been successfully called
#define BASS_ERROR_NOCD 12 // no CD in drive
#define BASS_ERROR_CDTRACK 13 // can't play the selected CD track
#define BASS_ERROR_ALREADY 14 // already initialized
#define BASS_ERROR_CDVOL 15 // CD has no volume control
#define BASS_ERROR_NOPAUSE 16 // not paused
#define BASS_ERROR_NOTAUDIO 17 // not an audio track
#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_NOA3D 26 // A3D.DLL is not installed
#define BASS_ERROR_NOTFILE 27 // the stream is not a file stream (WAV/MP3/MP2/MP1/OGG)
#define BASS_ERROR_NOHW 29 // no hardware voices available
#define BASS_ERROR_NOSYNC 30 // synchronizers have been disabled
#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 enabled
#define BASS_ERROR_PLAYING 35 // the channel is playing
#define BASS_ERROR_NOTAVAIL 37 // requested data is not available
#define BASS_ERROR_DECODE 38 // the channel is a "decoding channel"
#define BASS_ERROR_DX 39 // a sufficient DirectX version is not installed
#define BASS_ERROR_TIMEOUT 40 // connection timedout
#define BASS_ERROR_UNKNOWN -1 // some other mystery error
// Device setup flags
#define BASS_DEVICE_8BITS 1 // use 8 bit resolution, else 16 bit
#define BASS_DEVICE_MONO 2 // use mono, else stereo
#define BASS_DEVICE_3D 4 // enable 3D functionality
/* If the BASS_DEVICE_3D flag is not specified when initilizing BASS,
then the 3D flags (BASS_SAMPLE_3D and BASS_MUSIC_3D) are ignored when
loading/creating a sample/stream/music. */
#define BASS_DEVICE_NOSYNC 16 // disable synchronizers
#define BASS_DEVICE_LEAVEVOL 32 // leave the volume as it is
#define BASS_DEVICE_NOTHREAD 128 // update buffers manually (using BASS_Update)
#define BASS_DEVICE_LATENCY 256 // calculate device latency (BASS_INFO struct)
#define BASS_DEVICE_VOL1000 512 // 0-1000 volume range (else 0-100)
// DirectSound interfaces (for use with BASS_GetDSoundObject)
#define BASS_OBJECT_DS 1 // IDirectSound
#define BASS_OBJECT_DS3DL 2 // IDirectSound3DListener
typedef struct {
DWORD size; // size of this struct (set this before calling the function)
DWORD flags; // device capabilities (DSCAPS_xxx flags)
DWORD hwsize; // size of total device hardware memory
DWORD hwfree; // size of free device hardware memory
DWORD freesam; // number of free sample slots in the hardware
DWORD free3d; // number of free 3D sample slots in the hardware
DWORD minrate; // min sample rate supported by the hardware
DWORD maxrate; // max sample rate supported by the hardware
BOOL eax; // device supports EAX? (always FALSE if BASS_DEVICE_3D was not used)
DWORD a3d; // unused
DWORD dsver; // DirectSound version (use to check for DX5/7 functions)
DWORD latency; // delay (in ms) before start of playback (requires BASS_DEVICE_LATENCY)
} BASS_INFO;
// BASS_INFO flags (from DSOUND.H)
#define DSCAPS_CONTINUOUSRATE 0x00000010
/* supports all sample rates between min/maxrate */
#define DSCAPS_EMULDRIVER 0x00000020
/* device does NOT have hardware DirectSound support */
#define DSCAPS_CERTIFIED 0x00000040
/* device driver has been certified by Microsoft */
/* The following flags tell what type of samples are supported by HARDWARE
mixing, all these formats are supported by SOFTWARE mixing */
#define DSCAPS_SECONDARYMONO 0x00000100 // mono
#define DSCAPS_SECONDARYSTEREO 0x00000200 // stereo
#define DSCAPS_SECONDARY8BIT 0x00000400 // 8 bit
#define DSCAPS_SECONDARY16BIT 0x00000800 // 16 bit
typedef struct {
DWORD size; // size of this struct (set this before calling the function)
DWORD flags; // device capabilities (DSCCAPS_xxx flags)
DWORD formats; // supported standard formats (WAVE_FORMAT_xxx flags)
} BASS_RECORDINFO;
// BASS_RECORDINFO flags (from DSOUND.H)
#define DSCCAPS_EMULDRIVER DSCAPS_EMULDRIVER
/* device does NOT have hardware DirectSound recording support */
#define DSCCAPS_CERTIFIED DSCAPS_CERTIFIED
/* device driver has been certified by Microsoft */
// defines for formats field of BASS_RECORDINFO (from MMSYSTEM.H)
#define WAVE_FORMAT_1M08 0x00000001 /* 11.025 kHz, Mono, 8-bit */
#define WAVE_FORMAT_1S08 0x00000002 /* 11.025 kHz, Stereo, 8-bit */
#define WAVE_FORMAT_1M16 0x00000004 /* 11.025 kHz, Mono, 16-bit */
#define WAVE_FORMAT_1S16 0x00000008 /* 11.025 kHz, Stereo, 16-bit */
#define WAVE_FORMAT_2M08 0x00000010 /* 22.05 kHz, Mono, 8-bit */
#define WAVE_FORMAT_2S08 0x00000020 /* 22.05 kHz, Stereo, 8-bit */
#define WAVE_FORMAT_2M16 0x00000040 /* 22.05 kHz, Mono, 16-bit */
#define WAVE_FORMAT_2S16 0x00000080 /* 22.05 kHz, Stereo, 16-bit */
#define WAVE_FORMAT_4M08 0x00000100 /* 44.1 kHz, Mono, 8-bit */
#define WAVE_FORMAT_4S08 0x00000200 /* 44.1 kHz, Stereo, 8-bit */
#define WAVE_FORMAT_4M16 0x00000400 /* 44.1 kHz, Mono, 16-bit */
#define WAVE_FORMAT_4S16 0x00000800 /* 44.1 kHz, Stereo, 16-bit */
// Music flags
#define BASS_MUSIC_RAMP 1 // normal ramping
#define BASS_MUSIC_RAMPS 2 // sensitive ramping
/* Ramping doesn't take a lot of extra processing and improves
the sound quality by removing "clicks". Sensitive ramping will
leave sharp attacked samples, unlike normal ramping. */
#define BASS_MUSIC_LOOP 4 // loop music
#define BASS_MUSIC_FT2MOD 16 // play .MOD as FastTracker 2 does
#define BASS_MUSIC_PT1MOD 32 // play .MOD as ProTracker 1 does
#define BASS_MUSIC_MONO 64 // force mono mixing (less CPU usage)
#define BASS_MUSIC_3D 128 // enable 3D functionality
#define BASS_MUSIC_POSRESET 256 // stop all notes when moving position
#define BASS_MUSIC_SURROUND 512 // surround sound
#define BASS_MUSIC_SURROUND2 1024 // surround sound (mode 2)
#define BASS_MUSIC_STOPBACK 2048 // stop the music on a backwards jump effect
#define BASS_MUSIC_FX 4096 // enable DX8 effects
#define BASS_MUSIC_CALCLEN 8192 // calculate playback length
#define BASS_MUSIC_DECODE 0x200000// don't play the music, only decode (BASS_ChannelGetData)
#define BASS_MUSIC_NOSAMPLE 0x400000// don't load the samples
// Sample info structure & flags
typedef struct {
DWORD freq; // default playback rate
DWORD volume; // default volume (0-100)
int pan; // default pan (-100=left, 0=middle, 100=right)
DWORD flags; // BASS_SAMPLE_xxx flags
DWORD length; // length (in samples, not bytes)
DWORD max; // maximum simultaneous playbacks
/* The following are the sample's default 3D attributes (if the sample
is 3D, BASS_SAMPLE_3D is in flags) see BASS_ChannelSet3DAttributes */
DWORD mode3d; // BASS_3DMODE_xxx mode
float mindist; // minimum distance
float maxdist; // maximum distance
DWORD iangle; // angle of inside projection cone
DWORD oangle; // angle of outside projection cone
DWORD outvol; // delta-volume outside the projection cone
/* The following are the defaults used if the sample uses the DirectX 7
voice allocation/management features. */
DWORD vam; // voice allocation/management flags (BASS_VAM_xxx)
DWORD priority; // priority (0=lowest, 0xffffffff=highest)
} BASS_SAMPLE;
#define BASS_SAMPLE_8BITS 1 // 8 bit, else 16 bit
#define BASS_SAMPLE_MONO 2 // mono, else stereo
#define BASS_SAMPLE_LOOP 4 // looped
#define BASS_SAMPLE_3D 8 // 3D functionality enabled
#define BASS_SAMPLE_SOFTWARE 16 // it's NOT using hardware mixing
#define BASS_SAMPLE_MUTEMAX 32 // muted at max distance (3D only)
#define BASS_SAMPLE_VAM 64 // uses the DX7 voice allocation & management
#define BASS_SAMPLE_FX 128 // the DX8 effects are enabled
#define BASS_SAMPLE_OVER_VOL 0x10000 // override lowest volume
#define BASS_SAMPLE_OVER_POS 0x20000 // override longest playing
#define BASS_SAMPLE_OVER_DIST 0x30000 // override furthest from listener (3D only)
#define BASS_MP3_HALFRATE 0x10000 // reduced quality MP3/MP2/MP1 (half sample rate)
#define BASS_MP3_SETPOS 0x20000 // enable pin-point seeking on the MP3/MP2/MP1/OGG
#define BASS_STREAM_AUTOFREE 0x40000 // automatically free the stream when it stop/ends
#define BASS_STREAM_RESTRATE 0x80000 // restrict the download rate of internet file streams
#define BASS_STREAM_BLOCK 0x100000// download/play internet file stream (MPx/OGG) in small blocks
#define BASS_STREAM_DECODE 0x200000// don't play the stream, only decode (BASS_ChannelGetData)
#define BASS_STREAM_META 0x400000// request metadata from a Shoutcast stream
// DX7 voice allocation flags
#define BASS_VAM_HARDWARE 1
/* Play the sample in hardware. If no hardware voices are available then
the "play" call will fail */
#define BASS_VAM_SOFTWARE 2
/* Play the sample in software (ie. non-accelerated). No other VAM flags
may be used together with this flag. */
// DX7 voice management flags
/* These flags enable hardware resource stealing... if the hardware has no
available voices, a currently playing buffer will be stopped to make room for
the new buffer. NOTE: only samples loaded/created with the BASS_SAMPLE_VAM
flag are considered for termination by the DX7 voice management. */
#define BASS_VAM_TERM_TIME 4
/* If there are no free hardware voices, the buffer to be terminated will be
the one with the least time left to play. */
#define BASS_VAM_TERM_DIST 8
/* If there are no free hardware voices, the buffer to be terminated will be
one that was loaded/created with the BASS_SAMPLE_MUTEMAX flag and is beyond
it's max distance. If there are no buffers that match this criteria, then the
"play" call will fail. */
#define BASS_VAM_TERM_PRIO 16
/* If there are no free hardware voices, the buffer to be terminated will be
the one with the lowest priority. */
// 3D vector (for 3D positions/velocities/orientations)
typedef struct {
float x; // +=right, -=left
float y; // +=up, -=down
float z; // +=front, -=behind
} BASS_3DVECTOR;
// 3D channel modes
#define BASS_3DMODE_NORMAL 0
/* normal 3D processing */
#define BASS_3DMODE_RELATIVE 1
/* The channel's 3D position (position/velocity/orientation) are relative to
the listener. When the listener's position/velocity/orientation is changed
with BASS_Set3DPosition, the channel's position relative to the listener does
not change. */
#define BASS_3DMODE_OFF 2
/* Turn off 3D processing on the channel, the sound will be played
in the center. */
// EAX environments, use with BASS_SetEAXParameters
enum
{
EAX_ENVIRONMENT_GENERIC,
EAX_ENVIRONMENT_PADDEDCELL,
EAX_ENVIRONMENT_ROOM,
EAX_ENVIRONMENT_BATHROOM,
EAX_ENVIRONMENT_LIVINGROOM,
EAX_ENVIRONMENT_STONEROOM,
EAX_ENVIRONMENT_AUDITORIUM,
EAX_ENVIRONMENT_CONCERTHALL,
EAX_ENVIRONMENT_CAVE,
EAX_ENVIRONMENT_ARENA,
EAX_ENVIRONMENT_HANGAR,
EAX_ENVIRONMENT_CARPETEDHALLWAY,
EAX_ENVIRONMENT_HALLWAY,
EAX_ENVIRONMENT_STONECORRIDOR,
EAX_ENVIRONMENT_ALLEY,
EAX_ENVIRONMENT_FOREST,
EAX_ENVIRONMENT_CITY,
EAX_ENVIRONMENT_MOUNTAINS,
EAX_ENVIRONMENT_QUARRY,
EAX_ENVIRONMENT_PLAIN,
EAX_ENVIRONMENT_PARKINGLOT,
EAX_ENVIRONMENT_SEWERPIPE,
EAX_ENVIRONMENT_UNDERWATER,
EAX_ENVIRONMENT_DRUGGED,
EAX_ENVIRONMENT_DIZZY,
EAX_ENVIRONMENT_PSYCHOTIC,
EAX_ENVIRONMENT_COUNT // total number of environments
};
// EAX presets, usage: BASS_SetEAXParameters(EAX_PRESET_xxx)
#define EAX_PRESET_GENERIC EAX_ENVIRONMENT_GENERIC,0.5F,1.493F,0.5F
#define EAX_PRESET_PADDEDCELL EAX_ENVIRONMENT_PADDEDCELL,0.25F,0.1F,0.0F
#define EAX_PRESET_ROOM EAX_ENVIRONMENT_ROOM,0.417F,0.4F,0.666F
#define EAX_PRESET_BATHROOM EAX_ENVIRONMENT_BATHROOM,0.653F,1.499F,0.166F
#define EAX_PRESET_LIVINGROOM EAX_ENVIRONMENT_LIVINGROOM,0.208F,0.478F,0.0F
#define EAX_PRESET_STONEROOM EAX_ENVIRONMENT_STONEROOM,0.5F,2.309F,0.888F
#define EAX_PRESET_AUDITORIUM EAX_ENVIRONMENT_AUDITORIUM,0.403F,4.279F,0.5F
#define EAX_PRESET_CONCERTHALL EAX_ENVIRONMENT_CONCERTHALL,0.5F,3.961F,0.5F
#define EAX_PRESET_CAVE EAX_ENVIRONMENT_CAVE,0.5F,2.886F,1.304F
#define EAX_PRESET_ARENA EAX_ENVIRONMENT_ARENA,0.361F,7.284F,0.332F
#define EAX_PRESET_HANGAR EAX_ENVIRONMENT_HANGAR,0.5F,10.0F,0.3F
#define EAX_PRESET_CARPETEDHALLWAY EAX_ENVIRONMENT_CARPETEDHALLWAY,0.153F,0.259F,2.0F
#define EAX_PRESET_HALLWAY EAX_ENVIRONMENT_HALLWAY,0.361F,1.493F,0.0F
#define EAX_PRESET_STONECORRIDOR EAX_ENVIRONMENT_STONECORRIDOR,0.444F,2.697F,0.638F
#define EAX_PRESET_ALLEY EAX_ENVIRONMENT_ALLEY,0.25F,1.752F,0.776F
#define EAX_PRESET_FOREST EAX_ENVIRONMENT_FOREST,0.111F,3.145F,0.472F
#define EAX_PRESET_CITY EAX_ENVIRONMENT_CITY,0.111F,2.767F,0.224F
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?