Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minor style fixes. #2

Merged
merged 4 commits into from
Oct 10, 2023
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
2 changes: 1 addition & 1 deletion plugins/SlicerT/SlicerT.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -588,7 +588,7 @@ void SlicerT::loadSettings(const QDomElement& element)
m_noteThreshold.loadSettings(element, "threshold");
m_originalBPM.loadSettings(element, "origBPM");

// create dinamic buffer
// create dynamic buffer
float speedRatio = (float)m_originalBPM.value() / Engine::getSong()->getTempo();
m_phaseVocoder.loadSample(
m_originalSample.data(), m_originalSample.frames(), m_originalSample.sampleRate(), speedRatio);
Expand Down
13 changes: 8 additions & 5 deletions plugins/SlicerT/SlicerT.h
Original file line number Diff line number Diff line change
Expand Up @@ -99,14 +99,14 @@ class PhaseVocoder
};

// simple helper class that handles the different audio channels
class dinamicPlaybackBuffer
class DynamicPlaybackBuffer
{
public:
dinamicPlaybackBuffer()
DynamicPlaybackBuffer()
: m_leftChannel()
, m_rightChannel()
{
}
{}

void loadSample(const sampleFrame* outData, int frames, int sampleRate, float newRatio)
{
std::vector<float> leftData(frames, 0);
Expand All @@ -119,6 +119,7 @@ class dinamicPlaybackBuffer
m_leftChannel.loadData(leftData, sampleRate, newRatio);
m_rightChannel.loadData(rightData, sampleRate, newRatio);
}

void getFrames(sampleFrame* outData, int startFrame, int frames)
{
std::vector<float> leftOut(frames, 0); // not a huge performance issue
Expand All @@ -133,8 +134,10 @@ class dinamicPlaybackBuffer
outData[i][1] = rightOut[i];
}
}

int frames() { return m_leftChannel.frames(); }
float scaleRatio() { return m_leftChannel.scaleRatio(); }

void setScaleRatio(float newRatio)
{
m_leftChannel.setScaleRatio(newRatio);
Expand Down Expand Up @@ -180,7 +183,7 @@ public slots:

// sample buffers
SampleBuffer m_originalSample;
dinamicPlaybackBuffer m_phaseVocoder;
DynamicPlaybackBuffer m_phaseVocoder;

std::vector<int> m_slicePoints;

Expand Down
42 changes: 23 additions & 19 deletions plugins/SlicerT/SlicerTUI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,44 +58,44 @@ SlicerTUI::SlicerTUI(SlicerT* instrument, QWidget* parent)

// render background
QPalette pal;
pal.setBrush(backgroundRole(), PLUGIN_NAME::getIconPixmap("bg"));
pal.setBrush(backgroundRole(), PLUGIN_NAME::getIconPixmap("artwork"));
setPalette(pal);

// move editor and seeker
m_wf.move(2, 6);

// snap combo box
m_snapSetting.setGeometry(190, 200, 55, ComboBox::DEFAULT_HEIGHT);
m_snapSetting.setGeometry(185, 200, 55, ComboBox::DEFAULT_HEIGHT);
m_snapSetting.setToolTip(tr("Set slice snapping for detection"));
m_snapSetting.setModel(&m_slicerTParent->m_sliceSnap);

// bpm spin box
m_bpmBox.move(135, 203);
m_bpmBox.move(130, 203);
m_bpmBox.setToolTip(tr("Original sample BPM"));
m_bpmBox.setLabel(tr("BPM"));
m_bpmBox.setModel(&m_slicerTParent->m_originalBPM);

// threshold knob
m_noteThresholdKnob.move(14, 195);
m_noteThresholdKnob.move(9, 195);
m_noteThresholdKnob.setToolTip(tr("Threshold used for slicing"));
m_noteThresholdKnob.setLabel(tr("Threshold"));
m_noteThresholdKnob.setModel(&m_slicerTParent->m_noteThreshold);

// fadeout knob
m_fadeOutKnob.move(80, 195);
m_fadeOutKnob.setToolTip(tr("FadeOut for notes"));
m_fadeOutKnob.setLabel(tr("FadeOut"));
m_fadeOutKnob.move(75, 195);
m_fadeOutKnob.setToolTip(tr("Fade Out for notes"));
m_fadeOutKnob.setLabel(tr("Fade Out"));
m_fadeOutKnob.setModel(&m_slicerTParent->m_fadeOutFrames);

// midi copy button
m_midiExportButton.move(205, 155);
m_midiExportButton.move(215, 150);
m_midiExportButton.setActiveGraphic(PLUGIN_NAME::getIconPixmap("copyMidi"));
m_midiExportButton.setInactiveGraphic(PLUGIN_NAME::getIconPixmap("copyMidi"));
m_midiExportButton.setToolTip(tr("Copy midi pattern to clipboard"));
connect(&m_midiExportButton, SIGNAL(clicked()), this, SLOT(exportMidi()));

// slcie reset button
m_resetButton.move(25, 155);
// slice reset button
m_resetButton.move(19, 150);
m_resetButton.setActiveGraphic(PLUGIN_NAME::getIconPixmap("resetSlices"));
m_resetButton.setInactiveGraphic(PLUGIN_NAME::getIconPixmap("resetSlices"));
m_resetButton.setToolTip(tr("Reset Slices"));
Expand Down Expand Up @@ -139,8 +139,14 @@ void SlicerTUI::dragEnterEvent(QDragEnterEvent* dee)
{
dee->acceptProposedAction();
}
else if (txt.section(':', 0, 0) == "samplefile") { dee->acceptProposedAction(); }
else { dee->ignore(); }
else if (txt.section(':', 0, 0) == "samplefile")
{
dee->acceptProposedAction();
}
else
{
dee->ignore();
}
}
else { dee->ignore(); }
}
Expand All @@ -151,10 +157,8 @@ void SlicerTUI::dropEvent(QDropEvent* de)
QString value = StringPairDrag::decodeValue(de);
if (type == "samplefile")
{
m_slicerTParent->updateFile(value);
// castModel<AudioFileProcessor>()->setAudioFile( value );
// de->accept();
// set m_wf wave file
m_slicerTParent->updateFile(value);
return;
}
else if (type == QString("clip_%1").arg(static_cast<int>(Track::Type::Sample)))
Expand All @@ -174,10 +178,10 @@ void SlicerTUI::paintEvent(QPaintEvent* pe)
QPainter brush(this);
brush.setPen(QColor(255, 255, 255));
brush.setFont(QFont(brush.font().family(), 7.5f, -1, false));
brush.drawText(205, 170, 20, 20, Qt::AlignCenter, tr("Midi"));
brush.drawText(22, 170, 25, 20, Qt::AlignCenter, tr("Reset"));
brush.drawText(190, 217, 55, 20, Qt::AlignCenter, tr("Snap"));
brush.drawText(212, 165, 25, 20, Qt::AlignCenter, tr("Midi"));
brush.drawText(14, 165, 30, 20, Qt::AlignCenter, tr("Reset"));
brush.drawText(185, 217, 55, 20, Qt::AlignCenter, tr("Snap"));
}

} // namespace gui
} // namespace lmms
} // namespace lmms
6 changes: 3 additions & 3 deletions plugins/SlicerT/SlicerTUI.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ class SlicerTKnob : public Knob
SlicerTKnob(QWidget* _parent)
: Knob(KnobType::Styled, _parent)
{
setFixedSize(46, 40);
setCenterPointX(23.0);
setFixedSize(50, 40);
setCenterPointX(24.0);
setCenterPointY(15.0);
}
};
Expand Down Expand Up @@ -87,4 +87,4 @@ protected slots:
};
} // namespace gui
} // namespace lmms
#endif // SLICERT_UI_H
#endif // SLICERT_UI_H
3 changes: 2 additions & 1 deletion plugins/SlicerT/WaveForm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
namespace lmms {

namespace gui {

WaveForm::WaveForm(int w, int h, SlicerT* instrument, QWidget* parent)
: QWidget(parent)
,
Expand Down Expand Up @@ -327,4 +328,4 @@ void WaveForm::paintEvent(QPaintEvent* pe)
p.drawPixmap(0, m_seekerHeight + m_middleMargin, m_sliceEditor);
}
} // namespace gui
} // namespace lmms
} // namespace lmms
Binary file added plugins/SlicerT/artwork.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 added plugins/SlicerT/artwork.xcf
Binary file not shown.
Binary file removed plugins/SlicerT/bg.png
Binary file not shown.