Annotation of ntddk/src/mmedia/soundlib/inc/devices.h, revision 1.1.1.1

1.1       root        1: /*++ BUILD Version: 0001    // Increment this if a change has global effects
                      2: 
                      3: 
                      4: Copyright (c) 1992  Microsoft Corporation
                      5: 
                      6: Module Name:
                      7: 
                      8:     devices.h
                      9: 
                     10: Abstract:
                     11: 
                     12:     This include file defines constants and types for
                     13:     sound devices
                     14: 
                     15: Author:
                     16: 
                     17:     Robin Speed (RobinSp) 20-Oct-92
                     18: 
                     19: Revision History:
                     20: 
                     21: --*/
                     22: 
                     23: //
                     24: // Device type flags used in the local info structure
                     25: //
                     26: 
                     27: #define WAVE_IN             0x01    // Wave in device
                     28: #define WAVE_OUT            0x02    // Wave out device
                     29: #define MIDI_IN             0x03    // Midi in device
                     30: #define MIDI_OUT            0x04    // Midi out device
                     31: #define AUX_DEVICE          0x05    // aux device
                     32: 
                     33: //
                     34: // Wave specific constants
                     35: //
                     36: 
                     37: #define WAVE_DEFAULT_RATE 11025        // everyone should be able to do this
                     38: #define WAVE_DEFAULT_BITS_PER_SAMPLE 8 //        ditto
                     39: 
                     40: //
                     41: // Predeclare device info
                     42: //
                     43: 
                     44: struct _LOCAL_DEVICE_INFO;
                     45: 
                     46: //
                     47: // Device specific dispatch and volume setting routine definitions
                     48: //
                     49: typedef NTSTATUS SOUND_DISPATCH_ROUTINE(struct _LOCAL_DEVICE_INFO *, PIRP, PIO_STACK_LOCATION);
                     50: typedef VOID SOUND_HW_SET_VOLUME_ROUTINE(struct _LOCAL_DEVICE_INFO *);
                     51: 
                     52: //
                     53: // Each device has a 'device exclusion' routine which is called in 4 places :
                     54: //    1. When the device is opened for write             SoundExcludeOpen
                     55: //    2. When the device is closed for write              SoundExcludeClose
                     56: //    3. When the device is entered while open for write  SoundExcludeEnter
                     57: //    4. When a request is complete while open for write  SoundExcludeLeave
                     58: //
                     59: 
                     60: typedef enum {
                     61:        SoundExcludeOpen,
                     62:        SoundExcludeClose,
                     63:        SoundExcludeEnter,
                     64:        SoundExcludeLeave,
                     65:        SoundExcludeQueryOpen
                     66: } SOUND_EXCLUDE_CODE;
                     67: 
                     68: //
                     69: // Mutual exclusion - takes arguments :
                     70: //
                     71: //   Local device info - device data
                     72: //   Exclusion code - sound exclusion code
                     73: //
                     74: // This routine localises all the device mutual exclusion and copes
                     75: // with inter-device dependencies (eg if hardware is shared etc)
                     76: //
                     77: //   SoundExcludeEnter - Serialises access to all device enter whether
                     78: //           or not the device is open for write (use eg a mutant).
                     79: //
                     80: //           Typically enters a mutex
                     81: //
                     82: //   SoundExcludeLeave - Exit serialization.
                     83: //
                     84: //   SoundExcludeOpen - Sets device in use - fails if called a second time.
                     85: //           Allows driver to prevent mutually exclusive devices from
                     86: //           being opened.
                     87: //
                     88: //           Typically sets an 'in use' field
                     89: //
                     90: //   SoundExcludeClose - Frees device
                     91: //
                     92: //   SoundExcludeQueryOpen - test if open - mainly for ASSERTs
                     93: //
                     94: 
                     95: typedef BOOLEAN SOUND_EXCLUDE_ROUTINE(struct _LOCAL_DEVICE_INFO *,
                     96:                                       SOUND_EXCLUDE_CODE);
                     97: 
                     98: //
                     99: // Device initializeation data
                    100: //
                    101: 
                    102: typedef struct {
                    103:     PWSTR LeftVolumeName, RightVolumeName;  // Registry key value names
                    104:     ULONG DefaultVolume;                    // What to use if no value in
                    105:                                             // the registry
                    106:     ULONG Type;                             // Device type for IoCreateDevice
                    107:     ULONG DeviceType;                       // Internal type
                    108:     char  Key[4];                           // Debugging key for header
                    109:     PWSTR PrototypeName;                    // Name to use for device
                    110:                                             // - eg L"WaveIn"
                    111:     PIO_DPC_ROUTINE DeferredRoutine;        // Dpc routine
                    112: 
                    113:        SOUND_EXCLUDE_ROUTINE *ExclusionRoutine;// Mutual exclusion
                    114:     SOUND_DISPATCH_ROUTINE *DispatchRoutine;// Create, Cleanup, Read, Write,
                    115:                                             // Ioctl
                    116:     SOUND_DISPATCH_ROUTINE *DevCapsRoutine; // Device Caps
                    117:     SOUND_HW_SET_VOLUME_ROUTINE *HwSetVolume; // Set device volume
                    118:     ULONG IoMethod;                         // DO_DIRECT_IO etc
                    119: } SOUND_DEVICE_INIT, *PSOUND_DEVICE_INIT;
                    120: 
                    121: 
                    122: //
                    123: // driver local data structure specific to each device object
                    124: // sharead by both input and output devices
                    125: //
                    126: 
                    127: typedef struct _LOCAL_DEVICE_INFO {
                    128: 
                    129:     // static items not requiring use of the spin lock
                    130: 
                    131:     ULONG           Key;
                    132: #define LDI_WAVE_IN_KEY     (*(ULONG *)"LDWi")
                    133: #define LDI_WAVE_OUT_KEY    (*(ULONG *)"LDWo")
                    134: #define LDI_MIDI_IN_KEY     (*(ULONG *)"LDMi")
                    135: #define LDI_MIDI_OUT_KEY    (*(ULONG *)"LDMo")
                    136: #define LDI_AUX_KEY         (*(ULONG *)"LDAx")
                    137: 
                    138:     PVOID           pGlobalInfo;        // pointer to the shared info
                    139:     UCHAR           DeviceType;         // in or out
                    140:     UCHAR           DeviceNumber;       // 0, 1, ...
                    141:     UCHAR           DeviceIndex;
                    142:     UCHAR           CreationFlags;      // Various flags :
                    143: #define SOUND_CREATION_NO_NAME_RANGE ((UCHAR)0x01)
                    144:                                         //   Use name, don't append 0, 1...
                    145: #define SOUND_CREATION_NO_VOLUME     ((UCHAR)0x02)
                    146:                                         //   Volume setting not supported
                    147: 
                    148:     BOOLEAN         PreventVolumeSetting; // Allow shared volume setting
                    149: 
                    150:     WAVE_DD_VOLUME  Volume;             // Volume setting for this device
                    151: #ifdef VOLUME_NOTIFY
                    152:     LIST_ENTRY      VolumeQueue;        // Queue of people waiting for
                    153:                                         // IOCTL_SOUND_GET_CHANGED_VOLUME
                    154:                                         // to complete.
                    155: #endif // VOLUME_NOTIFY
                    156: #ifdef MASTERVOLUME
                    157:     BOOLEAN         MasterVolume;       // This is the master volume control
                    158: #endif // MASTERVOLUME
                    159:                                         // simulated in software.
                    160:     BOOLEAN         VolumeChanged;      // Volume setting has changed
                    161:     PVOID           DeviceSpecificData; // Data depending on device type
                    162:     PVOID           HwContext;          // Hardware dependent data
                    163:     //
                    164:     // The state variable is protected by the mutant only - it
                    165:     // should NOT be set in the Dpc routine.  It is therefore
                    166:     // essentially always valid
                    167:     //
                    168:     ULONG           State;              // STOPPED etc.
                    169:        PSOUND_DEVICE_INIT
                    170:                       DeviceInit;          // Point back to initialization data
                    171: 
                    172: 
                    173: } LOCAL_DEVICE_INFO, *PLOCAL_DEVICE_INFO;
                    174: 
                    175: 
                    176: SOUND_DISPATCH_ROUTINE
                    177:     SoundAuxDispatch,
                    178:     SoundMidiDispatch,
                    179:     SoundWaveDispatch,
                    180:     SoundIoctlGetPosition,
                    181:     SoundWaveOutGetCaps,
                    182:     SoundWaveInGetCaps,
                    183:     SoundIoctlSetState,
                    184:     SoundIoctlGetVolume,
                    185:     SoundIoctlGetChangedVolume,
                    186:     SoundIoctlSetVolume,
                    187:     SoundIoctlSetDebugLevel;
                    188: 
                    189: 
                    190: VOID
                    191: SoundWaveDeferred(
                    192:     PKDPC pDpc,
                    193:     PDEVICE_OBJECT pDeviceObject,
                    194:     PIRP pIrp,
                    195:     PVOID Context
                    196: );
                    197: 
                    198: VOID
                    199: SoundMidiInDeferred(
                    200:     IN     PKDPC pDpc,
                    201:     IN     PDEVICE_OBJECT pDeviceObject,
                    202:     IN OUT PIRP pIrpDeferred,
                    203:     IN OUT PVOID Context
                    204: );
                    205: 
                    206: NTSTATUS
                    207: SoundDispatch(
                    208:     IN    PDEVICE_OBJECT pDO,
                    209:     IN    PIRP pIrp
                    210: );
                    211: NTSTATUS
                    212: SoundSetShareAccess(
                    213:     IN OUT PLOCAL_DEVICE_INFO pLDI,
                    214:    IN     PIO_STACK_LOCATION IrpStack
                    215: );
                    216: 
                    217: SOUND_HW_SET_VOLUME_ROUTINE SoundNoVolume;
                    218: 
                    219: VOID
                    220: SoundSaveDeviceVolume(
                    221:    PLOCAL_DEVICE_INFO pLDI,
                    222:    PWSTR KeyName
                    223: );
                    224: 
                    225: 

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.