Hi,
I am trying to tap the audio data which is going to play by the player. So i tried to use the virtual audio driver (simple) which is msvad path of WDK. I have couple of questions. Can anyone in this forum help me out?
1.do we have any IDE for building and debugging the kernel mode drivers for windows XP?(like visual studio for any appln)
2.What i have to implement in the copyto or copyfrom functions in the wavecyclic file? and where i have to call these functions to get the data which is going to be played?
3.do you know from where the pcm data is getting played in the audio device?
can anyone give me some light on this issues?
Thanks
Muras K
> 1.do we have any IDE for building and debugging the kernel mode drivers for windows XP?(like
visual studio for any appln)
Install WDK 6001.18002, and build using “build” command in the command line. “build -c” is full rebuild.
WinDbg is the debugger.
2.What i have to implement in the copyto or copyfrom functions in the wavecyclic file?
Looks like you need to study (to “smoke”, as the Russian software development community says
) the documentation and the sample code. This is the usual way of understanding the architectures.
–
Maxim S. Shatskih
Windows DDK MVP
xxxxx@storagecraft.com
http://www.storagecraft.com
xxxxx@arbitron.com wrote:
I am trying to tap the audio data which is going to play by the player. So i tried to use the virtual audio driver (simple) which is msvad path of WDK. I have couple of questions. Can anyone in this forum help me out?
As long as you don’t need to support XP, you can do this with a GFX
APO. It’s a lot less trouble than msvad.
1.do we have any IDE for building and debugging the kernel mode drivers for windows XP?(like visual studio for any appln)
No. It’s possible to use Visual Studio for editing and building, using
something like Mark Roddy’s “ddkbuild”. Personally, I use gvim for
editing and build from the command line. For debugging, your only
practical choice is windbg.
2.What i have to implement in the copyto or copyfrom functions in the wavecyclic file? and where i have to call these functions to get the data which is going to be played?
You don’t call those functions. They will be called by the port driver
when there is new data. Since you are a render filter, you should only
see calls to CopyTo.
3.do you know from where the pcm data is getting played in the audio device?
I don’t understand the question. The audio data arrives in CopyTo.
It’s up to you to handle it.
–
Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.
Please keep the discussion on the mailing list, where it be of use to
others as well.
Selvan Murasoli wrote:
Thanks for your reply. Your answers are of good help for us. After
installation when I try to play some audio files using any player I am
not getting the debug traces (DBGprintf) from the copyto function. So
which means that our copyto function is not getting called during play
back. Any idea on this behavior of simple msvad driver?
You’re sure that it’s your device that is being selected for playback?
You may need to set some breakpoints in the kernel debugger to chase
this down.
**** What is GFX APO? Is it an open source PCM data tapping tool?
Hardly. The audio subsystem was almost totally rewritten for Vista.
Most of what was previously done in kernel is now done in a special
user-mode process. The audio processing is now set up as a graph, like
DirectShow. The components in this graph are called “audio processing
objects”, or APOs. The architecture allows you to insert APOs at the
very beginning of the graph (to monitor or modify microphone input) or
the very end of the graph (to monitor or modify speaker output). Those
APOs are called “effects APOs”. An effects APO that gets inserted into
each application’s graph separately (before mixing) is a “local effects
APO”, or “LFX APO”. An effects APO that gets inserted after mixing is a
“global effects APO”, or “GFX APO”.
There’s a nice white paper on this architecture here:
http://www.microsoft.com/whdc/device/audio/sysfx.mspx
–
Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.
Hi Tim,
Thanks for your reply,
* What you have said is correct,we have not selected our installed device for play back . Then i have selected my installed device by this way.
Control panel –> sound and audio devices –> opened the “audio” tap –> selected the “Sound playback default device” as msvad simple…
Is this the correct way to select my installed driver for playback?
** By selecting this way ,the playback is not happening . In other words we are not able to play the audio file, we are getting some error message form the player.
also we didn’t get the debug print from the copyto function. previously we didn’t get any debug print messages from the wavecyclic class, but after selecting this device we are getting some debug print messages from the wavecyclic class.
Do u have any idea why our debug print message which is in copyto function is not getting printed?
and also why the playback is not happening?
Thanks
Muras K
xxxxx@arbitron.com wrote:
* What you have said is correct,we have not selected our installed device for play back . Then i have selected my installed device by this way.
Control panel –> sound and audio devices –> opened the “audio” tap –> selected the “Sound playback default device” as msvad simple…
Is this the correct way to select my installed driver for playback?
Before making this the default system renderer, the most basic testing
would be to run graphedt, and set up a graph directly from your
microphone (or an audio file) to your audio device. Make sure you can
connect up the pins, then play the graph. If that runs, then the kernel
streaming aspects of your driver are in pretty good shape.
** By selecting this way ,the playback is not happening . In other words we are not able to play the audio file, we are getting some error message form the player.
also we didn’t get the debug print from the copyto function. previously we didn’t get any debug print messages from the wavecyclic class, but after selecting this device we are getting some debug print messages from the wavecyclic class.
Do u have any idea why our debug print message which is in copyto function is not getting printed?
and also why the playback is not happening?
Well, it’s pretty clear these are the same problem. If there’s an error
setting up the graph, then of course you will never get any calls to
CopyTo. You will have to use the error message from the player to
diagnose the problems.
–
Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.
Hi Tim,
Thanks for your reply.
Now i could able to tap the playback data and i could able to write the data in the .wav file format using the msvad - simple virtual audio driver.I have some doubts on this.
-
Is it possible to write the PCM raw data ? By default they are writing in the .wav file format, i have changed the writeheader length as zero and i got some raw pcm data kind of thing. Is this the right way to write the raw PCM data? How i have to check the data ithat i am getting is the PCM data?
-
Is it possible to convert the attributes of PCM data which i am getting from the copyto function into my required attributes? eg,By default i am getting 44.1k sample data in the 32 bit PCM mono format. but my required attributes are 8kHz sample data 8bit or 16bit mono format. Is it possible to convert onthe fly?
-
If i want to tap the playback data from the multiple input streams(let us say , i m playing ten songs from ten separate media player) what i have to do? I tired with simple virtual audio driver by same scenario what i have given above, but i m getting the output file with mixing of all the data. what i have to do for this?
i have also tried to install the "Multstr "driver which is in msvad folder and played multiple streams, with the use of multistr driver ,but i m getting mixed playback data? can u help me out to capture the multiple playback data simultaneously?
Thanks
Muras K
xxxxx@arbitron.com wrote:
Now i could able to tap the playback data and i could able to write the data in the .wav file format using the msvad - simple virtual audio driver.I have some doubts on this.
- Is it possible to write the PCM raw data ? By default they are writing in the .wav file format, i have changed the writeheader length as zero and i got some raw pcm data kind of thing. Is this the right way to write the raw PCM data? How i have to check the data ithat i am getting is the PCM data?
Are you talking about the code in “savedata.cpp” in the MSVAD sample?
I’m curious as to why you would want to eliminate the wave file
headers. It is so useful to be able to double-click that data and hear
it play back in Media Player; if you eliminate the wave header, you
won’t be able to do that. The wave file format is very simple to parse;
I would much rather leave the wave headers in there, and just skip past
them in any program that needs to manipulate the files.
Assuming you really want to do that, all you have to do is use #if 0 and
#endif around the code in FileWriteHeader, and around the header update
code in ~CSaveData. It concerns me a bit that you couldn’t figure this
out. This is pretty fundamental stuff.
Each audio driver advertises the formats it is willing to support.
MSVAD happens to advertise only PCM formats. You don’t have to verify that.
- Is it possible to convert the attributes of PCM data which i am getting from the copyto function into my required attributes? eg,By default i am getting 44.1k sample data in the 32 bit PCM mono format. but my required attributes are 8kHz sample data 8bit or 16bit mono format. Is it possible to convert onthe fly?
As I said, each audio driver advertises the formats it is willing to
support. If you want to limit what you get, you need to change the
KSDATARANGE tables in the driver to say that. The kernel mixer will
automatically insert a sample rate converter to shift down to your
format. See simple/wavtable.h.
- If i want to tap the playback data from the multiple input streams(let us say , i m playing ten songs from ten separate media player) what i have to do? I tired with simple virtual audio driver by same scenario what i have given above, but i m getting the output file with mixing of all the data. what i have to do for this?
I’m not convinced this is possible in the general case under XP. The
individual output streams are all mixed by the kernel mixer before being
delivered to the audio driver. It may be possible to implement a mixer
driver, but this is an area I have not explored.
In Vista, you can write an LFX APO to do this. The LFX APO is inserted
before the mixer – the GFX APO is inserted after.
–
Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.
Hi Tim,
Thanks for ur reply,In the wavetable.h they have given only the range ,right?not the exact value of bit rate or sampling rate? then how can i do my required setting?
also by default the maximum data range given in that header file is 16,but the captured file without header is playing exactly in the 32 bit format only, in the 16bit format i am getting delay playback? why its happening like this?
Thanks
Muras K
xxxxx@arbitron.com wrote:
Thanks for ur reply,In the wavetable.h they have given only the range ,right?not the exact value of bit rate or sampling rate? then how can i do my required setting?
THINK about this. Wavetable.h gives the range. If you only want to
support one format, then you narrow the range so that only one format
fits. Alternatively, ValidatePcm is the last chance to reject a
particular format.
You should note, however, that downstream clients are not required to
accept your ranges. If they really want a particular format, and you
don’t offer it, the attempt to connect the pins will fail.
also by default the maximum data range given in that header file is 16,but the captured file without header is playing exactly in the 32 bit format only, in the 16bit format i am getting delay playback? why its happening like this?
I don’t understand what you’re saying. How are you playing the file if
it doesn’t have a header? If you play 16-bit data to an audio port that
is expecting 8-bit data (the default), it would play back at half speed.
–
Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.