if( Mix_PlayChannel( 1, test1, 0 ) == -1 ) // Tests for error return value -1
{
return 1; // Returns 1 to something?
}
if( Mix_PlayChannel( 2, test2, 0 ) == -1 ) // Tests for error return value -1
{
return 1; // Returns 1 to something?
}
Without seeing what your function is the above code seems like it would not be playing sound at all, because it only tests for error return values of Mix_PlayChannel and in the case of an error (i.e. Mix_PlayChannel returns -1), the function returns 1/True (and exits already in the first if-block).
See: http://sdl.beuc.net/sdl.wiki/Mix_PlayChannel
You don't need to even grab (or assign) the return value to play the sound. The return value, if the Mix_PlayChannel function doesn't fail, is the channel number (in your case 1 or 2).
What you could write is just:
Mix_PlayChannel(1, test1, 0);
Mix_PlayChannel(2, test2, 0);
Or if you want to test for errors:
int channel;
channel = Mix_PlayChannel(1, test1, 0);
if(channel == -1) {
fprintf(stderr, "Unable to play WAV file: %s\n", Mix_GetError());
}
channel = Mix_PlayChannel(2, test2, 0);
if(channel == -1) {
fprintf(stderr, "Unable to play WAV file: %s\n", Mix_GetError());
}
There are some more examples here (note the special functions for playing music, instead of just sound files / SFX):
http://people.cs.clemson.edu/~malloy/courses/3dgames-2007/tutor/web/audio/audio.html