diff --git a/core/resource.d b/core/resource.d index 67752bd9f1..5e8ad4f160 100644 --- a/core/resource.d +++ b/core/resource.d @@ -183,7 +183,7 @@ struct ResourceManager // Otherwise, make this an empty resource else { - writefln("Lookup failed to find sound %s", id); + //writefln("Lookup failed to find sound %s", id); si.file = null; } @@ -242,7 +242,7 @@ struct ResourceManager if(mi.bsaIndex == -1) { - writefln("Lookup failed to find mesh %s", search); + //writefln("Lookup failed to find mesh %s", search); assert(mi.bsaFile == -1); } @@ -329,7 +329,7 @@ struct ResourceManager if(ti.bsaIndex == -1) { - writefln("Lookup failed to find texture %s", tmp); + //writefln("Lookup failed to find texture %s", tmp); assert(ti.bsaFile == -1); } diff --git a/ogre/cpp_interface.cpp b/ogre/cpp_interface.cpp index 65963b2df3..a597eafac9 100644 --- a/ogre/cpp_interface.cpp +++ b/ogre/cpp_interface.cpp @@ -200,9 +200,11 @@ extern "C" void cpp_makeScene() root->pitch(Degree(-90)); } +// Create a sky dome. Currently disabled since we aren't including the +// Ogre example data (which has the sky material.) extern "C" void cpp_makeSky() { - mSceneMgr->setSkyDome( true, "Examples/CloudySky", 5, 8 ); + //mSceneMgr->setSkyDome( true, "Examples/CloudySky", 5, 8 ); } extern "C" Light* cpp_attachLight(char *name, SceneNode* base, diff --git a/openmw.d b/openmw.d index 1418df343e..1c6b1d5a85 100644 --- a/openmw.d +++ b/openmw.d @@ -359,9 +359,6 @@ void main(char[][] args) // Run it until the user tells us to quit startRendering(); - - jukebox.disableMusic(); - battleMusic.disableMusic(); } else debug(verbose) writefln("Skipping rendering"); diff --git a/sound/audio.d b/sound/audio.d index 9ebd0dfae1..5476ba8e5a 100644 --- a/sound/audio.d +++ b/sound/audio.d @@ -29,6 +29,9 @@ public import sound.music; import sound.al; import sound.alc; +import std.stdio; +import std.string; + ALCdevice *Device = null; ALCcontext *Context = null; @@ -67,7 +70,11 @@ void initializeSound() void shutdownSound() { + jukebox.disableMusic(); + battleMusic.disableMusic(); + alutExit(); + alcMakeContextCurrent(null); if(Context) alcDestroyContext(Context); Context = null; diff --git a/sound/music.d b/sound/music.d index 51d638aa5e..76f551a8f5 100644 --- a/sound/music.d +++ b/sound/music.d @@ -26,6 +26,7 @@ module sound.music; import sound.audio; import sound.al; +import std.stdio; import std.string; import core.config; @@ -54,6 +55,7 @@ struct MusicManager throw new SoundException(name ~ " Jukebox", msg); } + /* KILLME // Used when randomizing playlist struct rndListStruct { @@ -61,6 +63,7 @@ struct MusicManager bool used; } rndListStruct[] rndList; + */ // TODO: How do we handle the play list? Randomize should be an // option. We could also support things like M3U files, etc. @@ -112,17 +115,33 @@ struct MusicManager randomize(); } - // Randomize playlist. An N^2 algorithm, but our current playlists - // are small. Improve it later if you really have to. If the - // argument is true, then we don't want the old last to be the new - // first. + // Randomize playlist. If the argument is true, then we don't want + // the old last to be the new first. private void randomize(bool checklast = false) { if(playlist.length < 2) return; - // Get the name of the last song played - char[] last = playlist[(index==0) ? ($-1) : (index-1)]; + // Get the index of the last song played + int lastidx = ((index==0) ? (playlist.length-1) : (index-1)); + foreach(int i, char[] s; playlist) + { + int idx = rnd.randInt(i,playlist.length-1); + + // Don't put the last idx as the first entry + if(i == 0 && checklast && lastidx == idx) + { + idx++; + if(idx == playlist.length) + idx = i; + } + if(idx == i) /* skip if swapping with self */ + continue; + playlist[i] = playlist[idx]; + playlist[idx] = s; + } + } + /* KILLME int left = playlist.length; rndList.length = left; @@ -159,7 +178,7 @@ struct MusicManager playlist[0] = playlist[$-1]; playlist[$-1] = last; } - } + */ // Skip to the next track void playNext()