[SDL] More MIDI woes

David Olofson david at olofson.net
Sun Feb 10 09:53:06 PST 2008


On Sunday 10 February 2008, Mason Wheeler wrote:
[...]
> >Sophisticated 
> fix: 
> Hack 
> the 
> player 
> to 
> "fast 
> forward" 
> to 
> the 
> first 
> >audible 
> event 
> when 
> started.
> >
> >Note 
> that 
> this 
> isn't 
> totally 
> safe 
> when 
> dealing 
> with 
> hardware 
> synths. 
> >You 
> may 
> well 
> find 
> that 
> any 
> notes 
> in 
> the 
> first 
> few 
> tens 
> or 
> hundreds 
> of 
> >ms 
> will 
> be 
> delayed 
> or 
> even 
> dropped 
> entirely.

Uhm... Well, that's one way of quoting, I guess. :-D

Your mail client is adding bogus newlines in all quoted text. This 
doesn't matter to HTML, but it obviously breaks the plain text part, 
which receives the same treatment.


> I think this is what the player I'm using is doing.  Is there any
> way to make SDL_Mixer do the same?

Well, there's always The Source. ;-)

The hack should be pretty trivial, theoretically. You should probably 
have some "first play" flag to avoid issues with looping tracks, and 
then you just drop the delta times until you see the first NoteOn 
event.

I wouldn't think SDL_mixer does that out of the box, but I could be 
wrong...


> Perhaps make it a setting that can be toggled, in case having it on
> would break other stuff?

Yeah, that might work. I'm not a SDL_mixer developer or even a user, 
so I have no say in the matter, though. :-)


> Messing around with the MIDI files themselves isn't an option,
> because I'm not writing my own game.  I'm building a game-designing
> tool and a general-purpose engine, and it has to be able to play
> anything that the designers throw at it.

Well, what you're seeing now isn't really a bug. It's not really any 
different from .WAV files that start with a moment of silence - that 
is, it's a bug in the media. Or, it's actually intended, in which 
case skipping initial silence would be a bug in the code. :-)


//David Olofson - Programmer, Composer, Open Source Advocate

.-------  http://olofson.net - Games, SDL examples  -------.
|        http://zeespace.net - 2.5D rendering engine       |
|       http://audiality.org - Music/audio engine          |
|     http://eel.olofson.net - Real time scripting         |
'--  http://www.reologica.se - Rheology instrumentation  --'


More information about the SDL mailing list