| Summary: | Music integration, part 1 | ||
|---|---|---|---|
| Product: | SDL_mixer | Reporter: | Mason Wheeler <masonwheeler> |
| Component: | misc | Assignee: | Sam Lantinga <slouken> |
| Status: | ASSIGNED --- | QA Contact: | Sam Lantinga <slouken> |
| Severity: | API change | ||
| Priority: | P2 | CC: | bastien.bouclet, realnc |
| Version: | unspecified | ||
| Hardware: | x86 | ||
| OS: | Windows 7 | ||
| Attachments: |
Diff patch for 1194
Bugfix for first patch Second bugfix patch |
||
|
Description
Mason Wheeler
2011-04-29 19:01:41 UTC
Created attachment 606 [details]
Diff patch for 1194
Created attachment 607 [details]
Bugfix for first patch
This patch fixes a double-free error in the first patch, and should be applied after it.
This has now been tested and will successfully play multiple songs together, at least with libmodplug. I haven't tested with other music formats yet. I know from looking at the code that multiple WAV-based songs will not play together; this will need to be fixed in a later patch. Not sure about other decoders. Created attachment 608 [details]
Second bugfix patch
Fixes an access violation when playing multiple songs sequentially on the same channel. Should be applied after the first bugfix.
Thanks for the patches. We're likely to merge SDL_sound into SDL_mixer in the next major release, so we can have a unified way to handle all kinds of sound formats. Please let us know if that's something you'd be interested in tackling! Cheers! I'm reopening this, since I reworked Mason's patches. (With current Mercurial default and SDL-1.2 branches in mind, of course.) I've put up a Mercirial repo with all my changes here: https://bitbucket.org/realnc/sdl_mixer I did not break binary or source compatibility; the new, channel-based music streams can be used in parallel with the old single-channel streams. These backends now support multiple streams simultaneously: MUS_WAV, MUS_OGG, MUS_FLAC, MUS_MP3, MUS_MP3_MAD, MUS_MID (with FluidSynth), MUS_MODPLUG. The only ones that don't support multiple streams right now are MikMod and Timidity; they can only play one stream at a time (though they can play in parallel with any other music streams that use the other backends.) Of course native MIDI cannot be supported since it works externally. Not sure about MUS_CMD; will need to think about it a bit more. I don't think this is ready for merging yet; needs testing first. Hopefully the provided binary and source compatibility will make it easy to test against current applications. My own tests are done on Linux. Will also test on OS X and Windows soon. Hopefully you guys can find a bit of time to review this. (In reply to comment #6) > [...] > These backends now support multiple streams simultaneously: > > MUS_WAV, MUS_OGG, MUS_FLAC, MUS_MP3, MUS_MP3_MAD, MUS_MID (with FluidSynth), > MUS_MODPLUG. > > The only ones that don't support multiple streams right now are MikMod and > Timidity [...] Not sure about MUS_CMD; will need to think about it a bit more. Turns out MUS_CMD works just fine. So you can add that to the list of working backends. After taking a good look at MikMod, it's obvious that it cannot support this. And this is by design: libmikmod lacks any API that would allow it to play multiple modules. Fortunately we have ModPlug. Maybe we should drop MikMod completely, given that ModPlug supports more formats and has better sound quality anyway. Is there any reason this hasn't been merged? Does it need more work? To me, the changes from this patched version are a must have when compared to the original version. My tests using alternatively samples and music on the same channels reveal no outstanding issues. Just in case it isn't clear how to merge with mercurial, it's simply a: hg pull -u https://bitbucket.org/realnc/sdl_mixer One thing we're losing with the new API though is gapless music support. I couldn't find a quick way to keep that one working. Previously, if you started a new Mix_Music from inside the Mix_HookMusicFinished() callback, the transition was gapless. Now there's a slight gap there. |