OpenAl + Ogg support ERROR

Started by
6 comments, last by TheOther 18 years, 9 months ago
I know that this problem was allready discussed here:
http://www.gamedev.net/community/forums/topic.asp?topic_id=198649&whichpage=1? 
but i didn't really get what was actually the solution. I've tried everything written there, and nothing helped. I also dont have "vorbisfile_static.dll" and other "_static.dll" files. What should I do?
=================* No Brain - No Pain *=================
Advertisement
Rule #1: disregard all of the ALut stuff.
[EDIT]
You can use it, but it's deprecated in Open AL 1.1.
[/EDIT]

Chances are your problems are related to your program crashing whenever you try to read the files, which can be solved by replacing all of the file handling functions, like this:

//the functions you'll use to replace the functions the OGG libraries broke//don't worry about them too much, just know that they worksize_t oread(void *ptr, size_t size, size_t nmemb, void *datasource){return fread(ptr,size,nmemb,(FILE*)datasource);}int oseek(void *datasource, ogg_int64_t offset, int whence){return fseek((FILE*)datasource,offset,whence);}int oclose(void *datasource){return fclose((FILE*)datasource);}long otell(void *datasource){return ftell((FILE*)datasource);}//in your code://<Open the file here, do error checking, etc.>OggVorbis_File ogg;memset(&ogg,0,sizeof(OggVorbis_File));//this might not be necessary//now instead of using this: ov_open(file,&ogg,0,0)//use this:ov_callbacks cbs;cbs.read_func = &oread;cbs.seek_func = &oseek;cbs.close_func = &oclose;cbs.tell_func = &otell;ov_open_callbacks(file,&ogg,0,0,cbs)


This should fix any problems you have, and it'll let you use the dynamic libraries, rather than the static ones.
Ok, thanks, that worked. But, what about ov_info, ov_comment..... The loader uses them to continue loading the file.
void cOggStream::open(string path){	int result;	if(!(oggFile=fopen(path.c_str(), "rb")))		throw string("Could Not Open File");		ov_callbacks cbs;	cbs.read_func = &oread	cbs.seek_func = &oseek	cbs.close_func = &oclose	cbs.tell_func = &otell	ov_open_callbacks(oggFile,&oggStream,0,0,cbs);		/*	if((result = ov_open(oggFile, &oggStream, NULL, 0)) < 0)	{		fclose(oggFile);		throw string("Could Not Open Stream") + ErrorString(result);	};	*/	vorbisInfo=ov_info(&oggStream, -1);	vorbisComment=ov_comment(&oggStream, -1);	if(vorbisInfo->channels==1)		format=AL_FORMAT_MONO16;	else		format=AL_FORMAT_STEREO16;	alGenBuffers(2, buffers);	check();	alGenSources(1, &source);	check();	alSource3f(source, AL_POSITION,        0.0, 0.0, 0.0);	alSource3f(source, AL_VELOCITY,        0.0, 0.0, 0.0);	alSource3f(source, AL_DIRECTION,       0.0, 0.0, 0.0);	alSourcef (source, AL_ROLLOFF_FACTOR,  0.0          );	alSourcei (source, AL_SOURCE_RELATIVE, AL_TRUE      );};
=================* No Brain - No Pain *=================
In my code, ov_info() works fine, but as for ov_comment(), I don't know, since I haven't had a use for it. I'm pretty sure it's just the file handling functions that are broken, so it should work.
Ok, the problem isn't in "ov_info" and "ov_comment". Now it crashes on alGenBuffers and alGenSources. I just dont get it. alGenBuffers and alGenSources work just fine in my other class that covers my sound system.
=================* No Brain - No Pain *=================
For example, if i comment out everything starting with glGenBuffers in the code posted earlier, my program starts without any errors. Where could be the problem?
=================* No Brain - No Pain *=================
Oh. I found my mistakes. Thanks a lot for the help. Now it's working fine. Thanks again.
=================* No Brain - No Pain *=================
So what was the problem?

This topic is closed to new replies.

Advertisement