Jump to content


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


8 replies to this topic

#1 toanitaliajuventus

    New Member

  • Members
  • Pip
  • 6 posts

Posted 23 September 2006 - 04:01 AM

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.

#2 singamkiranreddy

    New Member

  • Members
  • Pip
  • 3 posts

Posted 16 October 2006 - 10:03 AM

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

#3 detten

    New Member

  • Members
  • Pip
  • 1 posts

Posted 28 November 2006 - 01:47 PM

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?

#4 singamkiranreddy

    New Member

  • Members
  • Pip
  • 3 posts

Posted 12 June 2007 - 08:01 AM

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.

#5 adward

    New Member

  • Members
  • Pip
  • 1 posts

Posted 08 October 2007 - 03:06 PM

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

#6 toanitaliajuventus

    New Member

  • Members
  • Pip
  • 6 posts

Posted 15 November 2007 - 08:27 AM

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.

#7 ying

    New Member

  • Members
  • Pip
  • 1 posts

Posted 23 January 2008 - 06:34 AM

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,

#8 singamkiranreddy

    New Member

  • Members
  • Pip
  • 3 posts

Posted 19 May 2008 - 11:13 AM

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


#9 Reedbeta

    DevMaster Staff

  • Administrators
  • 5310 posts
  • LocationSanta Clara, CA

Posted 20 May 2008 - 05:12 AM

Please use [code]...[/code] to post code.
reedbeta.com - developer blog, OpenGL demos, and other projects





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users