Re: Convert DirectX secondary buffer contents to floating point
From: Chris P. [MVP] (msdn_at_chrisnet.net)
Date: 07/15/04
- Previous message: Philip Taylor [ATI]: "Re: !!! Please Help Direct Music 8.1 Sample Crash on W2K !!!"
- In reply to: Andrew Mayo: "Re: Convert DirectX secondary buffer contents to floating point"
- Next in thread: Andrew Mayo: "Re: Convert DirectX secondary buffer contents to floating point"
- Reply: Andrew Mayo: "Re: Convert DirectX secondary buffer contents to floating point"
- Messages sorted by: [ date ] [ thread ]
Date: Thu, 15 Jul 2004 10:34:47 -0400
Andrew Mayo wrote:
...
> I would prefer not to re-convert them to float format, so loading and
> converting at load time is preferable. What API should I use to do
> this and then get a pointer to the WAV buffer?. It sounds like I
> shouldn't be loading the file into a DirectSound secondary buffer, so
> is there an alternative DirectSound object/method I should be using,
> or is there another API I should use (sorry to ask but there are just
> *so* many Windows APIs out there now I am never sure what the current
> 'portable, preferred' method might be.
>
> Later on, I intend to support streaming from disk, so any technique
> ought to be extensible to this approach - that would require that I
> convert 'on the fly' with maximal efficiency.
What language are you using? In C there is no API to load a WAV file
directly into a secondary buffer.
Streaming is definately the way to go, it prevents wasting memory that could
be used for other things. Disk caching in 2K and XP keeps things pretty
well optimized.
If you don't want to stream right now, the way to go is to manually open the
file with CreateFile() or your language equivilant, parse the wave header to
validate the format and determine it's size, locate the data chunk, and read
the data in blocks at a time to process and placed the converted data in
your DS buffer. This process will be amenable to future streaming from
file.
There are several examples around on how to parse WAV files, so I won't go
through the gory details here. You can either use the mmIO functions, or
read the file as binary manually. But in your case where they should all be
in the same format things should be simple enough. I would probably make it
smart enough so that if it does find a 32-bit float file, it can still open
it and bypass the conversion step.
- Previous message: Philip Taylor [ATI]: "Re: !!! Please Help Direct Music 8.1 Sample Crash on W2K !!!"
- In reply to: Andrew Mayo: "Re: Convert DirectX secondary buffer contents to floating point"
- Next in thread: Andrew Mayo: "Re: Convert DirectX secondary buffer contents to floating point"
- Reply: Andrew Mayo: "Re: Convert DirectX secondary buffer contents to floating point"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|