Hello, My problem is that when I play an audio chunk with SDL_mixer or
smpeg, it only plays a portion of the sound, and then I have to call
Mix_PlayChannel/SMPEG_play again. Is there anyway I can start the
music/effect playing, and not have to constantly maintain it, without using
threads? I cant just put it into a tight loop though, because the cpu needs
to be doing other stuff then being tied up in the music/audio completely.
thanx ahead of time!_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com
“Uriah Liggett” <game_dev at hotmail.com> schrieb im Newsbeitrag
news:F7r9oD6XMLDthODt9Cz0000c609 at hotmail.com…
Hello, My problem is that when I play an audio chunk with SDL_mixer or
smpeg, it only plays a portion of the sound, and then I have to call
Mix_PlayChannel/SMPEG_play again. Is there anyway I can start the
music/effect playing, and not have to constantly maintain it, without
using
threads? I cant just put it into a tight loop though, because the cpu
needs
to be doing other stuff then being tied up in the music/audio completely.
thanx ahead of time!
Get your FREE download of MSN Explorer at http://explorer.msn.com
read this …
(from [smpeg] README.SDL_mixer)
#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);