Skip to content

Commit

Permalink
Fix logic that checks for valid sample formats
Browse files Browse the repository at this point in the history
  • Loading branch information
mdias committed Jan 2, 2020
1 parent 48f1f3e commit b35593b
Showing 1 changed file with 7 additions and 59 deletions.
66 changes: 7 additions & 59 deletions RS_ASIO/AsioSharedHost.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -420,57 +420,18 @@ bool AsioSharedHost::IsWaveFormatSupported(const WAVEFORMATEX& format, bool outp
return false;
}

// check if format matches with bits per sample
if (format.wBitsPerSample == 32)
{
switch (sampleType)
{
case ASIOSTInt32MSB:
case ASIOSTFloat32MSB:
case ASIOSTInt32MSB16:
case ASIOSTInt32MSB18:
case ASIOSTInt32MSB20:
case ASIOSTInt32MSB24:
case ASIOSTInt32LSB:
case ASIOSTFloat32LSB:
case ASIOSTInt32LSB16:
case ASIOSTInt32LSB18:
case ASIOSTInt32LSB20:
case ASIOSTInt32LSB24:
break;
default:
rslog::error_ts() << " requested wBitsPerSample is " << format.wBitsPerSample << " but ASIO channels format is " << sampleType << std::endl;
return false;
}
}
else if (format.wBitsPerSample == 24)
{
switch (sampleType)
{
case ASIOSTInt24MSB:
case ASIOSTInt24LSB:
break;
default:
rslog::error_ts() << " requested wBitsPerSample is " << format.wBitsPerSample << " but ASIO channels format is " << sampleType << std::endl;
return false;
}
}
else if (format.wBitsPerSample == 16)
// reject unsupported ASIO sample formaats
switch (sampleType)
{
switch (sampleType)
{
case ASIOSTInt16MSB:
case ASIOSTInt16LSB:
case ASIOSTInt24LSB:
case ASIOSTInt32LSB:
case ASIOSTFloat32LSB:
case ASIOSTFloat64LSB:
break;
default:
rslog::error_ts() << " requested wBitsPerSample is " << format.wBitsPerSample << " but ASIO channels format is " << sampleType << std::endl;
rslog::error_ts() << " ASIO sample type " << sampleType << " is not currently supported" << std::endl;
return false;
}
}
else
{
rslog::error_ts() << " requested wBitsPerSample is not supported" << std::endl;
return false;
}

// block align sanity check
Expand Down Expand Up @@ -519,19 +480,6 @@ bool AsioSharedHost::IsWaveFormatSupported(const WAVEFORMATEX& format, bool outp
bitsPerSample = wfe.Samples.wValidBitsPerSample;
}

switch (sampleType)
{
case ASIOSTInt16LSB:
case ASIOSTInt24LSB:
case ASIOSTInt32LSB:
case ASIOSTFloat32LSB:
case ASIOSTFloat64LSB:
break;
default:
rslog::error_ts() << " ASIO sample type " << sampleType << " is not currently supported" << std::endl;
return false;
}

return true;
}

Expand Down

0 comments on commit b35593b

Please sign in to comment.