🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: borland.public.cppbuilder.multimedia
12 messages
12 total messages Started by Mike Mon, 16 Apr 2001 08:43
Skipping when recording
#1255
Author: Mike
Date: Mon, 16 Apr 2001 08:43
9 lines
1048 bytes
Hi!

How can I record with waveIn without skipping (now I record to buffer,
than, when all data arrives, save to disk, and again start recording,
but
I lost a little of sound)?


Mike
Re: Skipping when recording
#1256
Author: Michael Warner
Date: Mon, 16 Apr 2001 15:07
20 lines
1763 bytes
On Mon, 16 Apr 2001 10:43:47 +0200, Mike <ppagee@yahoo.com> wrote:

>How can I record with waveIn without skipping (now I record to buffer,
>than, when all data arrives, save to disk, and again start recording,
>but
>I lost a little of sound)?

As with playing, you need to use double-buffering so that when one
buffer becomes full the other begins to fill while you process the
first one. The procedure works like this:

- Queue buffer A
- Queue buffer B
- Start recording
- A fills: process data in A and requeue it
- B fills: process data in B and requeue it
- A fills: etc.

You never leave the device without a queued buffer to place data into.
Size the buffers so that each holds a second or so of data.
Re: Skipping when recording
#1257
Author: Mike
Date: Tue, 17 Apr 2001 12:45
11 lines
1182 bytes
Hi!

So, when message MMWimData comes I should with
WaveRecordBegin(hwi, lpWaveHdrR2); (where is lpWaveHdrR2
second buffer) start recording into second buffer. And when
that buffer is filled start recording to first buffer.

But won't there be any gap?


Mike
Re: Skipping when recording
#1258
Author: Michael Warner
Date: Tue, 17 Apr 2001 16:21
15 lines
1811 bytes
On Tue, 17 Apr 2001 14:45:07 +0200, Mike <ppagee@yahoo.com> wrote:

>So, when message MMWimData comes I should with
>WaveRecordBegin(hwi, lpWaveHdrR2); (where is lpWaveHdrR2
>second buffer) start recording into second buffer. And when
>that buffer is filled start recording to first buffer.

No, buffer two should be queued _before_ the first buffer is returned
to you. If you look at my previous msg you'll see that the process is
begun by queueing both buffers.

Imagine that the incoming data is a stream of water flowing out of a
tap, and you have two buckets to transfer it. The way to catch all the
water is to always have a bucket ready below when the top one fills.
Try it in your kitchen sink with two cups to get the idea :-)
Re: Skipping when recording
#1259
Author: Mike
Date: Tue, 17 Apr 2001 20:08
12 lines
1217 bytes
Hi!

And how can I "put the other cup under"? With making header?

So, it should be something like this:
making header1
making header2
start recording 1
And what now? Start recording 2 or wait until recording 2 is finished?


Mike
Re: Skipping when recording
#1260
Author: William Meyer
Date: Wed, 18 Apr 2001 06:02
11 lines
1124 bytes
"Mike" <ppagee@yahoo.com> wrote in message
news:3ADAB0C3.35E942DC@yahoo.com...
>
> How can I record with waveIn without skipping (now I record to buffer,
> than, when all data arrives, save to disk, and again start recording,
> but
> I lost a little of sound)?

Are you using MCI?

Bill
Re: Skipping when recording
#1261
Author: Michael Warner
Date: Wed, 18 Apr 2001 06:26
11 lines
1480 bytes
On Tue, 17 Apr 2001 22:08:07 +0200, Mike <ppagee@yahoo.com> wrote:

>So, it should be something like this:
>making header1
>making header2
>start recording 1
>And what now? Start recording 2 or wait until recording 2 is finished?

When I refer to queueing a buffer, that means calling
waveInAddBuffer(). The fact that you must call waveInPrepareHeader()
first is just a procedural detail.
Re: Skipping when recording
#1262
Author: Mike
Date: Wed, 18 Apr 2001 20:21
8 lines
1007 bytes
Hi!

> Are you using MCI?

No, I don't.


Mike
Re: Skipping when recording
#1263
Author: Mike
Date: Thu, 19 Apr 2001 16:00
13 lines
1243 bytes
Hi!

So:
waveInPrepareHeader (1)
waveInPrepareHeader (2)
waveInAddBuffer (1)
waveInAddBuffer (2)
waveInStart

OK, how can i now know which buffer is full? And what do next?


Mike
Re: Skipping when recording
#1264
Author: Michael Warner
Date: Thu, 19 Apr 2001 16:34
21 lines
1831 bytes
On Thu, 19 Apr 2001 18:00:31 +0200, Mike <ppagee@yahoo.com> wrote:

>waveInPrepareHeader (1)
>waveInPrepareHeader (2)
>waveInAddBuffer (1)
>waveInAddBuffer (2)
>waveInStart

You got it!

>OK, how can i now know which buffer is full?

Without looking it up, I'm sure all the notification mechanisms
(message, callback etc) enable you to find out - you may need to fill
in a header "tag" of some kind. But you don't really need to know,
because the buffers always fill alternately, beginning with #1.

> And what do next?

Fetch the data from the filled buffer and re-queue it immediately. In
the meantime the other buffer is starting to fill.
Re: Skipping when recording
#1265
Author: Mike
Date: Fri, 20 Apr 2001 17:49
6 lines
1231 bytes
Hi!

Just thanks for everything! It works now.


Mike
Re: Skipping when recording
#1268
Author: Michael Warner
Date: Sun, 22 Apr 2001 15:08
6 lines
1474 bytes
On Fri, 20 Apr 2001 19:49:21 +0200, Mike <ppagee@yahoo.com> wrote:

>Just thanks for everything! It works now.

Great. I could have given you some sample code, but you actually
understand it now :-)
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads