mirror of
https://codeberg.org/armin/monoslicer.git
synced 2026-09-01 12:10:46 +02:00
Reduce plugin width by 102px and fix bottom panel layout to scale proportionally
This commit is contained in:
parent
d9302ad77a
commit
f035e89ba9
9 changed files with 305 additions and 106 deletions
|
|
@ -4,6 +4,7 @@
|
|||
#include <vector>
|
||||
#include <algorithm>
|
||||
#include <cmath>
|
||||
#include <functional>
|
||||
|
||||
class SliceManager
|
||||
{
|
||||
|
|
@ -12,7 +13,7 @@ public:
|
|||
{
|
||||
int startSample;
|
||||
int endSample;
|
||||
int midiNote; // pitch class (0 = C, 1 = C#, ..., 11 = B)
|
||||
int midiNote; // full MIDI note (60 = C4, 61 = C#4, ..., 83 = B5)
|
||||
};
|
||||
|
||||
SliceManager();
|
||||
|
|
@ -31,17 +32,14 @@ public:
|
|||
void trimStart(int sample);
|
||||
void trimEnd(int sample);
|
||||
|
||||
void undo();
|
||||
void redo();
|
||||
bool canUndo() const;
|
||||
bool canRedo() const;
|
||||
|
||||
std::vector<Slice> getSlices() const;
|
||||
int getNumSlices() const;
|
||||
Slice getSlice(int index) const;
|
||||
|
||||
void setSlices(const std::vector<Slice>& newSlices);
|
||||
|
||||
void setBeforeChangeCallback(std::function<void()> cb) { beforeChangeCallback = std::move(cb); }
|
||||
|
||||
int findSliceIndexForSample(int samplePos) const;
|
||||
|
||||
juce::AudioBuffer<float>* getMutableBuffer() { return sampleBuffer; }
|
||||
|
|
@ -49,14 +47,9 @@ public:
|
|||
private:
|
||||
void sortSlices();
|
||||
void assignMidiNotes();
|
||||
void pushHistory();
|
||||
void truncateHistory();
|
||||
|
||||
mutable juce::CriticalSection mutex;
|
||||
std::vector<Slice> slices;
|
||||
std::vector<std::vector<Slice>> undoStack;
|
||||
std::vector<std::vector<Slice>> redoStack;
|
||||
static constexpr size_t maxHistory = 50;
|
||||
juce::AudioBuffer<float>* sampleBuffer = nullptr;
|
||||
double currentSampleRate = 44100.0;
|
||||
|
||||
|
|
@ -64,6 +57,8 @@ private:
|
|||
float bassGain = 1.0f;
|
||||
float trebleGain = 1.0f;
|
||||
|
||||
std::function<void()> beforeChangeCallback;
|
||||
|
||||
std::vector<float> computeEnvelope(const float* channelData, int numSamples);
|
||||
std::vector<float> lowpassFilter(const std::vector<float>& input, float cutoffHz);
|
||||
std::vector<float> highpassFilter(const std::vector<float>& input, float cutoffHz);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue