playwave.c
author Sam Lantinga <slouken@libsdl.org>
Thu, 17 Feb 2011 13:33:16 -0800
changeset 503 0c77794aaef2
parent 488 94b190330355
child 518 8bc9b5fd2aae
permissions -rw-r--r--
Fixed bug 1021 (misplaced HAVE_SIGNAL_H condition in playmus.c and playwave.c)

Ozkan Sezer 2010-10-08 01:45:34 PDT

The HAVE_SIGNAL_H dependent signal.h includes in playmus.c and playwave.c are
misplaced, because SDL_config.h is not included at that point and this causes
signal.h to be never included. Moving it after the SDL.h and SDL_mixer.h
includes fixes the issue, like in the following.
slouken@0
     1
/*
slouken@0
     2
    PLAYWAVE:  A test application for the SDL mixer library.
slouken@386
     3
    Copyright (C) 1997-2009 Sam Lantinga
slouken@0
     4
slouken@138
     5
    This library is free software; you can redistribute it and/or
slouken@138
     6
    modify it under the terms of the GNU Library General Public
slouken@138
     7
    License as published by the Free Software Foundation; either
slouken@138
     8
    version 2 of the License, or (at your option) any later version.
slouken@0
     9
slouken@138
    10
    This library is distributed in the hope that it will be useful,
slouken@0
    11
    but WITHOUT ANY WARRANTY; without even the implied warranty of
slouken@138
    12
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
slouken@138
    13
    Library General Public License for more details.
slouken@0
    14
slouken@138
    15
    You should have received a copy of the GNU Library General Public
slouken@138
    16
    License along with this library; if not, write to the Free
slouken@0
    17
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
slouken@0
    18
slouken@0
    19
    Sam Lantinga
slouken@138
    20
    slouken@libsdl.org
slouken@0
    21
*/
slouken@0
    22
slouken@140
    23
/* $Id$ */
slouken@138
    24
slouken@0
    25
#include <stdlib.h>
slouken@0
    26
#include <stdio.h>
slouken@0
    27
#include <string.h>
slouken@488
    28
slouken@47
    29
#ifdef unix
slouken@0
    30
#include <unistd.h>
slouken@0
    31
#endif
slouken@0
    32
slouken@24
    33
#include "SDL.h"
slouken@34
    34
#include "SDL_mixer.h"
slouken@0
    35
slouken@503
    36
#ifdef HAVE_SIGNAL_H
slouken@503
    37
#include <signal.h>
slouken@503
    38
#endif
slouken@503
    39
slouken@0
    40
slouken@113
    41
/*
slouken@113
    42
 * rcg06132001 various mixer tests. Define the ones you want.
slouken@113
    43
 */
icculus@391
    44
/*#define TEST_MIX_DECODERS*/
slouken@127
    45
/*#define TEST_MIX_VERSIONS*/
slouken@127
    46
/*#define TEST_MIX_CHANNELFINISHED*/
slouken@113
    47
/*#define TEST_MIX_PANNING*/
slouken@113
    48
/*#define TEST_MIX_DISTANCE*/
slouken@127
    49
/*#define TEST_MIX_POSITION*/
slouken@113
    50
slouken@113
    51
slouken@113
    52
#if (defined TEST_MIX_POSITION)
slouken@113
    53
slouken@113
    54
#if (defined TEST_MIX_PANNING)
slouken@113
    55
#error TEST_MIX_POSITION interferes with TEST_MIX_PANNING.
slouken@113
    56
#endif
slouken@113
    57
slouken@113
    58
#if (defined TEST_MIX_DISTANCE)
slouken@113
    59
#error TEST_MIX_POSITION interferes with TEST_MIX_DISTANCE.
slouken@113
    60
#endif
slouken@113
    61
slouken@113
    62
#endif
slouken@113
    63
slouken@113
    64
slouken@113
    65
/* rcg06192001 for debugging purposes. */
slouken@113
    66
