SDL_os2audio.c (OS2_OpenDevice): change {0} initializers to SDL_zero()

Ozkan Sezer 2020-10-14 23:01:05 +03:00
parent 72594e255a
commit e112b776fc
1 changed files with 14 additions and 5 deletions

View File

@ -264,11 +264,14 @@ static int OS2_OpenDevice(_THIS, void *handle, const char *devname,
{ {
PSDL_PrivateAudioData pAData; PSDL_PrivateAudioData pAData;
SDL_AudioFormat SDLAudioFmt; SDL_AudioFormat SDLAudioFmt;
MCI_AMP_OPEN_PARMS stMCIAmpOpen = { 0 }; MCI_AMP_OPEN_PARMS stMCIAmpOpen;
MCI_BUFFER_PARMS stMCIBuffer = { 0 }; MCI_BUFFER_PARMS stMCIBuffer;
ULONG ulRC; ULONG ulRC;
ULONG ulIdx; ULONG ulIdx;
SDL_zero(stMCIAmpOpen);
SDL_zero(stMCIBuffer);
for( SDLAudioFmt = SDL_FirstAudioFormat( this->spec.format ); for( SDLAudioFmt = SDL_FirstAudioFormat( this->spec.format );
SDLAudioFmt != 0; SDLAudioFmt = SDL_NextAudioFormat() ) SDLAudioFmt != 0; SDLAudioFmt = SDL_NextAudioFormat() )
{ {
@ -311,11 +314,12 @@ static int OS2_OpenDevice(_THIS, void *handle, const char *devname,
if ( iscapture != 0 ) if ( iscapture != 0 )
{ {
MCI_CONNECTOR_PARMS stMCIConnector = { 0 }; MCI_CONNECTOR_PARMS stMCIConnector;
MCI_AMP_SET_PARMS stMCIAmpSet = { 0 }; MCI_AMP_SET_PARMS stMCIAmpSet;
BOOL fLineIn = _getEnvULong( "SDL_AUDIO_LINEIN", 1, 0 ); BOOL fLineIn = _getEnvULong( "SDL_AUDIO_LINEIN", 1, 0 );
// Set particular connector. // Set particular connector.
SDL_zero(stMCIConnector);
stMCIConnector.ulConnectorType = fLineIn ? MCI_LINE_IN_CONNECTOR stMCIConnector.ulConnectorType = fLineIn ? MCI_LINE_IN_CONNECTOR
: MCI_MICROPHONE_CONNECTOR; : MCI_MICROPHONE_CONNECTOR;
mciSendCommand( stMCIAmpOpen.usDeviceID, MCI_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 ); MCI_CONNECTOR_TYPE, &stMCIConnector, 0 );
// Disable monitor. // Disable monitor.
SDL_zero(stMCIAmpSet);
stMCIAmpSet.ulItem = MCI_AMP_SET_MONITOR; stMCIAmpSet.ulItem = MCI_AMP_SET_MONITOR;
mciSendCommand( stMCIAmpOpen.usDeviceID, MCI_SET, mciSendCommand( stMCIAmpOpen.usDeviceID, MCI_SET,
MCI_WAIT | MCI_SET_OFF | MCI_SET_ITEM, 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.format = SDLAudioFmt;
this->spec.channels = this->spec.channels > 1 ? 2 : 1; this->spec.channels = this->spec.channels > 1 ? 2 : 1;
if ( this->spec.freq < 8000 ) if ( this->spec.freq < 8000 )
{
this->spec.freq = 8000; this->spec.freq = 8000;
if ( this->spec.freq > 48000 ) }
else if ( this->spec.freq > 48000 )
{
this->spec.freq = 48000; this->spec.freq = 48000;
}
// Setup mixer. // Setup mixer.
pAData->stMCIMixSetup.ulFormatTag = MCI_WAVE_FORMAT_PCM; pAData->stMCIMixSetup.ulFormatTag = MCI_WAVE_FORMAT_PCM;