diff --git a/src/audio/os2/SDL_os2audio.c b/src/audio/os2/SDL_os2audio.c index 69b317efa..7b83d2447 100644 --- a/src/audio/os2/SDL_os2audio.c +++ b/src/audio/os2/SDL_os2audio.c @@ -264,11 +264,14 @@ static int OS2_OpenDevice(_THIS, void *handle, const char *devname, { PSDL_PrivateAudioData pAData; SDL_AudioFormat SDLAudioFmt; - MCI_AMP_OPEN_PARMS stMCIAmpOpen = { 0 }; - MCI_BUFFER_PARMS stMCIBuffer = { 0 }; + MCI_AMP_OPEN_PARMS stMCIAmpOpen; + MCI_BUFFER_PARMS stMCIBuffer; ULONG ulRC; ULONG ulIdx; + SDL_zero(stMCIAmpOpen); + SDL_zero(stMCIBuffer); + for( SDLAudioFmt = SDL_FirstAudioFormat( this->spec.format ); SDLAudioFmt != 0; SDLAudioFmt = SDL_NextAudioFormat() ) { @@ -311,11 +314,12 @@ static int OS2_OpenDevice(_THIS, void *handle, const char *devname, if ( iscapture != 0 ) { - MCI_CONNECTOR_PARMS stMCIConnector = { 0 }; - MCI_AMP_SET_PARMS stMCIAmpSet = { 0 }; + MCI_CONNECTOR_PARMS stMCIConnector; + MCI_AMP_SET_PARMS stMCIAmpSet; BOOL fLineIn = _getEnvULong( "SDL_AUDIO_LINEIN", 1, 0 ); // Set particular connector. + SDL_zero(stMCIConnector); stMCIConnector.ulConnectorType = fLineIn ? MCI_LINE_IN_CONNECTOR : MCI_MICROPHONE_CONNECTOR; mciSendCommand( stMCIAmpOpen.usDeviceID, MCI_CONNECTOR, @@ -323,6 +327,7 @@ static int OS2_OpenDevice(_THIS, void *handle, const char *devname, MCI_CONNECTOR_TYPE, &stMCIConnector, 0 ); // Disable monitor. + SDL_zero(stMCIAmpSet); stMCIAmpSet.ulItem = MCI_AMP_SET_MONITOR; mciSendCommand( stMCIAmpOpen.usDeviceID, MCI_SET, MCI_WAIT | MCI_SET_OFF | MCI_SET_ITEM, @@ -343,9 +348,13 @@ static int OS2_OpenDevice(_THIS, void *handle, const char *devname, this->spec.format = SDLAudioFmt; this->spec.channels = this->spec.channels > 1 ? 2 : 1; if ( this->spec.freq < 8000 ) + { this->spec.freq = 8000; - if ( this->spec.freq > 48000 ) + } + else if ( this->spec.freq > 48000 ) + { this->spec.freq = 48000; + } // Setup mixer. pAData->stMCIMixSetup.ulFormatTag = MCI_WAVE_FORMAT_PCM;