Author Topic: Music looping points?  (Read 2445 times)

Offline skyhawk

  • Colonel
  • ****
  • Posts: 115
    • View Profile
Music looping points?
« on: November 12, 2019, 06:16:27 am »
Quickly bringing up something from years ago to see if there is any chance of getting it implemented now:

Can we get looping points implemented for digital music? Something like this?

I ask because I could produce better-sounding MT-32 music packs for both EU and TFTD with this ability.

Offline Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 8615
    • View Profile
Re: Music looping points?
« Reply #1 on: November 12, 2019, 01:57:33 pm »
Music playback is part of SDL mixer library used by OpenXcom.
If they support it, we do to.
Try it, and let us know?

Offline skyhawk

  • Colonel
  • ****
  • Posts: 115
    • View Profile
Re: Music looping points?
« Reply #2 on: November 13, 2019, 09:49:15 pm »
HOLD UP! I just found THIS - If it's effectively a drop-in replacement it might be a low-calorie solution.....




I've skimmed the docs for SDL_Mixer, and it makes no reference to the functionality I'm looking for; I assume it does not have the ability.

From the looks of some of the functions, it _might_ be possible to cobble together the capability, but it would require an external source for the looping points, and much worse, would require the OpenXCom devs to spend the calories to implement it.

- Music would have to be played without SDL looping
- Mix_HookMusicFinished can catch when a music track stops
- Logic would have to be implemented to figure out if we want to continue playing music
- Mix_SetMusicPosition can set to an arbitrary time (Assuming it can accept a high-accuracy argument like "60.0015" or somesuch)
- Even with all this, I have no idea if we would get seamless playback, or an audible break in the music

While this is a fun thought experiment, this would probably break things and is in no way worth the effort.

Offline Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 8615
    • View Profile
Re: Music looping points?
« Reply #3 on: November 13, 2019, 10:01:42 pm »
1/ music in openxcom already loops, always did... why do you need some extra special looping?


2/ from the sdl mixer X feature list:

Quote
Added support of the loop points in the OGG and OPUS files (via LOOPSTART and LOOPEND (or LOOPLENGHT) meta-tags) (Later was also added into original SDL_mixer).

They say the looping was added to the original (used by openxcom) too...

Offline skyhawk

  • Colonel
  • ****
  • Posts: 115
    • View Profile
Re: Music looping points?
« Reply #4 on: November 13, 2019, 10:16:40 pm »
@Meridian, I'm asking because the MT-32, especially if you're producing nicer-sounding output like I want to provide, does a lot of reverb - Starting playback at a loop-point, means you're starting with all the reverb from the "previous loop", and it sounds nasty.

The documentation doesn't mention this, but I did find this, which suggests the capability is there. I'm going to go test....

Offline skyhawk

  • Colonel
  • ****
  • Posts: 115
    • View Profile
Re: Music looping points?
« Reply #5 on: November 14, 2019, 12:30:09 am »
Initial testing suggests that OpenXCom does not honor LOOPSTART and LOOPEND values.

Offline skyhawk

  • Colonel
  • ****
  • Posts: 115
    • View Profile
Re: Music looping points?
« Reply #6 on: November 14, 2019, 12:56:18 am »
I think the Ogg looping was introduced recently-ish in SDL-mixer 2.0, while OpenXCom uses the ancient SDL-mixer 1.2

Any chance of getting that updated?