DOS music and sound effects for Lemmix? an idea.

Started by Zaphod77, October 01, 2014, 06:10:43 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Zaphod77

random crashes usually means that you are forgetting to free stuff, or using uninitialized pointers.

maybe if I had your WIP source that was using in_vgm i could puzzle out the crash.  i'm pretty good at that.

namida

Nah, I triple-checked that everything was being freed and loaded correctly. Or at least that the code was there - it appeared that Bass simply wasn't freeing the loaded music correctly. At any rate, I didn't save the code once I started working on the OGG method. It's not much different from the current code for OGG (some of it might even still be in there commented out), except with extra/changed lines to use the BASS WinAMP plugin and of course load in_vgm accordingly. GameModPlay.pas if you're interested.
My projects
2D Lemmings: NeoLemmix (engine) | Lemmings Plus Series (level packs) | Doomsday Lemmings (level pack)
3D Lemmings: Loap (engine) | L3DEdit (level / graphics editor) | L3DUtils (replay / etc utility) | Lemmings Plus 3D (level pack)
Non-Lemmings: Commander Keen: Galaxy Reimagined (a Commander Keen fangame)

Zaphod77

I'm not sure how you would do this, but nuking behavior is not right with the sound effects still.

When yo do a nuke, or in fact with any non music sounds, they are spread out across the available channels of the OPL2 chip.

Assuming the chip is in 6 channel plus percussion mode, which is likely as many songs did use percussion, and that the musics used 3 channels plus percussion (seems about right) remaining sounds are split up among the remaining three channels.

So to correctly replicate sound behavior for DOS< you need to reserve a fixed number of channels for sound playback, which each sound replacing the one on the next channel if there is one.  I think the right number is three, but if the percussion wasn't made with percussion mode, there could be up to five.

namida

I *should* be able to do this now that the players are using Bass. If someone can confirm how many sound channels there are, I'll look into that.
My projects
2D Lemmings: NeoLemmix (engine) | Lemmings Plus Series (level packs) | Doomsday Lemmings (level pack)
3D Lemmings: Loap (engine) | L3DEdit (level / graphics editor) | L3DUtils (replay / etc utility) | Lemmings Plus 3D (level pack)
Non-Lemmings: Commander Keen: Galaxy Reimagined (a Commander Keen fangame)

Zaphod77

I know for a fact that the chip is in either 6+percussion or 9 channel mode, because there are no others.

I also know from testing that the channels dedicated to the music are never overwritten.

I'm not sure if it's even possible to work out a priority.  but in the absence of info, i'd do it like this.

Allocate one channel specifically for last three bricks clink.  any click on it will override te existing one. this ensures nothing else overrides it ever.

Allocate one channel for UI sounds, so those never get overridden either. I'm pretty sure the game does not do this, but i think it's good.


My testing suggests the following behavior. THREE sound channels are shared for all sound effects, the first free channel is used for the sound effect, and a channel is considered free 500 ms after a sound has started on it. sounds that happen when there are no fee channels are ignored.  If music is disabled, then six channels are free instead.  Exception: Trap sounds do take up the channel for their entire time. it's just the boing sound really that lasts after the channel is considered free.

I figured this out by nuking with a lot of lemmings on the screen.

Zaphod77

any progress on this? it's the main thing that's still bugging me about lemmix, especially since i now can run orig in dosbox without graphical glitches.

namida

I haven't looked at it again yet, sorry. I'll look at it now and see what I can do.
My projects
2D Lemmings: NeoLemmix (engine) | Lemmings Plus Series (level packs) | Doomsday Lemmings (level pack)
3D Lemmings: Loap (engine) | L3DEdit (level / graphics editor) | L3DUtils (replay / etc utility) | Lemmings Plus 3D (level pack)
Non-Lemmings: Commander Keen: Galaxy Reimagined (a Commander Keen fangame)

namida

Almost got it; the only thing left to do is to implement the different number of channels depending on whether music is enabled or not.

EDIT: Done. Note that it doesn't stop excess channels if you turn the music on mid-game. In essence, the extra 3 channels are always there, but no sound will be started on them if music is playing (however, if one's already playing when you turn the music on, it'll finish as normal).
My projects
2D Lemmings: NeoLemmix (engine) | Lemmings Plus Series (level packs) | Doomsday Lemmings (level pack)
3D Lemmings: Loap (engine) | L3DEdit (level / graphics editor) | L3DUtils (replay / etc utility) | Lemmings Plus 3D (level pack)
Non-Lemmings: Commander Keen: Galaxy Reimagined (a Commander Keen fangame)