1
2There is no longer explicit support for the SDL_mixer library.
3
4You can have the SDL mixer library mix audio from a movie by hooking into
5the SDL mixer music hooks:
6
7#include "smpeg.h"
8#include "SDL_mixer.h"
9
10        .. set up the mixer audio ...
11
12        /* Note the last parameter is zero! */
13        mpeg = SMPEG_new("file.mpg", &info, 0);
14
15        /* Play the movie, using SDL_mixer for audio */
16        SMPEG_enableaudio(mpeg, 0);
17        if ( play_audio ) {
18                SDL_AudioSpec audiofmt;
19                Uint16 format;
20                int freq, channels;
21
22                /* Tell SMPEG what the audio format is */
23                Mix_QuerySpec(&freq, &format, &channels);
24                audiofmt.format = format;
25                audiofmt.freq = freq;
26                audiofmt.channels = channels;
27                SMPEG_actualSpec(mpeg, &audiofmt);
28
29                /* Hook in the MPEG music mixer */
30                Mix_HookMusic(SMPEG_playAudioSDL, mpeg);
31                SMPEG_enableaudio(mpeg, 1);
32        }
33        SMPEG_play(mpeg);
34
35        /* Stop the movie and unhook SMPEG from the mixer */
36        SMPEG_stop(mpeg);
37        Mix_HookMusic(NULL, NULL);
38
39