[wdmaudiodev] Re: How to make Recording icons not appear for a device in the Sound panel

  • From: Matthew van Eerde <Matthew.van.Eerde@xxxxxxxxxxxxx>
  • To: "wdmaudiodev@xxxxxxxxxxxxx" <wdmaudiodev@xxxxxxxxxxxxx>
  • Date: Wed, 18 Jul 2012 00:09:49 +0000

You’re modifying the Kernel Streaming topology.

Download the Windows Driver Kit, open KS Studio, point it at your driver 
(before these changes), instantiate your filters, right-click each filter, View 
Nodes.  Look at the topology.

The topology is a graph which contains:


1.       Pin factories (the big black squares on the left and the right)

2.       Nodes (the things in the middle)

3.       Connections (the lines connecting pin factories and nodes to each 
other)

To remove capture, you need to make significant modifications to the graph.  
Draw the graph the way you want it to be.  Eliminate unneeded pin factories and 
nodes.  Recalculate what connections are necessary.

Only then should you modify code, because only then will you know what the code 
should be.

From: wdmaudiodev-bounce@xxxxxxxxxxxxx 
[mailto:wdmaudiodev-bounce@xxxxxxxxxxxxx] On Behalf Of Paul Titchener
Sent: Tuesday, July 17, 2012 5:04 PM
To: wdmaudiodev@xxxxxxxxxxxxx
Subject: [wdmaudiodev] Re: How to make Recording icons not appear for a device 
in the Sound panel

From some other forum posts, it appears that in addition to the mods below I 
made in the PHYSICALCONNECTIONTABLE: I also need to

PHYSICALCONNECTIONTABLE TopologyPhysicalConnections =
{
    KSPIN_TOPO_WAVEOUT_SOURCE,  // TopologyIn
    (ULONG)-1,     // TopologyOut
    (ULONG)-1,        // WaveIn
    KSPIN_WAVE_RENDER_SOURCE    // WaveOut
};

.. that I also need to mod wavetable.h to strip out the recording pin 
declarations.

However any changes I’ve tried to make that fail are causing the Playback icon 
not to appear, which doesn’t surprise me as my understanding of that file is 
minimal.

I pasted the wavtable.h file below, can anyone make suggestions on the correct 
way to modify it to allow the Playback functionality to remain but the Record 
functionality to no longer be displayed in the Sound panel?

Thanks,

Paul

//=============================================================================
static
KSDATARANGE_AUDIO PinDataRangesStream[] =
{
    {
        {
            sizeof(KSDATARANGE_AUDIO),
            0,
            0,
            0,
            STATICGUIDOF(KSDATAFORMAT_TYPE_AUDIO),
            STATICGUIDOF(KSDATAFORMAT_SUBTYPE_PCM),
            STATICGUIDOF(KSDATAFORMAT_SPECIFIER_WAVEFORMATEX)
        },
        MAX_CHANNELS_PCM,
        MIN_BITS_PER_SAMPLE_PCM,
        MAX_BITS_PER_SAMPLE_PCM,
        MIN_SAMPLE_RATE,
        MAX_SAMPLE_RATE
    },
};

static
PKSDATARANGE PinDataRangePointersStream[] =
{
    PKSDATARANGE(&PinDataRangesStream[0])
};

//=============================================================================
static
KSDATARANGE PinDataRangesBridge[] =
{
    {
        sizeof(KSDATARANGE),
        0,
        0,
        0,
        STATICGUIDOF(KSDATAFORMAT_TYPE_AUDIO),
        STATICGUIDOF(KSDATAFORMAT_SUBTYPE_ANALOG),
        STATICGUIDOF(KSDATAFORMAT_SPECIFIER_NONE)
    }
};

static
PKSDATARANGE PinDataRangePointersBridge[] =
{
    &PinDataRangesBridge[0]
};