static void output_test_warnings(void)
slouken@113
    67
{
slouken@113
    68
#if (defined TEST_MIX_CHANNELFINISHED)
slouken@113
    69
	fprintf(stderr, "Warning: TEST_MIX_CHANNELFINISHED is enabled in this binary...\n");
slouken@113
    70
#endif
slouken@113
    71
#if (defined TEST_MIX_PANNING)
slouken@113
    72
	fprintf(stderr, "Warning: TEST_MIX_PANNING is enabled in this binary...\n");
slouken@113
    73
#endif
slouken@113
    74
#if (defined TEST_MIX_VERSIONS)
slouken@113
    75
	fprintf(stderr, "Warning: TEST_MIX_VERSIONS is enabled in this binary...\n");
slouken@113
    76
#endif
slouken@113
    77
#if (defined TEST_MIX_DISTANCE)
slouken@113
    78
	fprintf(stderr, "Warning: TEST_MIX_DISTANCE is enabled in this binary...\n");
slouken@113
    79
#endif
slouken@113
    80
#if (defined TEST_MIX_POSITION)
slouken@113
    81
	fprintf(stderr, "Warning: TEST_MIX_POSITION is enabled in this binary...\n");
slouken@113
    82
#endif
slouken@113
    83
}
slouken@113
    84
slouken@113
    85
slouken@0
    86
static int audio_open = 0;
slouken@0
    87
static Mix_Chunk *wave = NULL;
slouken@0
    88
icculus@390
    89
/* rcg06042009 Report available decoders. */
icculus@390
    90
#if (defined TEST_MIX_DECODERS)
icculus@390
    91
static void report_decoders(void)
icculus@390
    92
{
icculus@390
    93
	int i, total;
icculus@390
    94
icculus@390
    95
    printf("Supported decoders...\n");
slouken@466
    96
	total = Mix_GetNumChunkDecoders();
icculus@390
    97
	for (i = 0; i < total; i++) {
icculus@390
    98
		fprintf(stderr, " - chunk decoder: %s\n", Mix_GetChunkDecoder(i));
icculus@390
    99
	}
icculus@390
   100
slouken@466
   101
	total = Mix_GetNumMusicDecoders();
icculus@390
   102
	for (i = 0; i < total; i++) {
icculus@390
   103
		fprintf(stderr, " - music decoder: %s\n", Mix_GetMusicDecoder(i));
icculus@390
   104
	}
icculus@390
   105
}
icculus@390
   106
#endif
slouken@113
   107
slouken@113
   108
/* rcg06192001 Check new Mixer version API. */
slouken@113
   109
#if (defined TEST_MIX_VERSIONS)
slouken@113
   110
static void output_versions(const char *libname, const SDL_version *compiled,
slouken@113
   111
							const SDL_version *linked)
slouken@113
   112
{
slouken@113
   113
	fprintf(stderr,
slouken@113
   114
			"This program was compiled against %s %d.%d.%d,\n"
slouken@113
   115
			" and is dynamically linked to %d.%d.%d.\n", libname,
slouken@113
   116
			compiled->major, compiled->minor, compiled->patch,
slouken@113
   117
			linked->major, linked->minor, linked->patch);
slouken@113
   118
}
slouken@113
   119
slouken@113
   120
static void test_versions(void)
slouken@113
   121
{
slouken@113
   122
	SDL_version compiled;
slouken@113
   123
	const SDL_version *linked;
slouken@113
   124
slouken@113
   125
	SDL_VERSION(&compiled);
slouken@113
   126
	linked = SDL_Linked_Version();
slouken@113
   127
	output_versions("SDL", &compiled, linked);
slouken@113
   128
slouken@227
   129
	SDL_MIXER_VERSION(&compiled);
slouken@113
   130
	linked = Mix_Linked_Version();
slouken@113
   131
	output_versions("SDL_mixer", &compiled, linked);
slouken@113
   132
}
slouken@113
   133
