2013-09-04 13:37:36 +00:00
|
|
|
/*
|
|
|
|
==============================================================================
|
|
|
|
|
2013-11-13 09:15:17 +00:00
|
|
|
This file was initially auto-generated by the Introjucer.
|
|
|
|
Now it is safe to edit.
|
2013-09-04 13:37:36 +00:00
|
|
|
|
|
|
|
==============================================================================
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef PLUGINPROCESSOR_H_INCLUDED
|
|
|
|
#define PLUGINPROCESSOR_H_INCLUDED
|
|
|
|
|
2014-08-25 21:36:25 +00:00
|
|
|
#include <deque>
|
2013-09-04 13:37:36 +00:00
|
|
|
#include "../JuceLibraryCode/JuceHeader.h"
|
2013-09-04 14:19:22 +00:00
|
|
|
#include "hiopl.h"
|
2013-09-09 16:14:43 +00:00
|
|
|
#include "FloatParameter.h"
|
2013-09-04 13:37:36 +00:00
|
|
|
|
|
|
|
|
|
|
|
//==============================================================================
|
2020-09-14 09:02:19 +00:00
|
|
|
class AdlibBlasterAudioProcessor : public AudioProcessor, public AudioProcessorValueTreeState::Listener
|
2013-09-04 13:37:36 +00:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
//==============================================================================
|
2015-02-24 20:07:55 +00:00
|
|
|
AdlibBlasterAudioProcessor();
|
2013-09-14 16:06:45 +00:00
|
|
|
void initPrograms();
|
2013-12-23 07:51:29 +00:00
|
|
|
void applyPitchBend();
|
2015-02-24 20:07:55 +00:00
|
|
|
~AdlibBlasterAudioProcessor();
|
2013-09-04 13:37:36 +00:00
|
|
|
|
|
|
|
//==============================================================================
|
2020-09-14 09:02:19 +00:00
|
|
|
void prepareToPlay (double sampleRate, int samplesPerBlock) override;
|
|
|
|
void releaseResources() override;
|
2013-09-04 13:37:36 +00:00
|
|
|
|
2020-09-14 09:02:19 +00:00
|
|
|
void processBlock (AudioSampleBuffer& buffer, MidiBuffer& midiMessages) override;
|
2013-09-04 13:37:36 +00:00
|
|
|
|
|
|
|
//==============================================================================
|
2020-09-14 09:02:19 +00:00
|
|
|
AudioProcessorEditor* createEditor() override;
|
|
|
|
bool hasEditor() const override;
|
2013-09-04 13:37:36 +00:00
|
|
|
|
|
|
|
//==============================================================================
|
2020-09-14 09:02:19 +00:00
|
|
|
const String getName() const override;
|
2013-09-04 13:37:36 +00:00
|
|
|
|
2015-02-13 03:13:54 +00:00
|
|
|
static const int MAX_INSTRUMENT_FILE_SIZE_BYTES = 1024;
|
2013-11-13 09:15:17 +00:00
|
|
|
|
2020-09-14 09:02:19 +00:00
|
|
|
int getNumParameters() override;
|
2013-09-04 13:37:36 +00:00
|
|
|
|
2020-09-14 09:02:19 +00:00
|
|
|
float getParameter (int index) override;
|
|
|
|
void setParameter (int index, float newValue, bool notify = false, bool updatetoHost= true);
|
|
|
|
|
2013-09-12 15:21:30 +00:00
|
|
|
void setEnumParameter (String name, int newValue);
|
|
|
|
void setIntParameter (String name, int newValue);
|
2020-09-14 09:02:19 +00:00
|
|
|
|
|
|
|
void beginChangeGesture (String name);
|
|
|
|
void endChangeGesture (String name);
|
|
|
|
|
2013-09-29 04:25:37 +00:00
|
|
|
int getIntParameter (String name);
|
|
|
|
int getEnumParameter (String name);
|
2017-03-04 03:44:56 +00:00
|
|
|
bool getBoolParameter(String name);
|
2020-09-14 09:02:19 +00:00
|
|
|
|
2013-11-13 09:15:17 +00:00
|
|
|
void loadInstrumentFromFile(String filename);
|
2015-11-30 14:29:58 +00:00
|
|
|
void saveInstrumentToFile(String filename);
|
2013-11-13 09:15:17 +00:00
|
|
|
void setParametersByRegister(int register_base, int op, uint8 value);
|
2013-09-04 13:37:36 +00:00
|
|
|
|
2017-05-28 13:57:32 +00:00
|
|
|
void disableChannel(const int idx);
|
|
|
|
void enableChannel(const int idx);
|
|
|
|
void toggleChannel(const int idx);
|
|
|
|
bool isChannelEnabled(const int idx) const;
|
2017-11-28 13:10:16 +00:00
|
|
|
size_t nChannelsEnabled();
|
2015-01-09 06:53:33 +00:00
|
|
|
const char* getChannelEnvelopeStage(int idx) const;
|
2014-08-25 21:36:25 +00:00
|
|
|
|
2013-11-13 15:18:47 +00:00
|
|
|
void updateGuiIfPresent();
|
|
|
|
|
2020-09-14 09:02:19 +00:00
|
|
|
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;
|
2013-09-04 13:37:36 +00:00
|
|
|
//==============================================================================
|
2020-09-14 09:02:19 +00:00
|
|
|
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;
|
2013-09-04 13:37:36 +00:00
|
|
|
//==============================================================================
|
2020-09-14 09:02:19 +00:00
|
|
|
void getStateInformation (MemoryBlock& destData) override;
|
|
|
|
void setStateInformation (const void* data, int sizeInBytes) override;
|
2013-09-04 13:37:36 +00:00
|
|
|
|
2020-06-23 07:54:09 +00:00
|
|
|
public:
|
|
|
|
String lastLoadFile;
|
|
|
|
int selectedIdxFile = -1;
|
2013-09-04 13:37:36 +00:00
|
|
|
private:
|
2013-09-04 14:19:22 +00:00
|
|
|
Hiopl *Opl;
|
2013-09-09 16:14:43 +00:00
|
|
|
std::vector<FloatParameter*> params;
|
2013-09-12 15:21:30 +00:00
|
|
|
std::map<String, int> paramIdxByName;
|
2013-09-13 17:13:18 +00:00
|
|
|
std::map<String, std::vector<float>> programs;
|
|
|
|
std::vector<String> program_order;
|
|
|
|
int i_program;
|
2013-09-22 11:10:28 +00:00
|
|
|
bool velocity;
|
2013-09-13 17:40:28 +00:00
|
|
|
static const int NO_NOTE=-1;
|
2014-08-26 21:24:51 +00:00
|
|
|
static const char *PROGRAM_INDEX;
|
2017-05-28 13:57:32 +00:00
|
|
|
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
|
2013-12-23 07:51:29 +00:00
|
|
|
float currentScaledBend;
|
2020-09-14 09:02:19 +00:00
|
|
|
|
|
|
|
std::unique_ptr<UndoManager> undoManager;
|
|
|
|
std::unique_ptr<AudioProcessorValueTreeState> valueTree;
|
2013-09-04 13:37:36 +00:00
|
|
|
//==============================================================================
|
2015-02-24 20:07:55 +00:00
|
|
|
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (AdlibBlasterAudioProcessor)
|
2013-09-04 13:37:36 +00:00
|
|
|
};
|
|
|
|
#endif // PLUGINPROCESSOR_H_INCLUDED
|