none
Allocating Audio buffer [Windows driver] RRS feed

  • Question

  • I want to use the following IMiniportWaveRTStream::AllocateAudioBuffer method which is defined in portcls.h. 

        NTSTATUS AllocateAudioBuffer(
          [in]   ULONG               RequestedSize,
          [out]  PMDL                *AudioBufferMdl,
          [out]  ULONG               *ActualSize,
          [out]  ULONG               *OffsetFromFirstPage,
          [out]  MEMORY_CACHING_TYPE *CacheType
        );


    But i want to use it in a C file. I found a structure which achieves the same but with one extra parameter.

        NTSTATUS AllocateAudioBuffer(
          INTERFACE THIS,
          [in]   ULONG               RequestedSize,
          [out]  PMDL                *AudioBufferMdl,
          [out]  ULONG               *ActualSize,
          [out]  ULONG               *OffsetFromFirstPage,
          [out]  MEMORY_CACHING_TYPE *CacheType
        );

     The interface strucure is defined as

        typedef struct _INTERFACE {
            USHORT Size;
            USHORT Version;
            PVOID Context;
            PINTERFACE_REFERENCE InterfaceReference;
            PINTERFACE_DEREFERENCE InterfaceDereference;
            // interface specific entries go here
        } INTERFACE, *PINTERFACE;

    What does this INTERFACE refers too? And how to obtain a reference to it.

    Reference: https://msdn.microsoft.com/en-us/library/windows/hardware/ff536744(v=vs.85).aspx
    Tuesday, March 31, 2015 12:11 AM

Answers

  • For an audio driver, you should be use C++.  C++ is the defined model for audio drivers, and drivers are hard enough to develop without stepping out of the model.  You can write some pretty C-like C++ if you want to.


    Don Burn Windows Filesystem and Driver Consulting Website: http://www.windrvr.com

    Tuesday, March 31, 2015 12:20 AM

All replies

  • For an audio driver, you should be use C++.  C++ is the defined model for audio drivers, and drivers are hard enough to develop without stepping out of the model.  You can write some pretty C-like C++ if you want to.


    Don Burn Windows Filesystem and Driver Consulting Website: http://www.windrvr.com

    Tuesday, March 31, 2015 12:20 AM
  • Hello Don,

    Thanks for the reply. I want to redirect audio data that i receive from SCO Channel to my speaker. Following is structure for the request

    struct _BRB_SCO_TRANSFER { BRB_HEADER Hdr; BTH_ADDR BtAddress; SCO_CHANNEL_HANDLE ChannelHandle; ULONG TransferFlags; ULONG BufferSize; PVOID Buffer; PMDL BufferMDL; ULONGLONG DataTag; };

    Can i get audio buffer pointer to pass it on this request?


    Tuesday, March 31, 2015 9:46 AM