playwave.c
changeset 488 94b190330355
parent 466 d3d060cb94a6
child 503 0c77794aaef2
equal deleted inserted replaced
487:485a29de2b2d 488:94b190330355
    23 /* $Id$ */
    23 /* $Id$ */
    24 
    24 
    25 #include <stdlib.h>
    25 #include <stdlib.h>
    26 #include <stdio.h>
    26 #include <stdio.h>
    27 #include <string.h>
    27 #include <string.h>
       
    28 
       
    29 #ifdef HAVE_SIGNAL_H
    28 #include <signal.h>
    30 #include <signal.h>
       
    31 #endif
    29 #ifdef unix
    32 #ifdef unix
    30 #include <unistd.h>
    33 #include <unistd.h>
    31 #endif
    34 #endif
    32 
    35 
    33 #include "SDL.h"
    36 #include "SDL.h"
   361 	int loops = 0;
   364 	int loops = 0;
   362 	int i;
   365 	int i;
   363 	int reverse_stereo = 0;
   366 	int reverse_stereo = 0;
   364 	int reverse_sample = 0;
   367 	int reverse_sample = 0;
   365 
   368 
       
   369 #ifdef HAVE_SETBUF
   366 	setbuf(stdout, NULL);    /* rcg06132001 for debugging purposes. */
   370 	setbuf(stdout, NULL);    /* rcg06132001 for debugging purposes. */
   367 	setbuf(stderr, NULL);    /* rcg06192001 for debugging purposes, too. */
   371 	setbuf(stderr, NULL);    /* rcg06192001 for debugging purposes, too. */
       
   372 #endif
   368 	output_test_warnings();
   373 	output_test_warnings();
   369 
   374 
   370 	/* Initialize variables */
   375 	/* Initialize variables */
   371 	audio_rate = MIX_DEFAULT_FREQUENCY;
   376 	audio_rate = MIX_DEFAULT_FREQUENCY;
   372 	audio_format = MIX_DEFAULT_FORMAT;
   377 	audio_format = MIX_DEFAULT_FORMAT;
   409 	/* Initialize the SDL library */
   414 	/* Initialize the SDL library */
   410 	if ( SDL_Init(SDL_INIT_AUDIO) < 0 ) {
   415 	if ( SDL_Init(SDL_INIT_AUDIO) < 0 ) {
   411 		fprintf(stderr, "Couldn't initialize SDL: %s\n",SDL_GetError());
   416 		fprintf(stderr, "Couldn't initialize SDL: %s\n",SDL_GetError());
   412 		return(255);
   417 		return(255);
   413 	}
   418 	}
       
   419 #ifdef HAVE_SIGNAL_H
   414 	signal(SIGINT, CleanUp);
   420 	signal(SIGINT, CleanUp);
   415 	signal(SIGTERM, CleanUp);
   421 	signal(SIGTERM, CleanUp);
       
   422 #endif
   416 
   423 
   417 	/* Open the audio device */
   424 	/* Open the audio device */
   418 	if (Mix_OpenAudio(audio_rate, audio_format, audio_channels, 4096) < 0) {
   425 	if (Mix_OpenAudio(audio_rate, audio_format, audio_channels, 4096) < 0) {
   419 		fprintf(stderr, "Couldn't open audio: %s\n", SDL_GetError());
   426 		fprintf(stderr, "Couldn't open audio: %s\n", SDL_GetError());
   420 		CleanUp(2);
   427 		CleanUp(2);