src/audio/mme/SDL_mmeaudio.c
changeset 2006 b3741f227757
parent 1895 c121d94672cb
child 2049 5f6550e5184f
child 3798 c8b3d3d13ed1
equal deleted inserted replaced
2005:45af7d69f8eb 2006:b3741f227757
   133     }
   133     }
   134     shm->sound = 0;
   134     shm->sound = 0;
   135     shm->wFmt.wf.wFormatTag = WAVE_FORMAT_PCM;
   135     shm->wFmt.wf.wFormatTag = WAVE_FORMAT_PCM;
   136 
   136 
   137     /* Determine the audio parameters from the AudioSpec */
   137     /* Determine the audio parameters from the AudioSpec */
   138     switch (spec->format & 0xFF) {
   138     switch (SDL_AUDIO_BITSIZE(spec->format)) {
   139     case 8:
   139     case 8:
   140         /* Unsigned 8 bit audio data */
   140         /* Unsigned 8 bit audio data */
   141         spec->format = AUDIO_U8;
   141         spec->format = AUDIO_U8;
   142         shm->wFmt.wBitsPerSample = 8;
   142         shm->wFmt.wBitsPerSample = 8;
   143         break;
   143         break;
   144     case 16:
   144     case 16:
   145         /* Signed 16 bit audio data */
   145         /* Signed 16 bit audio data */
   146         spec->format = AUDIO_S16;
   146         spec->format = AUDIO_S16;
   147         shm->wFmt.wBitsPerSample = 16;
   147         shm->wFmt.wBitsPerSample = 16;
   148         break;
   148         break;
       
   149     case 32:
       
   150         /* Signed 32 bit audio data */
       
   151         spec->format = AUDIO_S32;
       
   152         shm->wFmt.wBitsPerSample = 32;
       
   153         break;
   149     default:
   154     default:
   150         SDL_SetError("Unsupported audio format");
   155         SDL_SetError("Unsupported audio format");
   151         return (-1);
   156         return (-1);
   152     }
   157     }
   153 
   158 
       
   159     /* !!! FIXME: Can this handle more than stereo? */
   154     shm->wFmt.wf.nChannels = spec->channels;
   160     shm->wFmt.wf.nChannels = spec->channels;
   155     shm->wFmt.wf.nSamplesPerSec = spec->freq;
   161     shm->wFmt.wf.nSamplesPerSec = spec->freq;
   156     shm->wFmt.wf.nBlockAlign =
   162     shm->wFmt.wf.nBlockAlign =
   157         shm->wFmt.wf.nChannels * shm->wFmt.wBitsPerSample / 8;
   163         shm->wFmt.wf.nChannels * shm->wFmt.wBitsPerSample / 8;
   158     shm->wFmt.wf.nAvgBytesPerSec =
   164     shm->wFmt.wf.nAvgBytesPerSec =