xxxxx@gmail.com wrote:
This is how the audio data moves at the moment: I have program in user space, which reads music into shared with driver ring buffer. Audio data (bytes) in ring buffer gets filled at 44100Hz. The buffer is allocated in user space and I access it via mdl. In that tonegenerator function GenerateSine, I just get bytes from my buffer.
Where do you keep the buffer information? Is that in CAdapterCommon?Â
How do you keep the driver and the user-mode app synchronized? That is,
how does the user-mode app know you need more data?
I commented out everything in that function, and manually fill given buffer with data out of my ring buffer.
How do you do that? Are you keeping the ring buffer pointers in
CAdapterCommon? Or, God forbid, did you put it in a global? The SYSVAD
sample is very carefully architected with separation of duties. The
global stuff in adapter.cpp is the minimum required to get the job
done. The stuff that’s common to all of the devices is kept in the
CAdapterCommon object, which gets passed to the streams, so they can
access common data.
Either way, then the answer should be clear. Every stream needs to have
its own ring buffer pointer, instead of making it common.
That presents a synchronization problem, of course, because the two
streams might not suck at the same rate. You’ll have to figure out how
and when to ask for more data.
If I make call, I can see that my buffer is read twice as often, and when I debug, skype creates two streams (Idk for what reason, as you said, it could be for noise cancellation, or maybe when you make call, there is a tab in which you can see mic activity (its volume in real time), so maybe second stream is used for that, idk).
Are you sure it’s really two streams, and not one stream asking for
stereo when you’re expecting mono?
I don’t care if one of the streams pauses or exits, I need that every alive and running stream get ± same data from my ring buffer.
Of course you have to care! The ONLY way that multiple streams can get
the same data is if the streams are synchronized. If one of them pauses
or gets behind, YOU have to decide what to do.
Could you give some example, how could I use IAdapterCommon object in my case?
IAdapterCommon (also called PADAPTERCOMMON in the code) is the right way
to handle data that is common to all streams. The streams have access
to this through m_pAdapterCommon in the miniport object, or
m_pMiniport->GetAdapterCommObj() in the stream object.
–
Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.