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
|
||||
if ( bSndCrdConversionBufferRequired )
|
||||
{
|
||||
return iSndCardMonoBlockSizeSamConvBuff;
|
||||
return iSndCardMonoBlockSizeSamConvBuff + iMonoBlockSizeSam;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -8,16 +8,16 @@
|
|||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License as published by the Free Software
|
||||
* Foundation; either version 2 of the License, or (at your option) any later
|
||||
* Foundation; either version 2 of the License, or (at your option) any later
|
||||
* version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
* details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
\******************************************************************************/
|
||||
|
@ -103,12 +103,15 @@ CClientSettingsDlg::CClientSettingsDlg ( CClient* pNCliP, QWidget* parent,
|
|||
"<li>512 samples: This setting should only be used if only a very slow "
|
||||
"computer or a slow internet connection is available.</li>"
|
||||
"</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 "
|
||||
"is disabled. To change the actual buffer delay, this "
|
||||
"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, "
|
||||
"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 "
|
||||
"current upload rate and the overall delay. The lower the buffer size, "
|
||||
"the higher the probability of red light in the status indicator (drop "
|
||||
|
@ -159,7 +162,7 @@ CClientSettingsDlg::CClientSettingsDlg ( CClient* pNCliP, QWidget* parent,
|
|||
cbUseHighQualityAudio->setAccessibleName ( tr ( "Use high quality audio "
|
||||
"check box" ) );
|
||||
|
||||
// current connection status parameter
|
||||
// current connection status parameter
|
||||
QString strConnStats = tr ( "<b>Current Connection Status "
|
||||
"Parameter:</b> The ping time is the time required for the audio "
|
||||
"stream to travel from the client to the server and backwards. This "
|
||||
|
|
|
@ -639,7 +639,16 @@ void CSound::bufferSwitch ( long index, ASIOBool processNow )
|
|||
|
||||
case ASIOSTInt24MSB:
|
||||
// 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;
|
||||
|
||||
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
|
||||
// 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;
|
||||
|
||||
case ASIOSTFloat64MSB: // IEEE 754 64 bit double float, as found on Intel x86 architecture
|
||||
// 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;
|
||||
|
||||
case ASIOSTInt32MSB16: // 32 bit data with 16 bit alignment
|
||||
// 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;
|
||||
|
||||
case ASIOSTInt32MSB18: // 32 bit data with 18 bit alignment
|
||||
// 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;
|
||||
|
||||
case ASIOSTInt32MSB20: // 32 bit data with 20 bit alignment
|
||||
// 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;
|
||||
|
||||
case ASIOSTInt32MSB24: // 32 bit data with 24 bit alignment
|
||||
// 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;
|
||||
}
|
||||
}
|
||||
|
@ -823,7 +864,15 @@ void CSound::bufferSwitch ( long index, ASIOBool processNow )
|
|||
|
||||
case ASIOSTInt24MSB:
|
||||
// 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;
|
||||
|
||||
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
|
||||
// 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;
|
||||
|
||||
case ASIOSTFloat64MSB: // IEEE 754 64 bit double float, as found on Intel x86 architecture
|
||||
// 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;
|
||||
|
||||
case ASIOSTInt32MSB16: // 32 bit data with 16 bit alignment
|
||||
// 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;
|
||||
|
||||
case ASIOSTInt32MSB18: // 32 bit data with 18 bit alignment
|
||||
// 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;
|
||||
|
||||
case ASIOSTInt32MSB20: // 32 bit data with 20 bit alignment
|
||||
// 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;
|
||||
|
||||
case ASIOSTInt32MSB24: // 32 bit data with 24 bit alignment
|
||||
// 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;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue