added some more ASIO sample conversions
This commit is contained in:
parent
75b1994257
commit
9f3d07ca67
3 changed files with 121 additions and 21 deletions
|
@ -142,7 +142,7 @@ public:
|
||||||
// sound card conversion buffer is used or not
|
// sound card conversion buffer is used or not
|
||||||
if ( bSndCrdConversionBufferRequired )
|
if ( bSndCrdConversionBufferRequired )
|
||||||
{
|
{
|
||||||
return iSndCardMonoBlockSizeSamConvBuff;
|
return iSndCardMonoBlockSizeSamConvBuff + iMonoBlockSizeSam;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -103,12 +103,15 @@ CClientSettingsDlg::CClientSettingsDlg ( CClient* pNCliP, QWidget* parent,
|
||||||
"<li>512 samples: This setting should only be used if only a very slow "
|
"<li>512 samples: This setting should only be used if only a very slow "
|
||||||
"computer or a slow internet connection is available.</li>"
|
"computer or a slow internet connection is available.</li>"
|
||||||
"</ul>"
|
"</ul>"
|
||||||
"Some sound card driver to not allow the buffer delay to be changed "
|
"Some sound card driver do not allow the buffer delay to be changed "
|
||||||
"from within the llcon software. In this case the buffer delay setting "
|
"from within the llcon software. In this case the buffer delay setting "
|
||||||
"is disabled. To change the actual buffer delay, this "
|
"is disabled. To change the actual buffer delay, this "
|
||||||
"setting has to be changed in the sound card driver. On Windows, press "
|
"setting has to be changed in the sound card driver. On Windows, press "
|
||||||
"the ASIO Setup button to open the driver settings panel. On Linux, "
|
"the ASIO Setup button to open the driver settings panel. On Linux, "
|
||||||
"use the Jack configuration tool to change the buffer size.<br>"
|
"use the Jack configuration tool to change the buffer size.<br>"
|
||||||
|
"If no buffer size is selected and all settings are disabled, a "
|
||||||
|
"unsupported bufffer size is used by the driver. The llcon software "
|
||||||
|
"will still work with this setting but with restricted performannce.<br>"
|
||||||
"The actual buffer delay has influence on the connection status, the "
|
"The actual buffer delay has influence on the connection status, the "
|
||||||
"current upload rate and the overall delay. The lower the buffer size, "
|
"current upload rate and the overall delay. The lower the buffer size, "
|
||||||
"the higher the probability of red light in the status indicator (drop "
|
"the higher the probability of red light in the status indicator (drop "
|
||||||
|
|
|
@ -639,7 +639,16 @@ void CSound::bufferSwitch ( long index, ASIOBool processNow )
|
||||||
|
|
||||||
case ASIOSTInt24MSB:
|
case ASIOSTInt24MSB:
|
||||||
// NOT YET TESTED
|
// NOT YET TESTED
|
||||||
// TODO
|
for ( iCurSample = 0; iCurSample < iASIOBufferSizeMono; iCurSample++ )
|
||||||
|
{
|
||||||
|
// because the bits are flipped, we do not have to perform the
|
||||||
|
// shift by 8 bits
|
||||||
|
int iCurSam = 0;
|
||||||
|
memcpy ( &iCurSam, ( (char*) bufferInfos[i].buffers[index] ) + iCurSample * 3, 3 );
|
||||||
|
|
||||||
|
vecsTmpAudioSndCrdStereo[2 * iCurSample + bufferInfos[i].channelNum] =
|
||||||
|
Flip16Bits ( static_cast<int16_t> ( iCurSam ) );
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ASIOSTInt32MSB:
|
case ASIOSTInt32MSB:
|
||||||
|
@ -655,32 +664,64 @@ void CSound::bufferSwitch ( long index, ASIOBool processNow )
|
||||||
|
|
||||||
case ASIOSTFloat32MSB: // IEEE 754 32 bit float, as found on Intel x86 architecture
|
case ASIOSTFloat32MSB: // IEEE 754 32 bit float, as found on Intel x86 architecture
|
||||||
// NOT YET TESTED
|
// NOT YET TESTED
|
||||||
// TODO
|
for ( iCurSample = 0; iCurSample < iASIOBufferSizeMono; iCurSample++ )
|
||||||
|
{
|
||||||
|
vecsTmpAudioSndCrdStereo[2 * iCurSample + bufferInfos[i].channelNum] =
|
||||||
|
static_cast<int16_t> ( static_cast<float> (
|
||||||
|
Flip32Bits ( static_cast<int32_t*> (
|
||||||
|
bufferInfos[i].buffers[index] )[iCurSample] ) ) * _MAXSHORT );
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ASIOSTFloat64MSB: // IEEE 754 64 bit double float, as found on Intel x86 architecture
|
case ASIOSTFloat64MSB: // IEEE 754 64 bit double float, as found on Intel x86 architecture
|
||||||
// NOT YET TESTED
|
// NOT YET TESTED
|
||||||
// TODO
|
for ( iCurSample = 0; iCurSample < iASIOBufferSizeMono; iCurSample++ )
|
||||||
|
{
|
||||||
|
vecsTmpAudioSndCrdStereo[2 * iCurSample + bufferInfos[i].channelNum] =
|
||||||
|
static_cast<int16_t> ( static_cast<double> (
|
||||||
|
Flip64Bits ( static_cast<int64_t*> (
|
||||||
|
bufferInfos[i].buffers[index] )[iCurSample] ) ) * _MAXSHORT );
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ASIOSTInt32MSB16: // 32 bit data with 16 bit alignment
|
case ASIOSTInt32MSB16: // 32 bit data with 16 bit alignment
|
||||||
// NOT YET TESTED
|
// NOT YET TESTED
|
||||||
// TODO
|
for ( iCurSample = 0; iCurSample < iASIOBufferSizeMono; iCurSample++ )
|
||||||
|
{
|
||||||
|
vecsTmpAudioSndCrdStereo[2 * iCurSample + bufferInfos[i].channelNum] =
|
||||||
|
static_cast<int16_t> ( Flip32Bits ( static_cast<int32_t*> (
|
||||||
|
bufferInfos[i].buffers[index] )[iCurSample] ) & 0xFFFF );
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ASIOSTInt32MSB18: // 32 bit data with 18 bit alignment
|
case ASIOSTInt32MSB18: // 32 bit data with 18 bit alignment
|
||||||
// NOT YET TESTED
|
// NOT YET TESTED
|
||||||
// TODO
|
for ( iCurSample = 0; iCurSample < iASIOBufferSizeMono; iCurSample++ )
|
||||||
|
{
|
||||||
|
vecsTmpAudioSndCrdStereo[2 * iCurSample + bufferInfos[i].channelNum] =
|
||||||
|
static_cast<int16_t> ( ( Flip32Bits ( static_cast<int32_t*> (
|
||||||
|
bufferInfos[i].buffers[index] )[iCurSample] ) & 0x3FFFF ) >> 2 );
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ASIOSTInt32MSB20: // 32 bit data with 20 bit alignment
|
case ASIOSTInt32MSB20: // 32 bit data with 20 bit alignment
|
||||||
// NOT YET TESTED
|
// NOT YET TESTED
|
||||||
// TODO
|
for ( iCurSample = 0; iCurSample < iASIOBufferSizeMono; iCurSample++ )
|
||||||
|
{
|
||||||
|
vecsTmpAudioSndCrdStereo[2 * iCurSample + bufferInfos[i].channelNum] =
|
||||||
|
static_cast<int16_t> ( ( Flip32Bits ( static_cast<int32_t*> (
|
||||||
|
bufferInfos[i].buffers[index] )[iCurSample] ) & 0xFFFFF ) >> 4 );
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ASIOSTInt32MSB24: // 32 bit data with 24 bit alignment
|
case ASIOSTInt32MSB24: // 32 bit data with 24 bit alignment
|
||||||
// NOT YET TESTED
|
// NOT YET TESTED
|
||||||
// TODO
|
for ( iCurSample = 0; iCurSample < iASIOBufferSizeMono; iCurSample++ )
|
||||||
|
{
|
||||||
|
vecsTmpAudioSndCrdStereo[2 * iCurSample + bufferInfos[i].channelNum] =
|
||||||
|
static_cast<int16_t> ( ( Flip32Bits ( static_cast<int32_t*> (
|
||||||
|
bufferInfos[i].buffers[index] )[iCurSample] ) & 0xFFFFFF ) >> 8 );
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -823,7 +864,15 @@ void CSound::bufferSwitch ( long index, ASIOBool processNow )
|
||||||
|
|
||||||
case ASIOSTInt24MSB:
|
case ASIOSTInt24MSB:
|
||||||
// NOT YET TESTED
|
// NOT YET TESTED
|
||||||
// TODO
|
for ( iCurSample = 0; iCurSample < iASIOBufferSizeMono; iCurSample++ )
|
||||||
|
{
|
||||||
|
// because the bits are flipped, we do not have to perform the
|
||||||
|
// shift by 8 bits
|
||||||
|
int32_t iCurSam = static_cast<int32_t> ( Flip16Bits (
|
||||||
|
vecsTmpAudioSndCrdStereo[2 * iCurSample + bufferInfos[i].channelNum] ) );
|
||||||
|
|
||||||
|
memcpy ( ( (char*) bufferInfos[i].buffers[index] ) + iCurSample * 3, &iCurSam, 3 );
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ASIOSTInt32MSB:
|
case ASIOSTInt32MSB:
|
||||||
|
@ -841,32 +890,80 @@ void CSound::bufferSwitch ( long index, ASIOBool processNow )
|
||||||
|
|
||||||
case ASIOSTFloat32MSB: // IEEE 754 32 bit float, as found on Intel x86 architecture
|
case ASIOSTFloat32MSB: // IEEE 754 32 bit float, as found on Intel x86 architecture
|
||||||
// NOT YET TESTED
|
// NOT YET TESTED
|
||||||
// TODO
|
for ( iCurSample = 0; iCurSample < iASIOBufferSizeMono; iCurSample++ )
|
||||||
|
{
|
||||||
|
const float fCurSam = static_cast<float> (
|
||||||
|
vecsTmpAudioSndCrdStereo[2 * iCurSample + bufferInfos[i].channelNum] );
|
||||||
|
|
||||||
|
static_cast<float*> ( bufferInfos[i].buffers[index] )[iCurSample] =
|
||||||
|
static_cast<float> ( Flip32Bits ( static_cast<int32_t> (
|
||||||
|
fCurSam / _MAXSHORT ) ) );
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ASIOSTFloat64MSB: // IEEE 754 64 bit double float, as found on Intel x86 architecture
|
case ASIOSTFloat64MSB: // IEEE 754 64 bit double float, as found on Intel x86 architecture
|
||||||
// NOT YET TESTED
|
// NOT YET TESTED
|
||||||
// TODO
|
for ( iCurSample = 0; iCurSample < iASIOBufferSizeMono; iCurSample++ )
|
||||||
|
{
|
||||||
|
const double fCurSam = static_cast<double> (
|
||||||
|
vecsTmpAudioSndCrdStereo[2 * iCurSample + bufferInfos[i].channelNum] );
|
||||||
|
|
||||||
|
static_cast<float*> ( bufferInfos[i].buffers[index] )[iCurSample] =
|
||||||
|
static_cast<double> ( Flip64Bits ( static_cast<int64_t> (
|
||||||
|
fCurSam / _MAXSHORT ) ) );
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ASIOSTInt32MSB16: // 32 bit data with 16 bit alignment
|
case ASIOSTInt32MSB16: // 32 bit data with 16 bit alignment
|
||||||
// NOT YET TESTED
|
// NOT YET TESTED
|
||||||
// TODO
|
for ( iCurSample = 0; iCurSample < iASIOBufferSizeMono; iCurSample++ )
|
||||||
|
{
|
||||||
|
// convert to 32 bit
|
||||||
|
const int32_t iCurSam = static_cast<int32_t> (
|
||||||
|
vecsTmpAudioSndCrdStereo[2 * iCurSample + bufferInfos[i].channelNum] );
|
||||||
|
|
||||||
|
static_cast<int32_t*> ( bufferInfos[i].buffers[index] )[iCurSample] =
|
||||||
|
Flip32Bits ( iCurSam );
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ASIOSTInt32MSB18: // 32 bit data with 18 bit alignment
|
case ASIOSTInt32MSB18: // 32 bit data with 18 bit alignment
|
||||||
// NOT YET TESTED
|
// NOT YET TESTED
|
||||||
// TODO
|
for ( iCurSample = 0; iCurSample < iASIOBufferSizeMono; iCurSample++ )
|
||||||
|
{
|
||||||
|
// convert to 32 bit
|
||||||
|
const int32_t iCurSam = static_cast<int32_t> (
|
||||||
|
vecsTmpAudioSndCrdStereo[2 * iCurSample + bufferInfos[i].channelNum] );
|
||||||
|
|
||||||
|
static_cast<int32_t*> ( bufferInfos[i].buffers[index] )[iCurSample] =
|
||||||
|
Flip32Bits ( iCurSam << 2 );
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ASIOSTInt32MSB20: // 32 bit data with 20 bit alignment
|
case ASIOSTInt32MSB20: // 32 bit data with 20 bit alignment
|
||||||
// NOT YET TESTED
|
// NOT YET TESTED
|
||||||
// TODO
|
for ( iCurSample = 0; iCurSample < iASIOBufferSizeMono; iCurSample++ )
|
||||||
|
{
|
||||||
|
// convert to 32 bit
|
||||||
|
const int32_t iCurSam = static_cast<int32_t> (
|
||||||
|
vecsTmpAudioSndCrdStereo[2 * iCurSample + bufferInfos[i].channelNum] );
|
||||||
|
|
||||||
|
static_cast<int32_t*> ( bufferInfos[i].buffers[index] )[iCurSample] =
|
||||||
|
Flip32Bits ( iCurSam << 4 );
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ASIOSTInt32MSB24: // 32 bit data with 24 bit alignment
|
case ASIOSTInt32MSB24: // 32 bit data with 24 bit alignment
|
||||||
// NOT YET TESTED
|
// NOT YET TESTED
|
||||||
// TODO
|
for ( iCurSample = 0; iCurSample < iASIOBufferSizeMono; iCurSample++ )
|
||||||
|
{
|
||||||
|
// convert to 32 bit
|
||||||
|
const int32_t iCurSam = static_cast<int32_t> (
|
||||||
|
vecsTmpAudioSndCrdStereo[2 * iCurSample + bufferInfos[i].channelNum] );
|
||||||
|
|
||||||
|
static_cast<int32_t*> ( bufferInfos[i].buffers[index] )[iCurSample] =
|
||||||
|
Flip32Bits ( iCurSam << 8 );
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue