[wdmaudiodev] Re: AVStream Mixer Problems

  • From: "John D. Farmer" <johndfarmer@xxxxxxxxxxx>
  • To: <wdmaudiodev@xxxxxxxxxxxxx>
  • Date: Wed, 25 Aug 2004 15:05:10 -0700

MessageDJ,

If I have understood the document at: 
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/stream/hh/stream/aud-design_7e776381-911a-4b3a-9bf7-f10f10098dc0.xml.asp
 correctly I've now changed my Support function to this:

// A contiguous memory structure to assign to the data buffer in our 
SupportVolumeLevel function.
typedef struct _VOLUME_LEVEL_SUPPORT {
 KSPROPERTY_DESCRIPTION  PropDesc;
 KSPROPERTY_MEMBERSHEADER Members;
 KSPROPERTY_STEPPING_LONG Range;
} VOLUMELEVELSUPPORT, *PVOLUMELEVELSUPPORT;

NTSTATUS
SupportVolumeLevel(
 IN  PIRP        irp,
 IN  PKSPROPERTY property,
 OUT PVOID       data
)
{
    DbgPrint("Enter SupportVolumeLevel\n");
    NTSTATUS status;
    
    VOLUMELEVELSUPPORT VolumeSupport;

    KSPROPERTY_DESCRIPTION PropDesc;
    
    PropDesc.AccessFlags = KSPROPERTY_TYPE_BASICSUPPORT | KSPROPERTY_TYPE_GET | 
KSPROPERTY_TYPE_SET;
    PropDesc.DescriptionSize   = sizeof(KSPROPERTY_DESCRIPTION) + 
sizeof(KSPROPERTY_MEMBERSHEADER) + sizeof(KSPROPERTY_STEPPING_LONG);
    PropDesc.PropTypeSet.Set = KSPROPTYPESETID_General;
    PropDesc.PropTypeSet.Id  = VT_I4;
    PropDesc.PropTypeSet.Flags = 0;
    PropDesc.MembersListCount = 1;

    KSPROPERTY_MEMBERSHEADER Members;

    Members.MembersFlags = KSPROPERTY_MEMBER_STEPPEDRANGES;
    Members.MembersSize  = sizeof(KSPROPERTY_STEPPING_LONG);
    Members.MembersCount = 1;
    Members.Flags = 0;

    KSPROPERTY_STEPPING_LONG Range;
    
    Range.SteppingDelta = 1;
    Range.Bounds.SignedMinimum = -32767; 
    Range.Bounds.SignedMaximum = 32767;

    DbgPrint ("BASIC_SUPPORT: max=0x%x min=0x%x step=0x%x\n", 
Range.Bounds.SignedMaximum, Range.Bounds.SignedMinimum, Range.SteppingDelta);
    
    VolumeSupport.PropDesc = PropDesc;
    VolumeSupport.Members = Members;
    VolumeSupport.Range = Range;
    
    *((PVOLUMELEVELSUPPORT) data) = VolumeSupport;

    status = STATUS_SUCCESS;
    
    return status;
} // SupportVolumeLevel

Some things that are disturbing me are:
    
    - When I go into KS Studio and look at the master volume node the 
KSPROPERTY_AUDIO_VOLUMELEVEL is set to GET only even though I clearly specified 
Get and Set handlers in my DEFINE_KSPROPERTY_ITEM:
            DEFINE_KSPROPERTY_ITEM
             (
                    KSPROPERTY_AUDIO_VOLUMELEVEL,                // PropertyId 
(property item defined in ksmedia.h)
                    PropertyGetVolumeLevel,                                     
   // GetPropertyHandler
                    sizeof(KSNODEPROPERTY_AUDIO_CHANNEL),     // MinProperty 
(minimum buffer length for property)
                    sizeof(LONG),                                               
         // MinData (minimum buffer length for returned data)
                    PropertySetVolumeLevel,                                     
   // SetPropertyHandler  
                    NULL,                                                       
            // Values
                    0,                                                          
               // RelationsCount
                    NULL,                                                       
            // Relations
                    SupportVolumeLevel,                                         
    // Support Handler
                    0                                                           
               // SerializedSize
             )

    - All the items in the Description for that Property are 0
    
    - If specify NULL instead of a Support Handler I lose the control from 
