Direct X10 wont play every type of .wav file

Started by
4 comments, last by L. Spiro 12 years, 5 months ago
hi

I've just learnt that Direct X10 refuses to play every type of wav even though, the secondary buffer was initialized to accept them. Why is this?

http://dl.dropbox.com/u/42518274/DirectXwavesound_tutorial.rar

if you take this section:


// Load a wave audio file onto a secondary buffer.
result = LoadWaveFile("../Engine/data/sound01.wav", &m_secondaryBuffer1);
if(!result)
{
return false;
}



and change it to "kanyewestpower.wav" (which is in the data folder), it gives the error that direct X sound couldn't be initialized.
why is this?
The little theory I've got so far is that a reason might be because the kanye west file isn't a 16bit sound file.
But apart from this I'm not sure how much code I have to change before I can get it to work.


// Load a wave audio file onto a secondary buffer.
result = LoadWaveFile("../Engine/data/kanyewestpower.wav", &m_secondaryBuffer1);
if(!result)
{
return false;
}

Advertisement
First off, people generally don't want to download your entire project solution. If you've got a particular problem, try and narrow it down and post all the relevant (but only relevant) code, rather than code dumping everything here (which I won't wade through) or uploading the files to some server (which I won't download). You can, of course, link to something where we can download the relevant wav file, if necessary. Just a suggestion.

Second, give some more specifics about the problem. Yes, you said that DirecX Sound couldn't be initialized, but what exactly does LoadWaveFile return? An error code? What's the exact value of the error code? What exactly is LoadWaveFile doing? Yeah, I could download the project, browse through it, try to build it (assuming I have all the dependencies installed on my machine), debug it, etc. but I'd much, much rather just have you post the relevant code and have me look at it and try and just use my brain to decipher what's wrong, rather than going through a million steps to see what's wrong.

Post the code for LoadWaveFile and the definition and any uses of [font="CourierNew, monospace"]m_secondaryBuffer1[/font].


P.S. The reason I say this is to help you know how to effectively ask questions and seek help. You're putting forth effort, which is good, and you're seeking help when you need it, which is good, but there are more effective ways to get help and less effective ways to get help. Learning the effective ways will probably help you more than just answering this question. Last time, you wanted help but didn't post enough code at first, so now you're posting all your code at the beginning, so you're making progress. Now let's help you learn how to post just the necessary code. Look at your code and try and find everything that may be relevant to this problem, and post it, while forgetting about everything else that is irrelevant.
[size=2][ I was ninja'd 71 times before I stopped counting a long time ago ] [ f.k.a. MikeTacular ] [ My Blog ] [ SWFer: Gaplessly looped MP3s in your Flash games ]
just want to make sure, are you saying that using [color=#008800][font=CourierNew, monospace][size=2]"../Engine/data/sound01.wav"[/font] works, but using [color=#008800][font=CourierNew, monospace][size=2]"../Engine/data/kanyewestpower.wav"[/font] doesn't?

Are these two different files? If they are, one thing to check (i know this is quite obvious, but doesn't hurt to ask), is to make sure that the kanyewest file is exactly the correct name, and exactly in that data folder. Just a suggestion
Quoting http://rastertek.com/dx10tut14.html:

I also do a couple other checks to ensure it is a 44.1KHz stereo 16bit audio file. If it is mono, 22.1 KHZ, 8bit, or anything else then it will fail ensuring we are only loading the exact format we want[/quote]

Put a breakpoint on that LoadWaveFile, step through all the checks. I bet the format isn't right.

Also: Be careful to provide full downloads of possibly IP protected stuff. This is bannable offense around here.
DirectSound hasn't been updated since version 8 so we can rule out anything DX10-specific for starters.

It's definitely capable of loading 8-bit WAVs; I have code running right now that loads and plays 8-bit WAVs, using the IDirectSoundBuffer8 interface. Even bloody Quake used it for 8-bit source data back in 1996. No problems there; format ruled out as a potential cause.

DirectSound is not a general purpose WAV loader and player. I'm betting that you're blasting right through a limitation. Like the others said, set some breakpoints and check your HRESULTS.

Direct3D has need of instancing, but we do not. We have plenty of glVertexAttrib calls.

Your problem is probably related to the file format, but I want to give this tip anyway.

Whenever hard-coding a file name into your code, always go to the file in Explorer, click the file, hit F2 (and on Windows Vista and up also hit Ctrl-A) and then Ctrl-C to copy the file name exactly as it is.
I told a coworker about this a few years ago but he didn’t make it law until the 5 times he had incorrect names in his code. One was because there was a space after the extension (who knows?).
It was that one that broke his back of resistance and he has never had a problem getting exactly the correct file names into his code since.

Anyway it just leaves one less possible error for you to consider when examining these types of issues.


L. Spiro

I restore Nintendo 64 video-game OST’s into HD! https://www.youtube.com/channel/UCCtX_wedtZ5BoyQBXEhnVZw/playlists?view=1&sort=lad&flow=grid

This topic is closed to new replies.

Advertisement