make sliders send MIDI CC to FluidSynth. Make name column in table wider. Make synth wider.
This commit is contained in:
parent
070f0d2a87
commit
23c0a2dd37
|
@ -58,14 +58,7 @@ void FluidSynthModel::initialise() {
|
|||
|
||||
for(int i{SOUND_CTRL1}; i <= SOUND_CTRL10; i++)
|
||||
{
|
||||
fluid_midi_event_t *midi_event(new_fluid_midi_event());
|
||||
fluid_midi_event_set_type(midi_event, static_cast<int>(CONTROL_CHANGE));
|
||||
fluid_midi_event_set_channel(midi_event, channel);
|
||||
fluid_midi_event_set_control(midi_event, i);
|
||||
fluid_midi_event_set_value(midi_event, 0);
|
||||
fluid_synth_handle_midi_event(synth, midi_event);
|
||||
delete_fluid_midi_event(midi_event);
|
||||
// fluid_channel_set_cc(channel, i, 0);
|
||||
setControllerValue(i, 0);
|
||||
}
|
||||
|
||||
// fluid_synth_bank_select(synth, 0, 3);
|
||||
|
@ -159,7 +152,7 @@ void FluidSynthModel::initialise() {
|
|||
static_cast<int>(SOUND_CTRL10), // MIDI CC 79 undefined
|
||||
FLUID_MOD_CC
|
||||
| FLUID_MOD_UNIPOLAR
|
||||
| FLUID_MOD_LINEAR
|
||||
| FLUID_MOD_CONCAVE
|
||||
| FLUID_MOD_POSITIVE);
|
||||
fluid_mod_set_source2(mod, 0, 0);
|
||||
fluid_mod_set_dest(mod, GEN_VOLENVSUSTAIN);
|
||||
|
@ -172,6 +165,17 @@ void FluidSynthModel::initialise() {
|
|||
initialised = true;
|
||||
}
|
||||
|
||||
void FluidSynthModel::setControllerValue(int controller, int value) {
|
||||
fluid_midi_event_t *midi_event(new_fluid_midi_event());
|
||||
fluid_midi_event_set_type(midi_event, static_cast<int>(CONTROL_CHANGE));
|
||||
fluid_midi_event_set_channel(midi_event, channel);
|
||||
fluid_midi_event_set_control(midi_event, controller);
|
||||
fluid_midi_event_set_value(midi_event, value);
|
||||
fluid_synth_handle_midi_event(synth, midi_event);
|
||||
delete_fluid_midi_event(midi_event);
|
||||
// fluid_channel_set_cc(channel, i, 0);
|
||||
}
|
||||
|
||||
int FluidSynthModel::getChannel() {
|
||||
return channel;
|
||||
}
|
||||
|
|
|
@ -31,6 +31,7 @@ public:
|
|||
int getChannel();
|
||||
|
||||
void onFileNameChanged(const String &absPath, int bank, int preset);
|
||||
void setControllerValue(int controller, int value);
|
||||
|
||||
//==============================================================================
|
||||
/**
|
||||
|
|
|
@ -97,15 +97,15 @@ enum fluid_midi_control_change
|
|||
LEGATO_SWITCH = 0x44,
|
||||
HOLD2_SWITCH = 0x45,
|
||||
SOUND_CTRL1 = 0x46,
|
||||
SOUND_CTRL2 = 0x47,
|
||||
SOUND_CTRL3 = 0x48,
|
||||
SOUND_CTRL4 = 0x49,
|
||||
SOUND_CTRL5 = 0x4A,
|
||||
SOUND_CTRL6 = 0x4B,
|
||||
SOUND_CTRL2 = 0x47, // MIDI CC 71 Timbre/Harmonic Intensity (filter resonance)
|
||||
SOUND_CTRL3 = 0x48, // MIDI CC 72 Release time
|
||||
SOUND_CTRL4 = 0x49, // MIDI CC 73 Attack time
|
||||
SOUND_CTRL5 = 0x4A, // MIDI CC 74 Brightness (cutoff frequency, FILTERFC)
|
||||
SOUND_CTRL6 = 0x4B, // MIDI CC 75 Decay Time
|
||||
SOUND_CTRL7 = 0x4C,
|
||||
SOUND_CTRL8 = 0x4D,
|
||||
SOUND_CTRL9 = 0x4E,
|
||||
SOUND_CTRL10 = 0x4F,
|
||||
SOUND_CTRL10 = 0x4F, // MIDI CC 79 undefined
|
||||
GPC5 = 0x50,
|
||||
GPC6 = 0x51,
|
||||
GPC7 = 0x52,
|
||||
|
|
|
@ -17,10 +17,11 @@ JuicySFAudioProcessorEditor::JuicySFAudioProcessorEditor (JuicySFAudioProcessor&
|
|||
processor (p),
|
||||
midiKeyboard (p.keyboardState, SurjectiveMidiKeyboardComponent::horizontalKeyboard),
|
||||
tablesComponent(p.getFluidSynthModel()),
|
||||
filePicker(p.getFluidSynthModel())
|
||||
filePicker(p.getFluidSynthModel()),
|
||||
slidersComponent{p.getFluidSynthModel()}
|
||||
{
|
||||
// set resize limits for this plug-in
|
||||
setResizeLimits (400, 300, 1900, 1000);
|
||||
setResizeLimits (500, 300, 1900, 1000);
|
||||
|
||||
setSize (p.lastUIWidth, p.lastUIHeight);
|
||||
|
||||
|
@ -82,7 +83,7 @@ void JuicySFAudioProcessorEditor::resized()
|
|||
const int padding{8};
|
||||
const int pianoHeight{70};
|
||||
const int filePickerHeight{25};
|
||||
const int slidersHeight{150};
|
||||
// const int slidersHeight{150};
|
||||
Rectangle<int> r{getLocalBounds()};
|
||||
filePicker.setBounds(r.removeFromTop(filePickerHeight + padding).reduced(padding, 0).withTrimmedTop(padding));
|
||||
|
||||
|
|
|
@ -7,10 +7,13 @@
|
|||
//
|
||||
|
||||
#include "SlidersComponent.h"
|
||||
#include "FluidSynthModel.h"
|
||||
#include "MidiConstants.h"
|
||||
|
||||
std::function<void()> SlidersComponent::makeSliderListener(Slider& slider) {
|
||||
return [&slider]{
|
||||
slider.setValue(slider.getValue(), NotificationType::dontSendNotification);
|
||||
std::function<void()> SlidersComponent::makeSliderListener(Slider& slider, int controller) {
|
||||
return [this, controller, &slider]{
|
||||
// slider.setValue(slider.getValue(), NotificationType::dontSendNotification);
|
||||
fluidSynthModel->setControllerValue(controller, slider.getValue());
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -55,7 +58,8 @@ void SlidersComponent::resized() {
|
|||
filterResonanceSlider.setBounds(rFilter.removeFromLeft(sliderWidth + sliderXMargin).withTrimmedTop(labelHeight).withTrimmedLeft(sliderXMargin));
|
||||
}
|
||||
|
||||
SlidersComponent::SlidersComponent() :
|
||||
SlidersComponent::SlidersComponent(FluidSynthModel* fluidSynthModel) :
|
||||
fluidSynthModel{fluidSynthModel},
|
||||
envelopeGroup{"envelopeGroup", "Envelope"},
|
||||
filterGroup{"filterGroup", "Filter"}
|
||||
{
|
||||
|
@ -66,32 +70,32 @@ filterGroup{"filterGroup", "Filter"}
|
|||
|
||||
attackSlider.setSliderStyle(style);
|
||||
attackSlider.setRange(rangeMin, rangeMax, rangeStep);
|
||||
// attackSlider.onValueChange = makeSliderListener(attackSlider);
|
||||
attackSlider.onValueChange = makeSliderListener(attackSlider, static_cast<int>(SOUND_CTRL4));
|
||||
attackSlider.setTextBoxStyle(Slider::TextBoxBelow, true, attackSlider.getTextBoxWidth(), attackSlider.getTextBoxHeight());
|
||||
|
||||
decaySlider.setSliderStyle(style);
|
||||
decaySlider.setRange(rangeMin, rangeMax, rangeStep);
|
||||
// decaySlider.onValueChange = makeSliderListener(decaySlider);
|
||||
decaySlider.onValueChange = makeSliderListener(decaySlider, static_cast<int>(SOUND_CTRL6));
|
||||
decaySlider.setTextBoxStyle(Slider::TextBoxBelow, true, decaySlider.getTextBoxWidth(), decaySlider.getTextBoxHeight());
|
||||
|
||||
sustainSlider.setSliderStyle(style);
|
||||
sustainSlider.setRange(rangeMin, rangeMax, rangeStep);
|
||||
// sustainSlider.onValueChange = makeSliderListener(sustainSlider);
|
||||
sustainSlider.onValueChange = makeSliderListener(sustainSlider, static_cast<int>(SOUND_CTRL10));
|
||||
sustainSlider.setTextBoxStyle(Slider::TextBoxBelow, true, sustainSlider.getTextBoxWidth(), sustainSlider.getTextBoxHeight());
|
||||
|
||||
releaseSlider.setSliderStyle(style);
|
||||
releaseSlider.setRange(rangeMin, rangeMax, rangeStep);
|
||||
// releaseSlider.onValueChange = makeSliderListener(releaseSlider);
|
||||
releaseSlider.onValueChange = makeSliderListener(releaseSlider, static_cast<int>(SOUND_CTRL3));
|
||||
releaseSlider.setTextBoxStyle(Slider::TextBoxBelow, true, releaseSlider.getTextBoxWidth(), releaseSlider.getTextBoxHeight());
|
||||
|
||||
filterCutOffSlider.setSliderStyle(style);
|
||||
filterCutOffSlider.setRange(rangeMin, rangeMax, rangeStep);
|
||||
// filterCutOffSlider.onValueChange = makeSliderListener(filterCutOffSlider);
|
||||
filterCutOffSlider.onValueChange = makeSliderListener(filterCutOffSlider, static_cast<int>(SOUND_CTRL5));
|
||||
filterCutOffSlider.setTextBoxStyle(Slider::TextBoxBelow, true, filterCutOffSlider.getTextBoxWidth(), filterCutOffSlider.getTextBoxHeight());
|
||||
|
||||
filterResonanceSlider.setSliderStyle(style);
|
||||
filterResonanceSlider.setRange(rangeMin, rangeMax, rangeStep);
|
||||
// filterResonanceSlider.onValueChange = makeSliderListener(filterResonanceSlider);
|
||||
filterResonanceSlider.onValueChange = makeSliderListener(filterResonanceSlider, static_cast<int>(SOUND_CTRL2));
|
||||
filterResonanceSlider.setTextBoxStyle(Slider::TextBoxBelow, true, filterResonanceSlider.getTextBoxWidth(), filterResonanceSlider.getTextBoxHeight());
|
||||
|
||||
addAndMakeVisible(attackSlider);
|
||||
|
@ -134,4 +138,4 @@ filterGroup{"filterGroup", "Filter"}
|
|||
|
||||
addAndMakeVisible(envelopeGroup);
|
||||
addAndMakeVisible(filterGroup);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,13 +1,14 @@
|
|||
# pragma once
|
||||
|
||||
#include "../JuceLibraryCode/JuceHeader.h"
|
||||
#include "FluidSynthModel.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
class SlidersComponent : public Component
|
||||
{
|
||||
public:
|
||||
SlidersComponent();
|
||||
SlidersComponent(FluidSynthModel* fluidSynthModel);
|
||||
~SlidersComponent();
|
||||
|
||||
void resized() override;
|
||||
|
@ -15,7 +16,9 @@ public:
|
|||
const int getDesiredWidth();
|
||||
|
||||
private:
|
||||
std::function<void()> makeSliderListener(Slider& slider);
|
||||
std::function<void()> makeSliderListener(Slider& slider, int controller);
|
||||
|
||||
FluidSynthModel* fluidSynthModel;
|
||||
|
||||
GroupComponent envelopeGroup;
|
||||
|
||||
|
|
|
@ -40,7 +40,7 @@ TableComponent::TableComponent(
|
|||
// Add some columns to the table header, based on the column list in our database..
|
||||
for (auto &column : columns) // access by reference to avoid copying
|
||||
{
|
||||
const int colWidth{ columnIx == 1 ? 30 : 100 };
|
||||
const int colWidth{ columnIx == 1 ? 30 : 200 };
|
||||
table.getHeader().addColumn (
|
||||
String(column),
|
||||
columnIx++,
|
||||
|
|
Loading…
Reference in New Issue
Block a user