+
+ALvoid *
+SGSoundSample::load_file(const char *path, const char *file)
+{
+ ALvoid* data = 0;
+
+ SGPath samplepath( path );
+ if ( strlen(file) ) {
+ samplepath.append( file );
+ }
+
+#if defined(ALUT_API_MAJOR_VERSION) && ALUT_API_MAJOR_VERSION >= 1
+ ALfloat freqf;
+ data = alutLoadMemoryFromFile(samplepath.c_str(), &format, &size, &freqf );
+ if (data == NULL) {
+ throw sg_io_exception("Failed to load wav file.",
+ sg_location(samplepath.str()));
+ }
+ freq = (ALsizei)freqf;
+#else
+# if defined (__APPLE__)
+ alutLoadWAVFile( (ALbyte *)samplepath.c_str(),
+ &format, &data, &size, &freq );
+# else
+ alutLoadWAVFile( (ALbyte *)samplepath.c_str(),
+ &format, &data, &size, &freq, &loop );
+# endif
+ if ( print_openal_error("constructor (alutLoadWAVFile)") ) {
+ throw sg_io_exception("Failed to load wav file.",
+ sg_location(samplepath.str()));
+ }
+#endif
+
+ return data;
+}
+