being enabled but I get the SET back

Can you guys see anything I'm doing wrong here.  I have searched repeatedly 
through the MSDN documentation, but it seems to be very sparse in relation to 
this whole topic; especially with regards to AVSTREAM.  In fact most of the 
code above is modified from samples in the DDK.

To answer DJ's question:  My device does Implement the AVC Audio subunit spec.  
We originally tried to use AVCAudio.sys after modifying the INF and trying to 
install it, it not only crashed our test machine but hosed our registry beyond 
any ability to repair.
We tried to use 61883.sys and AVC.sys, but there we're quirks in both of those 
drivers that wouldn't allow us to get the card initialized properly.  I believe 
we also had problems sending data down to the bus.  The final problem was that 
we needed support for Windows 2000 (I believe AVC wasn't supported on except in 
MSDV.sys).  The long story short, I ended up crafting my own psuedo AVC.sys by 
sending down raw Isochronous commands to the 1394 bus and getting the response 
back in a allocated address range.  I only included selective AVC command 
specific to our hardware.

Finally this is probably a rather stupid question, but is there any way to use 
my Volume Control to send the volume and mute values to the KMIXER lines so 
that KMIXER can take care of mixing the audio stream instead of having to set 
the hardware to those volume values (it seems the new chip we are working with 
does not yet support the Audio Subunit FUNCTION_BLOCK command, so I don't think 
the hardware can set the volume right now anyway).

Thanks again for your time,

John


  ----- Original Message ----- 
  From: Mathieu Routhier 
  To: wdmaudiodev@xxxxxxxxxxxxx 
  Sent: Wednesday, August 25, 2004 1:45 PM
  Subject: [wdmaudiodev] Re: AVStream Mixer Problems


  Oh.  One more thing:

   

  In my experience, sysaudio will set a volume value and verify it has been 
successfully set by querying the value right afterwards.  If it gets confused 
by seeing that the value is not set as required, after a few tries, it will 
ultimately give up and disable the control.  I don't know the exact algorithm 
but that's what I've witnessed.

   

  Mat

   


------------------------------------------------------------------------------

  From: wdmaudiodev-bounce@xxxxxxxxxxxxx 
[mailto:wdmaudiodev-bounce@xxxxxxxxxxxxx] On Behalf Of DJ Sisolak
  Sent: Wednesday, August 25, 2004 3:50 PM
  To: wdmaudiodev@xxxxxxxxxxxxx
  Subject: [wdmaudiodev] Re: AVStream Mixer Problems

   

  Hi John,

   

  I would like to add to Mathieu's comments that if the support handler does 
not return the expected structures and simply returns success as you say,  then 
the control will likely not function as well. 

   

  On a side note, does your device implement the AV/C Audio subunit spec? 

   

  Thx,

  DJ

   

  This posting is provided "AS IS" with no warranties, and confers no rights

   


------------------------------------------------------------------------------

  From: wdmaudiodev-bounce@xxxxxxxxxxxxx 
[mailto:wdmaudiodev-bounce@xxxxxxxxxxxxx] On Behalf Of Mathieu Routhier
  Sent: Wednesday, August 25, 2004 11:35 AM
  To: wdmaudiodev@xxxxxxxxxxxxx
  Subject: [wdmaudiodev] Re: AVStream Mixer Problems

   

  John,

   

  Obviously, if your hardware needs a message to change its volume value, yes 
you need to send a message to it.  Maybe I misunderstood the question?

   

  About the second question, yes, these controls are inserted by 
kmixer/sysaudio.  I would suggest you implement volume control on your master 
volume and leave the other controls untouched.  The inputs from those lines are 
mixed directly into your audio device, so you couldn't differentiate these 
feeds even if you wanted to.  And for the balance control, this translates to 
volume commands; so you don't really need to do anything special for this to 
work, other than supporting a stereo volume commands.

   

  Mat

   

Other related posts: