Virtual audio driver by using MSVAD (Simple) project

i have set “Sound play back” Default device to MSVAD (Simple) and also Sound Recording " Default device to MSVAD (Simple) .
after that i play the sound in windows media player and i record that sound. it will record the clicking sound the the orignal sound

i have read the artical the i have to modify the CopyTo adn CopyFrom function. i dont know the implentaion which will be the implementation of it

xxxxx@yahoo.com wrote:

i have set “Sound play back” Default device to MSVAD (Simple) and also Sound Recording " Default device to MSVAD (Simple) .
after that i play the sound in windows media player and i record that sound. it will record the clicking sound the the orignal sound

i have read the artical the i have to modify the CopyTo adn CopyFrom function. i dont know the implentaion which will be the implementation of it

What??

Perhaps you should step back a moment and describe what you are trying
to accomplish. The MSVAD source has an implementation of CopyTo and
CopyFrom, but we can’t possibly advise you on what to modify unless we
know what you are trying to do.


Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.

my main goal is to capture sound from one PC and transfer to an other PC in order to do that i am modifiy msvad->Simple code for capting the sound.

this is because i want to create a virtual sound card driver inorder to capture the sound played on a remote PC which has no Phasical sound card.

my software work well with Physical sound card but not with that.
my software capture with WaveIn api.
the orignal basedma.cpp coded is as follow

/*++

Copyright (c) 1997-2000 Microsoft Corporation All Rights Reserved

Module Name:

basedma.cpp

Abstract:

IDmaChannel implementation. Does nothing HW related.

–*/

#include <msvad.h>
#include “common.h”
#include “basewave.h”

#pragma code_seg(“PAGE”)
//=============================================================================
STDMETHODIMP_(NTSTATUS)
CMiniportWaveCyclicStreamMSVAD::AllocateBuffer
(
IN ULONG BufferSize,
IN PPHYSICAL_ADDRESS PhysicalAddressConstraint OPTIONAL
)
/++

Routine Description:

The AllocateBuffer function allocates a buffer associated with the DMA object.
The buffer is nonPaged.
Callers of AllocateBuffer should run at a passive IRQL.

Arguments:

BufferSize - Size in bytes of the buffer to be allocated.

PhysicalAddressConstraint - Optional constraint to place on the physical
address of the buffer. If supplied, only the bits
that are set in the constraint address may vary
from the beginning to the end of the buffer.
For example, if the desired buffer should not
cross a 64k boundary, the physical address
constraint 0x000000000000ffff should be specified

Return Value:

NT status code.

/
{
PAGED_CODE();

DPF_ENTER((“[CMiniportWaveCyclicStreamMSVAD::AllocateBuffer]”));

NTSTATUS ntStatus = STATUS_SUCCESS;

//
// Adjust this cap as needed…
ASSERT (BufferSize <= DMA_BUFFER_SIZE);

m_pvDmaBuffer = (PVOID)
ExAllocatePoolWithTag
(
NonPagedPool,
BufferSize,
MSVAD_POOLTAG
);
if (!m_pvDmaBuffer)
{
ntStatus = STATUS_INSUFFICIENT_RESOURCES;
}
else
{
m_ulDmaBufferSize = BufferSize;
}

return ntStatus;
} // AllocateBuffer
#pragma code_seg()

//=============================================================================
STDMETHODIMP_(ULONG)
CMiniportWaveCyclicStreamMSVAD::AllocatedBufferSize
(
void
)
/++

Routine Description:

AllocatedBufferSize returns the size of the allocated buffer.
Callers of AllocatedBufferSize can run at any IRQL.

Arguments:

Return Value:

ULONG

/
{
DPF_ENTER((“[CMiniportWaveCyclicStreamMSVAD::AllocatedBufferSize]”));

return m_ulDmaBufferSize;
} // AllocatedBufferSize

//=============================================================================
STDMETHODIMP_(ULONG)
CMiniportWaveCyclicStreamMSVAD::BufferSize
(
void
)
/++

Routine Description:

BufferSize returns the size set by SetBufferSize or the allocated buffer size
if the buffer size has not been set. The DMA object does not actually use
this value internally. This value is maintained by the object to allow its
various clients to communicate the intended size of the buffer. This call
is often used to obtain the map size parameter to the Start member
function. Callers of BufferSize can run at any IRQL

Arguments:

Return Value:

ULONG

/
{
return m_ulDmaBufferSize;
} // BufferSize

//=============================================================================
STDMETHODIMP_(void)
CMiniportWaveCyclicStreamMSVAD::CopyFrom
(
IN PVOID Destination,
IN PVOID Source,
IN ULONG ByteCount
)
/++

Routine Description:

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

Arguments:

Destination - Points to the destination buffer.

Source - Points to the source buffer.

ByteCount - Points to the source buffer.

Return Value:

void

/
{
} // CopyFrom

//=============================================================================
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

/
)
{
m_SaveData.WriteData((PBYTE) Source, ByteCount);
} // CopyTo

//=============================================================================
#pragma code_seg(“PAGE”)
STDMETHODIMP_(void)
CMiniportWaveCyclicStreamMSVAD::FreeBuffer
(
void
)
/++

Routine Description:

The FreeBuffer function frees the buffer allocated by AllocateBuffer. Because
the buffer is automatically freed when the DMA object is deleted, this
function is not normally used. Callers of FreeBuffer should run at
IRQL PASSIVE_LEVEL.

