Also, after taking a quick screenshot while the error displayed, it turns out it couldn't load the map. (default/tutorial.rmp). Do you know what's up with that? Is it because it's in a subfolder (maps/default/tutorial.rmp)? And do you think you could output the error to the console too?
Edit: just noticed it plays back the menu sound effects only once, too. Is it because I'm stopping the last instance and then immediately playing it back again, perhaps?
Figured out the map issue after stepping through the map load function with the debugger a few times. The map itself loads just fine, it's actually the tileset that causes the load failure. Good call on the subdirectory thing: It turns out the tileset filename stored in the RMP file is relative to the directory containing that map--whereas minisphere assumes it's always relative to <gamedir>/maps. So yeah, having the map in a subdirectory tripped it up. Shouldn't be too difficult to fix. 1.0.5, here we come!
As for the sounds, I have noticed a few issues with sound myself, but I haven't been able to pin down the cause yet. Either I'm doing something wrong or Allegro's audio routines are glitched. I'm thinking more the former, though...
The sound stuff was actually one of the first things I implemented way back in the beginning of minisphere's development (yes, my priorities are odd, don't judge me!
), so the code could probably use another go-over.
Edit: So apparently minisphere doesn't like playing the same sound more than once, despite the explicit
al_seek_audio_stream_secs(stream, 0.0); in js_Sound_stop(). Further investigation will be needed. I didn't notice this before because all my sound-playing in Specs is done through Scenario's built-in playSound scenelet, which loads sounds anew each time they're played. I never bothered to implement caching for that scenelet...
Edit2: Damn it, best I can tell it's a race condition in Allegro. This is my working theory: Allegro apparently runs the stream in a separate thread. When you call the stream functions, it queues the operation to be done on the worker thread. So even though I've queued a rewind, I also call play immediately afterwards. I'm guessing Allegro processes the play operation before the seek, so it immediately stops again as it's still at the end of the stream.
Edit3: Aaand I was right. When the stream ends "naturally" (manual starts and stops don't seem to affect it), the stream feeder thread terminates and never gets restarted unless you recreate the stream. Looks like it
was an Allegro bug after all!