#### Archived

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

# Ogg Vorbis Failure

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

## 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 on other sites
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 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 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.

##### 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 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:

1. 1
2. 2
Rutin
21
3. 3
4. 4
A4L
15
5. 5
khawk
14

• 13
• 26
• 10
• 11
• 9
• ### Forum Statistics

• Total Topics
633737
• Total Posts
3013612
×