Re: Sound Card read Data
From: Corey Murtagh (emonk_at_slingshot.no.uce)
Date: 04/17/04
- Next message: Corey Murtagh: "Re: Basic programming Question?"
- Previous message: Malcolm: "Re: college"
- In reply to: barmagan_at_transvaro.com.tr: "Sound Card read Data"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Sun, 18 Apr 2004 07:59:31 +1200
barmagan@transvaro.com.tr wrote:
> Hi,
> I want to read realtime data from sound cards R/L channels.
> I've found sources of an oscilloscope program using
> waveIn*** APIs. Program transfers sound card buffer to an
> other buffer. But I couldn't modify the source in order to
> read only the current realtime data, because I don't
> understand how these APIs and sound card work.
> I can only init (waveInOpen) and start the A/D conversion
> (waveInStart). but I don't know the procedure (which APIs
> to use and How) for reading realtime data from both
> channels. Can you help me?
You need to prepare a set of buffers (at least 2 for seamless capture)
using the waveInPrepareHeader function, start the waveIn device, then
process messages/callbacks from the device. You will get a message (or
callback) each time one of the buffers fills up, at which point you call
waveInUnprepareHeader, copy the data from the buffer, then re-prepare it.
Using two (or more) buffers ensures that the waveIn device continues to
capture while you're working with the current buffer. It's quite
possible on a reasonably fast machine to use two smallish buffers - say
20ms each - if you're not doing too much with the data. The larger the
buffer the larger the lag between your program and real-time.
-- Corey Murtagh The Electric Monk "Quidquid latine dictum sit, altum viditur!"
- Next message: Corey Murtagh: "Re: Basic programming Question?"
- Previous message: Malcolm: "Re: college"
- In reply to: barmagan_at_transvaro.com.tr: "Sound Card read Data"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|