Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into SFACMerge
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelgregorius committed Apr 2, 2024
2 parents 896d70c + 9dd7f4d commit e9969e7
Show file tree
Hide file tree
Showing 9 changed files with 62 additions and 70 deletions.
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/build
/target
/build/
/target/
.*.sw?
.DS_Store
*~
Expand Down
13 changes: 6 additions & 7 deletions src/core/InstrumentPlayHandle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,22 +47,21 @@ void InstrumentPlayHandle::play(sampleFrame * working_buffer)
// ensure that all our nph's have been processed first
auto nphv = NotePlayHandle::nphsOfInstrumentTrack(instrumentTrack, true);

bool nphsLeft = false;
bool nphsLeft;
do
{
for (const NotePlayHandle * constNotePlayHandle : nphv)
nphsLeft = false;
for (const auto& handle : nphv)
{
if (constNotePlayHandle->state() != ThreadableJob::ProcessingState::Done &&
!constNotePlayHandle->isFinished())
if (handle->state() != ThreadableJob::ProcessingState::Done && !handle->isFinished())
{
nphsLeft = true;
NotePlayHandle * notePlayHandle = const_cast<NotePlayHandle *>(constNotePlayHandle);
notePlayHandle->process();
const_cast<NotePlayHandle*>(handle)->process();
}
}
}
while (nphsLeft);

m_instrument->play(working_buffer);

// Process the audio buffer that the instrument has just worked on...
Expand Down
54 changes: 19 additions & 35 deletions src/core/LadspaManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -122,14 +122,8 @@ LadspaManager::~LadspaManager()
LadspaManagerDescription * LadspaManager::getDescription(
const ladspa_key_t & _plugin )
{
if( m_ladspaManagerMap.contains( _plugin ) )
{
return( m_ladspaManagerMap[_plugin] );
}
else
{
return( nullptr );
}
auto const it = m_ladspaManagerMap.find(_plugin);
return it != m_ladspaManagerMap.end() ? *it : nullptr;
}