#endif
slouken@113
   134
slouken@113
   135
slouken@113
   136
#ifdef TEST_MIX_CHANNELFINISHED  /* rcg06072001 */
slouken@113
   137
static volatile int channel_is_done = 0;
slouken@113
   138
static void channel_complete_callback(int chan)
slouken@113
   139
{
slouken@113
   140
	Mix_Chunk *done_chunk = Mix_GetChunk(chan);
slouken@113
   141
	fprintf(stderr, "We were just alerted that Mixer channel #%d is done.\n", chan);
slouken@113
   142
	fprintf(stderr, "Channel's chunk pointer is (%p).\n", done_chunk);
slouken@113
   143
	fprintf(stderr, " Which %s correct.\n", (wave == done_chunk) ? "is" : "is NOT");
slouken@113
   144
	channel_is_done = 1;
slouken@113
   145
}
slouken@113
   146
#endif
slouken@113
   147
slouken@113
   148
slouken@113
   149
/* rcg06192001 abstract this out for testing purposes. */
slouken@113
   150
static int still_playing(void)
slouken@113
   151
{
slouken@113
   152
#ifdef TEST_MIX_CHANNELFINISHED
slouken@113
   153
	return(!channel_is_done);
slouken@113
   154
#else
slouken@113
   155
	return(Mix_Playing(0));
slouken@113
   156
#endif
slouken@113
   157
}
slouken@113
   158
slouken@113
   159
slouken@113
   160
#if (defined TEST_MIX_PANNING)
slouken@113
   161
static void do_panning_update(void)
slouken@113
   162
{
slouken@113
   163
	static Uint8 leftvol = 128;
slouken@113
   164
	static Uint8 rightvol = 128;
slouken@113
   165
	static Uint8 leftincr = -1;
slouken@113
   166
	static Uint8 rightincr = 1;
slouken@113
   167
	static int panningok = 1;
slouken@113
   168
	static Uint32 next_panning_update = 0;
slouken@113
   169
slouken@113
   170
	if ((panningok) && (SDL_GetTicks() >= next_panning_update)) {
slouken@113
   171
		panningok = Mix_SetPanning(0, leftvol, rightvol);
slouken@113
   172
		if (!panningok) {
slouken@113
   173
			fprintf(stderr, "Mix_SetPanning(0, %d, %d) failed!\n",
slouken@113
   174
					(int) leftvol, (int) rightvol);
slouken@113
   175
			fprintf(stderr, "Reason: [%s].\n", Mix_GetError());
slouken@113
   176
		}
slouken@113
   177
slouken@113
   178
		if ((leftvol == 255) || (leftvol == 0)) {
slouken@113
   179
			if (leftvol == 255)
slouken@113
   180
				printf("All the way in the left speaker.\n");
slouken@113
   181
				leftincr *= -1;
slouken@113
   182
		}
slouken@113
   183
slouken@113
   184
		if ((rightvol == 255) || (rightvol == 0)) {
slouken@113
   185
			if (rightvol == 255)
slouken@113
   186
				printf("All the way in the right speaker.\n");
slouken@113
   187
			rightincr *= -1;
slouken@113
   188
		}
slouken@113
   189
slouken@113
   190
		leftvol += leftincr;
slouken@113
   191
		rightvol += rightincr;
slouken@113
   192
		next_panning_update = SDL_GetTicks() + 10;
slouken@113
   193
	}
slouken@113
   194
}
slouken@113
   195
#endif
slouken@113
   196
slouken@113
   197
slouken@113
   198
#if (defined TEST_MIX_DISTANCE)
slouken@113
   199
