File: README.SDL_mixer

package info (click to toggle)
smpeg 0.4.4-8
  • links: PTS
  • area: main
  • in suites: woody
  • size: 1,892 kB
  • ctags: 1,445
  • sloc: cpp: 14,948; sh: 8,962; ansic: 2,323; asm: 542; makefile: 162
file content (38 lines) | stat: -rw-r--r-- 1,179 bytes parent folder | download | duplicates (10)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38

There is no longer explicit support for the SDL_mixer library.

You can have the SDL mixer library mix audio from a movie by hooking into
the SDL mixer music hooks:

#include "smpeg.h"
#include "SDL_mixer.h"

        .. set up the mixer audio ...

        /* Note the last parameter is zero! */
        mpeg = SMPEG_new("file.mpg", &info, 0);

        /* Play the movie, using SDL_mixer for audio */
        SMPEG_enableaudio(mpeg, 0);
        if ( play_audio ) {
                SDL_AudioSpec audiofmt;
                Uint16 format;
                int freq, channels;

                /* Tell SMPEG what the audio format is */
                Mix_QuerySpec(&freq, &format, &channels);
                audiofmt.format = format;
                audiofmt.freq = freq;
                audiofmt.channels = channels;
                SMPEG_actualSpec(mpeg, &audiofmt);

                /* Hook in the MPEG music mixer */
                Mix_HookMusic(SMPEG_playAudioSDL, mpeg);
                SMPEG_enableaudio(mpeg, 1);
        }
        SMPEG_play(mpeg);

        /* Stop the movie and unhook SMPEG from the mixer */
        SMPEG_stop(mpeg);
        Mix_HookMusic(NULL, NULL);