Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/messmerd/lmms into effect…
Browse files Browse the repository at this point in the history
…-process-wrapper
  • Loading branch information
messmerd committed Sep 20, 2024
2 parents 6f3ec8c + 1d7ed16 commit a165c27
Show file tree
Hide file tree
Showing 38 changed files with 486 additions and 256 deletions.
7 changes: 0 additions & 7 deletions include/AudioEngine.h
Original file line number Diff line number Diff line change
Expand Up @@ -290,9 +290,6 @@ class LMMS_EXPORT AudioEngine : public QObject

void changeQuality(const struct qualitySettings & qs);

inline bool isMetronomeActive() const { return m_metronomeActive; }
inline void setMetronomeActive(bool value = true) { m_metronomeActive = value; }

//! Block until a change in model can be done (i.e. wait for audio thread)
void requestChangeInModel();
void doneChangeInModel();
Expand Down Expand Up @@ -353,8 +350,6 @@ class LMMS_EXPORT AudioEngine : public QObject

void swapBuffers();

void handleMetronome();

void clearInternal();

bool m_renderOnly;
Expand Down Expand Up @@ -403,8 +398,6 @@ class LMMS_EXPORT AudioEngine : public QObject

AudioEngineProfiler m_profiler;

bool m_metronomeActive;

bool m_clearSignal;

std::recursive_mutex m_changeMutex;
Expand Down
5 changes: 5 additions & 0 deletions include/InstrumentTrackWindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@

#include "ModelView.h"
#include "SerializingObject.h"
#include "PluginView.h"

class QLabel;
class QLineEdit;
Expand Down Expand Up @@ -67,6 +68,9 @@ class InstrumentTrackWindow : public QWidget, public ModelView,
InstrumentTrackWindow( InstrumentTrackView * _tv );
~InstrumentTrackWindow() override;

void resizeEvent(QResizeEvent* event) override;


// parent for all internal tab-widgets
TabWidget * tabWidgetParent()
{
Expand Down Expand Up @@ -152,6 +156,7 @@ protected slots:
InstrumentSoundShapingView * m_ssView;
InstrumentFunctionNoteStackingView* m_noteStackingView;
InstrumentFunctionArpeggioView* m_arpeggioView;
QWidget* m_instrumentFunctionsView; // container of note stacking and arpeggio
InstrumentMidiIOView * m_midiView;
EffectRackView * m_effectView;
InstrumentTuningView *m_tuningView;
Expand Down
43 changes: 43 additions & 0 deletions include/Metronome.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
/*
* Metronome.h
*
* Copyright (c) 2024 saker
*
* This file is part of LMMS - https://lmms.io
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program (see COPYING); if not, write to the
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301 USA.
*
*/

#ifndef LMMS_METRONOME_H
#define LMMS_METRONOME_H

#include <cstddef>

namespace lmms {
class Metronome
{
public:
bool active() const { return m_active; }
void setActive(bool active) { m_active = active; }
void processTick(int currentTick, int ticksPerBar, int beatsPerBar, size_t bufferOffset);

private:
bool m_active = false;
};
} // namespace lmms

#endif // LMMS_METRONOME_H
18 changes: 7 additions & 11 deletions include/MixerChannelView.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
#include <QLineEdit>
#include <QPixmap>
#include <QWidget>
#include <QStackedWidget>

namespace lmms
{
Expand All @@ -59,11 +60,6 @@ namespace lmms::gui
Q_PROPERTY(QColor strokeInnerActive READ strokeInnerActive WRITE setStrokeInnerActive)
Q_PROPERTY(QColor strokeInnerInactive READ strokeInnerInactive WRITE setStrokeInnerInactive)
public:
enum class SendReceiveState
{
None, SendToThis, ReceiveFromThis
};

MixerChannelView(QWidget* parent, MixerView* mixerView, int channelIndex);
void paintEvent(QPaintEvent* event) override;
void contextMenuEvent(QContextMenuEvent*) override;
Expand All @@ -74,9 +70,6 @@ namespace lmms::gui
int channelIndex() const;
void setChannelIndex(int index);

SendReceiveState sendReceiveState() const;
void setSendReceiveState(const SendReceiveState& state);

QBrush backgroundActive() const;
void setBackgroundActive(const QBrush& c);

Expand Down Expand Up @@ -115,19 +108,22 @@ namespace lmms::gui

private:
SendButtonIndicator* m_sendButton;
QLabel* m_receiveArrow;
QStackedWidget* m_receiveArrowOrSendButton;
int m_receiveArrowStackedIndex = -1;
int m_sendButtonStackedIndex = -1;

Knob* m_sendKnob;
LcdWidget* m_channelNumberLcd;
QLineEdit* m_renameLineEdit;
QGraphicsView* m_renameLineEditView;
QLabel* m_sendArrow;
QLabel* m_receiveArrow;
PixmapButton* m_muteButton;
PixmapButton* m_soloButton;
PeakIndicator* m_peakIndicator = nullptr;
Fader* m_fader;
EffectRackView* m_effectRackView;
MixerView* m_mixerView;
SendReceiveState m_sendReceiveState = SendReceiveState::None;
int m_channelIndex = 0;
bool m_inRename = false;

Expand All @@ -141,4 +137,4 @@ namespace lmms::gui
};
} // namespace lmms::gui

#endif
#endif // MIXER_CHANNEL_VIEW_H
19 changes: 11 additions & 8 deletions include/PluginView.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,23 +27,26 @@

#include <QWidget>

#include "Plugin.h"
#include "ModelView.h"
#include "Plugin.h"

namespace lmms::gui
{
namespace lmms::gui {

class LMMS_EXPORT PluginView : public QWidget, public ModelView
class LMMS_EXPORT PluginView : public QWidget, public ModelView
{
public:
PluginView( Plugin * _plugin, QWidget * _parent ) :
QWidget( _parent ),
ModelView( _plugin, this )
PluginView(Plugin* _plugin, QWidget* _parent)
: QWidget(_parent)
, ModelView(_plugin, this)
{
}

} ;
void setResizable(bool resizable) { m_isResizable = resizable; }
bool isResizable() { return m_isResizable; }

private:
bool m_isResizable = false;
};

} // namespace lmms::gui

Expand Down
6 changes: 6 additions & 0 deletions include/Song.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@

#include "AudioEngine.h"
#include "Controller.h"
#include "Metronome.h"
#include "lmms_constants.h"
#include "MeterModel.h"
#include "Timeline.h"
Expand Down Expand Up @@ -375,6 +376,8 @@ class LMMS_EXPORT Song : public TrackContainer

const std::string& syncKey() const noexcept { return m_vstSyncController.sharedMemoryKey(); }

Metronome& metronome() { return m_metronome; }

public slots:
void playSong();
void record();
Expand Down Expand Up @@ -448,6 +451,7 @@ private slots:
void restoreKeymapStates(const QDomElement &element);

void processAutomations(const TrackList& tracks, TimePos timeStart, fpp_t frames);
void processMetronome(size_t bufferOffset);

void setModified(bool value);

Expand Down Expand Up @@ -513,6 +517,8 @@ private slots:

AutomatedValueMap m_oldAutomatedValues;

Metronome m_metronome;

friend class Engine;
friend class gui::SongEditor;
friend class gui::ControllerRackView;
Expand Down
Binary file modified plugins/Compressor/limiter_sel.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified plugins/Compressor/limiter_unsel.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion plugins/Eq/EqControlsDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ EqControlsDialog::EqControlsDialog( EqControls *controls ) :
resKnob->setVolumeKnob(false);
resKnob->setModel( m_parameterWidget->getBandModels( i )->res );
if(i > 1 && i < 6) { resKnob->setHintText( tr( "Bandwidth: " ) , tr( " Octave" ) ); }
else { resKnob->setHintText( tr( "Resonance : " ) , "" ); }
else { resKnob->setHintText(tr("Resonance: "), ""); }

auto freqKnob = new Knob(KnobType::Bright26, this);
freqKnob->move( distance, 396 );
Expand Down
11 changes: 4 additions & 7 deletions plugins/Lb302/Lb302.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -462,7 +462,7 @@ inline float GET_INC(float freq) {
return freq/Engine::audioEngine()->outputSampleRate(); // TODO: Use actual sampling rate.
}

int Lb302Synth::process(SampleFrame* outbuf, const int size)
int Lb302Synth::process(SampleFrame* outbuf, const std::size_t size)
{
const float sampleRatio = 44100.f / Engine::audioEngine()->outputSampleRate();

Expand Down Expand Up @@ -498,13 +498,10 @@ int Lb302Synth::process(SampleFrame* outbuf, const int size)
// hard coded value of 0.99897516.
auto decay = computeDecayFactor(0.245260770975f, 1.f / 65536.f);

for( int i=0; i<size; i++ )
for (auto i = std::size_t{0}; i < size; i++)
{
// start decay if we're past release
if( i >= release_frame )
{
vca_mode = VcaMode::Decay;
}
if (i >= release_frame) { vca_mode = VcaMode::Decay; }

// update vcf
if(vcf_envpos >= ENVINC) {
Expand Down Expand Up @@ -751,7 +748,7 @@ void Lb302Synth::playNote( NotePlayHandle * _n, SampleFrame* _working_buffer )
}
m_notesMutex.unlock();

release_frame = std::max(release_frame, static_cast<int>(_n->framesLeft()) + static_cast<int>(_n->offset()));
release_frame = std::max(release_frame, _n->framesLeft() + _n->offset());
}


Expand Down
4 changes: 2 additions & 2 deletions plugins/Lb302/Lb302.h
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ public slots:
Lb302FilterKnobState fs;
QAtomicPointer<Lb302Filter> vcf;

int release_frame;
size_t release_frame;

// More States
int vcf_envpos; // Update counter. Updates when >= ENVINC
Expand Down Expand Up @@ -246,7 +246,7 @@ public slots:

void recalcFilter();

int process(SampleFrame* outbuf, const int size);
int process(SampleFrame* outbuf, const std::size_t size);

friend class gui::Lb302SynthView;

Expand Down
3 changes: 2 additions & 1 deletion plugins/SlicerT/SlicerT.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ void SlicerT::playNote(NotePlayHandle* handle, SampleFrame* workingBuffer)
void SlicerT::deleteNotePluginData(NotePlayHandle* handle)
{
delete static_cast<PlaybackState*>(handle->m_pluginData);
emit isPlaying(-1, 0, 0);
}

// uses the spectral flux to determine the change in magnitude
Expand Down Expand Up @@ -246,7 +247,7 @@ void SlicerT::findSlices()
if (noteSnap == 0) { sliceLock = 1; }
for (float& sliceValue : m_slicePoints)
{
sliceValue += sliceLock / 2;
sliceValue += sliceLock / 2.f;
sliceValue -= static_cast<int>(sliceValue) % sliceLock;
}

Expand Down
2 changes: 2 additions & 0 deletions plugins/SlicerT/SlicerT.h
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,8 @@ public slots:
void findSlices();
void findBPM();

QString getSampleName() { return m_originalSample.sampleFile(); }

QString nodeName() const override;
gui::PluginView* instantiateView(QWidget* parent) override;

Expand Down
Loading

0 comments on commit a165c27

Please sign in to comment.