static void do_distance_update(void)
slouken@113
   200
{
slouken@113
   201
	static Uint8 distance = 1;
slouken@113
   202
	static Uint8 distincr = 1;
slouken@113
   203
	static int distanceok = 1;
slouken@113
   204
	static Uint32 next_distance_update = 0;
slouken@113
   205
slouken@113
   206
	if ((distanceok) && (SDL_GetTicks() >= next_distance_update)) {
slouken@113
   207
		distanceok = Mix_SetDistance(0, distance);
slouken@113
   208
		if (!distanceok) {
slouken@113
   209
			fprintf(stderr, "Mix_SetDistance(0, %d) failed!\n", (int) distance);
slouken@113
   210
			fprintf(stderr, "Reason: [%s].\n", Mix_GetError());
slouken@113
   211
		}
slouken@113
   212
slouken@113
   213
		if (distance == 0) {
slouken@113
   214
			printf("Distance at nearest point.\n");
slouken@113
   215
			distincr *= -1;
slouken@113
   216
		}
slouken@113
   217
		else if (distance == 255) {
slouken@113
   218
			printf("Distance at furthest point.\n");
slouken@113
   219
			distincr *= -1;
slouken@113
   220
		}
slouken@113
   221
slouken@113
   222
		distance += distincr;
slouken@113
   223
		next_distance_update = SDL_GetTicks() + 15;
slouken@113
   224
	}
slouken@113
   225
}
slouken@113
   226
#endif
slouken@113
   227
slouken@113
   228
slouken@113
   229
#if (defined TEST_MIX_POSITION)
slouken@113
   230
static void do_position_update(void)
slouken@113
   231
{
slouken@113
   232
	static Sint16 distance = 1;
slouken@113
   233
	static Sint8 distincr = 1;
slouken@113
   234
	static Uint16 angle = 0;
slouken@113
   235
	static Sint8 angleincr = 1;
slouken@113
   236
	static int positionok = 1;
slouken@113
   237
	static Uint32 next_position_update = 0;
slouken@113
   238
slouken@113
   239
	if ((positionok) && (SDL_GetTicks() >= next_position_update)) {
slouken@113
   240
		positionok = Mix_SetPosition(0, angle, distance);
slouken@113
   241
		if (!positionok) {
slouken@113
   242
			fprintf(stderr, "Mix_SetPosition(0, %d, %d) failed!\n",
slouken@113
   243
					(int) angle, (int) distance);
slouken@113
   244
			fprintf(stderr, "Reason: [%s].\n", Mix_GetError());
slouken@113
   245
		}
slouken@113
   246
slouken@113
   247
		if (angle == 0) {
slouken@113
   248
			printf("Due north; now rotating clockwise...\n");
slouken@113
   249
			angleincr = 1;
slouken@113
   250
		}
slouken@113
   251
slouken@113
   252
		else if (angle == 360) {
slouken@113
   253
			printf("Due north; now rotating counter-clockwise...\n");
slouken@113
   254
			angleincr = -1;
slouken@113
   255
		}
slouken@113
   256
slouken@113
   257
		distance += distincr;
slouken@113
   258
slouken@113
   259
		if (distance < 0) {
slouken@113
   260
			distance = 0;
slouken@113
   261
			distincr = 3;
slouken@113
   262
			printf("Distance is very, very near. Stepping away by threes...\n");
slouken@113
   263
		} else if (distance > 255) {
slouken@113
   264
			distance = 255;
slouken@113
   265
			distincr = -3;
slouken@113
   266
			printf("Distance is very, very far. Stepping towards by threes...\n");
slouken@113
   267
		}
slouken@113
   268
slouken@113
   269
		angle += angleincr;
slouken@113
   270
		next_position_update = SDL_GetTicks() + 30;
slouken@113
   271
	}
slouken@113
   272
}
slouken@113
   273
#endif
slouken@113
   274
slouken@113
   275
slouken@321
   276