Expand Down Expand Up @@ -519,24 +513,16 @@ bool LadspaManager::isInteger( const ladspa_key_t & _plugin,

bool LadspaManager::isEnum( const ladspa_key_t & _plugin, uint32_t _port )
{
if( m_ladspaManagerMap.contains( _plugin )
&& _port < getPortCount( _plugin ) )
auto const * desc = getDescriptor(_plugin);
if (desc && _port < desc->PortCount)
{
LADSPA_Descriptor_Function descriptorFunction =
m_ladspaManagerMap[_plugin]->descriptorFunction;
const LADSPA_Descriptor * descriptor =
descriptorFunction(
m_ladspaManagerMap[_plugin]->index );
LADSPA_PortRangeHintDescriptor hintDescriptor =
descriptor->PortRangeHints[_port].HintDescriptor;
desc->PortRangeHints[_port].HintDescriptor;
// This is an LMMS extension to ladspa
return( LADSPA_IS_HINT_INTEGER( hintDescriptor ) &&
LADSPA_IS_HINT_TOGGLED( hintDescriptor ) );
}
else
{
return( false );
return LADSPA_IS_HINT_INTEGER(hintDescriptor) && LADSPA_IS_HINT_TOGGLED(hintDescriptor);
}

return false;
}


Expand All @@ -562,22 +548,20 @@ const void * LadspaManager::getImplementationData(



const LADSPA_Descriptor * LadspaManager::getDescriptor(
const ladspa_key_t & _plugin )
const LADSPA_Descriptor * LadspaManager::getDescriptor(const ladspa_key_t & _plugin)
{
if( m_ladspaManagerMap.contains( _plugin ) )
{
LADSPA_Descriptor_Function descriptorFunction =
m_ladspaManagerMap[_plugin]->descriptorFunction;
const LADSPA_Descriptor * descriptor =
descriptorFunction(
m_ladspaManagerMap[_plugin]->index );
return( descriptor );
}
else
auto const it = m_ladspaManagerMap.find(_plugin);
if (it != m_ladspaManagerMap.end())
{
return( nullptr );
auto const plugin = *it;

LADSPA_Descriptor_Function descriptorFunction = plugin->descriptorFunction;
const LADSPA_Descriptor* descriptor = descriptorFunction(plugin->index);

return descriptor;
}

return nullptr;
}


Expand Down
7 changes: 1 addition & 6 deletions src/gui/SampleTrackWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@
#include "SampleTrackView.h"
#include "Song.h"
#include "SubWindow.h"
#include "TabWidget.h"
#include "TrackLabelButton.h"

namespace lmms::gui
Expand Down Expand Up @@ -69,13 +68,9 @@ SampleTrackWindow::SampleTrackWindow(SampleTrackView * tv) :
vlayout->setContentsMargins(0, 0, 0, 0);
vlayout->setSpacing(0);

auto generalSettingsWidget = new TabWidget(tr("GENERAL SETTINGS"), this);

auto generalSettingsWidget = new QWidget(this);
auto generalSettingsLayout = new QVBoxLayout(generalSettingsWidget);

generalSettingsLayout->setContentsMargins(8, 18, 8, 8);
generalSettingsLayout->setSpacing(6);

auto nameWidget = new QWidget(generalSettingsWidget);
auto nameLayout = new QHBoxLayout(nameWidget);
nameLayout->setContentsMargins(0, 0, 0, 0);
Expand Down
2 changes: 1 addition & 1 deletion src/gui/editors/PianoRoll.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3031,7 +3031,7 @@ void PianoRoll::paintEvent(QPaintEvent * pe )
if (hasValidMidiClip())
{
int pianoAreaHeight = keyAreaBottom() - keyAreaTop();
int m_pianoKeysVisible = pianoAreaHeight / m_keyLineHeight;
m_pianoKeysVisible = pianoAreaHeight / m_keyLineHeight;
int partialKeyVisible = pianoAreaHeight % m_keyLineHeight;
// check if we're below the minimum key area size
if (m_pianoKeysVisible * m_keyLineHeight < KEY_AREA_MIN_HEIGHT)
Expand Down
6 changes: 1 addition & 5 deletions src/gui/instrument/InstrumentTrackWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,13 +93,9 @@ InstrumentTrackWindow::InstrumentTrackWindow( InstrumentTrackView * _itv ) :
vlayout->setContentsMargins(0, 0, 0, 0);
vlayout->setSpacing( 0 );

auto generalSettingsWidget = new TabWidget(tr("GENERAL SETTINGS"), this);

auto generalSettingsWidget = new QWidget(this);
auto generalSettingsLayout = new QVBoxLayout(generalSettingsWidget);

generalSettingsLayout->setContentsMargins( 8, 18, 8, 8 );
generalSettingsLayout->setSpacing( 6 );

auto nameAndChangeTrackWidget = new QWidget(generalSettingsWidget);
auto nameAndChangeTrackLayout = new QHBoxLayout(nameAndChangeTrackWidget);
nameAndChangeTrackLayout->setContentsMargins( 0, 0, 0, 0 );
Expand Down
4 changes: 2 additions & 2 deletions src/gui/tracks/PatternTrackView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@

#include "Engine.h"
#include "GuiApplication.h"
#include "MainWindow.h"
#include "PatternEditor.h"
#include "PatternStore.h"
#include "PatternTrack.h"
Expand Down Expand Up @@ -74,8 +75,7 @@ bool PatternTrackView::close()
void PatternTrackView::clickedTrackLabel()
{
Engine::patternStore()->setCurrentPattern(m_patternTrack->patternIndex());
getGUI()->patternEditor()->parentWidget()->show();
getGUI()->patternEditor()->setFocus(Qt::ActiveWindowFocusReason);
getGUI()->mainWindow()->togglePatternEditorWin(true);
}


Expand Down
26 changes: 19 additions & 7 deletions src/gui/widgets/ComboBox.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,20 @@

#include "ComboBox.h"

#include <QApplication>
#include <QDesktopWidget>
#include <QMouseEvent>
#include <QPainter>
#include <QStyleOptionFrame>
#include <QScreen>

#include "CaptionMenu.h"
#include "embed.h"
#include "gui_templates.h"

#define QT_SUPPORTS_WIDGET_SCREEN (QT_VERSION >= QT_VERSION_CHECK(5,14,0))
#if !QT_SUPPORTS_WIDGET_SCREEN
#include <QApplication>
#include <QDesktopWidget>
#endif

namespace lmms::gui
{
const int CB_ARROW_BTN_WIDTH = 18;
Expand Down Expand Up @@ -116,15 +120,23 @@ void ComboBox::mousePressEvent( QMouseEvent* event )
a->setData( i );
}

QPoint gpos = mapToGlobal( QPoint( 0, height() ) );
if( gpos.y() + m_menu.sizeHint().height() < qApp->desktop()->height() )
QPoint gpos = mapToGlobal(QPoint(0, height()));

#if (QT_SUPPORTS_WIDGET_SCREEN)
bool const menuCanBeFullyShown = screen()->geometry().contains(QRect(gpos, m_menu.sizeHint()));
#else
bool const menuCanBeFullyShown = gpos.y() + m_menu.sizeHint().height() < qApp->desktop()->height();
#endif

if (menuCanBeFullyShown)
{
m_menu.exec( gpos );
m_menu.exec(gpos);
}
else
{
m_menu.exec( mapToGlobal( QPoint( width(), 0 ) ) );
m_menu.exec(mapToGlobal(QPoint(width(), 0)));
}

m_pressed = false;
update();
}
Expand Down
16 changes: 11 additions & 5 deletions src/gui/widgets/LcdWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,20 +78,26 @@ void LcdWidget::setValue(int value)
}
}

m_display = s;
if (m_display != s)
{
m_display = s;

update();
update();
}
}

void LcdWidget::setValue(float value)
{
if (value < 0 && value > -1)
if (-1 < value && value < 0)
{
QString s = QString::number(static_cast<int>(value));
s.prepend('-');

m_display = s;
update();
if (m_display != s)
{
m_display = s;
update();
}
}
else
{
Expand Down

0 comments on commit e9969e7

Please sign in to comment.