Skip to content
This repository has been archived by the owner on Feb 11, 2021. It is now read-only.

Commit

Permalink
Browse files Browse the repository at this point in the history
Formatting update
  • Loading branch information
slouken committed Sep 24, 2006
1 parent 19cf0b6 commit a27248e
Show file tree
Hide file tree
Showing 27 changed files with 326 additions and 298 deletions.
3 changes: 2 additions & 1 deletion include/SDL_compat.h
Expand Up @@ -147,7 +147,8 @@ extern DECLSPEC SDL_Surface *SDLCALL SDL_DisplayFormatAlpha(SDL_Surface *
surface);
extern DECLSPEC void SDLCALL SDL_WM_SetCaption(const char *title,
const char *icon);
extern DECLSPEC void SDLCALL SDL_WM_GetCaption(const char **title, const char **icon);
extern DECLSPEC void SDLCALL SDL_WM_GetCaption(const char **title,
const char **icon);
extern DECLSPEC void SDLCALL SDL_WM_SetIcon(SDL_Surface * icon, Uint8 * mask);
extern DECLSPEC int SDLCALL SDL_WM_IconifyWindow(void);
extern DECLSPEC int SDLCALL SDL_WM_ToggleFullScreen(SDL_Surface * surface);
Expand Down
2 changes: 1 addition & 1 deletion src/audio/alsa/SDL_alsa_audio.c
Expand Up @@ -523,7 +523,7 @@ ALSA_OpenAudio(_THIS, SDL_AudioSpec * spec)
status = -1;
for (test_format = SDL_FirstAudioFormat(spec->format);
test_format && (status < 0);) {
status = 0; /* if we can't support a format, it'll become -1. */
status = 0; /* if we can't support a format, it'll become -1. */
switch (test_format) {
case AUDIO_U8:
format = SND_PCM_FORMAT_U8;
Expand Down
72 changes: 36 additions & 36 deletions src/audio/amigaos/SDL_ahiaudio.c
Expand Up @@ -235,50 +235,50 @@ AHI_OpenAudio(_THIS, SDL_AudioSpec * spec)
while ((!valid_datatype) && (test_format)) {
valid_datatype = 1;
switch (test_format) {
case AUDIO_S8:
D(bug("AUDIO_S8...\n"));
spec->format = AUDIO_S8;
this->hidden->bytespersample = 1;
if (spec->channels < 2)
this->hidden->type = AHIST_M8S;
else
this->hidden->type = AHIST_S8S;
break;

case AUDIO_S16MSB:
D(bug("AUDIO_S16MSB...\n"));
spec->format = AUDIO_S16MSB;
this->hidden->bytespersample = 2;
if (spec->channels < 2)
this->hidden->type = AHIST_M16S;
else
this->hidden->type = AHIST_S16S;
break;

case AUDIO_S32MSB:
D(bug("AUDIO_S32MSB...\n"));
spec->format = AUDIO_S32MSB;
this->hidden->bytespersample = 4;
if (spec->channels < 2)
this->hidden->type = AHIST_M32S;
else
this->hidden->type = AHIST_S32S;
break;

default:
valid_datatype = 0;
test_format = SDL_NextAudioFormat();
break;
case AUDIO_S8:
D(bug("AUDIO_S8...\n"));
spec->format = AUDIO_S8;
this->hidden->bytespersample = 1;
if (spec->channels < 2)
this->hidden->type = AHIST_M8S;
else
this->hidden->type = AHIST_S8S;
break;

case AUDIO_S16MSB:
D(bug("AUDIO_S16MSB...\n"));
spec->format = AUDIO_S16MSB;
this->hidden->bytespersample = 2;
if (spec->channels < 2)
this->hidden->type = AHIST_M16S;
else
this->hidden->type = AHIST_S16S;
break;

case AUDIO_S32MSB:
D(bug("AUDIO_S32MSB...\n"));
spec->format = AUDIO_S32MSB;
this->hidden->bytespersample = 4;
if (spec->channels < 2)
this->hidden->type = AHIST_M32S;
else
this->hidden->type = AHIST_S32S;
break;

default:
valid_datatype = 0;
test_format = SDL_NextAudioFormat();
break;
}
}

if (!valid_datatype) { /* shouldn't happen, but just in case... */
if (!valid_datatype) { /* shouldn't happen, but just in case... */
SDL_SetError("Unsupported audio format");
return (-1);
}

if (spec->channels > 2) {
spec->channels = 2; /* will convert at higher level. */
spec->channels = 2; /* will convert at higher level. */
}

D(bug("Before CalculateAudioSpec\n"));
Expand Down
82 changes: 41 additions & 41 deletions src/audio/baudio/SDL_beaudio.cc
Expand Up @@ -160,59 +160,59 @@ extern "C"
SDL_AudioFormat test_format = SDL_FirstAudioFormat(spec->format);

/* Parse the audio format and fill the Be raw audio format */
memset(&format, '\0', sizeof (media_raw_audio_format));
memset(&format, '\0', sizeof(media_raw_audio_format));
format.byte_order = B_MEDIA_LITTLE_ENDIAN;
format.frame_rate = (float) spec->freq;
format.channel_count = spec->channels; /* !!! FIXME: support > 2? */
while ((!valid_datatype) && (test_format)) {
valid_datatype = 1;
spec->format = test_format;
switch (test_format) {
case AUDIO_S8:
format.format = media_raw_audio_format::B_AUDIO_CHAR;
break;

case AUDIO_U8:
format.format = media_raw_audio_format::B_AUDIO_UCHAR;
break;

case AUDIO_S16LSB:
format.format = media_raw_audio_format::B_AUDIO_SHORT;
break;

case AUDIO_S16MSB:
format.format = media_raw_audio_format::B_AUDIO_SHORT;
format.byte_order = B_MEDIA_BIG_ENDIAN;
break;

case AUDIO_S32LSB:
format.format = media_raw_audio_format::B_AUDIO_INT;
break;

case AUDIO_S32MSB:
format.format = media_raw_audio_format::B_AUDIO_INT;
format.byte_order = B_MEDIA_BIG_ENDIAN;
break;

case AUDIO_F32LSB:
format.format = media_raw_audio_format::B_AUDIO_FLOAT;
break;

case AUDIO_F32MSB:
format.format = media_raw_audio_format::B_AUDIO_FLOAT;
format.byte_order = B_MEDIA_BIG_ENDIAN;
break;

default:
valid_datatype = 0;
test_format = SDL_NextAudioFormat();
break;
case AUDIO_S8:
format.format = media_raw_audio_format::B_AUDIO_CHAR;
break;

case AUDIO_U8:
format.format = media_raw_audio_format::B_AUDIO_UCHAR;
break;

case AUDIO_S16LSB:
format.format = media_raw_audio_format::B_AUDIO_SHORT;
break;

case AUDIO_S16MSB:
format.format = media_raw_audio_format::B_AUDIO_SHORT;
format.byte_order = B_MEDIA_BIG_ENDIAN;
break;

case AUDIO_S32LSB:
format.format = media_raw_audio_format::B_AUDIO_INT;
break;

case AUDIO_S32MSB:
format.format = media_raw_audio_format::B_AUDIO_INT;
format.byte_order = B_MEDIA_BIG_ENDIAN;
break;

case AUDIO_F32LSB:
format.format = media_raw_audio_format::B_AUDIO_FLOAT;
break;

case AUDIO_F32MSB:
format.format = media_raw_audio_format::B_AUDIO_FLOAT;
format.byte_order = B_MEDIA_BIG_ENDIAN;
break;

default:
valid_datatype = 0;
test_format = SDL_NextAudioFormat();
break;
}
}

format.buffer_size = spec->samples;

if (!valid_datatype) { /* shouldn't happen, but just in case... */
if (!valid_datatype) { /* shouldn't happen, but just in case... */
SDL_SetError("Unsupported audio format");
return (-1);
}
Expand Down
34 changes: 17 additions & 17 deletions src/audio/dart/SDL_dart.c
Expand Up @@ -108,34 +108,34 @@ DART_OpenAudio(_THIS, SDL_AudioSpec * spec)

// Determine the audio parameters from the AudioSpec
if (spec->channels > 2)
spec->channels = 2; // !!! FIXME: more than stereo support in OS/2?
spec->channels = 2; // !!! FIXME: more than stereo support in OS/2?

while ((!valid_datatype) && (test_format)) {
spec->format = test_format;
valid_datatype = 1;
switch (test_format) {
case AUDIO_U8:
// Unsigned 8 bit audio data
iSilence = 0x80;
iBits = 8;
break;

case AUDIO_S16LSB:
// Signed 16 bit audio data
iSilence = 0x00;
iBits = 16;
break;
case AUDIO_U8:
// Unsigned 8 bit audio data
iSilence = 0x80;
iBits = 8;
break;

case AUDIO_S16LSB:
// Signed 16 bit audio data
iSilence = 0x00;
iBits = 16;
break;

// !!! FIXME: int32?

default:
valid_datatype = 0;
test_format = SDL_NextAudioFormat();
break;
default:
valid_datatype = 0;
test_format = SDL_NextAudioFormat();
break;
}
}

if (!valid_datatype) { // shouldn't happen, but just in case...
if (!valid_datatype) { // shouldn't happen, but just in case...
// Close DART, and exit with error code!
mciSendCommand(iDeviceOrd, MCI_CLOSE, MCI_WAIT, &GenericParms, 0);
SDL_SetError("Unsupported audio format");
Expand Down
20 changes: 10 additions & 10 deletions src/audio/dc/SDL_dcaudio.c
Expand Up @@ -226,24 +226,24 @@ DCAUD_OpenAudio(_THIS, SDL_AudioSpec * spec)
spec->format = test_format;
switch (test_format) {
/* only formats Dreamcast accepts... */
case AUDIO_S8:
case AUDIO_S16LSB:
valid_datatype = 1;
break;

default:
test_format = SDL_NextAudioFormat();
break;
case AUDIO_S8:
case AUDIO_S16LSB:
valid_datatype = 1;
break;

default:
test_format = SDL_NextAudioFormat();
break;
}
}

if (!valid_datatype) { /* shouldn't happen, but just in case... */
if (!valid_datatype) { /* shouldn't happen, but just in case... */
SDL_SetError("Unsupported audio format");
return (-1);
}

if (spec->channels > 2)
spec->channels = 2; /* no more than stereo on the Dreamcast. */
spec->channels = 2; /* no more than stereo on the Dreamcast. */

/* Update the fragment size as size in bytes */
SDL_CalculateAudioSpec(spec);
Expand Down
36 changes: 18 additions & 18 deletions src/audio/dmedia/SDL_irixaudio.c
Expand Up @@ -176,36 +176,36 @@ AL_OpenAudio(_THIS, SDL_AudioSpec * spec)
spec->format = test_format;

switch (test_format) {
case AUDIO_S8:
width = AL_SAMPLE_8;
fmt = AL_SAMPFMT_TWOSCOMP;
break;
case AUDIO_S8:
width = AL_SAMPLE_8;
fmt = AL_SAMPFMT_TWOSCOMP;
break;

case AUDIO_S16SYS:
width = AL_SAMPLE_16;
fmt = AL_SAMPFMT_TWOSCOMP;
break;
case AUDIO_S16SYS:
width = AL_SAMPLE_16;
fmt = AL_SAMPFMT_TWOSCOMP;
break;

case AUDIO_F32SYS:
width = 0; /* not used here... */
fmt = AL_SAMPFMT_FLOAT;
break;
case AUDIO_F32SYS:
width = 0; /* not used here... */
fmt = AL_SAMPFMT_FLOAT;
break;

/* Docs say there is int24, but not int32.... */

default:
valid = 0;
test_format = SDL_NextAudioFormat();
break;
default:
valid = 0;
test_format = SDL_NextAudioFormat();
break;
}

if (valid) {
ALconfig audio_config = alNewConfig();
valid = 0;
if (audio_config) {
if (alSetChannels(audio_config, spec->channels) < 0) {
if (spec->channels > 2) { /* can't handle > stereo? */
spec->channels = 2; /* try again below. */
if (spec->channels > 2) { /* can't handle > stereo? */
spec->channels = 2; /* try again below. */
}
}

Expand Down

0 comments on commit a27248e

Please sign in to comment.