Send sound buffer to virtual audio device and pass to real device for playback, Can??

7c69bd88316ac6b6687428daa0e02698
0
toanitaliajuventus 101 Sep 23, 2006 at 04:01

i am using virtual audio device/driver get from DDK.

In DDK have available virtual audio driver, i have build msvad folder then
install with msvad.inf file. Chose AC3 in during installation.

I would like to pass sound data (were captured in to a sound buffer) to
virtual audio device. And sure my Audio In device is a real device.
But it seem , i can not use this virtual driver for now. I must change code
in source files of MSVAD and rebuild and then reinstall, right?

Can help/show me how to pass the sound buffer to virtual audio driver, and
then get this buffer from virtual audio driver to real audio device for
playback..

This is need for me, hope will have anyone can help me..

Thanks for any help.

8 Replies

Please log in or register to post a reply.

3d411692175ef519ab2a9d1cdc81845b
0
singamkiranreddy 101 Oct 16, 2006 at 10:03

How to pass data from virtual audio device to real hardware :

solution:

1: catch data from copto fuction of msvad sample
2: In the same function create your own Irps and fill the data
which u got in copyto function.
3: Get symbolic link name of real hardware function driver.
4: send filled irps to the function driver

E53e81ef13c513c8d8f0c1fd191929ef
0
detten 101 Nov 28, 2006 at 13:47

Thank you for the steps, but I was wondering how exactly this is done.
I am new to driver development and IRP’s.

I have troubles putting step 2 into code. What API would you use to create the IRP? It seems at least I need to know the stacksize to use IoAllocateIrp, how do I retrieve that from the MSVAD sample driver? And how would I fill it with the source data?

3d411692175ef519ab2a9d1cdc81845b
0
singamkiranreddy 101 Jun 12, 2007 at 08:01

sorry for the late reply. I left the driver field and now in to Network Stacks. Still if you want the code related to that i will provide.

E72c66410ceffb56f288b01d6bf99c81
0
adward 101 Oct 08, 2007 at 15:06

hi,i am writing a driver which can capture all sounds from a computer,and now i am learning the msvad source code,but still many things can`t understand,can you give me some source code about this ?? thank you, my email is : adward_hotmail@hotmail.com

7c69bd88316ac6b6687428daa0e02698
0
toanitaliajuventus 101 Nov 15, 2007 at 08:27

hi singamkiranreddy

Do you have code implementation for copyto/copyfrom function ?

I read basedma.cpp in the msvad but i donot know what need to implementation for copyto function.

Can you send to me your sample code , email : phamquoctoan@gmail.com

Thank for your help.

8bbd42438b930896c016531d13f09444
0
ying 101 Jan 23, 2008 at 06:34

hello singamkiranreddy and others,

I am trying to achieve the same thing here, and having trouble on how to implement the copyto/copyfrom function.

could you please send me the sample code? my email is ying@yingternet.com

Thank you very much,

3d411692175ef519ab2a9d1cdc81845b
0
singamkiranreddy 101 May 19, 2008 at 11:13
STDMETHODIMP_(void)
CMiniportWaveCyclicStreamMSVAD::CopyTo
( 
    IN  PVOID                   Destination,
    IN  PVOID                   Source,
    IN  ULONG                   ByteCount 
/*++

Routine Description:

  The CopyTo function copies sample data to the DMA buffer. 
  Callers of CopyTo can run at any IRQL. 

Arguments:

  Destination - Points to the destination buffer. 
  
  Source - Points to the source buffer

  ByteCount - Number of bytes to be copied

Return Value:

  void

--*/
)
{
    
    if(Count==6)   //after 6 writes create Irp and pass it down
    {
      Count=0;
     
      if(FunObject)
      {
          irp1 = IoAllocateIrp (FunObject->StackSize, FALSE);
          if(irp1!=NULL)
          {
             //Fill IRP
             irp1->IoStatus.Status = STATUS_NOT_SUPPORTED;                  
             irp1->IoStatus.Information = 0;
             PIO_STACK_LOCATION  irpStack = IoGetNextIrpStackLocation(irp1);
             irpStack->MajorFunction = IRP_MJ_DEVICE_CONTROL;
             irpStack->Parameters.DeviceIoControl.IoControlCode=IOCTL_p17;
             irpStack->Parameters.DeviceIoControl.Type3InputBuffer=irpBuffer;
             irpStack->Parameters.DeviceIoControl.InputBufferLength=irpBufferLength;
             DbgPrint("sending buffer is =%x sending BufferLength is =%x",irpBuffer,irpBufferLength);
             IoSetCompletionRoutine(irp1, DataIrpComplete, this, TRUE, TRUE, TRUE);

             //pass IRP to FunctionDriver
             NTSTATUS Status = IoCallDriver(FunObject, irp1); 
          }
      }
    } 
  
            

    if(BufferNo==1)
    {
       temp=(PUCHAR)Buffer1+Offset;
       memcpy((PUCHAR)temp,(PUCHAR)Source,ByteCount);   
       Offset+=ByteCount;
       Count++;
       if(Count==6)
       {
         irpBuffer=Buffer1;
         irpBufferLength=Offset;
         BufferNo=2;
         Offset=0;
         
       }
    }
    else if(BufferNo==2)
    {
       temp=(PUCHAR)Buffer2+Offset;
       memcpy((PUCHAR)temp,(PUCHAR)Source,ByteCount);   
       Offset+=ByteCount;
       Count++;
       if(Count==6)
       {
         irpBuffer=Buffer2;
         irpBufferLength=Offset;
         BufferNo=1;
         Offset=0;
       }
    }


  //  m_SaveData.WriteData((PBYTE) Source, ByteCount);
} // CopyTo
A8433b04cb41dd57113740b779f61acb
0
Reedbeta 168 May 20, 2008 at 05:12

Please use …[/code[b][/b]] to post code. [code]…[/code**] to post code.