static void CleanUp(int exitcode)
slouken@0
   277
{
megastep@21
   278
	if ( wave ) {
megastep@21
   279
		Mix_FreeChunk(wave);
megastep@21
   280
		wave = NULL;
megastep@21
   281
	}
slouken@0
   282
	if ( audio_open ) {
slouken@0
   283
		Mix_CloseAudio();
slouken@0
   284
		audio_open = 0;
slouken@0
   285
	}
slouken@0
   286
	SDL_Quit();
slouken@321
   287
slouken@321
   288
	exit(exitcode);
slouken@0
   289
}
slouken@0
   290
slouken@113
   291
slouken@113
   292
static void Usage(char *argv0)
slouken@0
   293
{
slouken@245
   294
	fprintf(stderr, "Usage: %s [-8] [-r rate] [-c channels] [-f] [-F] [-l] [-m] <wavefile>\n", argv0);
slouken@0
   295
}
slouken@92
   296
slouken@92
   297
slouken@113
   298
/*
slouken@113
   299
 * rcg06182001 This is sick, but cool.
slouken@113
   300
 *
slouken@113
   301
 *  Actually, it's meant to be an example of how to manipulate a voice
slouken@113
   302
 *  without having to use the mixer effects API. This is more processing
slouken@113
   303
 *  up front, but no extra during the mixing process. Also, in a case like
slouken@113
   304
 *  this, when you need to touch the whole sample at once, it's the only
slouken@113
   305
 *  option you've got. And, with the effects API, you are altering a copy of
slouken@113
   306
 *  the original sample for each playback, and thus, your changes aren't
slouken@113
   307
 *  permanent; here, you've got a reversed sample, and that's that until
slouken@113
   308
 *  you either reverse it again, or reload it.
slouken@113
   309
 */
slouken@113
   310
static void flip_sample(Mix_Chunk *wave)
slouken@92
   311
{
slouken@113
   312
	Uint16 format;
slouken@113
   313
	int channels, i, incr;
slouken@113
   314
	Uint8 *start = wave->abuf;
slouken@113
   315
	Uint8 *end = wave->abuf + wave->alen;
slouken@113
   316
slouken@113
   317
	Mix_QuerySpec(NULL, &format, &channels);
slouken@113
   318
	incr = (format & 0xFF) * channels;
slouken@113
   319
slouken@113
   320
	end -= incr;
slouken@113
   321
slouken@113
   322
	switch (incr) {
slouken@113
   323
		case 8:
slouken@113
   324
			for (i = wave->alen / 2; i >= 0; i -= 1) {
slouken@113
   325
				Uint8 tmp = *start;
slouken@113
   326
				*start = *end;
slouken@113
   327
				*end = tmp;
slouken@113
   328
				start++;
slouken@113
   329
				end--;
slouken@113
   330
			}
slouken@113
   331
			break;
slouken@113
   332
slouken@113
   333
		case 16:
slouken@113
   334
			for (i = wave->alen / 2; i >= 0; i -= 2) {
slouken@113
   335
				Uint16 tmp = *start;
slouken@113
   336
				*((Uint16 *) start) = *((Uint16 *) end);
slouken@113
   337
				*((Uint16 *) end) = tmp;
slouken@113
   338
				start += 2;
slouken@113
   339
				end -= 2;
slouken@113
   340
			}
slouken@113
   341
			break;
slouken@113
   342
slouken@113
   343
		case 32:
slouken@113
   344
			for (i = wave->alen / 2; i >= 0; i -= 4) {
slouken@113
   345
				Uint32 tmp = *start;
slouken@113
   346
				*((Uint32 *) start) = *((Uint32 *) end);
slouken@113
   347
				*((Uint32 *) end) = tmp;
slouken@113
   348
				start += 4;
slouken@113
   349
				end -= 4;
slouken@113
   350
			}
slouken@113
   351
			break;
slouken@113
   352
slouken@113
   353
		default:
slouken@113
   354
			fprintf(stderr, "Unhandled format in sample flipping.\n");
slouken@113
   355
			return;
slouken@113
   356
	}
slouken@92
   357
}
slouken@92
   358
