Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions src/client.h
Original file line number Diff line number Diff line change
Expand Up @@ -286,10 +286,14 @@ class CClient : public QObject
Channel.GetBufErrorRates ( vecErrRates, dLimit, dMaxUpLimit );
}

//### TODO: BEGIN ###//
// Refactor this to use signal/slot mechanism. https://github.com/jamulussoftware/jamulus/pull/3479/files#r1976382416
// ### TODO: BEGIN ###//
// Refactor this to use signal/slot mechanism. https://github.com/jamulussoftware/jamulus/pull/3479/files#r1976382416
CProtocol* getConnLessProtocol() { return &ConnLessProtocol; }
//### TODO: END ###//
// ### TODO: END ###//

// MIDI control
void EnableMIDI ( bool bEnable ) { Sound.EnableMIDI ( bEnable ); }
bool IsMIDIEnabled() const { return Sound.IsMIDIEnabled(); }

// settings
CChannelCoreInfo ChannelInfo;
Expand Down
19 changes: 15 additions & 4 deletions src/clientdlg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -537,6 +537,8 @@ CClientDlg::CClientDlg ( CClient* pNCliP,

QObject::connect ( &ClientSettingsDlg, &CClientSettingsDlg::NumMixerPanelRowsChanged, this, &CClientDlg::OnNumMixerPanelRowsChanged );

QObject::connect ( &ClientSettingsDlg, &CClientSettingsDlg::MIDIControllerUsageChanged, this, &CClientDlg::OnMIDIControllerUsageChanged );

QObject::connect ( this, &CClientDlg::SendTabChange, &ClientSettingsDlg, &CClientSettingsDlg::OnMakeTabChange );

QObject::connect ( MainMixerBoard, &CAudioMixerBoard::ChangeChanGain, this, &CClientDlg::OnChangeChanGain );
Expand Down Expand Up @@ -1287,11 +1289,11 @@ void CClientDlg::Disconnect()
TimerDetectFeedback.stop();
bDetectFeedback = false;

//### TODO: BEGIN ###//
// is this still required???
// immediately update status bar
// ### TODO: BEGIN ###//
// is this still required???
// immediately update status bar
OnTimerStatus();
//### TODO: END ###//
// ### TODO: END ###//

// reset LEDs
ledBuffers->Reset();
Expand Down Expand Up @@ -1519,3 +1521,12 @@ void CClientDlg::SetPingTime ( const int iPingTime, const int iOverallDelayMs, c
}

void CClientDlg::OnOpenMidiSettings() { ShowGeneralSettings ( SETTING_TAB_MIDI ); }

void CClientDlg::OnMIDIControllerUsageChanged ( bool bEnabled )
{
// Update the mixer board's MIDI flag to trigger proper user numbering display
MainMixerBoard->SetMIDICtrlUsed ( bEnabled );

// Enable/disable runtime MIDI via the sound interface through the public CClient interface
pClient->EnableMIDI ( bEnabled );
}
1 change: 1 addition & 0 deletions src/clientdlg.h
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,7 @@ public slots:
void accept() { close(); } // introduced by pljones

void OnOpenMidiSettings();
void OnMIDIControllerUsageChanged ( bool bEnabled );

signals:
void SendTabChange ( int iTabIdx );
Expand Down
40 changes: 37 additions & 3 deletions src/clientsettingsdlg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -399,11 +399,15 @@ CClientSettingsDlg::CClientSettingsDlg ( CClient* pNCliP, CClientSettings* pNSet
chbAudioAlerts->setAccessibleName ( tr ( "Audio Alerts check box" ) );

// MIDI settings
chbUseMIDIController->setWhatsThis ( tr ( "Enable/disable MIDI-in port" ) );

chbUseMIDIController->setAccessibleName ( tr ( "Enable or disable MIDI-in port check box" ) );

QString strMidiSettings = "<b>" + tr ( "MIDI controller settings" ) + ":</b> " +
tr ( "There is one global MIDI channel parameter (1-16) and two parameters you can set "
"for each item controlled: offset and consecutive CC numbers (count). First set the "
"for each item controlled: First MIDI CC and consecutive CC numbers (count). First set the "
"channel you want Jamulus to listen on (0 for all channels). Then, for each item "
"you want to control (volume fader, pan, solo, mute), set the offset (CC number "
"you want to control (volume fader, pan, solo, mute), set the first MIDI CC (CC number "
"to start from) and number of consecutive CC numbers (count). There is one "
"exception that does not require establishing consecutive CC numbers which is "
"the “Mute Myself” parameter - it only requires a single CC number as it is only "
Expand All @@ -412,6 +416,7 @@ CClientSettingsDlg::CClientSettingsDlg ( CClient* pNCliP, CClientSettings* pNSet
tr ( "You can either type in the MIDI CC values or use the \"Learn\" button: click on "
"\"Learn\", move the fader/knob on your MIDI controller, and the MIDI CC number "
"will be saved." );

lblChannel->setWhatsThis ( strMidiSettings );
lblMuteMyself->setWhatsThis ( strMidiSettings );
faderGroup->setWhatsThis ( strMidiSettings );
Expand Down Expand Up @@ -835,6 +840,22 @@ CClientSettingsDlg::CClientSettingsDlg ( CClient* pNCliP, CClientSettings* pNSet
ApplyMIDIMappingFromSettings();
} );

// Connect MIDI controller checkbox
QObject::connect ( chbUseMIDIController, &QCheckBox::toggled, this, [this] ( bool checked ) {
pSettings->bUseMIDIController = checked;

if ( checked )
{
pClient->ApplyMIDIMapping ( pSettings->GetMIDIMapString() );
}
else
{
pClient->ApplyMIDIMapping ( "" );
}

emit MIDIControllerUsageChanged ( checked );
} );

// MIDI Learn buttons
midiLearnButtons[0] = butLearnMuteMyself;
midiLearnButtons[1] = butLearnFaderOffset;
Expand Down Expand Up @@ -886,6 +907,7 @@ void CClientSettingsDlg::showEvent ( QShowEvent* event )
spnSoloCount->setValue ( pSettings->midiSoloCount );
spnMuteOffset->setValue ( pSettings->midiMuteOffset );
spnMuteCount->setValue ( pSettings->midiMuteCount );
chbUseMIDIController->setChecked ( pSettings->bUseMIDIController );

QDialog::showEvent ( event );
}
Expand Down Expand Up @@ -1331,7 +1353,19 @@ void CClientSettingsDlg::OnAudioPanValueChanged ( int value )
UpdateAudioFaderSlider();
}

void CClientSettingsDlg::ApplyMIDIMappingFromSettings() { pClient->ApplyMIDIMapping ( pSettings->GetMIDIMapString() ); }
void CClientSettingsDlg::ApplyMIDIMappingFromSettings()
{
// Only apply MIDI mapping if the controller is enabled
if ( pSettings->bUseMIDIController )
{
pClient->ApplyMIDIMapping ( pSettings->GetMIDIMapString() );
}
else
{
// If disabled, ensure no MIDI mapping is applied
pClient->ApplyMIDIMapping ( "" );
}
}

void CClientSettingsDlg::ResetMidiLearn()
{
Expand Down
1 change: 1 addition & 0 deletions src/clientsettingsdlg.h
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ public slots:
void AudioChannelsChanged();
void CustomDirectoriesChanged();
void NumMixerPanelRowsChanged ( int value );
void MIDIControllerUsageChanged ( bool bEnabled );

private:
enum MidiLearnTarget
Expand Down
80 changes: 74 additions & 6 deletions src/clientsettingsdlgbase.ui
Original file line number Diff line number Diff line change
Expand Up @@ -1341,6 +1341,13 @@
<string>MIDI</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_19">
<item>
<widget class="QCheckBox" name="chbUseMIDIController">
<property name="text">
<string>Enable MIDI-in port</string>
</property>
</widget>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout_17">
<item>
Expand Down Expand Up @@ -1377,12 +1384,18 @@
</font>
</property>
<property name="text">
<string>Channel</string>
<string>MIDI Channel</string>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="spnChannel">
<property name="minimumSize">
<size>
<width>55</width>
<height>0</height>
</size>
</property>
<property name="font">
<font>
<weight>50</weight>
Expand Down Expand Up @@ -1422,6 +1435,12 @@
</item>
<item>
<widget class="QSpinBox" name="spnMuteMyself">
<property name="minimumSize">
<size>
<width>65</width>
<height>0</height>
</size>
</property>
<property name="font">
<font>
<weight>50</weight>
Expand Down Expand Up @@ -1499,12 +1518,18 @@
</font>
</property>
<property name="text">
<string>Offset</string>
<string>First MIDI CC</string>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="spnFaderOffset">
<property name="minimumSize">
<size>
<width>65</width>
<height>0</height>
</size>
</property>
<property name="font">
<font>
<weight>50</weight>
Expand Down Expand Up @@ -1560,6 +1585,12 @@
</item>
<item>
<widget class="QSpinBox" name="spnFaderCount">
<property name="minimumSize">
<size>
<width>65</width>
<height>0</height>
</size>
</property>
<property name="font">
<font>
<weight>50</weight>
Expand Down Expand Up @@ -1624,12 +1655,18 @@
</font>
</property>
<property name="text">
<string>Offset</string>
<string>First MIDI CC</string>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="spnPanOffset">
<property name="minimumSize">
<size>
<width>65</width>
<height>0</height>
</size>
</property>
<property name="font">
<font>
<weight>50</weight>
Expand Down Expand Up @@ -1685,6 +1722,12 @@
</item>
<item>
<widget class="QSpinBox" name="spnPanCount">
<property name="minimumSize">
<size>
<width>65</width>
<height>0</height>
</size>
</property>
<property name="font">
<font>
<weight>50</weight>
Expand Down Expand Up @@ -1749,12 +1792,18 @@
</font>
</property>
<property name="text">
<string>Offset</string>
<string>First MIDI CC</string>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="spnSoloOffset">
<property name="minimumSize">
<size>
<width>65</width>
<height>0</height>
</size>
</property>
<property name="font">
<font>
<weight>50</weight>
Expand Down Expand Up @@ -1810,6 +1859,12 @@
</item>
<item>
<widget class="QSpinBox" name="spnSoloCount">
<property name="minimumSize">
<size>
<width>65</width>
<height>0</height>
</size>
</property>
<property name="font">
<font>
<weight>50</weight>
Expand Down Expand Up @@ -1874,12 +1929,18 @@
</font>
</property>
<property name="text">
<string>Offset</string>
<string>First MIDI CC</string>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="spnMuteOffset">
<property name="minimumSize">
<size>
<width>65</width>
<height>0</height>
</size>
</property>
<property name="font">
<font>
<weight>50</weight>
Expand Down Expand Up @@ -1935,6 +1996,12 @@
</item>
<item>
<widget class="QSpinBox" name="spnMuteCount">
<property name="minimumSize">
<size>
<width>65</width>
<height>0</height>
</size>
</property>
<property name="font">
<font>
<weight>50</weight>
Expand Down Expand Up @@ -1995,8 +2062,8 @@
<tabstop>butDriverSetup</tabstop>
<tabstop>cbxLInChan</tabstop>
<tabstop>cbxRInChan</tabstop>
<tabstop>cbxLOutChan</tabstop>
<tabstop>cbxROutChan</tabstop>
<tabstop>cbxLOutChan</tabstop>
<tabstop>cbxAudioChannels</tabstop>
<tabstop>cbxAudioQuality</tabstop>
<tabstop>rbtBufferDelayPreferred</tabstop>
Expand All @@ -2012,6 +2079,7 @@
<tabstop>cbxInputBoost</tabstop>
<tabstop>chbDetectFeedback</tabstop>
<tabstop>sldAudioPan</tabstop>
<tabstop>chbUseMIDIController</tabstop>
<tabstop>spnChannel</tabstop>
<tabstop>spnMuteMyself</tabstop>
<tabstop>butLearnMuteMyself</tabstop>
Expand Down
Loading