Re: Correlating SecondaryBuffer PlayCursor Position and Time in VB.NET
- From: "Chris P. [MVP]" <msdn@xxxxxxxxxxxx>
- Date: Mon, 18 Apr 2005 22:46:02 -0400
On Tue, 19 Apr 2005 00:16:29 GMT, Chrisbot.com wrote:
> This is great stuff. Thank you.
>
> What do you think about loading into separate SecondaryBuffers the 64
> samples from individual wav files. To play them in sequence, I'll Play() the
> first one and then While SecBuf_01.Status.Playing until it is finished.
> Then, continue Playing() and While-ing until each file in the sequence is
> played. I'm thinking of a recursive loop scenario.
I think it would work but would be a little bit wasteful. The ideal would
be to load on the fly, having perhaps just the next buffer after the one
that's playing loaded ready to go. Unless of course all your clips are a
matter of seconds in which case I would still create the buffers on the fly
but have all the clips loaded into memory.
> I am interested to learn more about breaking up a buffer into separate
> buffers. That would probably be a more elegant way to load the samples.
Wave files are very simple in structure. There is a header, followed by
data. The header is made up of RIFF size descriptor with a fmt chunk and a
data chunk. For a wave file the RIFF chunk describes the size of the
entire file including header. The fmt chunk marker is folloed by a DWORD
which has the size of the header block which is either a WAVEFORMAT,
WAVEFORMATEX or WAVEFORMATEXTENSIBLE structure - this can be determined by
the size of the header and the format ID. Following the header is the data
marker which again has a DWORD size letting you know the size of the data
in bytes. Divide appropriately to determine the size of the file in
samples or milliseconds.
Now if your file contains multiple clips it gets a little more complicated.
Obviously your going to need something that tells you were the clips begin
and end such as a cue *** or something similar.
> The Notification object is something I would like to learn more about too.
It's fairly straight forward. It's basically an object that allows you to
set a marker at a given point (or points) in the buffer. When the cursor
reaches that point and event is triggered. If your program is waiting on
that event you can then trigger the appropriate reaction.
> Do you have any example code for either buffer splitting or Notification
> object?
Nothing in .NET, I'm still a C++ guy. The principles are similar enough
however. If you can provide a little more details about your files,
especially how you intend to determine breaks in the individual clips, I'll
be more than happy to point you in the right direction.
-Chris
.
- Follow-Ups:
- Re: Correlating SecondaryBuffer PlayCursor Position and Time in VB.NET
- From: Chrisbot.com
- Re: Correlating SecondaryBuffer PlayCursor Position and Time in VB.NET
- References:
- Correlating SecondaryBuffer PlayCursor Position and Time in VB.NET
- From: Chrisbot.com
- Re: Correlating SecondaryBuffer PlayCursor Position and Time in VB.NET
- From: Chris P. [MVP]
- Re: Correlating SecondaryBuffer PlayCursor Position and Time in VB.NET
- From: Chrisbot.com
- Re: Correlating SecondaryBuffer PlayCursor Position and Time in VB.NET
- From: Chris P. [MVP]
- Re: Correlating SecondaryBuffer PlayCursor Position and Time in VB.NET
- From: Chrisbot.com
- Correlating SecondaryBuffer PlayCursor Position and Time in VB.NET
- Prev by Date: Re: Correlating SecondaryBuffer PlayCursor Position and Time in VB.NET
- Next by Date: z axis volume problem with DirectSound listener
- Previous by thread: Re: Correlating SecondaryBuffer PlayCursor Position and Time in VB.NET
- Next by thread: Re: Correlating SecondaryBuffer PlayCursor Position and Time in VB.NET
- Index(es):