File:  [WindowsNT SDKs] / ntddk / src / mmedia / soundlib / inc / devices.h
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs
Thu Aug 9 18:31:12 2018 UTC (7 years, 9 months ago) by root
Branches: msft, MAIN
CVS tags: ntddk-nov-1993, HEAD
Microsoft Windows NT Build 511 (DDK SDK) 11-01-1993

/*++ BUILD Version: 0001    // Increment this if a change has global effects


Copyright (c) 1992  Microsoft Corporation

Module Name:

    devices.h

Abstract:

    This include file defines constants and types for
    sound devices

Author:

    Robin Speed (RobinSp) 20-Oct-92

Revision History:

--*/

//
// Device type flags used in the local info structure
//

#define WAVE_IN             0x01    // Wave in device
#define WAVE_OUT            0x02    // Wave out device
#define MIDI_IN             0x03    // Midi in device
#define MIDI_OUT            0x04    // Midi out device
#define AUX_DEVICE          0x05    // aux device

//
// Wave specific constants
//

#define WAVE_DEFAULT_RATE 11025        // everyone should be able to do this
#define WAVE_DEFAULT_BITS_PER_SAMPLE 8 //        ditto

//
// Predeclare device info
//

struct _LOCAL_DEVICE_INFO;

//
// Device specific dispatch and volume setting routine definitions
//
typedef NTSTATUS SOUND_DISPATCH_ROUTINE(struct _LOCAL_DEVICE_INFO *, PIRP, PIO_STACK_LOCATION);
typedef VOID SOUND_HW_SET_VOLUME_ROUTINE(struct _LOCAL_DEVICE_INFO *);

//
// Each device has a 'device exclusion' routine which is called in 4 places :
//    1. When the device is opened for write	          SoundExcludeOpen
//    2. When the device is closed for write              SoundExcludeClose
//    3. When the device is entered while open for write  SoundExcludeEnter
//    4. When a request is complete while open for write  SoundExcludeLeave
//

typedef enum {
	SoundExcludeOpen,
	SoundExcludeClose,
	SoundExcludeEnter,
	SoundExcludeLeave,
	SoundExcludeQueryOpen
} SOUND_EXCLUDE_CODE;

//
// Mutual exclusion - takes arguments :
//
//   Local device info - device data
//   Exclusion code - sound exclusion code
//
// This routine localises all the device mutual exclusion and copes
// with inter-device dependencies (eg if hardware is shared etc)
//
//   SoundExcludeEnter - Serialises access to all device enter whether
//           or not the device is open for write (use eg a mutant).
//
//           Typically enters a mutex
//
//   SoundExcludeLeave - Exit serialization.
//
//   SoundExcludeOpen - Sets device in use - fails if called a second time.
//           Allows driver to prevent mutually exclusive devices from
//           being opened.
//
//           Typically sets an 'in use' field
//
//   SoundExcludeClose - Frees device
//
//   SoundExcludeQueryOpen - test if open - mainly for ASSERTs
//

typedef BOOLEAN SOUND_EXCLUDE_ROUTINE(struct _LOCAL_DEVICE_INFO *,
                                      SOUND_EXCLUDE_CODE);

//
// Device initializeation data
//

typedef struct {
    PWSTR LeftVolumeName, RightVolumeName;  // Registry key value names
    ULONG DefaultVolume;                    // What to use if no value in
                                            // the registry
    ULONG Type;                             // Device type for IoCreateDevice
    ULONG DeviceType;                       // Internal type
    char  Key[4];                           // Debugging key for header
    PWSTR PrototypeName;                    // Name to use for device
                                            // - eg L"WaveIn"
    PIO_DPC_ROUTINE DeferredRoutine;        // Dpc routine

	SOUND_EXCLUDE_ROUTINE *ExclusionRoutine;// Mutual exclusion
    SOUND_DISPATCH_ROUTINE *DispatchRoutine;// Create, Cleanup, Read, Write,
                                            // Ioctl
    SOUND_DISPATCH_ROUTINE *DevCapsRoutine; // Device Caps
    SOUND_HW_SET_VOLUME_ROUTINE *HwSetVolume; // Set device volume
    ULONG IoMethod;                         // DO_DIRECT_IO etc
} SOUND_DEVICE_INIT, *PSOUND_DEVICE_INIT;


//
// driver local data structure specific to each device object
// sharead by both input and output devices
//

typedef struct _LOCAL_DEVICE_INFO {

    // static items not requiring use of the spin lock

    ULONG           Key;
#define LDI_WAVE_IN_KEY     (*(ULONG *)"LDWi")
#define LDI_WAVE_OUT_KEY    (*(ULONG *)"LDWo")
#define LDI_MIDI_IN_KEY     (*(ULONG *)"LDMi")
#define LDI_MIDI_OUT_KEY    (*(ULONG *)"LDMo")
#define LDI_AUX_KEY         (*(ULONG *)"LDAx")

    PVOID           pGlobalInfo;        // pointer to the shared info
    UCHAR           DeviceType;         // in or out
    UCHAR           DeviceNumber;       // 0, 1, ...
    UCHAR           DeviceIndex;
    UCHAR           CreationFlags;      // Various flags :
#define SOUND_CREATION_NO_NAME_RANGE ((UCHAR)0x01)
                                        //   Use name, don't append 0, 1...
#define SOUND_CREATION_NO_VOLUME     ((UCHAR)0x02)
                                        //   Volume setting not supported

    BOOLEAN         PreventVolumeSetting; // Allow shared volume setting

    WAVE_DD_VOLUME  Volume;             // Volume setting for this device
#ifdef VOLUME_NOTIFY
    LIST_ENTRY      VolumeQueue;        // Queue of people waiting for
                                        // IOCTL_SOUND_GET_CHANGED_VOLUME
                                        // to complete.
#endif // VOLUME_NOTIFY
#ifdef MASTERVOLUME
    BOOLEAN         MasterVolume;       // This is the master volume control
#endif // MASTERVOLUME
                                        // simulated in software.
    BOOLEAN         VolumeChanged;      // Volume setting has changed
    PVOID           DeviceSpecificData; // Data depending on device type
    PVOID           HwContext;          // Hardware dependent data
    //
    // The state variable is protected by the mutant only - it
    // should NOT be set in the Dpc routine.  It is therefore
    // essentially always valid
    //
    ULONG           State;              // STOPPED etc.
	PSOUND_DEVICE_INIT
	               DeviceInit;          // Point back to initialization data


} LOCAL_DEVICE_INFO, *PLOCAL_DEVICE_INFO;


SOUND_DISPATCH_ROUTINE
    SoundAuxDispatch,
    SoundMidiDispatch,
    SoundWaveDispatch,
    SoundIoctlGetPosition,
    SoundWaveOutGetCaps,
    SoundWaveInGetCaps,
    SoundIoctlSetState,
    SoundIoctlGetVolume,
    SoundIoctlGetChangedVolume,
    SoundIoctlSetVolume,
    SoundIoctlSetDebugLevel;


VOID
SoundWaveDeferred(
    PKDPC pDpc,
    PDEVICE_OBJECT pDeviceObject,
    PIRP pIrp,
    PVOID Context
);

VOID
SoundMidiInDeferred(
    IN     PKDPC pDpc,
    IN     PDEVICE_OBJECT pDeviceObject,
    IN OUT PIRP pIrpDeferred,
    IN OUT PVOID Context
);

NTSTATUS
SoundDispatch(
    IN    PDEVICE_OBJECT pDO,
    IN    PIRP pIrp
);
NTSTATUS
SoundSetShareAccess(
    IN OUT PLOCAL_DEVICE_INFO pLDI,
   IN     PIO_STACK_LOCATION IrpStack
);

SOUND_HW_SET_VOLUME_ROUTINE SoundNoVolume;

VOID
SoundSaveDeviceVolume(
   PLOCAL_DEVICE_INFO pLDI,
   PWSTR KeyName
);



unix.superglobalmegacorp.com

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