Compile fixes.
authorRyan C. Gordon <icculus@icculus.org>
Sat, 02 Sep 2006 21:19:00 +0000
changeset 201672fa74928062
parent 2015 152dcc2f089f
child 2017 df06e6eb65c6
Compile fixes.
src/audio/macosx/SDL_coreaudio.c
     1.1 --- a/src/audio/macosx/SDL_coreaudio.c	Fri Sep 01 22:48:43 2006 +0000
     1.2 +++ b/src/audio/macosx/SDL_coreaudio.c	Sat Sep 02 21:19:00 2006 +0000
     1.3 @@ -207,21 +207,20 @@
     1.4      Component comp;
     1.5      ComponentDescription desc;
     1.6      struct AudioUnitInputCallback callback;
     1.7 -    AudioStreamBasicDescription desc;
     1.8 +    AudioStreamBasicDescription strdesc;
     1.9      SDL_AudioFormat test_format = SDL_FirstAudioFormat(spec->format);
    1.10      int valid_datatype = 0;
    1.11  
    1.12      /* Setup a AudioStreamBasicDescription with the requested format */
    1.13 -    memset(&desc, '\0', sizeof (AudioStreamBasicDescription));
    1.14 -    desc.mFormatID = kAudioFormatLinearPCM;
    1.15 -    desc.mFormatFlags = kLinearPCMFormatFlagIsPacked;
    1.16 -    desc.mChannelsPerFrame = spec->channels;
    1.17 -    desc.mSampleRate = spec->freq;
    1.18 -    desc.mFramesPerPacket = 1;
    1.19 +    memset(&strdesc, '\0', sizeof (AudioStreamBasicDescription));
    1.20 +    strdesc.mFormatID = kAudioFormatLinearPCM;
    1.21 +    strdesc.mFormatFlags = kLinearPCMFormatFlagIsPacked;
    1.22 +    strdesc.mChannelsPerFrame = spec->channels;
    1.23 +    strdesc.mSampleRate = spec->freq;
    1.24 +    strdesc.mFramesPerPacket = 1;
    1.25  
    1.26      while ((!valid_datatype) && (test_format)) {
    1.27          spec->format = test_format;
    1.28 -        desc.mFormatFlags = 0;
    1.29          /* Just a list of valid SDL formats, so people don't pass junk here. */
    1.30          switch (test_format) {
    1.31              case AUDIO_U8:
    1.32 @@ -235,15 +234,14 @@
    1.33              case AUDIO_F32LSB:
    1.34              case AUDIO_F32MSB:
    1.35                  valid_datatype = 1;
    1.36 -                desc.mBitsPerChannel = SDL_AUDIO_BITSIZE(spec->format);
    1.37 +                strdesc.mBitsPerChannel = SDL_AUDIO_BITSIZE(spec->format);
    1.38 +                if (SDL_AUDIO_ISBIGENDIAN(spec->format))
    1.39 +                    strdesc.mFormatFlags |= kLinearPCMFormatFlagIsBigEndian;
    1.40  
    1.41                  if (SDL_AUDIO_ISFLOAT(spec->format))
    1.42 -                    desc.mFormatFlags |= kLinearPCMFormatFlagIsFloat;
    1.43 +                    strdesc.mFormatFlags |= kLinearPCMFormatFlagIsFloat;
    1.44                  else if (SDL_AUDIO_ISSIGNED(spec->format))
    1.45 -                    desc.mFormatFlags |= kLinearPCMFormatFlagIsSignedInteger;
    1.46 -
    1.47 -                if (SDL_AUDIO_ISBIGENDIAN(spec->format))
    1.48 -                    desc.mFormatFlags |= kLinearPCMFormatFlagIsBigEndian;
    1.49 +                    strdesc.mFormatFlags |= kLinearPCMFormatFlagIsSignedInteger;
    1.50                  break;
    1.51          }
    1.52      }
    1.53 @@ -253,13 +251,13 @@
    1.54          return (-1);
    1.55      }
    1.56  
    1.57 -    desc.mBytesPerFrame =
    1.58 -        desc.mBitsPerChannel * desc.mChannelsPerFrame / 8;
    1.59 -    desc.mBytesPerPacket =
    1.60 -        desc.mBytesPerFrame * desc.mFramesPerPacket;
    1.61 -
    1.62 +    strdesc.mBytesPerFrame =
    1.63 +        strdesc.mBitsPerChannel * strdesc.mChannelsPerFrame / 8;
    1.64 +    strdesc.mBytesPerPacket =
    1.65 +        strdesc.mBytesPerFrame * strdesc.mFramesPerPacket;
    1.66  
    1.67      /* Locate the default output audio unit */
    1.68 +    memset(&desc, '\0', sizeof (ComponentDescription));
    1.69      desc.componentType = kAudioUnitComponentType;
    1.70      desc.componentSubType = kAudioUnitSubType_Output;
    1.71      desc.componentManufacturer = kAudioUnitID_DefaultOutput;