Needing some creativity for cross-fading music with mixer

Obviously we can’t do this with sdl_mixer (one channel only).
The onyl valid suggestion I’ve seen is to load the music as a sound and do a fadein_play while the music is fading out - obviously this is memory-intensive and won’t work on a long track. Of course, could just make a copy of the fade-in section of the track and store that, but it seems like a shit solution.
Or at the least inelegant.
Any other ideas?

Wasn’t there a mixer in the works, as part of SDL_sound…? What happened to it?

Do you need to use SDL_mixer for other things as well? If so, you
could probably roll your own streaming/cross-fading mixer as an effect
for SDL_mixer, and stream music from SDL_sound. It’ll have to be
implemented in C, C++ or something else that compiles to native code,
as it’ll have to run in the “audio context” of the SDL audio API.

Other than that, find a more flexible mixer (IIRC, one project was
mentioned on this list some time ago), or roll your own. If you need
to play sound effects and all that as well though, the latter is a lot
more work than it may seem at first.

If you’re brave enough: Audiality 2 + SDL_sound via the new
asynchronous streaming API - but that’s probably overkill, and not
properly documented yet. :-)On Mon, May 5, 2014 at 1:07 PM, mattbentley wrote:

Obviously we can’t do this with sdl_mixer (one channel only).
The onyl valid suggestion I’ve seen is to load the music as a sound and do a
fadein_play while the music is fading out - obviously this is
memory-intensive and won’t work on a long track. Of course, could just make
a copy of the fade-in section of the track and store that, but it seems like
a shit solution.
Or at the least inelegant.
Any other ideas?


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


//David Olofson - Consultant, Developer, Artist, Open Source Advocate

.— Games, examples, libraries, scripting, sound, music, graphics —.
| http://consulting.olofson.net http://olofsonarcade.com |
’---------------------------------------------------------------------’

I would implement LADSPA filters support in SDL_Mixer, that would get way
more than that audio options, for the same work.

I did gstreamer-1.0 ladspa plugin, there are like 300++ good LADSPA effects
or so, fades included, echos, reverbs, vinyls, + whatever you need to as
any can be implemented.

Very modular solution. ;-)On Mon, May 5, 2014 at 2:22 PM, David Olofson wrote:

Wasn’t there a mixer in the works, as part of SDL_sound…? What happened
to it?

Do you need to use SDL_mixer for other things as well? If so, you
could probably roll your own streaming/cross-fading mixer as an effect
for SDL_mixer, and stream music from SDL_sound. It’ll have to be
implemented in C, C++ or something else that compiles to native code,
as it’ll have to run in the “audio context” of the SDL audio API.

Other than that, find a more flexible mixer (IIRC, one project was
mentioned on this list some time ago), or roll your own. If you need
to play sound effects and all that as well though, the latter is a lot
more work than it may seem at first.

If you’re brave enough: Audiality 2 + SDL_sound via the new
asynchronous streaming API - but that’s probably overkill, and not
properly documented yet. :slight_smile:

On Mon, May 5, 2014 at 1:07 PM, mattbentley wrote:

Obviously we can’t do this with sdl_mixer (one channel only).
The onyl valid suggestion I’ve seen is to load the music as a sound and
do a
fadein_play while the music is fading out - obviously this is
memory-intensive and won’t work on a long track. Of course, could just
make
a copy of the fade-in section of the track and store that, but it seems
like
a shit solution.
Or at the least inelegant.
Any other ideas?


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


//David Olofson - Consultant, Developer, Artist, Open Source Advocate

.— Games, examples, libraries, scripting, sound, music, graphics —.
| http://consulting.olofson.net http://olofsonarcade.com |
’---------------------------------------------------------------------’


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

David Olofson wrote:

Wasn’t there a mixer in the works, as part of SDL_sound…? What happened to it?

Do you need to use SDL_mixer for other things as well? If so, you
could probably roll your own streaming/cross-fading mixer as an effect
for SDL_mixer, and stream music from SDL_sound.

Thanks for the reply guys - I’ve ended up going with my initial solution - mainly because there’s an added benefit that I didn’t think of at time of posting - mainly that any ‘intro’ sections for songs (ie. initial portions which can’t feasibly be included as part of an ongoing music loop) can be separated from the main loop.

I did take a look at the mixer code and concluded that it was way too complex/cryptically-written to be easily patched, unfortunately. A shame, I would’ve liked to implement it.

Maybe ALmixer can help? I wrote it partly because the one-music
channel limitation was a non-starter for me. (I needed music+speech.)
Unfortunately, I don’t have loop points. But I think there are other
things you can do like seek and/or keep another stream loaded and
seeked to, ready to play.

I wasn’t planning on doing an announcement yet, but since I’m talking
about it, I just revamped this branch for SDL2. Additionally, I have
native decoder backends for Android (OpenSL ES) and as of last week, I
just wrote the Windows Media Foundation backend. So now Mac, iOS,
Android, and Windows can access AAC/MP4, MP3, and a bunch of other
common formats like WAV. I think this may be an industry first among
cross-platform and OpenAL engines. (Nobody wants to write native
decoder backends because they are a pain to figure out how to write.)

Thanks,
EricOn 5/5/14, mattbentley wrote:

David Olofson wrote:

Wasn’t there a mixer in the works, as part of SDL_sound…? What happened
to it?

Do you need to use SDL_mixer for other things as well? If so, you
could probably roll your own streaming/cross-fading mixer as an effect
for SDL_mixer, and stream music from SDL_sound.

Thanks for the reply guys - I’ve ended up going with my initial solution -
mainly because there’s an added benefit that I didn’t think of at time of
posting - mainly that any ‘intro’ sections for songs (ie. initial portions
which can’t feasibly be included as part of an ongoing music loop) can be
separated from the main loop.

I did take a look at the mixer code and concluded that it was way too
complex/cryptically-written to be easily patched, unfortunately. A shame, I
would’ve liked to implement it.


Beginning iPhone Games Development
http://playcontrol.net/iphonegamebook/

OGG and FLAC are open choices i like.On Tue, May 6, 2014 at 10:38 AM, Eric Wing wrote:

On 5/5/14, mattbentley wrote:

David Olofson wrote:

Wasn’t there a mixer in the works, as part of SDL_sound…? What
happened

to it?

Do you need to use SDL_mixer for other things as well? If so, you
could probably roll your own streaming/cross-fading mixer as an effect
for SDL_mixer, and stream music from SDL_sound.

Thanks for the reply guys - I’ve ended up going with my initial solution

mainly because there’s an added benefit that I didn’t think of at time of
posting - mainly that any ‘intro’ sections for songs (ie. initial
portions
which can’t feasibly be included as part of an ongoing music loop) can be
separated from the main loop.

I did take a look at the mixer code and concluded that it was way too
complex/cryptically-written to be easily patched, unfortunately. A
shame, I
would’ve liked to implement it.

Maybe ALmixer can help? I wrote it partly because the one-music
channel limitation was a non-starter for me. (I needed music+speech.)
Unfortunately, I don’t have loop points. But I think there are other
things you can do like seek and/or keep another stream loaded and
seeked to, ready to play.

I wasn’t planning on doing an announcement yet, but since I’m talking
about it, I just revamped this branch for SDL2. Additionally, I have
native decoder backends for Android (OpenSL ES) and as of last week, I
just wrote the Windows Media Foundation backend. So now Mac, iOS,
Android, and Windows can access AAC/MP4, MP3, and a bunch of other
common formats like WAV. I think this may be an industry first among
cross-platform and OpenAL engines. (Nobody wants to write native
decoder backends because they are a pain to figure out how to write.)
https://bitbucket.org/ewing/almixer_androidopensles

Thanks,
Eric

Beginning iPhone Games Development
http://playcontrol.net/iphonegamebook/


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org