2
0
Fork 0
OPL/Source/PluginProcessor.h
George Reales 03b6d2c2ef v1.8
Parameter exposure (AU/iOS AUv3/VST/VST3) for host automation.
iOS Universal build with iPhone support.
Enhanced AUv3 GUI window display fit.
AUv3 GUI scrolling using left and right border sides.
2020-09-14 11:02:19 +02:00

122 lines
4.6 KiB
C++
Executable file

/*
==============================================================================
This file was initially auto-generated by the Introjucer.
Now it is safe to edit.
==============================================================================
*/
#ifndef PLUGINPROCESSOR_H_INCLUDED
#define PLUGINPROCESSOR_H_INCLUDED
#include <deque>
#include "../JuceLibraryCode/JuceHeader.h"
#include "hiopl.h"
#include "FloatParameter.h"
//==============================================================================
class AdlibBlasterAudioProcessor : public AudioProcessor, public AudioProcessorValueTreeState::Listener
{
public:
//==============================================================================
AdlibBlasterAudioProcessor();
void initPrograms();
void applyPitchBend();
~AdlibBlasterAudioProcessor();
//==============================================================================
void prepareToPlay (double sampleRate, int samplesPerBlock) override;
void releaseResources() override;
void processBlock (AudioSampleBuffer& buffer, MidiBuffer& midiMessages) override;
//==============================================================================
AudioProcessorEditor* createEditor() override;
bool hasEditor() const override;
//==============================================================================
const String getName() const override;
static const int MAX_INSTRUMENT_FILE_SIZE_BYTES = 1024;
int getNumParameters() override;
float getParameter (int index) override;
void setParameter (int index, float newValue, bool notify = false, bool updatetoHost= true);
void setEnumParameter (String name, int newValue);
void setIntParameter (String name, int newValue);
void beginChangeGesture (String name);
void endChangeGesture (String name);
int getIntParameter (String name);
int getEnumParameter (String name);
bool getBoolParameter(String name);
void loadInstrumentFromFile(String filename);
void saveInstrumentToFile(String filename);
void setParametersByRegister(int register_base, int op, uint8 value);
void disableChannel(const int idx);
void enableChannel(const int idx);
void toggleChannel(const int idx);
bool isChannelEnabled(const int idx) const;
size_t nChannelsEnabled();
const char* getChannelEnvelopeStage(int idx) const;
void updateGuiIfPresent();
const String getParameterName (int index) override;
const String getParameterText (int index) override;
const String getInputChannelName (int channelIndex) const override;
const String getOutputChannelName (int channelIndex) const override;
bool isInputChannelStereoPair (int index) const override;
bool isOutputChannelStereoPair (int index) const override;
bool acceptsMidi() const override;
bool producesMidi() const override;
bool silenceInProducesSilenceOut() const override;
double getTailLengthSeconds() const override;
//==============================================================================
int getNumPrograms() override;
int getCurrentProgram() override;
void setCurrentProgram (int index) override;
const String getProgramName (int index) override;
void changeProgramName (int index, const String& newName) override;
RangedAudioParameter* getParameterPointer(String parameterId) {
return valueTree->getParameter(parameterId);
}
void parameterChanged (const String& parameterID, float newValue) override;
//==============================================================================
void getStateInformation (MemoryBlock& destData) override;
void setStateInformation (const void* data, int sizeInBytes) override;
public:
String lastLoadFile;
int selectedIdxFile = -1;
private:
Hiopl *Opl;
std::vector<FloatParameter*> params;
std::map<String, int> paramIdxByName;
std::map<String, std::vector<float>> programs;
std::vector<String> program_order;
int i_program;
bool velocity;
static const int NO_NOTE=-1;
static const char *PROGRAM_INDEX;
int active_notes[Hiopl::CHANNELS + 1]; // keyed by 1-based channel index
bool channel_enabled[Hiopl::CHANNELS + 1]; // keyed by 1-based channel index
std::deque<int> available_channels; // most recently freed at end
std::deque<int> used_channels; // most recently used at end
float currentScaledBend;
std::unique_ptr<UndoManager> undoManager;
std::unique_ptr<AudioProcessorValueTreeState> valueTree;
//==============================================================================
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (AdlibBlasterAudioProcessor)
};
#endif // PLUGINPROCESSOR_H_INCLUDED