From: <sv...@ww...> - 2007-10-25 19:05:56
|
Author: nsmoooose Date: 2007-10-25 12:05:48 -0700 (Thu, 25 Oct 2007) New Revision: 2187 Modified: branches/osg_2_0/csp/cspsim/sound/OggLoader.cpp Log: In windows it isn't safe to send a FILE structure between dll:s (ov_open). Usually because of different versions of vc runtime. Using the manually built devpack this call isn't succeeding. By using the much simpler ov_fopen method this issue is solved. Browse at: https://www.zerobar.net/viewcvs/viewcvs.cgi?view=rev&rev=2187 Modified: branches/osg_2_0/csp/cspsim/sound/OggLoader.cpp =================================================================== --- branches/osg_2_0/csp/cspsim/sound/OggLoader.cpp 2007-10-07 17:46:29 UTC (rev 2186) +++ branches/osg_2_0/csp/cspsim/sound/OggLoader.cpp 2007-10-25 19:05:48 UTC (rev 2187) @@ -37,13 +37,12 @@ class OggLoader: public SoundFileLoader { public: static bool loadOgg(std::string const &filename, std::string &data, ALenum &format, ALsizei &freq) { - FILE *f = fopen(filename.c_str(), "rb"); - if (!f) { + OggVorbis_File ogg; + int open_result = ov_fopen(const_cast<char*>(filename.c_str()), &ogg); + if(open_result < 0) { CSPLOG(ERROR, AUDIO) << "error opening file sound sample " << filename; return false; } - OggVorbis_File ogg; - ov_open(f, &ogg, NULL, 0); vorbis_info *info = ov_info(&ogg, -1); format = (info->channels == 1) ? AL_FORMAT_MONO16 : AL_FORMAT_STEREO16; freq = info->rate; |