Skip to content

Commit

Permalink
Improve mono compatibility with LADSPA plugins (LMMS#7674)
Browse files Browse the repository at this point in the history
  • Loading branch information
sakertooth authored Jan 31, 2025
1 parent 2c674ec commit 77ca0f8
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 11 deletions.
11 changes: 5 additions & 6 deletions include/AudioDevice.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ class AudioDevice
virtual void unregisterPort( AudioPort * _port );
virtual void renamePort( AudioPort * _port );


inline bool supportsCapture() const
{
return m_supportsCapture;
Expand All @@ -76,11 +75,6 @@ class AudioDevice
return m_sampleRate;
}

ch_cnt_t channels() const
{
return m_channels;
}

void processNextBuffer();

virtual void startProcessing()
Expand Down Expand Up @@ -109,6 +103,11 @@ class AudioDevice
void clearS16Buffer( int_sample_t * _outbuf,
const fpp_t _frames );

ch_cnt_t channels() const
{
return m_channels;
}

inline void setSampleRate( const sample_rate_t _new_sr )
{
m_sampleRate = _new_sr;
Expand Down
3 changes: 1 addition & 2 deletions plugins/LadspaBrowser/LadspaDescription.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,7 @@ LadspaDescription::LadspaDescription( QWidget * _parent,
QList<QString> pluginNames;
for (const auto& plugin : plugins)
{
ch_cnt_t audioDeviceChannels = Engine::audioEngine()->audioDev()->channels();
if (_type != LadspaPluginType::Valid || manager->getDescription(plugin.second)->inputChannels <= audioDeviceChannels)
if (_type != LadspaPluginType::Valid || manager->getDescription(plugin.second)->inputChannels <= DEFAULT_CHANNELS)
{
pluginNames.push_back(plugin.first);
m_pluginKeys.push_back(plugin.second);
Expand Down
3 changes: 1 addition & 2 deletions plugins/LadspaEffect/LadspaEffect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -279,9 +279,8 @@ void LadspaEffect::pluginInstantiation()
Ladspa2LMMS * manager = Engine::getLADSPAManager();

// Calculate how many processing units are needed.
const ch_cnt_t lmms_chnls = Engine::audioEngine()->audioDev()->channels();
int effect_channels = manager->getDescription( m_key )->inputChannels;
setProcessorCount( lmms_chnls / effect_channels );
setProcessorCount(DEFAULT_CHANNELS / effect_channels);

// get inPlaceBroken property
m_inPlaceBroken = manager->isInplaceBroken( m_key );
Expand Down
2 changes: 1 addition & 1 deletion plugins/LadspaEffect/LadspaSubPluginFeatures.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ void LadspaSubPluginFeatures::listSubPluginKeys(
for( l_sortable_plugin_t::const_iterator it = plugins.begin();
it != plugins.end(); ++it )
{
if( lm->getDescription( ( *it ).second )->inputChannels <= Engine::audioEngine()->audioDev()->channels() )
if (lm->getDescription((*it).second)->inputChannels <= DEFAULT_CHANNELS)
{
_kl.push_back( ladspaKeyToSubPluginKey( _desc, ( *it ).first, ( *it ).second ) );
}
Expand Down

0 comments on commit 77ca0f8

Please sign in to comment.