slouken@92
   359
slouken@113
   360
int main(int argc, char *argv[])
slouken@0
   361
{
slouken@47
   362
	int audio_rate;
slouken@0
   363
	Uint16 audio_format;
slouken@0
   364
	int audio_channels;
megastep@21
   365
	int loops = 0;
slouken@0
   366
	int i;
slouken@113
   367
	int reverse_stereo = 0;
slouken@113
   368
	int reverse_sample = 0;
slouken@113
   369
slouken@488
   370
#ifdef HAVE_SETBUF
slouken@113
   371
	setbuf(stdout, NULL);    /* rcg06132001 for debugging purposes. */
slouken@113
   372
	setbuf(stderr, NULL);    /* rcg06192001 for debugging purposes, too. */
slouken@488
   373
#endif
slouken@113
   374
	output_test_warnings();
slouken@0
   375
slouken@0
   376
	/* Initialize variables */
slouken@70
   377
	audio_rate = MIX_DEFAULT_FREQUENCY;
slouken@70
   378
	audio_format = MIX_DEFAULT_FORMAT;
slouken@0
   379
	audio_channels = 2;
slouken@0
   380
slouken@0
   381
	/* Check command line usage */
slouken@0
   382
	for ( i=1; argv[i] && (*argv[i] == '-'); ++i ) {
slouken@0
   383
		if ( (strcmp(argv[i], "-r") == 0) && argv[i+1] ) {
slouken@0
   384
			++i;
slouken@0
   385
			audio_rate = atoi(argv[i]);
slouken@0
   386
		} else
slouken@0
   387
		if ( strcmp(argv[i], "-m") == 0 ) {
slouken@0
   388
			audio_channels = 1;
slouken@0
   389
		} else
slouken@245
   390
		if ( (strcmp(argv[i], "-c") == 0) && argv[i+1] ) {
slouken@245
   391
			++i;
slouken@245
   392
			audio_channels = atoi(argv[i]);
slouken@245
   393
		} else
megastep@21
   394
		if ( strcmp(argv[i], "-l") == 0 ) {
megastep@21
   395
			loops = -1;
megastep@21
   396
		} else
slouken@0
   397
		if ( strcmp(argv[i], "-8") == 0 ) {
slouken@0
   398
			audio_format = AUDIO_U8;
slouken@113
   399
		} else
slouken@113
   400
		if ( strcmp(argv[i], "-f") == 0 ) { /* rcg06122001 flip stereo */
slouken@113
   401
			reverse_stereo = 1;
slouken@113
   402
		} else
slouken@113
   403
		if ( strcmp(argv[i], "-F") == 0 ) { /* rcg06172001 flip sample */
slouken@113
   404
			reverse_sample = 1;
slouken@0
   405
		} else {
slouken@0
   406
			Usage(argv[0]);
slouken@83
   407
			return(1);
slouken@0
   408
		}
slouken@0
   409
	}
slouken@0
   410
	if ( ! argv[i] ) {
slouken@0
   411
		Usage(argv[0]);
slouken@83
   412
		return(1);
slouken@0
   413
	}
slouken@0
   414
slouken@0
   415
	/* Initialize the SDL library */
slouken@0
   416
	if ( SDL_Init(SDL_INIT_AUDIO) < 0 ) {
slouken@0
   417
		fprintf(stderr, "Couldn't initialize SDL: %s\n",SDL_GetError());
slouken@83
   418
		return(255);
slouken@0
   419
	}
slouken@488
   420
#ifdef HAVE_SIGNAL_H
slouken@321
   421
	signal(SIGINT, CleanUp);
slouken@321
   422
	signal(SIGTERM, CleanUp);
slouken@488
   423
#endif
slouken@0
   424
slouken@0
   425
	/* Open the audio device */
slouken@0
   426
	if (Mix_OpenAudio(audio_rate, audio_format, audio_channels, 4096) < 0) {
slouken@0
   427
		fprintf(stderr, "Couldn't open audio: %s\n", SDL_GetError());
slouken@321
   428
		CleanUp(2);
slouken@0
   429
	} else {
slouken@0
   430
		Mix_QuerySpec(&audio_rate, &audio_format, &audio_channels);
megastep@21
   431
		printf("Opened audio at %d Hz %d bit %s", audio_rate,
slouken@0
   432
			(audio_format&0xFF),
slouken@245
   433
			(audio_channels > 2) ? "surround" :
slouken@0
   434
			(audio_channels > 1) ? "stereo" : "mono");
megastep@21
   435
		if ( loops ) {
megastep@21
   436
		  printf(" (looping)\n");
megastep@21
   437
		} else {
megastep@21
   438
		  putchar('\n');
megastep@21
   439
		}
slouken@0
   440
	}
slouken@0
   441
	audio_open = 1;
slouken@0
   442
slouken@113
   443
#if (defined TEST_MIX_VERSIONS)
icculus@389
   444
	test_versions();
slouken@113
   445
#endif
slouken@113
   446
icculus@390
   447
#if (defined TEST_MIX_DECODERS)
icculus@390
   448
	report_decoders();
icculus@390
   449
#endif
icculus@390
   450
slouken@0
   451
	/* Load the requested wave file */
slouken@0
   452
	wave = Mix_LoadWAV(argv[i]);
slouken@0
   453
	if ( wave == NULL ) {
slouken@0
   454
		fprintf(stderr, "Couldn't load %s: %s\n",
slouken@0
   455
						argv[i], SDL_GetError());
slouken@321
   456
		CleanUp(2);
slouken@0
   457
	}
slouken@0
   458
slouken@113
   459
	if (reverse_sample) {
slouken@113
   460
		flip_sample(wave);
slouken@113
   461
	}
slouken@113
   462
slouken@92
   463
#ifdef TEST_MIX_CHANNELFINISHED  /* rcg06072001 */
slouken@92
   464
	Mix_ChannelFinished(channel_complete_callback);
slouken@92
   465
#endif
slouken@92
   466
slouken@113
   467
	if ( (!Mix_SetReverseStereo(MIX_CHANNEL_POST, reverse_stereo)) &&
slouken@113
   468
		 (reverse_stereo) )
slouken@113
   469
	{
slouken@113
   470
		printf("Failed to set up reverse stereo effect!\n");
slouken@113
   471
		printf("Reason: [%s].\n", Mix_GetError());
slouken@113
   472
	}
slouken@113
   473
slouken@0
   474
	/* Play and then exit */
megastep@21
   475
	Mix_PlayChannel(0, wave, loops);
slouken@92
   476
slouken@113
   477
	while (still_playing()) {
slouken@113
   478
slouken@113
   479
#if (defined TEST_MIX_PANNING)  /* rcg06132001 */
slouken@113
   480
		do_panning_update();
slouken@92
   481
#endif
slouken@92
   482
slouken@113
   483
#if (defined TEST_MIX_DISTANCE) /* rcg06192001 */
slouken@113
   484
		do_distance_update();
slouken@113
   485
#endif
slouken@113
   486
slouken@113
   487
#if (defined TEST_MIX_POSITION) /* rcg06202001 */
slouken@113
   488
		do_position_update();
slouken@113
   489
#endif
slouken@113
   490
slouken@113
   491
		SDL_Delay(1);
slouken@113
   492
slouken@113
   493
	} /* while still_playing() loop... */
slouken@113
   494
slouken@321
   495
	CleanUp(0);
slouken@321
   496
slouken@321
   497
	/* Not reached, but fixes compiler warnings */
slouken@321
   498
	return 0;
slouken@0
   499
}
slouken@113
   500
slouken@113
   501
/* end of playwave.c ... */
slouken@113
   502