//=============================================================================
static
PCPIN_DESCRIPTOR MiniportPins[] =
{
    // Wave In Streaming Pin (Capture) KSPIN_WAVE_CAPTURE_SINK
    {
        MAX_OUTPUT_STREAMS,
        MAX_OUTPUT_STREAMS,
        0,
        NULL,
        {
            0,
            NULL,
            0,
            NULL,
            SIZEOF_ARRAY(PinDataRangePointersStream),
            PinDataRangePointersStream,
            KSPIN_DATAFLOW_OUT,
            KSPIN_COMMUNICATION_SINK,
            &KSCATEGORY_AUDIO,
            &KSAUDFNAME_RECORDING_CONTROL,
            0
        }
    },

    // Wave In Bridge Pin (Capture - From Topology) KSPIN_WAVE_CAPTURE_SOURCE
    {
        0,
        0,
        0,
        NULL,
        {
            0,
            NULL,
            0,
            NULL,
            SIZEOF_ARRAY(PinDataRangePointersBridge),
            PinDataRangePointersBridge,
            KSPIN_DATAFLOW_IN,
            KSPIN_COMMUNICATION_NONE,
            &KSCATEGORY_AUDIO,
            NULL,
            0
        }
    },
    // Wave Out Streaming Pin (Renderer) KSPIN_WAVE_RENDER_SINK
    {
        MAX_INPUT_STREAMS,
        MAX_INPUT_STREAMS,
        0,
        NULL,
        {
            0,
            NULL,
            0,
            NULL,
            SIZEOF_ARRAY(PinDataRangePointersStream),
            PinDataRangePointersStream,
            KSPIN_DATAFLOW_IN,
            KSPIN_COMMUNICATION_SINK,
            &KSCATEGORY_AUDIO,
            NULL,
            0
        }
    },
    // Wave Out Bridge Pin (Renderer) KSPIN_WAVE_RENDER_SOURCE
    {
        0,
        0,
        0,
        NULL,
        {
            0,
            NULL,
            0,
            NULL,
            SIZEOF_ARRAY(PinDataRangePointersBridge),
            PinDataRangePointersBridge,
            KSPIN_DATAFLOW_OUT,
            KSPIN_COMMUNICATION_NONE,
            &KSCATEGORY_AUDIO,
            NULL,
            0
        }
    },
};

//=============================================================================
static PCPROPERTY_ITEM PropertiesDAC[] =
{
    // KSPROPERTY_AUDIO_CHANNEL_CONFIG
    {
        &KSPROPSETID_Audio,                                     // Property Set
        KSPROPERTY_AUDIO_CHANNEL_CONFIG,                        // Property ID
        PCPROPERTY_ITEM_FLAG_GET | PCPROPERTY_ITEM_FLAG_SET,    // Flags
        PropertyHandler_Wave                                    // Handler
    }
};

//=============================================================================
DEFINE_PCAUTOMATION_TABLE_PROP(AutomationDAC, PropertiesDAC);

//=============================================================================
static
PCNODE_DESCRIPTOR MiniportNodes[] =
{
    // KSNODE_WAVE_ADC
    {
        0,                      // Flags
        NULL,                   // AutomationTable
        &KSNODETYPE_ADC,        // Type
        NULL                    // Name
    },
    // KSNODE_WAVE_DAC
    {
        0,                      // Flags
        &AutomationDAC,         // AutomationTable
        &KSNODETYPE_DAC,        // Type
        NULL                    // Name
    }
};


//=============================================================================
static
PCCONNECTION_DESCRIPTOR MiniportConnections[] =
{
    { PCFILTER_NODE,        KSPIN_WAVE_CAPTURE_SOURCE,  KSNODE_WAVE_ADC,     1 
},
    { KSNODE_WAVE_ADC,      0,                          PCFILTER_NODE,       
KSPIN_WAVE_CAPTURE_SINK },

    { PCFILTER_NODE,        KSPIN_WAVE_RENDER_SINK,     KSNODE_WAVE_DAC,     1 
},
    { KSNODE_WAVE_DAC,      0,                          PCFILTER_NODE,       
KSPIN_WAVE_RENDER_SOURCE },
};

//=============================================================================
static
PCFILTER_DESCRIPTOR MiniportFilterDescriptor =
{
    0,                                  // Version
    NULL,                               // AutomationTable
    sizeof(PCPIN_DESCRIPTOR),           // PinSize
    SIZEOF_ARRAY(MiniportPins),         // PinCount
    MiniportPins,                       // Pins
    sizeof(PCNODE_DESCRIPTOR),          // NodeSize
    SIZEOF_ARRAY(MiniportNodes),        // NodeCount
    MiniportNodes,                      // Nodes
    SIZEOF_ARRAY(MiniportConnections),  // ConnectionCount
    MiniportConnections,                // Connections
    0,                                  // CategoryCount
    NULL                                // Categories - NULL->use defaults 
(AUDIO RENDER CAPTURE)
};

Other related posts: