11 Commits

Author SHA1 Message Date
Dmitry Marakasov
24482d85f6 Follow SDL2 include path conventions
Though these are broken and error prone, as they ignore the possibility
of conflicts between SDL, SDL2 and wrappers thereof discarding useful
include path prefix (SDL2/), since SDL and satellite libraries follow
these it's too hard to stay away.

So don't use prefixes for SDL include paths any longer.
2017-02-08 13:19:04 +03:00
Dmitry Marakasov
0aede126fc Fix main() signatures to be compatible with SDL_main 2015-12-15 22:06:56 +03:00
Dmitry Marakasov
f3511a1a71 Implement mixer music 2015-08-31 18:38:29 +03:00
Dmitry Marakasov
e37d67725e It is actually safe to free chunks which are still playing
Though documentation and even a comment at the start of Mix_FreeChunk()
state that it's unsafe to free chunk which is still being played, the
function actually contains the code to stop all playback of a chunk which is
being freed. See SDL2_mixer 2.0.0, mixer.c:759:

    /* Guarantee that this chunk isn't playing */
    SDL_LockAudio();
    if ( mix_channel ) {
        for ( i=0; i<num_channels; ++i ) {
            if ( chunk == mix_channel[i].chunk ) {
                mix_channel[i].playing = 0;
                mix_channel[i].looping = 0;
            }
        }
    }
    SDL_UnlockAudio();

As a result, no special actions are required to stop Mixer playback
before destruction of the Chunks (which is a common case with SDL2pp,
as Chunks may only be constructed after Mixer is created, and are
correspondingly destroyed in reverse order, e.g. before Mixer).
2015-08-29 02:34:16 +03:00
Dmitry Marakasov
1cc64cea4f Cosmetic fixes for example 2015-08-29 00:27:22 +03:00
Dmitry Marakasov
4be68384ff Extend example 2015-08-28 23:46:13 +03:00
Dmitry Marakasov
30734317c8 It's a good idea to halt playback before Chunk destruction 2015-08-28 23:26:51 +03:00
Dmitry Marakasov
c5dc35574d Implement mixer playback 2015-08-28 23:23:47 +03:00
Dmitry Marakasov
a25c84932c Add stub Mixer class 2015-08-28 23:04:19 +03:00
Dmitry Marakasov
94f4a3d7aa Include Chunk into example 2015-08-28 19:32:18 +03:00
Dmitry Marakasov
7cc56a1ccb Add basic example for SDLMixer 2015-08-27 20:43:41 +03:00