Jump to content
  • Advertisement


This topic is now archived and is closed to further replies.


ogg vorbis: vorbisfile trouble

This topic is 5719 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I''m trying to load .ogg files into a direct sound buffer. To do this, I copied the decoding part of vorbisfile_example.c that comes with the ogg vorbis SDK. When I run my program (which attempts to load an existing .ogg file from disk) it gives me one of those annoying acces violation errors. Of course I had kind of expected this, nothing I ever do works the first time... Debugging it, I found out that the call to ov_read() is the problem. Both the file and the OggVorbis_File are passed correctly... and is "crashes". Wondering how this could happen I compiled the actual example and found out it doesn''t work either (I replaced stdin and stdout with other streams). What could be causing this? Maybe I should not use vorbisfile to decode the ogg file, but use libvorbis instead. The problem with that is that I don''t know how long the decoded pcm data is. I tried findng some documentation but I found none... for some reason the "programming with libvorbis" section in the documentation is not finished or something... So my second question would be how to find out how many bytes the decoded file will be. Or maybe someone knows some source I can take a look at... anything that can get me moving again! Thanks in advance.

Share this post

Link to post
Share on other sites
Guest Anonymous Poster
im not sure this will be any help but i did code a ogg player class som time ago and i ran into a simillar problem with the ov_read function.. the problem disapeard when i linked to the libs with _static in their name instead of the normal ones. it might be worth a try.

Share this post

Link to post
Share on other sites
I posted this link last week or so to the "DirectShow vs Vorbis OGG" thread. You might find it helpful.


Also, ogg has this nightmare lib scheme that is probably the cause of your problems. As Anonymous Poster wrote, you should use the "_static" libs for your immediate needs. Note that there are "4" of them! Also, the debug "_static_d" libs gave me some trouble, so going with the release libs may be a good idea.

You also might need to set things like /nodefaultlib:"LIBCD"

Note : I've put the names of what you should include and where in the directogg.h file.

[EDIT] : You'll just need to include 3 _static libs. The 4th one is for encoding.

[edited by - kuroahiru on April 20, 2003 4:40:06 AM]

Share this post

Link to post
Share on other sites
I tried what Kuroahiru suggested (tried to compile the ogg player), I included the static libs (and dxguid.lib) and added the /nodefaultlib options.

It hits an assert at dbgheap.c, line 1100 (or something) at _CrtIsHeapPtr(pUserData) or something along the lines...

The console window does say something about loading ogg player.

I have the feeling there''s still something wrong with the libraries... maybe you could show me your build settings?

Share this post

Link to post
Share on other sites
Build settings are almost set as the default for VC++6.
But, since you said there was an error, I looked around to see if I missed something.

Don''t know if this will help, but you can try this:

Change "Singlethreaded" to "Multithreaded DLL" in
Project Settings - C/C++ - Code Generation - Use run-time lib.

Note: Make sure to select the non-debug versions from the drop down list.

Two other things to keep in mind.
1) Did you ready an ogg/wave/midi file for the player to play? Does the error only occur when you''re trying to load ogg? Basically, does it play the other types?? Knowing that should further narrow down the error.

2) Compile in both release and debug builds to see if one actually survives. I just compiled them using both, and they ran fine. But during testing 6 months or so ago, the debug builds died left and right while the release builds were rock solid.

Share this post

Link to post
Share on other sites
Great! The Multithreaded DLL runtime lib did the trick!

Thank you.

EDIT - found a possible bug in code

// Open File
if((fileIn = fopen(file, "rb")) == NULL)
//std::cout << "Error - Can't Open File: " << szFile << "\n";
return 0;

This code appears to attempt to close a file after is has failed to open it. I found that out by stupidly misspelling the name of an .ogg file...

Could this be a bug?

EDIT 2 - messed up the [ code ] tag

[edited by - Kurioes on April 20, 2003 10:36:09 AM]

Share this post

Link to post
Share on other sites
It''s good to know that you were successful in compiling the code. Most of the other ogg codes should compile now too.

I''ll add the "Use Multithreaded-lib" part to the source when I get a chance.

Also, calling fclose() on an unopened file is my error. Thanks for catching the mistake.

Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!