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