Thread: Didn't know where to post this, here WAVEFORMATEX....help

  1. #1
    left crog... back when? incognito's Avatar
    Join Date
    Oct 2001
    Posts
    1,427

    Didn't know where to post this, here WAVEFORMATEX....help

    I have a problem with WAVEFORMATEX, I know how to assign values to it and everything......for example
    Code:
    WAVEFORMATEX waveFormat;
    
    waveFormat.wFormatTag = WAVE_FORMAT_PCM;
    waveFormat.nChannels = 2;
    waveFormat.nSamplesPerSec = 44100;
    waveFormat.wBitsPerSample = 16;
    waveFormat.nBlockAlign = waveFormat.nChannels * (waveFormat.wBitsPerSample/8);
    waveFormat.nAvgBytesPerSec = waveFormat.nSamplesPerSec * waveFormat.nBlockAlign;
    waveFormat.cbSize = 0;
    First of, I haven't finished the chapter on Direct Sound.....but I've skimmed ahead and don't see this being mentioned again, so I want to know how is are these formats assigned to a sound buffer or sound object. I mean after you fill out all this information how do you assign it to something? Thank you in advance.
    There are some real morons in this world please do not become one of them, do not become a victim of moronitis. PROGRAMMING IS THE FUTURE...THE FUTURE IS NOW!!!!!!!!!

    "...The only real game I thank in the world is baseball..." --Babe Ruth

    "Life is beautiful"-Don Corleone right before he died.

    "The expert on anything was once a beginner" -Baseball poster I own.


    Left cprog on 1-3-2005. Don't know when I am coming back. Thanks to those who helped me over the years.

  2. #2
    left crog... back when? incognito's Avatar
    Join Date
    Oct 2001
    Posts
    1,427
    sorry to bump but is that I still haven't found the answer to this question, I've searched the board and the internet and still nothing.
    There are some real morons in this world please do not become one of them, do not become a victim of moronitis. PROGRAMMING IS THE FUTURE...THE FUTURE IS NOW!!!!!!!!!

    "...The only real game I thank in the world is baseball..." --Babe Ruth

    "Life is beautiful"-Don Corleone right before he died.

    "The expert on anything was once a beginner" -Baseball poster I own.


    Left cprog on 1-3-2005. Don't know when I am coming back. Thanks to those who helped me over the years.

  3. #3
    S­énior Member
    Join Date
    Jan 2002
    Posts
    982
    This is dependent on the DirectSound version you are programming for but it'll probably be something along the lines of -

    Code:
    pointerToYourDirectSoundBuffer->SetFormat(pToYourWAVEFORMATEX);
    Last edited by Sorensen; 05-23-2002 at 02:16 PM.

  4. #4
    left crog... back when? incognito's Avatar
    Join Date
    Oct 2001
    Posts
    1,427
    What's the last parameter for? 0? I am using Direct X 7.0
    There are some real morons in this world please do not become one of them, do not become a victim of moronitis. PROGRAMMING IS THE FUTURE...THE FUTURE IS NOW!!!!!!!!!

    "...The only real game I thank in the world is baseball..." --Babe Ruth

    "Life is beautiful"-Don Corleone right before he died.

    "The expert on anything was once a beginner" -Baseball poster I own.


    Left cprog on 1-3-2005. Don't know when I am coming back. Thanks to those who helped me over the years.

  5. #5
    left crog... back when? incognito's Avatar
    Join Date
    Oct 2001
    Posts
    1,427
    Get it now........ hey do you know of any place where I can find all the definitions to the Direct X Functions?
    There are some real morons in this world please do not become one of them, do not become a victim of moronitis. PROGRAMMING IS THE FUTURE...THE FUTURE IS NOW!!!!!!!!!

    "...The only real game I thank in the world is baseball..." --Babe Ruth

    "Life is beautiful"-Don Corleone right before he died.

    "The expert on anything was once a beginner" -Baseball poster I own.


    Left cprog on 1-3-2005. Don't know when I am coming back. Thanks to those who helped me over the years.

  6. #6
    S­énior Member
    Join Date
    Jan 2002
    Posts
    982
    >What's the last parameter for? 0?

    Sorry I edited it as I was merging 2 functions into one. The last parameter for CreateSoundBuffer() is NULL.

    >I am using Direct X 7.0

    You may have searched the internet high and low, but the information you require is in perhaps the most obvious place. Try the Direct X 7.0 help file - DirectSound Tutorial 1, Step 1 : Set Up DirectSound. It contains all the information you require.

  7. #7
    left crog... back when? incognito's Avatar
    Join Date
    Oct 2001
    Posts
    1,427
    Thanks man it took me a while to find, but I finally got it......
    umm, I found this one...

    hr = (*lplpDsb)->lpVtbl->SetFormat(*lplpDsb, &wf);

    Just don't know what this lpVtbl is for.
    There are some real morons in this world please do not become one of them, do not become a victim of moronitis. PROGRAMMING IS THE FUTURE...THE FUTURE IS NOW!!!!!!!!!

    "...The only real game I thank in the world is baseball..." --Babe Ruth

    "Life is beautiful"-Don Corleone right before he died.

    "The expert on anything was once a beginner" -Baseball poster I own.


    Left cprog on 1-3-2005. Don't know when I am coming back. Thanks to those who helped me over the years.

  8. #8
    left crog... back when? incognito's Avatar
    Join Date
    Oct 2001
    Posts
    1,427
    Because I see that in some other functions that I didn't see using that before on the book. What does this mean? Is that like extra in there or something.......lpVtbl
    There are some real morons in this world please do not become one of them, do not become a victim of moronitis. PROGRAMMING IS THE FUTURE...THE FUTURE IS NOW!!!!!!!!!

    "...The only real game I thank in the world is baseball..." --Babe Ruth

    "Life is beautiful"-Don Corleone right before he died.

    "The expert on anything was once a beginner" -Baseball poster I own.


    Left cprog on 1-3-2005. Don't know when I am coming back. Thanks to those who helped me over the years.

  9. #9
    S­énior Member
    Join Date
    Jan 2002
    Posts
    982
    >Just don't know what this lpVtbl is for.

    That's for using Direct X in straight C. To access functions through pointers to COM objects you need to go via a pointer to a table of functions (as C doesn't support functions in structs without doing something along these lines).

    If you're using C++ anyway then you either need to use C++ documentation or ignore the lpVtbl bit.

  10. #10
    left crog... back when? incognito's Avatar
    Join Date
    Oct 2001
    Posts
    1,427
    Thanks I'll stick for ignoring it for now......
    There are some real morons in this world please do not become one of them, do not become a victim of moronitis. PROGRAMMING IS THE FUTURE...THE FUTURE IS NOW!!!!!!!!!

    "...The only real game I thank in the world is baseball..." --Babe Ruth

    "Life is beautiful"-Don Corleone right before he died.

    "The expert on anything was once a beginner" -Baseball poster I own.


    Left cprog on 1-3-2005. Don't know when I am coming back. Thanks to those who helped me over the years.

  11. #11
    S­énior Member
    Join Date
    Jan 2002
    Posts
    982
    You'll also have to ignore the first parameter in any function that uses the Vtable as this is silently passed in C++.

  12. #12
    left crog... back when? incognito's Avatar
    Join Date
    Oct 2001
    Posts
    1,427
    You mean out of......(*lplpDsb, &wf);

    to ignore *lplpDsb?

    Thanks that outta save me a lot of hair on my head and headaches.
    There are some real morons in this world please do not become one of them, do not become a victim of moronitis. PROGRAMMING IS THE FUTURE...THE FUTURE IS NOW!!!!!!!!!

    "...The only real game I thank in the world is baseball..." --Babe Ruth

    "Life is beautiful"-Don Corleone right before he died.

    "The expert on anything was once a beginner" -Baseball poster I own.


    Left cprog on 1-3-2005. Don't know when I am coming back. Thanks to those who helped me over the years.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Help (Trying to post message)
    By mrkm in forum A Brief History of Cprogramming.com
    Replies: 4
    Last Post: 10-06-2003, 04:05 PM
  2. Post your Best Text Adventure
    By Joe100 in forum Game Programming
    Replies: 3
    Last Post: 08-15-2003, 05:47 PM
  3. Auto POST
    By vasanth in forum A Brief History of Cprogramming.com
    Replies: 10
    Last Post: 06-07-2003, 10:42 AM
  4. post update
    By iain in forum A Brief History of Cprogramming.com
    Replies: 0
    Last Post: 08-12-2001, 10:47 AM