Jump to content
  • Advertisement

Archived

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

Omaha

Ogg Vorbis Failure

This topic is 5754 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 am attempting to decode .OGG files in the function I''m working on, presently in this skeletal version:
  bool ReadSong(char *RFilename, Sound_t *RSound)
{
	FILE *Handle;
	OggVorbis_File OggHandle;
	
	if(!(Handle=fopen(RFilename, "rb")))
		return false;
				
	ov_open(Handle, &OggHandle, NULL, 0);
	
	ov_clear(&OggHandle);
	
	return true;
}  
Am I doing something drastically incorrect here? The ov_open line generates an access violation. According to the Vorbis documentation I''m paging through, there is no special OggVorbis_File initialization other than calling ov_open, nor do I find anything in the documentation for that function to indicate I am passing invalid parameters. Anyone worked with Ogg Vorbis before see something wrong here?

Share this post


Link to post
Share on other sites
Advertisement
It looks okay to me. Are you completely sure nothing else you''re doing could be causing the problem? Although it''s unlikely, maybe your copy of the Ogg/Vorbis/VorbisFile library is broken or linked incorrectly?

Share this post


Link to post
Share on other sites
I''ll double check my linker config, and I''ve tried with several .OGG files to make sure it just wasn''t my encoder.

Thanks for the reply.

Share this post


Link to post
Share on other sites
Assuming your code is correct, I think I know what your problem is. The easiest way to get your app working is to link with the Multithreaded DLL runtime library instead of the Single Threaded or Multithreaded libraries this should stop the access voilation. In VC++ 6, go to

Project > Settings > C/C++ > Category: Code Generation

(I have no clue if this may have any effects on the rest of your app, after all your not making a dll yet your using a library for dlls.)

Another way I''ve found (assuming your making a single threaded application) is to link with the static ogg vorbis libraries and have the linker ignore "msvcrt.lib" and "libcmt.lib" (if your making a debug build I think these libs are different).

I still have no clue why the ogg vorbis libraries won''t link nicely like other libs.

Digital Radiation

Share this post


Link to post
Share on other sites
Well, I''ve tried all of that (Thanks for the suggestions) and it still dies on me. I tried rebuilding the libraries from their source code, and that didn''t fix the error, but now when it breaks (still at the ov_open line) it comes to a halt in the fseek function. I''m confident the file handle is valid, so I don''t get it.

I''ve tried dynamic linking, static linking, debug builds, release builds, but nothing seems to let me read an .OGG file.

Grr. I suppose I could implement the vorbis library and try and do this the "hard" way... Or maybe I''ll just look into another format. I dunno. Frustrating.

Share this post


Link to post
Share on other sites
Don''t know if this will help, but here''s a link to some code which was on flipcode a while back:

http://www.flipcode.com/cgi-bin/msg.cgi?showThread=COTD-OggVorbisPlayerClass&forum=cotd&id=-1



Digital Radiation

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.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!