[Ohrrpgce] SDL_mixer and loop points

Ralph Versteegen teeemcee at gmail.com
Thu Nov 21 03:33:10 PST 2019

I know I've discussed this before, but apparently not on the mailinglist.

SDL_Mixer 2 added support for .ogg loop points a couple of years ago.
(Strangely it's not in the changelog)

Loop points work as LOOPSTART and LOOPEND or LOOPLENGTH (optional) comments
embedded in the .ogg file. LOOPSTART+LOOPLENGTH is RPG Maker-compatible.

Within the last few days to weeks, more stuff has landed in SDL_mixer hg.
-loop points in FLAC files (note: I compiled sdl_mixer.dll without FLAC
-loop points can now be expressed in hh:mm:ss notation, or named LOOP_START
or LOOP-START, for compatibility with Doom source ports
-loop points now respect the number of times we asked SDL_mixer to loop the
song. I believe after that number of loops, it'll proceed past LOOPEND to
the end, and then stop (not loop to beginning). Someone could always submit
a patch for another comment controlling a separate loop count.

So I would like to add the ability to edit loop-points right in the music
import menu.

We already have code for adding comments to an .ogg file when converting
.mp3 to .ogg, but it seems to oggenc can't be used to add comments to an
existing ogg file. Instead, the vorbiscomment program (part of
vorbis-tools) does that. Another 186kB download.

=== SDL_mixer 1.2 ===

Loop points aren't in SDL_mixer 1.2. There hasn't been an update to
SDL_mixer 1.2 since 2012, but it looks like they're preparing a bugfix one,
including a number of backported loop-related bugfixes. It's certainly not
getting any features.

There are only a couple bugs that I'm aware of left in gfx_sdl2; I'd like
to fix them and switch to it as default on Mac, Linux and Windows after
Fufluns is released

However the ogg loop stuff is spread over just a few of commits and should
be very easy to backport to SDL_mixer 1.2, for our own build of
sdl_mixer.dll (for people who want to stick to gfx_sdl instead of gfx_sdl2
for whatever reason) and also for the android port.

=== SDL_mixer X ===

Loop points were first implemented in SDL_mixer X, which is a fork of
SDL_mixer 2, which has a number of interesting features.

Most notably, it supports many more module formats and has ADLMIDI (OPL3)
and OPNMIDI OPN2 synthesizer-based MIDI players, which could be used to
play MIDI on Android or elsewhere without needing soundfonts. Sounds
different to MIDI playback with a soundfont, but I think in most case
ADLMIDI not bad (except percussion maybe). These both also support
controller 111-based loop points (RPG Maker-compatible), just like
music_native/native2 do. They could also be used to implement true BAM
playback. (ADLMIDI contains at least two OPL3 synthesizers: Nuked and

But these synths are GPLv3+ licensed, which is a problem (inhibiting
relicensing of the engine). So maybe we could use it just on Android for
MIDI playback, and not for BAM. iOS has MIDI support builtin.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.motherhamster.org/pipermail/ohrrpgce-motherhamster.org/attachments/20191122/6d553a59/attachment.html>

More information about the Ohrrpgce mailing list