This repository has been archived by the owner on May 2, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
basscd.h
186 lines (157 loc) · 5.82 KB
/
basscd.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
/*
BASSCD 2.4 C/C++ header file
Copyright (c) 2003-2011 Un4seen Developments Ltd.
See the BASSCD.CHM file for more detailed documentation
*/
#ifndef BASSCD_H
#define BASSCD_H
#include "bass.h"
#if BASSVERSION!=0x204
#error conflicting BASS and BASSCD versions
#endif
#ifdef __cplusplus
extern "C" {
#endif
#ifndef BASSCDDEF
#define BASSCDDEF(f) WINAPI f
#endif
// additional error codes returned by BASS_ErrorGetCode
#define BASS_ERROR_NOCD 12 // no CD in drive
#define BASS_ERROR_CDTRACK 13 // invalid track number
#define BASS_ERROR_NOTAUDIO 17 // not an audio track
// additional BASS_SetConfig options
#define BASS_CONFIG_CD_FREEOLD 0x10200
#define BASS_CONFIG_CD_RETRY 0x10201
#define BASS_CONFIG_CD_AUTOSPEED 0x10202
#define BASS_CONFIG_CD_SKIPERROR 0x10203
// additional BASS_SetConfigPtr options
#define BASS_CONFIG_CD_CDDB_SERVER 0x10204
// BASS_CD_SetInterface options
#define BASS_CD_IF_AUTO 0
#define BASS_CD_IF_SPTI 1
#define BASS_CD_IF_ASPI 2
#define BASS_CD_IF_WIO 3
#define BASS_CD_IF_LINUX 4
typedef struct {
const char *vendor; // manufacturer
const char *product; // model
const char *rev; // revision
int letter; // drive letter
DWORD rwflags; // read/write capability flags
BOOL canopen; // BASS_CD_DOOR_OPEN/CLOSE is supported?
BOOL canlock; // BASS_CD_DOOR_LOCK/UNLOCK is supported?
DWORD maxspeed; // max read speed (KB/s)
DWORD cache; // cache size (KB)
BOOL cdtext; // can read CD-TEXT
} BASS_CD_INFO;
// "rwflag" read capability flags
#define BASS_CD_RWFLAG_READCDR 1
#define BASS_CD_RWFLAG_READCDRW 2
#define BASS_CD_RWFLAG_READCDRW2 4
#define BASS_CD_RWFLAG_READDVD 8
#define BASS_CD_RWFLAG_READDVDR 16
#define BASS_CD_RWFLAG_READDVDRAM 32
#define BASS_CD_RWFLAG_READANALOG 0x10000
#define BASS_CD_RWFLAG_READM2F1 0x100000
#define BASS_CD_RWFLAG_READM2F2 0x200000
#define BASS_CD_RWFLAG_READMULTI 0x400000
#define BASS_CD_RWFLAG_READCDDA 0x1000000
#define BASS_CD_RWFLAG_READCDDASIA 0x2000000
#define BASS_CD_RWFLAG_READSUBCHAN 0x4000000
#define BASS_CD_RWFLAG_READSUBCHANDI 0x8000000
#define BASS_CD_RWFLAG_READC2 0x10000000
#define BASS_CD_RWFLAG_READISRC 0x20000000
#define BASS_CD_RWFLAG_READUPC 0x40000000
// additional BASS_CD_StreamCreate/File flags
#define BASS_CD_SUBCHANNEL 0x200
#define BASS_CD_SUBCHANNEL_NOHW 0x400
#define BASS_CD_C2ERRORS 0x800
// additional CD sync types
#define BASS_SYNC_CD_ERROR 1000
#define BASS_SYNC_CD_SPEED 1002
// BASS_CD_Door actions
#define BASS_CD_DOOR_CLOSE 0
#define BASS_CD_DOOR_OPEN 1
#define BASS_CD_DOOR_LOCK 2
#define BASS_CD_DOOR_UNLOCK 3
// BASS_CD_GetID flags
#define BASS_CDID_UPC 1
#define BASS_CDID_CDDB 2
#define BASS_CDID_CDDB2 3
#define BASS_CDID_TEXT 4
#define BASS_CDID_CDPLAYER 5
#define BASS_CDID_MUSICBRAINZ 6
#define BASS_CDID_ISRC 0x100 // + track #
#define BASS_CDID_CDDB_QUERY 0x200
#define BASS_CDID_CDDB_READ 0x201 // + entry #
#define BASS_CDID_CDDB_READ_CACHE 0x2FF
// BASS_CD_GetTOC modes
#define BASS_CD_TOC_TIME 0x100
// TOC structures
typedef struct
{
BYTE res1;
BYTE adrcon; // ADR + control
BYTE track; // track number
BYTE res2;
union {
DWORD lba; // start address (logical block address)
BYTE hmsf[4]; // start address (hours/minutes/seconds/frames)
};
} BASS_CD_TOC_TRACK;
typedef struct
{
WORD size; // size of TOC
BYTE first; // first track
BYTE last; // last track
BASS_CD_TOC_TRACK tracks[100]; // up to 100 tracks
} BASS_CD_TOC;
// BASS_CD_TOC_TRACK "adrcon" flags
#define BASS_CD_TOC_CON_PRE 1
#define BASS_CD_TOC_CON_COPY 2
#define BASS_CD_TOC_CON_DATA 4
typedef void (CALLBACK CDDATAPROC)(HSTREAM handle, int pos, DWORD type, const void *buffer, DWORD length, void *user);
/* Sub-channel/C2 reading callback function.
handle : The CD stream handle
pos : The position of the data
type : The type of data (BASS_CD_DATA_xxx)
buffer : Buffer containing the data.
length : Number of bytes in the buffer
user : The 'user' parameter value given when calling BASS_CD_StreamCreate/FileEx */
// CDDATAPROC "type" values
#define BASS_CD_DATA_SUBCHANNEL 0
#define BASS_CD_DATA_C2 1
// BASS_CHANNELINFO type
#define BASS_CTYPE_STREAM_CD 0x10200
DWORD BASSCDDEF(BASS_CD_SetInterface)(DWORD iface);
BOOL BASSCDDEF(BASS_CD_GetInfo)(DWORD drive, BASS_CD_INFO *info);
BOOL BASSCDDEF(BASS_CD_Door)(DWORD drive, DWORD action);
BOOL BASSCDDEF(BASS_CD_DoorIsOpen)(DWORD drive);
BOOL BASSCDDEF(BASS_CD_DoorIsLocked)(DWORD drive);
BOOL BASSCDDEF(BASS_CD_IsReady)(DWORD drive);
DWORD BASSCDDEF(BASS_CD_GetTracks)(DWORD drive);
DWORD BASSCDDEF(BASS_CD_GetTrackLength)(DWORD drive, DWORD track);
DWORD BASSCDDEF(BASS_CD_GetTrackPregap)(DWORD drive, DWORD track);
BOOL BASSCDDEF(BASS_CD_GetTOC)(DWORD drive, DWORD mode, BASS_CD_TOC *toc);
const char *BASSCDDEF(BASS_CD_GetID)(DWORD drive, DWORD id);
DWORD BASSCDDEF(BASS_CD_GetSpeed)(DWORD drive);
BOOL BASSCDDEF(BASS_CD_SetSpeed)(DWORD drive, DWORD speed);
DWORD BASSCDDEF(BASS_CD_GetCache)(DWORD drive);
BOOL BASSCDDEF(BASS_CD_SetCache)(DWORD drive, BOOL enable);
BOOL BASSCDDEF(BASS_CD_SetOffset)(DWORD drive, int offset);
BOOL BASSCDDEF(BASS_CD_Release)(DWORD drive);
HSTREAM BASSCDDEF(BASS_CD_StreamCreate)(DWORD drive, DWORD track, DWORD flags);
HSTREAM BASSCDDEF(BASS_CD_StreamCreateFile)(const char *file, DWORD flags);
HSTREAM BASSCDDEF(BASS_CD_StreamCreateEx)(DWORD drive, DWORD track, DWORD flags, CDDATAPROC *proc, void *user);
HSTREAM BASSCDDEF(BASS_CD_StreamCreateFileEx)(const char *file, DWORD flags, CDDATAPROC *proc, void *user);
DWORD BASSCDDEF(BASS_CD_StreamGetTrack)(HSTREAM handle);
BOOL BASSCDDEF(BASS_CD_StreamSetTrack)(HSTREAM handle, DWORD track);
BOOL BASSCDDEF(BASS_CD_Analog_Play)(DWORD drive, DWORD track, DWORD pos);
DWORD BASSCDDEF(BASS_CD_Analog_PlayFile)(const char *file, DWORD pos);
BOOL BASSCDDEF(BASS_CD_Analog_Stop)(DWORD drive);
DWORD BASSCDDEF(BASS_CD_Analog_IsActive)(DWORD drive);
DWORD BASSCDDEF(BASS_CD_Analog_GetPosition)(DWORD drive);
#ifdef __cplusplus
}
#endif
#endif