[wdmaudiodev] Re: very low latency audio and a C# UI?

  • From: "Voelkel, Andy" <andy.voelkel@xxxxxxxxxxxxxxx>
  • To: <wdmaudiodev@xxxxxxxxxxxxx>
  • Date: Thu, 26 Feb 2009 19:56:55 -0800

Hi Jerry,

 

Yes, the UI would be for routing/levels and visualization (VU meters),
it would not have to process the audio stream.

 

My first reaction to your suggestion was to wonder why I didn't think of
it. But after thinking about, I wonder: A C++ dll will run in the
process space of the caller, a .NET app, and all the threads created
will belong to that process. When the .NET gc runs and "suspends all
threads", will it know not to suspend the thread that was created by the
C++ dll for callbacks from, say, an ASIO driver? I have not run across
the information that would allow me to answer this question. It seems
possible that the CLR would suspend all the threads of the process, and
glitches would occur at low latency. It is also possible that the CLR
would be smart enough to know not to.

 

Does anyone know the answer to this question? Or where to go to find out
the answer?

 

I'll check out the blog.

 

- Andy

 

________________________________

From: wdmaudiodev-bounce@xxxxxxxxxxxxx
[mailto:wdmaudiodev-bounce@xxxxxxxxxxxxx] On Behalf Of Jerry Evans
Sent: Thursday, February 26, 2009 11:54 AM
To: wdmaudiodev@xxxxxxxxxxxxx
Subject: [wdmaudiodev] Re: very low latency audio and a C# UI?

 

Andy

Just to clarify - if your DSP code is C++, then what role for the C#
components. Is the UI control only (routing/levels/etc) or is the UI a
more active participant:  does it actually have to process the audio
stream in some way?

I'd package the DSP code into a C++ DLL and export a narrow API for the
C# code to call. Your primary audio thread is created within the DLL and
has a signalling/control mechanism based on shared events or somesuch.
That is all pretty easy to organise. I think you could get read access
to the audio stream without too much trouble as well - treat the C#
audio sink as a slow output device to account for GC and interop
overhead etc. 

The blog here might be of interest:
http://geekswithblogs.net/robp/archive/2008/08/13/speedy-c-part-3-unders
tanding-memory-references-pinned-objects-and.aspx

HTH & keep us posted - I'm sure we'll have to face this issue before too
long.

Jerry

Voelkel, Andy wrote: 

Hi Tim,

 

Thanks. That helps, just to know it is possible. One of the things I
don't know how to do create an "unmanaged threads". I was under the
impression that threads themselves aren't managed or unmanaged, only
code was. And therefore I don't know how to arrange it so that the gc
knows that my low latency thread doesn't contain unmanaged code and
thereform doesn't suspend it". Do you have any book or other reading
recommendations that would enlighten me on such issues? 

 

- Andy

 







CONFIDENTIALITY NOTICE: This e-mail transmission, and any documents, files or 
previous e-mail messages attached to it, may contain information that is 
confidential and/or legally privileged. If you are not the intended recipient, 
or a person responsible for delivering it to the intended recipient, please DO 
NOT disclose the contents to another person, store or copy the information in 
any medium, or use any of the information contained in or attached to this 
transmission for any purpose. If you have received this transmission in error, 
please immediately notify the sender by reply email or at 
mailto:privacy@xxxxxxxxxxxxxxx, and destroy the original transmission and its 
attachments without reading or saving in any manner. 

For further information about Plantronics - the Company, its products, brands, 
partners, please visit our website www.plantronics.com.

Other related posts: