Re: Convert DirectX secondary buffer contents to floating point

From: Chris P. [MVP] (msdn_at_chrisnet.net)
Date: 07/15/04

  • Next message: Nihil: "SecondaryBuffer using BufferDescription and Value not in Range err"
    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.


  • Next message: Nihil: "SecondaryBuffer using BufferDescription and Value not in Range err"

    Relevant Pages

    • Re: Multiple date formats in a Table
      ... could choose a future date so they all sort at the end. ... However if you are set up to use UK format dates of dd/mm/yy, ... converting any entries where you know the full date. ... > iii) Once you've got a function that works, create a new query in design ...
      (microsoft.public.access.tablesdbdesign)
    • Re: mp3 in the car
      ... >>I started converting to CDs and I have spent years replacing all the ... I seriously doubt they'd be available in MP3 format. ... >>many aren't available in as cassettes. ... When I said converting, I meant replacing. ...
      (rec.audio.car)
    • Re: using "!!" in "c"
      ... that Keith was". ... Here's what the standard says about the "%p" format for the *printf ... The argument shall be a pointer to void. ... converting an integer to a pointer-to-function might ...
      (comp.lang.c)
    • Re: Setting frame rate for vedio captured from handycam
      ... sample grabber filter it is converting the frames into the format what ... i set on input and output pin of sample grabber its working fine. ... when i set YUY2 it is converting the frames into YUY2 ...
      (microsoft.public.win32.programmer.directx.video)
    • Re: Need HTML/Access Coding Guru for Question
      ... controls on the forms, including combo boxes and formats, would be ... Also can I create an API for other software companies to connect to? ... I have a company who uses Java or Netbeans, I can't remember and they want ... Converting the code to VB.NET could potentially solve both problems. ...
      (microsoft.public.access.formscoding)