Home | History | Annotate | Download | only in ddk
      1 /*
      2     ReactOS Sound System
      3     NT4 Multimedia Audio Support (ntddsnd.h)
      4 
      5     This file is in the public domain.
      6 
      7     Author:
      8         Andrew Greenwood (andrew.greenwood (at) silverblade.co.uk)
      9 
     10     History:
     11         24 May 2008 - Created
     12         2 July 2008 - Added device names as seen from user-mode
     13         5 July 2008 - Added macros for checking device type
     14         14 Feb 2009 - Added base control codes for nonstandard extensions
     15 
     16     This file contains definitions and structures for Windows NT4 style
     17     multimedia drivers. The NT4 DDK has these split across multiple header
     18     files: NTDDSND.H, NTDDWAVE.H, NTDDMIDI.H, NTDDMIX.H and NTDDAUX.H
     19 
     20     Should you have an unstoppable urge to build an NT4 multimedia driver
     21     against these headers, just create the other files listed above and make
     22     them #include this one.
     23 
     24     There are also a number of additional enhancements within this file
     25     not found in the originals (such as DOS device name strings and device
     26     type IDs).
     27 */
     28 
     29 #ifndef NTDDSND_H
     30 #define NTDDSND_H
     31 
     32 #define SOUND_MAX_DEVICES           100
     33 #define SOUND_MAX_DEVICE_NAME       80
     34 
     35 
     36 /*
     37     Base control codes
     38 */
     39 
     40 #define IOCTL_SOUND_BASE    FILE_DEVICE_SOUND
     41 #define IOCTL_WAVE_BASE     0x0000
     42 #define IOCTL_MIDI_BASE     0x0080
     43 #define IOCTL_AUX_BASE      0x0100
     44 #define IOCTL_MIX_BASE      0x0180
     45 
     46 
     47 /*
     48     Helper macros for defining control codes
     49 */
     50 
     51 #define WAVE_CTL_CODE(subcode, iomethod, access) \
     52     CTL_CODE(FILE_DEVICE_SOUND, IOCTL_WAVE_BASE + subcode, iomethod, access)
     53 
     54 #define MIDI_CTL_CODE(subcode, iomethod, access) \
     55     CTL_CODE(FILE_DEVICE_SOUND, IOCTL_MIDI_BASE + subcode, iomethod, access)
     56 
     57 #define MIX_CTL_CODE(subcode, iomethod, access) \
     58     CTL_CODE(FILE_DEVICE_SOUND, IOCTL_MIX_BASE + subcode, iomethod, access)
     59 
     60 #define AUX_CTL_CODE(subcode, iomethod, access) \
     61     CTL_CODE(FILE_DEVICE_SOUND, IOCTL_AUX_BASE + subcode, iomethod, access)
     62 
     63 
     64 /*
     65     Wave device control codes
     66 */
     67 
     68 #define IOCTL_WAVE_QUERY_FORMAT \
     69     WAVE_CTL_CODE(0x0001, METHOD_BUFFERED, FILE_READ_ACCESS)
     70 
     71 #define IOCTL_WAVE_SET_FORMAT \
     72     WAVE_CTL_CODE(0x0002, METHOD_BUFFERED, FILE_WRITE_ACCESS)
     73 
     74 #define IOCTL_WAVE_GET_CAPABILITIES \
     75     WAVE_CTL_CODE(0x0003, METHOD_BUFFERED, FILE_READ_ACCESS)
     76 
     77 #define IOCTL_WAVE_SET_STATE \
     78     WAVE_CTL_CODE(0x0004, METHOD_BUFFERED, FILE_WRITE_ACCESS)
     79 
     80 #define IOCTL_WAVE_GET_STATE \
     81     WAVE_CTL_CODE(0x0005, METHOD_BUFFERED, FILE_WRITE_ACCESS)
     82 
     83 #define IOCTL_WAVE_GET_POSITION \
     84     WAVE_CTL_CODE(0x0006, METHOD_BUFFERED, FILE_WRITE_ACCESS)
     85 
     86 #define IOCTL_WAVE_SET_VOLUME \
     87     WAVE_CTL_CODE(0x0007, METHOD_BUFFERED, FILE_READ_ACCESS)
     88 
     89 #define IOCTL_WAVE_GET_VOLUME \
     90     WAVE_CTL_CODE(0x0008, METHOD_BUFFERED, FILE_READ_ACCESS)
     91 
     92 #define IOCTL_WAVE_SET_PITCH \
     93     WAVE_CTL_CODE(0x0009, METHOD_BUFFERED, FILE_WRITE_ACCESS)
     94 
     95 #define IOCTL_WAVE_GET_PITCH \
     96     WAVE_CTL_CODE(0x000A, METHOD_BUFFERED, FILE_WRITE_ACCESS)
     97 
     98 #define IOCTL_WAVE_SET_PLAYBACK_RATE \
     99     WAVE_CTL_CODE(0x000B, METHOD_BUFFERED, FILE_WRITE_ACCESS)
    100 
    101 #define IOCTL_WAVE_GET_PLAYBACK_RATE \
    102     WAVE_CTL_CODE(0x000C, METHOD_BUFFERED, FILE_WRITE_ACCESS)
    103 
    104 #define IOCTL_WAVE_PLAY \
    105     WAVE_CTL_CODE(0x000D, METHOD_IN_DIRECT, FILE_WRITE_ACCESS)
    106 
    107 #define IOCTL_WAVE_RECORD \
    108     WAVE_CTL_CODE(0x000E, METHOD_OUT_DIRECT, FILE_WRITE_ACCESS)
    109 
    110 #define IOCTL_WAVE_BREAK_LOOP \
    111     WAVE_CTL_CODE(0x000F, METHOD_BUFFERED, FILE_WRITE_ACCESS)
    112 
    113 #define IOCTL_WAVE_SET_LOW_PRIORITY \
    114     WAVE_CTL_CODE(0x0010, METHOD_BUFFERED, FILE_WRITE_ACCESS)
    115 
    116 #if DBG
    117 /* Debug-only control code */
    118 #define IOCTL_WAVE_SET_DEBUG_LEVEL \
    119         WAVE_CTL_CODE(0x0040, METHOD_BUFFERED, FILE_READ_ACCESS)
    120 #endif
    121 
    122 
    123 /*
    124     MIDI device control codes
    125 */
    126 
    127 #define IOCTL_MIDI_GET_CAPABILITIES \
    128     MIDI_CTL_CODE(0x0001, METHOD_BUFFERED, FILE_READ_ACCESS)
    129 
    130 #define IOCTL_MIDI_SET_STATE \
    131     MIDI_CTL_CODE(0x0002, METHOD_BUFFERED, FILE_WRITE_ACCESS)
    132 
    133 #define IOCTL_MIDI_GET_STATE \
    134     MIDI_CTL_CODE(0x0003, METHOD_BUFFERED, FILE_WRITE_ACCESS)
    135 
    136 #define IOCTL_MIDI_SET_VOLUME \
    137     MIDI_CTL_CODE(0x0004, METHOD_BUFFERED, FILE_READ_ACCESS)
    138 
    139 #define IOCTL_MIDI_GET_VOLUME \
    140     MIDI_CTL_CODE(0x0005, METHOD_BUFFERED, FILE_READ_ACCESS)
    141 
    142 #define IOCTL_MIDI_PLAY \
    143     MIDI_CTL_CODE(0x0006, METHOD_NEITHER, FILE_WRITE_ACCESS)
    144 
    145 #define IOCTL_MIDI_RECORD \
    146     MIDI_CTL_CODE(0x0007, METHOD_BUFFERED, FILE_WRITE_ACCESS)
    147 
    148 #define IOCTL_MIDI_CACHE_PATCHES \
    149     MIDI_CTL_CODE(0x0008, METHOD_BUFFERED, FILE_WRITE_ACCESS)
    150 
    151 #define IOCTL_MIDI_CACHE_DRUM_PATCHES \
    152     MIDI_CTL_CODE(0x0009, METHOD_BUFFERED, FILE_WRITE_ACCESS)
    153 
    154 #if DBG
    155 /* Debug-only control code */
    156 #define IOCTL_MIDI_SET_DEBUG_LEVEL \
    157         WAVE_CTL_CODE(0x0040, METHOD_BUFFERED, FILE_READ_ACCESS)
    158 #endif
    159 
    160 
    161 /*
    162     Mixer device control codes
    163 */
    164 
    165 #define IOCTL_MIX_GET_CONFIGURATION \
    166     MIX_CTL_CODE(0x0001, METHOD_BUFFERED, FILE_READ_ACCESS)
    167 
    168 #define IOCTL_MIX_GET_CONTROL_DATA \
    169     MIX_CTL_CODE(0x0002, METHOD_BUFFERED, FILE_READ_ACCESS)
    170 
    171 #define IOCTL_MIX_GET_LINE_DATA \
    172     MIX_CTL_CODE(0x0003, METHOD_BUFFERED, FILE_READ_ACCESS)
    173 
    174 #define IOCTL_MIX_REQUEST_NOTIFY \
    175     MIX_CTL_CODE(0x0004, METHOD_BUFFERED, FILE_READ_ACCESS)
    176 
    177 
    178 /*
    179     Auxiliary device control codes
    180 */
    181 
    182 #define IOCTL_AUX_GET_CAPABILITIES \
    183     AUX_CTL_CODE(0x0001, METHOD_BUFFERED, FILE_READ_ACCESS)
    184 
    185 #define IOCTL_AUX_SET_VOLUME \
    186     AUX_CTL_CODE(0x0002, METHOD_BUFFERED, FILE_READ_ACCESS)
    187 
    188 #define IOCTL_AUX_GET_VOLUME \
    189     AUX_CTL_CODE(0x0003, METHOD_BUFFERED, FILE_READ_ACCESS)
    190 
    191 #define IOCTL_SOUND_GET_CHANGED_VOLUME \
    192     AUX_CTL_CODE(0x0004, METHOD_BUFFERED, FILE_READ_ACCESS)
    193 
    194 
    195 /*
    196     Wave structures & states
    197 */
    198 
    199 #define WAVE_DD_MAX_VOLUME      0xFFFFFFFF
    200 
    201 typedef struct _WAVE_DD_VOLUME
    202 {
    203     ULONG Left;
    204     ULONG Right;
    205 } WAVE_DD_VOLUME, *PWAVE_DD_VOLUME;
    206 
    207 typedef struct _WAVE_DD_PITCH
    208 {
    209     ULONG Pitch;
    210 } WAVE_DD_PITCH, *PWAVE_DD_PITCH;
    211 
    212 typedef struct _WAVE_DD_PLAYBACK_RATE
    213 {
    214     ULONG Rate;
    215 } WAVE_DD_PLAYBACK_RATE, *PWAVE_DD_PLAYBACK_RATE;
    216 
    217 /* IOCTL_WAVE_SET_STATE commands */
    218 #define WAVE_DD_STOP        0x0001
    219 #define WAVE_DD_PLAY        0x0002
    220 #define WAVE_DD_RECORD      0x0003
    221 #define WAVE_DD_RESET       0x0004
    222 
    223 /* IOCTL_WAVE_GET_STATE responses */
    224 #define WAVE_DD_IDLE        0x0000
    225 #define WAVE_DD_STOPPED     0x0001
    226 #define WAVE_DD_PLAYING     0x0002
    227 #define WAVE_DD_RECORDING   0x0003
    228 
    229 
    230 /*
    231     MIDI structures & states
    232 */
    233 
    234 typedef struct _MIDI_DD_INPUT_DATA
    235 {
    236     LARGE_INTEGER Time;
    237     UCHAR Data[sizeof(ULONG)];
    238 } MIDI_DD_INPUT_DATA, *PMIDI_DD_INPUT_DATA;
    239 
    240 typedef struct _MIDI_DD_VOLUME
    241 {
    242     ULONG Left;
    243     ULONG Right;
    244 } MIDI_DD_VOLUME, *PMIDI_DD_VOLUME;
    245 
    246 typedef struct _MIDI_DD_CACHE_PATCHES
    247 {
    248     ULONG Bank;
    249     ULONG Flags;
    250     ULONG Patches[128];
    251 } MIDI_DD_CACHE_PATCHES, *PMIDI_DD_CACHE_PATCHES;
    252 
    253 typedef struct _MIDI_DD_CACHE_DRUM_PATCHES
    254 {
    255     ULONG Patch;
    256     ULONG Flags;
    257     ULONG DrumPatches[128];
    258 } MIDI_DD_CACHE_DRUM_PATCHES, *PMIDI_DD_CACHE_DRUM_PATCHES;
    259 
    260 /* IOCTL_MIDI_SET_STATE commands */
    261 #define MIDI_DD_STOP        0x0001
    262 #define MIDI_DD_PLAY        0x0002
    263 #define MIDI_DD_RECORD      0x0003
    264 #define MIDI_DD_RESET       0x0004
    265 
    266 /* IOCTL_MIDI_GET_STATE responses */
    267 #define MIDI_DD_IDLE        0x0000
    268 #define MIDI_DD_STOPPED     0x0001
    269 #define MIDI_DD_PLAYING     0x0002
    270 #define MIDI_DD_RECORDING   0x0003
    271 
    272 
    273 /*
    274     Mixer structures
    275     TODO: This is incomplete (see NTDDMIX.H in NT4 DDK)
    276 */
    277 
    278 typedef struct _MIXER_DD_READ_DATA
    279 {
    280     ULONG Id;
    281 } MIXER_DD_READ_DATA, *PMIXER_DD_READ_DATA;
    282 
    283 typedef struct _MIXER_DD_LINE_DATA
    284 {
    285     ULONG fdwLine;
    286 } MIXER_DD_LINE_DATA, *PMIXER_DD_LINE_DATA;
    287 
    288 
    289 /*
    290     Auxiliary structures
    291 */
    292 
    293 #define AUX_DD_MAX_VOLUME   0xFFFFFFFF
    294 
    295 typedef struct _AUX_DD_VOLUME
    296 {
    297     ULONG Left;
    298     ULONG Right;
    299 } AUX_DD_VOLUME, *PAUX_DD_VOLUME;
    300 
    301 
    302 #endif /* NTDDSND_H */
    303 
    304