Arguments:

Return Value:

void

/
{
PAGED_CODE();

DPF_ENTER((“[CMiniportWaveCyclicStreamMSVAD::FreeBuffer]”));

if ( m_pvDmaBuffer )
{
ExFreePoolWithTag( m_pvDmaBuffer, MSVAD_POOLTAG );
m_ulDmaBufferSize = 0;
}
} // FreeBuffer
#pragma code_seg()

//=============================================================================
STDMETHODIMP_(PADAPTER_OBJECT)
CMiniportWaveCyclicStreamMSVAD::GetAdapterObject
(
void
)
/++

Routine Description:

The GetAdapterObject function returns the DMA object’s internal adapter
object. Callers of GetAdapterObject can run at any IRQL.

Arguments:

Return Value:

PADAPTER_OBJECT - The return value is the object’s internal adapter object.

/
{
DPF_ENTER((“[CMiniportWaveCyclicStreamMSVAD::GetAdapterObject]”));

// MSVAD does not have need a physical DMA channel. Therefore it
// does not have physical DMA structure.

return NULL;
} // GetAdapterObject

//=============================================================================
STDMETHODIMP_(ULONG)
CMiniportWaveCyclicStreamMSVAD::MaximumBufferSize
(
void
)
/++

Routine Description:

Arguments:

Return Value:

NT status code.

/
{
DPF_ENTER((“[CMiniportWaveCyclicStreamMSVAD::MaximumBufferSize]”));

return m_pMiniport->m_MaxDmaBufferSize;
} // MaximumBufferSize

//=============================================================================
STDMETHODIMP_(PHYSICAL_ADDRESS)
CMiniportWaveCyclicStreamMSVAD::PhysicalAddress
(
void
)
/++

Routine Description:

MaximumBufferSize returns the size in bytes of the largest buffer this DMA
object is configured to support. Callers of MaximumBufferSize can run
at any IRQL

Arguments:

Return Value:

PHYSICAL_ADDRESS - The return value is the size in bytes of the largest
buffer this DMA object is configured to support.

/
{
DPF_ENTER((“[CMiniportWaveCyclicStreamMSVAD::PhysicalAddress]”));

PHYSICAL_ADDRESS pAddress;

pAddress.QuadPart = (LONGLONG) m_pvDmaBuffer;

return pAddress;
} // PhysicalAddress

//=============================================================================
STDMETHODIMP_(void)
CMiniportWaveCyclicStreamMSVAD::SetBufferSize
(
IN ULONG BufferSize
)
/++

Routine Description:

The SetBufferSize function sets the current buffer size. This value is set to
the allocated buffer size when AllocateBuffer is called. The DMA object does
not actually use this value internally. This value is maintained by the object
to allow its various clients to communicate the intended size of the buffer.
Callers of SetBufferSize can run at any IRQL.

Arguments:

BufferSize - Current size in bytes.

Return Value:

void

/
{
DPF_ENTER((“[CMiniportWaveCyclicStreamMSVAD::SetBufferSize]”));

if ( BufferSize <= m_ulDmaBufferSize )
{
m_ulDmaBufferSize = BufferSize;
}
else
{
DPF(D_ERROR, (“Tried to enlarge dma buffer size”));
}
} // SetBufferSize

//=============================================================================
STDMETHODIMP_(PVOID)
CMiniportWaveCyclicStreamMSVAD::SystemAddress
(
void
)
/++

Routine Description:

The SystemAddress function returns the virtual system address of the
allocated buffer. Callers of SystemAddress can run at any IRQL.

Arguments:

Return Value:

PVOID - The return value is the virtual system address of the
allocated buffer.

/
{
return m_pvDmaBuffer;
} // SystemAddress

//=============================================================================
STDMETHODIMP_(ULONG)
CMiniportWaveCyclicStreamMSVAD::TransferCount
(
void
)
/++

Routine Description:

The TransferCount function returns the size in bytes of the buffer currently
being transferred by a slave DMA object. Callers of TransferCount can run
at any IRQL.

Arguments:

Return Value:

ULONG - The return value is the size in bytes of the buffer currently
being transferred.

/
{
DPF_ENTER((“[CMiniportWaveCyclicStreamMSVAD::TransferCount]”));

return m_ulDmaBufferSize;
}</msvad.h>

xxxxx@yahoo.com wrote:

my main goal is to capture sound from one PC and transfer to an other PC in order to do that i am modifiy msvad->Simple code for capting the sound.

this is because i want to create a virtual sound card driver inorder to capture the sound played on a remote PC which has no Phasical sound card.

my software work well with Physical sound card but not with that.
my software capture with WaveIn api.

How much tracing have you done in this driver? This is not a trivial
proposition. You’re going to need to read the MSVAD code to understand
what’s going on.

If your MSVAD is an output device, then clearly the data would be copied
into the DMA buffer. Thus, the data would come in to the CopyTo
function. You will need to figure out what the MSVAD code does with the
data, and change it to do whatever you need.


Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.

first i will thnak to your response.

i m new in drvier development. i have not found usful information on virtual audio drver that how to make. can u tell me the link for the understanding of MSVAD (Simple) that is given in WDK. there is also limited information given in that readme.html file that is in WDK.