Skip to content

Commit

Permalink
Add d option to ctrlmidich for device name
Browse files Browse the repository at this point in the history
  • Loading branch information
softins committed Dec 4, 2024
1 parent 494f9e4 commit 7e11100
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 9 deletions.
27 changes: 18 additions & 9 deletions src/sound/soundbase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ char const sMidiCtlChar[] = {
/* [EMidiCtlType::Solo] = */ 's',
/* [EMidiCtlType::Mute] = */ 'm',
/* [EMidiCtlType::MuteMyself] = */ 'o',
/* [EMidiCtlType::Device] = */ 'd',
/* [EMidiCtlType::None] = */ '\0' };

/* Implementation *************************************************************/
Expand Down Expand Up @@ -309,16 +310,24 @@ void CSoundBase::ParseCommandLineArgument ( const QString& strMIDISetup )
continue;
EMidiCtlType eTyp = static_cast<EMidiCtlType> ( iCtrl );

const QStringList slP = sParm.mid ( 1 ).split ( '*' );
int iFirst = slP[0].toUInt();
int iNum = ( slP.count() > 1 ) ? slP[1].toUInt() : 1;
for ( int iOff = 0; iOff < iNum; iOff++ )
if ( eTyp == Device )
{
if ( iOff >= MAX_NUM_CHANNELS )
break;
if ( iFirst + iOff >= 128 )
break;
aMidiCtls[iFirst + iOff] = { eTyp, iOff };
// save MIDI device name to select
strMIDIDevice = sParm.mid ( 1 );
}
else
{
const QStringList slP = sParm.mid ( 1 ).split ( '*' );
int iFirst = slP[0].toUInt();
int iNum = ( slP.count() > 1 ) ? slP[1].toUInt() : 1;
for ( int iOff = 0; iOff < iNum; iOff++ )
{
if ( iOff >= MAX_NUM_CHANNELS )
break;
if ( iFirst + iOff >= 128 )
break;
aMidiCtls[iFirst + iOff] = { eTyp, iOff };
}
}
}
}
Expand Down
3 changes: 3 additions & 0 deletions src/sound/soundbase.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ enum EMidiCtlType
Solo,
Mute,
MuteMyself,
Device,
None
};

Expand Down Expand Up @@ -167,6 +168,8 @@ class CSoundBase : public QThread
QString strCurDevName;
QString strDriverNames[MAX_NUMBER_SOUND_CARDS];

QString strMIDIDevice;

signals:
void ReinitRequest ( int iSndCrdResetType );
void ControllerInFaderLevel ( int iChannelIdx, int iValue );
Expand Down

0 comments on commit 7e11100

Please sign in to comment.