2018-02-27 08:25:20 +08:00
|
|
|
//
|
|
|
|
// Created by Alex Birch on 17/09/2017.
|
|
|
|
//
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "../JuceLibraryCode/JuceHeader.h"
|
|
|
|
#include "Pills.h"
|
|
|
|
#include "TableComponent.h"
|
|
|
|
#include "Preset.h"
|
|
|
|
#include "PresetsToBanks.h"
|
|
|
|
#include "FluidSynthModel.h"
|
|
|
|
#include <memory>
|
|
|
|
#include <fluidsynth.h>
|
|
|
|
|
|
|
|
using namespace std;
|
|
|
|
|
|
|
|
class TablesComponent : public Component,
|
|
|
|
public FluidSynthModel::Listener
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
TablesComponent(
|
2019-07-07 07:22:47 +08:00
|
|
|
AudioProcessorValueTreeState& valueTreeState,
|
|
|
|
FluidSynthModel& fluidSynthModel
|
2018-02-27 08:25:20 +08:00
|
|
|
);
|
|
|
|
~TablesComponent();
|
|
|
|
|
|
|
|
void resized() override;
|
|
|
|
|
|
|
|
bool keyPressed(const KeyPress &key) override;
|
2018-04-11 06:29:32 +08:00
|
|
|
void fontChanged(FluidSynthModel *, const String &) override;
|
2018-02-27 08:25:20 +08:00
|
|
|
|
|
|
|
private:
|
2019-07-07 07:22:47 +08:00
|
|
|
AudioProcessorValueTreeState& valueTreeState;
|
|
|
|
FluidSynthModel& fluidSynthModel;
|
2018-02-27 08:25:20 +08:00
|
|
|
int selectedBank;
|
|
|
|
|
|
|
|
Pills* banks;
|
|
|
|
TableComponent* presetTable;
|
|
|
|
|
|
|
|
BanksToPresets banksToPresets;
|
|
|
|
|
|
|
|
static vector<vector<string>> mapPresets(const BanksToPresets &banksToPresets, int bank);
|
|
|
|
static vector<string> mapBanks(const BanksToPresets &banksToPresets);
|
|
|
|
|
|
|
|
void onBankSelected(int bank);
|
|
|
|
void onPresetSelected(int preset);
|
|
|
|
int presetToIndexMapper(int preset);
|
|
|
|
|
|
|
|
fluid_preset_t* getCurrentPreset();
|
|
|
|
Preset getFirstPresetInBank(int bank);
|
|
|
|
|
|
|
|
bool initialised;
|
|
|
|
|
|
|
|
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (TablesComponent)
|
|
|
|
};
|