Loading...
Searching...
No Matches
juce_MPESynthesiserBase.h
/*
==============================================================================
This file is part of the JUCE library.
Copyright (c) 2022 - Raw Material Software Limited
JUCE is an open source library subject to commercial or open-source
licensing.
The code included in this file is provided under the terms of the ISC license
http://www.isc.org/downloads/software-support-policy/isc-license. Permission
To use, copy, modify, and/or distribute this software for any purpose with or
without fee is hereby granted provided that the above copyright notice and
this permission notice appear in all copies.
JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER
EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE
DISCLAIMED.
==============================================================================
*/
namespace juce
{
//==============================================================================
struct JUCE_API MPESynthesiserBase : public MPEInstrument::Listener
{
public:
//==============================================================================
MPESynthesiserBase();
MPESynthesiserBase (MPEInstrument& instrument);
//==============================================================================
MPEZoneLayout getZoneLayout() const noexcept;
void setZoneLayout (MPEZoneLayout newLayout);
//==============================================================================
virtual void setCurrentPlaybackSampleRate (double sampleRate);
double getSampleRate() const noexcept { return sampleRate; }
//==============================================================================
template <typename floatType>
void renderNextBlock (AudioBuffer<floatType>& outputAudio,
const MidiBuffer& inputMidi,
int startSample,
int numSamples);
//==============================================================================
virtual void handleMidiEvent (const MidiMessage&);
//==============================================================================
void setMinimumRenderingSubdivisionSize (int numSamples, bool shouldBeStrict = false) noexcept;
//==============================================================================
void enableLegacyMode (int pitchbendRange = 2,
Range<int> channelRange = Range<int> (1, 17));
bool isLegacyModeEnabled() const noexcept;
Range<int> getLegacyModeChannelRange() const noexcept;
void setLegacyModeChannelRange (Range<int> channelRange);
int getLegacyModePitchbendRange() const noexcept;
void setLegacyModePitchbendRange (int pitchbendRange);
//==============================================================================
using TrackingMode = MPEInstrument::TrackingMode;
void setPressureTrackingMode (TrackingMode modeToUse);
void setPitchbendTrackingMode (TrackingMode modeToUse);
void setTimbreTrackingMode (TrackingMode modeToUse);
protected:
//==============================================================================
virtual void renderNextSubBlock (AudioBuffer<float>& outputAudio,
int startSample,
int numSamples) = 0;
virtual void renderNextSubBlock (AudioBuffer<double>& /*outputAudio*/,
int /*startSample*/,
int /*numSamples*/) {}
protected:
//==============================================================================
MPEInstrument& instrument;
private:
//==============================================================================
MPEInstrument defaultInstrument { MPEZone (MPEZone::Type::lower, 15) };
CriticalSection noteStateLock;
double sampleRate = 0.0;
int minimumSubBlockSize = 32;
bool subBlockSubdivisionIsStrict = false;
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (MPESynthesiserBase)
};
} // namespace juce
juce::AudioBuffer
Definition juce_AudioSampleBuffer.h:34
juce::CriticalSection
Definition juce_CriticalSection.h:43
juce::MPEInstrument::Listener
Definition juce_MPEInstrument.h:260
juce::MPEInstrument
Definition juce_MPEInstrument.h:54
juce::MPEZoneLayout
Definition juce_MPEZoneLayout.h:123
juce::MidiBuffer
Definition juce_MidiBuffer.h:145
juce::MidiMessage
Definition juce_MidiMessage.h:35
juce::Range
Definition juce_Range.h:40
juce::MPESynthesiserBase
Definition juce_MPESynthesiserBase.h:47
juce::MPESynthesiserBase::getZoneLayout
MPEZoneLayout getZoneLayout() const noexcept
Definition juce_MPESynthesiserBase.cpp:39
juce::MPESynthesiserBase::setZoneLayout
void setZoneLayout(MPEZoneLayout newLayout)
Definition juce_MPESynthesiserBase.cpp:44
juce::MPESynthesiserBase::instrument
MPEInstrument & instrument
Definition juce_MPESynthesiserBase.h:202
juce::MPESynthesiserBase::setCurrentPlaybackSampleRate
virtual void setCurrentPlaybackSampleRate(double sampleRate)
Definition juce_MPESynthesiserBase.cpp:145
juce::MPESynthesiserBase::getSampleRate
double getSampleRate() const noexcept
Definition juce_MPESynthesiserBase.h:83
juce::MPESynthesiserBase::renderNextSubBlock
virtual void renderNextSubBlock(AudioBuffer< float > &outputAudio, int startSample, int numSamples)=0
juce::MPESynthesiserBase::MPESynthesiserBase
MPESynthesiserBase()
Definition juce_MPESynthesiserBase.cpp:26
juce::MPEZone
Definition juce_MPEZoneLayout.h:42