initial work for support CoreAudio aggregated devices

This commit is contained in:
Volker Fischer 2020-05-02 11:28:10 +02:00
parent 78b61cf01b
commit d35c5fa6cf
2 changed files with 74 additions and 1 deletions

View file

@ -15,12 +15,14 @@
* bug fix: for mono capture jack audio interface Jamulus complains it cannot make connections (Ticket #137) * bug fix: for mono capture jack audio interface Jamulus complains it cannot make connections (Ticket #137)
TODO implement panning for channels (Ticket #52, #145) TODO support CoreAudio aggregated devices
TODO support internationalization TODO support internationalization
TODO standard style: meter bar gets smaller sometimes if board is full and fader text is short TODO standard style: meter bar gets smaller sometimes if board is full and fader text is short
TODO implement panning for channels (Ticket #52, #145)
TODO sometimes I cannot see the central server in the server list TODO sometimes I cannot see the central server in the server list
TODO server: warning if Central server selected but OS location is different (e.g. US) -> warning in GUI and command line TODO server: warning if Central server selected but OS location is different (e.g. US) -> warning in GUI and command line

View file

@ -869,6 +869,56 @@ OSStatus CSound::callbackIO ( AudioDeviceID inDevice,
GetSelCHAndAddCH ( iSelInputRightChannel, iNumInChan, iSelCHRight, iSelAddCHRight ); GetSelCHAndAddCH ( iSelInputRightChannel, iNumInChan, iSelCHRight, iSelAddCHRight );
// check size (float32 has four bytes) // check size (float32 has four bytes)
// if ( inInputData->mBuffers[0].mDataByteSize * inInputData->mNumberBuffers ==
// (UInt32) iNumInChan * static_cast<UInt32> ( iCoreAudioBufferSizeMono * 4 ) )
// {
// const int iNumChanPerFrame = iNumInChan / inInputData->mNumberBuffers;
// const int iSelBufferLeft = iSelCHLeft / iNumChanPerFrame;
// const int iSelBufferRight = iSelCHRight / iNumChanPerFrame;
// const int iSelInterlChLeft = iSelCHLeft % iNumChanPerFrame;
// const int iSelInterlChRight = iSelCHRight % iNumChanPerFrame;
//
// Float32* pLeftData = static_cast<Float32*> ( inInputData->mBuffers[iSelBufferLeft].mData );
// Float32* pRightData = static_cast<Float32*> ( inInputData->mBuffers[iSelBufferRight].mData );
//
// // copy input data
// for ( int i = 0; i < iCoreAudioBufferSizeMono; i++ )
// {
// // copy left and right channels separately
// pSound->vecsTmpAudioSndCrdStereo[2 * i] = (short) ( pLeftData[iNumChanPerFrame * i + iSelInterlChLeft] * _MAXSHORT );
// pSound->vecsTmpAudioSndCrdStereo[2 * i + 1] = (short) ( pRightData[iNumChanPerFrame * i + iSelInterlChRight] * _MAXSHORT );
// }
//
// // add an additional optional channel
// if ( iSelAddCHLeft >= 0 )
// {
// const int iSelAddCHBufferLeft = iSelAddCHLeft / iNumChanPerFrame;
// const int iSelAddCHInterlChLeft = iSelAddCHLeft % iNumChanPerFrame;
//
// pLeftData = static_cast<Float32*> ( inInputData->mBuffers[iSelAddCHBufferLeft].mData );
//
// for ( int i = 0; i < iCoreAudioBufferSizeMono; i++ )
// {
// pSound->vecsTmpAudioSndCrdStereo[2 * i] = Double2Short (
// pSound->vecsTmpAudioSndCrdStereo[2 * i] + pLeftData[iNumChanPerFrame * i + iSelAddCHInterlChLeft] * _MAXSHORT );
// }
// }
//
// if ( iSelAddCHRight >= 0 )
// {
// const int iSelAddCHBufferRight = iSelAddCHRight / iNumChanPerFrame;
// const int iSelAddCHInterlChRight = iSelAddCHRight % iNumChanPerFrame;
//
// pRightData = static_cast<Float32*> ( inInputData->mBuffers[iSelAddCHBufferRight].mData );
//
// for ( int i = 0; i < iCoreAudioBufferSizeMono; i++ )
// {
// pSound->vecsTmpAudioSndCrdStereo[2 * i + 1] = Double2Short (
// pSound->vecsTmpAudioSndCrdStereo[2 * i + 1] + pRightData[iNumChanPerFrame * i + iSelAddCHInterlChRight] * _MAXSHORT );
// }
// }
// }
// else
if ( inInputData->mBuffers[0].mDataByteSize == if ( inInputData->mBuffers[0].mDataByteSize ==
static_cast<UInt32> ( iCoreAudioBufferSizeMono * iNumInChan * 4 ) ) static_cast<UInt32> ( iCoreAudioBufferSizeMono * iNumInChan * 4 ) )
{ {
@ -954,6 +1004,27 @@ OSStatus CSound::callbackIO ( AudioDeviceID inDevice,
if ( ( inDevice == pSound->CurrentAudioOutputDeviceID ) && outOutputData ) if ( ( inDevice == pSound->CurrentAudioOutputDeviceID ) && outOutputData )
{ {
// check size (float32 has four bytes) // check size (float32 has four bytes)
// if ( inOutputData->mBuffers[0].mDataByteSize * inOutputData->mNumberBuffers ==
// (UInt32) iNumOutChan * static_cast<UInt32> ( iCoreAudioBufferSizeMono * 4 ) )
// {
// const int iNumChanPerFrame = iNumOutChan / inOutputData->mNumberBuffers;
// const int iSelBufferLeft = iSelOutputLeftChannel / iNumChanPerFrame;
// const int iSelBufferRight = iSelOutputRightChannel / iNumChanPerFrame;
// const int iSelInterlChLeft = iSelOutputLeftChannel % iNumChanPerFrame;
// const int iSelInterlChRight = iSelOutputRightChannel % iNumChanPerFrame;
//
// Float32* pLeftData = static_cast<Float32*> ( inOutputData->mBuffers[iSelBufferLeft].mData );
// Float32* pRightData = static_cast<Float32*> ( inOutputData->mBuffers[iSelBufferRight].mData );
//
// // copy output data
// for ( int i = 0; i < iCoreAudioBufferSizeMono; i++ )
// {
// // copy left and right channels separately
// pLeftData[iNumChanPerFrame * i + iSelInterlChLeft] = (Float32) pSound->vecsTmpAudioSndCrdStereo[2 * i] / _MAXSHORT;
// pRightData[iNumChanPerFrame * i + iSelInterlChRight] = (Float32) pSound->vecsTmpAudioSndCrdStereo[2 * i] / _MAXSHORT;
// }
// }
// else
if ( outOutputData->mBuffers[0].mDataByteSize == if ( outOutputData->mBuffers[0].mDataByteSize ==
static_cast<UInt32> ( iCoreAudioBufferSizeMono * iNumOutChan * 4 ) ) static_cast<UInt32> ( iCoreAudioBufferSizeMono * iNumOutChan * 4 ) )
{ {