juicysfplugin/Source/TablesComponent.h

57 lines
1.3 KiB
C++

//
// 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(
AudioProcessorValueTreeState& valueTreeState,
FluidSynthModel& fluidSynthModel
);
~TablesComponent();
void resized() override;
bool keyPressed(const KeyPress &key) override;
// void fontChanged(FluidSynthModel *, const String &) override;
private:
AudioProcessorValueTreeState& valueTreeState;
FluidSynthModel& fluidSynthModel;
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)
};