Author Topic: DOS music and sound effects for Lemmix? an idea.  (Read 13175 times)

0 Members and 1 Guest are viewing this topic.

Zaphod77

  • Guest
Re: DOS music and sound effects for Lemmix? an idea.
« Reply #30 on: October 08, 2014, 05:52:58 PM »
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.

Offline namida

  • Administrator
  • Posts: 12399
    • View Profile
    • NeoLemmix Website
Re: DOS music and sound effects for Lemmix? an idea.
« Reply #31 on: October 08, 2014, 09:16:41 PM »
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 Lemmings 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)

Zaphod77

  • Guest
Re: DOS music and sound effects for Lemmix? an idea.
« Reply #32 on: October 08, 2014, 09:49:35 PM »
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.

Offline namida

  • Administrator
  • Posts: 12399
    • View Profile
    • NeoLemmix Website
Re: DOS music and sound effects for Lemmix? an idea.
« Reply #33 on: October 08, 2014, 10:27:16 PM »
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 Lemmings 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)

Zaphod77

  • Guest
Re: DOS music and sound effects for Lemmix? an idea.
« Reply #34 on: October 09, 2014, 01:11:49 AM »
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

  • Guest
Re: DOS music and sound effects for Lemmix? an idea.
« Reply #35 on: November 09, 2014, 05:27:20 AM »
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.

Offline namida

  • Administrator
  • Posts: 12399
    • View Profile
    • NeoLemmix Website
Re: DOS music and sound effects for Lemmix? an idea.
« Reply #36 on: November 09, 2014, 06:28:33 AM »
I haven't looked at it again yet, sorry. I'll look at it now and see what I can do.
My Lemmings 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)

Offline namida

  • Administrator
  • Posts: 12399
    • View Profile
    • NeoLemmix Website
Re: DOS music and sound effects for Lemmix? an idea.
« Reply #37 on: November 09, 2014, 09:20:20 AM »
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 Lemmings 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)