upgrade to JUCE 5.4.3. Remove (probably) unused JUCE modules. Remove VST2 target (it's been end-of-life'd by Steinberg and by JUCE)
This commit is contained in:
@ -162,7 +162,6 @@ private:
|
||||
AudioCDBurner (const int deviceIndex);
|
||||
|
||||
class Pimpl;
|
||||
friend struct ContainerDeletePolicy<Pimpl>;
|
||||
std::unique_ptr<Pimpl> pimpl;
|
||||
|
||||
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (AudioCDBurner)
|
||||
|
@ -52,11 +52,10 @@ void AudioAppComponent::setAudioChannels (int numInputChannels, int numOutputCha
|
||||
|
||||
if (usingCustomDeviceManager && xml == nullptr)
|
||||
{
|
||||
AudioDeviceManager::AudioDeviceSetup setup;
|
||||
deviceManager.getAudioDeviceSetup (setup);
|
||||
auto setup = deviceManager.getAudioDeviceSetup();
|
||||
|
||||
if (setup.inputChannels.countNumberOfSetBits() != numInputChannels
|
||||
|| setup.outputChannels.countNumberOfSetBits() != numOutputChannels)
|
||||
|| setup.outputChannels.countNumberOfSetBits() != numOutputChannels)
|
||||
{
|
||||
setup.inputChannels.clear();
|
||||
setup.outputChannels.clear();
|
||||
|
@ -52,7 +52,7 @@ public:
|
||||
AudioAppComponent();
|
||||
AudioAppComponent (AudioDeviceManager&);
|
||||
|
||||
~AudioAppComponent();
|
||||
~AudioAppComponent() override;
|
||||
|
||||
/** A subclass should call this from their constructor, to set up the audio. */
|
||||
void setAudioChannels (int numInputChannels, int numOutputChannels, const XmlElement* const storedSettings = nullptr);
|
||||
@ -84,7 +84,7 @@ public:
|
||||
@see releaseResources, getNextAudioBlock
|
||||
*/
|
||||
virtual void prepareToPlay (int samplesPerBlockExpected,
|
||||
double sampleRate) = 0;
|
||||
double sampleRate) override = 0;
|
||||
|
||||
/** Allows the source to release anything it no longer needs after playback has stopped.
|
||||
|
||||
@ -98,7 +98,7 @@ public:
|
||||
|
||||
@see prepareToPlay, getNextAudioBlock
|
||||
*/
|
||||
virtual void releaseResources() = 0;
|
||||
virtual void releaseResources() override = 0;
|
||||
|
||||
/** Called repeatedly to fetch subsequent blocks of audio data.
|
||||
|
||||
@ -112,7 +112,7 @@ public:
|
||||
|
||||
@see AudioSourceChannelInfo, prepareToPlay, releaseResources
|
||||
*/
|
||||
virtual void getNextAudioBlock (const AudioSourceChannelInfo& bufferToFill) = 0;
|
||||
virtual void getNextAudioBlock (const AudioSourceChannelInfo& bufferToFill) override = 0;
|
||||
|
||||
/** Shuts down the audio device and clears the audio source.
|
||||
|
||||
|
@ -36,7 +36,7 @@ struct SimpleDeviceManagerInputLevelMeter : public Component,
|
||||
inputLevelGetter = manager.getInputLevelGetter();
|
||||
}
|
||||
|
||||
~SimpleDeviceManagerInputLevelMeter()
|
||||
~SimpleDeviceManagerInputLevelMeter() override
|
||||
{
|
||||
}
|
||||
|
||||
@ -60,8 +60,9 @@ struct SimpleDeviceManagerInputLevelMeter : public Component,
|
||||
|
||||
void paint (Graphics& g) override
|
||||
{
|
||||
// (add a bit of a skew to make the level more obvious)
|
||||
getLookAndFeel().drawLevelMeter (g, getWidth(), getHeight(),
|
||||
(float) std::exp (std::log (level) / 3.0)); // (add a bit of a skew to make the level more obvious)
|
||||
(float) std::exp (std::log (level) / 3.0));
|
||||
}
|
||||
|
||||
AudioDeviceManager& manager;
|
||||
@ -145,7 +146,7 @@ public:
|
||||
if (items.isEmpty())
|
||||
{
|
||||
g.setColour (Colours::grey);
|
||||
g.setFont (13.0f);
|
||||
g.setFont (0.5f * getRowHeight());
|
||||
g.drawText (noItemsMessage,
|
||||
0, 0, getWidth(), getHeight() / 2,
|
||||
Justification::centred, true);
|
||||
@ -217,7 +218,7 @@ public:
|
||||
setup.manager->addChangeListener (this);
|
||||
}
|
||||
|
||||
~AudioDeviceSettingsPanel()
|
||||
~AudioDeviceSettingsPanel() override
|
||||
{
|
||||
setup.manager->removeChangeListener (this);
|
||||
}
|
||||
@ -259,6 +260,7 @@ public:
|
||||
|
||||
if (outputChanList != nullptr)
|
||||
{
|
||||
outputChanList->setRowHeight (jmin (22, h));
|
||||
outputChanList->setBounds (r.removeFromTop (outputChanList->getBestHeight (maxListBoxHeight)));
|
||||
outputChanLabel->setBounds (0, outputChanList->getBounds().getCentreY() - h / 2, r.getX(), h);
|
||||
r.removeFromTop (space);
|
||||
@ -266,6 +268,7 @@ public:
|
||||
|
||||
if (inputChanList != nullptr)
|
||||
{
|
||||
inputChanList->setRowHeight (jmin (22, h));
|
||||
inputChanList->setBounds (r.removeFromTop (inputChanList->getBestHeight (maxListBoxHeight)));
|
||||
inputChanLabel->setBounds (0, inputChanList->getBounds().getCentreY() - h / 2, r.getX(), h);
|
||||
r.removeFromTop (space);
|
||||
@ -330,8 +333,7 @@ public:
|
||||
|
||||
void updateConfig (bool updateOutputDevice, bool updateInputDevice, bool updateSampleRate, bool updateBufferSize)
|
||||
{
|
||||
AudioDeviceManager::AudioDeviceSetup config;
|
||||
setup.manager->getAudioDeviceSetup (config);
|
||||
auto config = setup.manager->getAudioDeviceSetup();
|
||||
String error;
|
||||
|
||||
if (updateOutputDevice || updateInputDevice)
|
||||
@ -769,9 +771,7 @@ public:
|
||||
|
||||
auto item = items[row];
|
||||
bool enabled = false;
|
||||
|
||||
AudioDeviceManager::AudioDeviceSetup config;
|
||||
setup.manager->getAudioDeviceSetup (config);
|
||||
auto config = setup.manager->getAudioDeviceSetup();
|
||||
|
||||
if (setup.useStereoPairs)
|
||||
{
|
||||
@ -825,7 +825,7 @@ public:
|
||||
if (items.isEmpty())
|
||||
{
|
||||
g.setColour (Colours::grey);
|
||||
g.setFont (13.0f);
|
||||
g.setFont (0.5f * getRowHeight());
|
||||
g.drawText (noItemsMessage,
|
||||
0, 0, getWidth(), getHeight() / 2,
|
||||
Justification::centred, true);
|
||||
@ -868,8 +868,7 @@ public:
|
||||
|
||||
if (isPositiveAndBelow (row, items.size()))
|
||||
{
|
||||
AudioDeviceManager::AudioDeviceSetup config;
|
||||
setup.manager->getAudioDeviceSetup (config);
|
||||
auto config = setup.manager->getAudioDeviceSetup();
|
||||
|
||||
if (setup.useStereoPairs)
|
||||
{
|
||||
@ -908,12 +907,7 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
auto error = setup.manager->setAudioDeviceSetup (config, true);
|
||||
|
||||
if (error.isNotEmpty())
|
||||
{
|
||||
//xxx
|
||||
}
|
||||
setup.manager->setAudioDeviceSetup (config, true);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1068,6 +1062,7 @@ void AudioDeviceSelectorComponent::resized()
|
||||
|
||||
if (midiInputsList != nullptr)
|
||||
{
|
||||
midiInputsList->setRowHeight (jmin (22, itemHeight));
|
||||
midiInputsList->setBounds (r.removeFromTop (midiInputsList->getBestHeight (jmin (itemHeight * 8,
|
||||
getHeight() - r.getY() - space - itemHeight))));
|
||||
r.removeFromTop (space);
|
||||
|
@ -73,7 +73,7 @@ public:
|
||||
bool hideAdvancedOptionsWithButton);
|
||||
|
||||
/** Destructor */
|
||||
~AudioDeviceSelectorComponent();
|
||||
~AudioDeviceSelectorComponent() override;
|
||||
|
||||
/** The device manager that this component is controlling */
|
||||
AudioDeviceManager& deviceManager;
|
||||
@ -95,6 +95,12 @@ public:
|
||||
|
||||
private:
|
||||
//==============================================================================
|
||||
void handleBluetoothButton();
|
||||
void updateDeviceType();
|
||||
void updateMidiOutput();
|
||||
void changeListenerCallback (ChangeBroadcaster*) override;
|
||||
void updateAllControls();
|
||||
|
||||
std::unique_ptr<ComboBox> deviceTypeDropDown;
|
||||
std::unique_ptr<Label> deviceTypeDropDownLabel;
|
||||
std::unique_ptr<Component> audioDeviceSettingsComp;
|
||||
@ -105,18 +111,11 @@ private:
|
||||
const bool hideAdvancedOptionsWithButton;
|
||||
|
||||
class MidiInputSelectorComponentListBox;
|
||||
friend struct ContainerDeletePolicy<MidiInputSelectorComponentListBox>;
|
||||
std::unique_ptr<MidiInputSelectorComponentListBox> midiInputsList;
|
||||
std::unique_ptr<ComboBox> midiOutputSelector;
|
||||
std::unique_ptr<Label> midiInputsLabel, midiOutputLabel;
|
||||
std::unique_ptr<TextButton> bluetoothButton;
|
||||
|
||||
void handleBluetoothButton();
|
||||
void updateDeviceType();
|
||||
void updateMidiOutput();
|
||||
void changeListenerCallback (ChangeBroadcaster*) override;
|
||||
void updateAllControls();
|
||||
|
||||
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (AudioDeviceSelectorComponent)
|
||||
};
|
||||
|
||||
|
@ -98,7 +98,7 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
~LevelDataSource()
|
||||
~LevelDataSource() override
|
||||
{
|
||||
owner.cache.getTimeSliceThread().removeTimeSliceClient (this);
|
||||
}
|
||||
@ -642,7 +642,7 @@ void AudioThumbnail::saveTo (OutputStream& output) const
|
||||
//==============================================================================
|
||||
bool AudioThumbnail::setDataSource (LevelDataSource* newSource)
|
||||
{
|
||||
jassert (MessageManager::getInstance()->currentThreadHasLockedMessageManager());
|
||||
JUCE_ASSERT_MESSAGE_MANAGER_IS_LOCKED
|
||||
|
||||
numSamplesFinished = 0;
|
||||
|
||||
|
@ -68,7 +68,7 @@ public:
|
||||
AudioThumbnailCache& cacheToUse);
|
||||
|
||||
/** Destructor. */
|
||||
~AudioThumbnail();
|
||||
~AudioThumbnail() override;
|
||||
|
||||
//==============================================================================
|
||||
/** Clears and resets the thumbnail. */
|
||||
@ -201,13 +201,6 @@ private:
|
||||
class ThumbData;
|
||||
class CachedWindow;
|
||||
|
||||
friend class LevelDataSource;
|
||||
friend class ThumbData;
|
||||
friend class CachedWindow;
|
||||
friend struct ContainerDeletePolicy<LevelDataSource>;
|
||||
friend struct ContainerDeletePolicy<ThumbData>;
|
||||
friend struct ContainerDeletePolicy<CachedWindow>;
|
||||
|
||||
std::unique_ptr<LevelDataSource> source;
|
||||
std::unique_ptr<CachedWindow> window;
|
||||
OwnedArray<ThumbData> channels;
|
||||
|
@ -46,8 +46,8 @@ class JUCE_API AudioThumbnailBase : public ChangeBroadcaster,
|
||||
{
|
||||
public:
|
||||
//==============================================================================
|
||||
AudioThumbnailBase() {}
|
||||
virtual ~AudioThumbnailBase() {}
|
||||
AudioThumbnailBase() = default;
|
||||
~AudioThumbnailBase() override = default;
|
||||
|
||||
//==============================================================================
|
||||
/** Clears and resets the thumbnail. */
|
||||
|
@ -106,7 +106,6 @@ private:
|
||||
TimeSliceThread thread;
|
||||
|
||||
class ThumbnailCacheEntry;
|
||||
friend struct ContainerDeletePolicy<ThumbnailCacheEntry>;
|
||||
OwnedArray<ThumbnailCacheEntry> thumbs;
|
||||
CriticalSection lock;
|
||||
int maxNumThumbsToStore;
|
||||
|
@ -29,8 +29,7 @@ namespace juce
|
||||
|
||||
struct AudioVisualiserComponent::ChannelInfo
|
||||
{
|
||||
ChannelInfo (AudioVisualiserComponent& o, int bufferSize)
|
||||
: owner (o), nextSample (0), subSample (0)
|
||||
ChannelInfo (AudioVisualiserComponent& o, int bufferSize) : owner (o)
|
||||
{
|
||||
setBufferSize (bufferSize);
|
||||
clear();
|
||||
@ -38,20 +37,21 @@ struct AudioVisualiserComponent::ChannelInfo
|
||||
|
||||
void clear() noexcept
|
||||
{
|
||||
for (int i = 0; i < levels.size(); ++i)
|
||||
levels.getReference(i) = Range<float>();
|
||||
// VS2013 doesn't like {} here...
|
||||
for (auto& l : levels)
|
||||
l = Range<float>();
|
||||
|
||||
value = Range<float>();
|
||||
value = {};
|
||||
subSample = 0;
|
||||
}
|
||||
|
||||
void pushSamples (const float* inputSamples, const int num) noexcept
|
||||
void pushSamples (const float* inputSamples, int num) noexcept
|
||||
{
|
||||
for (int i = 0; i < num; ++i)
|
||||
pushSample (inputSamples[i]);
|
||||
}
|
||||
|
||||
void pushSample (const float newSample) noexcept
|
||||
void pushSample (float newSample) noexcept
|
||||
{
|
||||
if (--subSample <= 0)
|
||||
{
|
||||
@ -69,7 +69,7 @@ struct AudioVisualiserComponent::ChannelInfo
|
||||
void setBufferSize (int newSize)
|
||||
{
|
||||
levels.removeRange (newSize, levels.size());
|
||||
levels.insertMultiple (-1, Range<float>(), newSize - levels.size());
|
||||
levels.insertMultiple (-1, {}, newSize - levels.size());
|
||||
|
||||
if (nextSample >= newSize)
|
||||
nextSample = 0;
|
||||
@ -78,13 +78,13 @@ struct AudioVisualiserComponent::ChannelInfo
|
||||
AudioVisualiserComponent& owner;
|
||||
Array<Range<float>> levels;
|
||||
Range<float> value;
|
||||
int nextSample, subSample;
|
||||
int nextSample = 0, subSample = 0;
|
||||
|
||||
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (ChannelInfo)
|
||||
};
|
||||
|
||||
//==============================================================================
|
||||
AudioVisualiserComponent::AudioVisualiserComponent (const int initialNumChannels)
|
||||
AudioVisualiserComponent::AudioVisualiserComponent (int initialNumChannels)
|
||||
: numSamples (1024),
|
||||
inputSamplesPerBlock (256),
|
||||
backgroundColour (Colours::black),
|
||||
@ -99,7 +99,7 @@ AudioVisualiserComponent::~AudioVisualiserComponent()
|
||||
{
|
||||
}
|
||||
|
||||
void AudioVisualiserComponent::setNumChannels (const int numChannels)
|
||||
void AudioVisualiserComponent::setNumChannels (int numChannels)
|
||||
{
|
||||
channels.clear();
|
||||
|
||||
@ -111,14 +111,14 @@ void AudioVisualiserComponent::setBufferSize (int newNumSamples)
|
||||
{
|
||||
numSamples = newNumSamples;
|
||||
|
||||
for (int i = 0; i < channels.size(); ++i)
|
||||
channels.getUnchecked(i)->setBufferSize (newNumSamples);
|
||||
for (auto* c : channels)
|
||||
c->setBufferSize (newNumSamples);
|
||||
}
|
||||
|
||||
void AudioVisualiserComponent::clear()
|
||||
{
|
||||
for (int i = 0; i < channels.size(); ++i)
|
||||
channels.getUnchecked(i)->clear();
|
||||
for (auto* c : channels)
|
||||
c->clear();
|
||||
}
|
||||
|
||||
void AudioVisualiserComponent::pushBuffer (const float** d, int numChannels, int num)
|
||||
@ -138,7 +138,7 @@ void AudioVisualiserComponent::pushBuffer (const AudioBuffer<float>& buffer)
|
||||
|
||||
void AudioVisualiserComponent::pushBuffer (const AudioSourceChannelInfo& buffer)
|
||||
{
|
||||
const int numChannels = jmin (buffer.buffer->getNumChannels(), channels.size());
|
||||
auto numChannels = jmin (buffer.buffer->getNumChannels(), channels.size());
|
||||
|
||||
for (int i = 0; i < numChannels; ++i)
|
||||
channels.getUnchecked(i)->pushSamples (buffer.buffer->getReadPointer (i, buffer.startSample),
|
||||
@ -179,27 +179,24 @@ void AudioVisualiserComponent::paint (Graphics& g)
|
||||
{
|
||||
g.fillAll (backgroundColour);
|
||||
|
||||
Rectangle<float> r (getLocalBounds().toFloat());
|
||||
const float channelHeight = r.getHeight() / channels.size();
|
||||
auto r = getLocalBounds().toFloat();
|
||||
auto channelHeight = r.getHeight() / channels.size();
|
||||
|
||||
g.setColour (waveformColour);
|
||||
|
||||
for (int i = 0; i < channels.size(); ++i)
|
||||
{
|
||||
const ChannelInfo& c = *channels.getUnchecked(i);
|
||||
|
||||
for (auto* c : channels)
|
||||
paintChannel (g, r.removeFromTop (channelHeight),
|
||||
c.levels.begin(), c.levels.size(), c.nextSample);
|
||||
}
|
||||
c->levels.begin(), c->levels.size(), c->nextSample);
|
||||
}
|
||||
|
||||
void AudioVisualiserComponent::getChannelAsPath (Path& path, const Range<float>* levels, int numLevels, int nextSample)
|
||||
void AudioVisualiserComponent::getChannelAsPath (Path& path, const Range<float>* levels,
|
||||
int numLevels, int nextSample)
|
||||
{
|
||||
path.preallocateSpace (4 * numLevels + 8);
|
||||
|
||||
for (int i = 0; i < numLevels; ++i)
|
||||
{
|
||||
const float level = -(levels[(nextSample + i) % numLevels].getEnd());
|
||||
auto level = -(levels[(nextSample + i) % numLevels].getEnd());
|
||||
|
||||
if (i == 0)
|
||||
path.startNewSubPath (0.0f, level);
|
||||
|
@ -51,7 +51,7 @@ public:
|
||||
AudioVisualiserComponent (int initialNumChannels);
|
||||
|
||||
/** Destructor. */
|
||||
~AudioVisualiserComponent();
|
||||
~AudioVisualiserComponent() override;
|
||||
|
||||
/** Changes the number of channels that the visualiser stores. */
|
||||
void setNumChannels (int numChannels);
|
||||
@ -121,8 +121,6 @@ public:
|
||||
|
||||
private:
|
||||
struct ChannelInfo;
|
||||
friend struct ChannelInfo;
|
||||
friend struct ContainerDeletePolicy<ChannelInfo>;
|
||||
|
||||
OwnedArray<ChannelInfo> channels;
|
||||
int numSamples, inputSamplesPerBlock;
|
||||
|
@ -50,10 +50,10 @@ struct MidiKeyboardComponent::UpDownButton : public Button
|
||||
owner.setLowestVisibleKey (note * 12);
|
||||
}
|
||||
|
||||
void paintButton (Graphics& g, bool isMouseOverButton, bool isButtonDown) override
|
||||
void paintButton (Graphics& g, bool shouldDrawButtonAsHighlighted, bool shouldDrawButtonAsDown) override
|
||||
{
|
||||
owner.drawUpDownButton (g, getWidth(), getHeight(),
|
||||
isMouseOverButton, isButtonDown,
|
||||
shouldDrawButtonAsHighlighted, shouldDrawButtonAsDown,
|
||||
delta > 0);
|
||||
}
|
||||
|
||||
@ -712,7 +712,7 @@ void MidiKeyboardComponent::updateNoteUnderMouse (Point<float> pos, bool isDown,
|
||||
auto newNote = xyToNote (pos, mousePositionVelocity);
|
||||
auto oldNote = mouseOverNotes.getUnchecked (fingerNum);
|
||||
auto oldNoteDown = mouseDownNotes.getUnchecked (fingerNum);
|
||||
auto eventVelocity = useMousePositionForVelocity ? mousePositionVelocity * velocity : 1.0f;
|
||||
auto eventVelocity = useMousePositionForVelocity ? mousePositionVelocity * velocity : velocity;
|
||||
|
||||
if (oldNote != newNote)
|
||||
{
|
||||
|
@ -73,7 +73,7 @@ public:
|
||||
Orientation orientation);
|
||||
|
||||
/** Destructor. */
|
||||
~MidiKeyboardComponent();
|
||||
~MidiKeyboardComponent() override;
|
||||
|
||||
//==============================================================================
|
||||
/** Changes the velocity used in midi note-on messages that are triggered by clicking
|
||||
|
@ -35,7 +35,7 @@
|
||||
|
||||
ID: juce_audio_utils
|
||||
vendor: juce
|
||||
version: 5.3.2
|
||||
version: 5.4.3
|
||||
name: JUCE extra audio utility classes
|
||||
description: Classes for audio-related GUI and miscellaneous tasks.
|
||||
website: http://www.juce.com/juce
|
||||
|
@ -27,7 +27,13 @@
|
||||
namespace juce
|
||||
{
|
||||
|
||||
#define JNI_CLASS_MEMBERS(METHOD, STATICMETHOD, FIELD, STATICFIELD) \
|
||||
#define JNI_CLASS_MEMBERS(METHOD, STATICMETHOD, FIELD, STATICFIELD, CALLBACK) \
|
||||
STATICMETHOD (getAndroidBluetoothManager, "getAndroidBluetoothManager", "(Landroid/content/Context;)Lcom/roli/juce/JuceMidiSupport$BluetoothManager;")
|
||||
|
||||
DECLARE_JNI_CLASS_WITH_MIN_SDK (AndroidJuceMidiSupport, "com/roli/juce/JuceMidiSupport", 23)
|
||||
#undef JNI_CLASS_MEMBERS
|
||||
|
||||
#define JNI_CLASS_MEMBERS(METHOD, STATICMETHOD, FIELD, STATICFIELD, CALLBACK) \
|
||||
METHOD (getMidiBluetoothAddresses, "getMidiBluetoothAddresses", "()[Ljava/lang/String;") \
|
||||
METHOD (pairBluetoothMidiDevice, "pairBluetoothMidiDevice", "(Ljava/lang/String;)Z") \
|
||||
METHOD (unpairBluetoothMidiDevice, "unpairBluetoothMidiDevice", "(Ljava/lang/String;)V") \
|
||||
@ -35,7 +41,7 @@ namespace juce
|
||||
METHOD (getBluetoothDeviceStatus, "getBluetoothDeviceStatus", "(Ljava/lang/String;)I") \
|
||||
METHOD (startStopScan, "startStopScan", "(Z)V")
|
||||
|
||||
DECLARE_JNI_CLASS (AndroidBluetoothManager, JUCE_ANDROID_ACTIVITY_CLASSPATH "$BluetoothManager");
|
||||
DECLARE_JNI_CLASS_WITH_MIN_SDK (AndroidBluetoothManager, "com/roli/juce/JuceMidiSupport$BluetoothManager", 23)
|
||||
#undef JNI_CLASS_MEMBERS
|
||||
|
||||
//==============================================================================
|
||||
@ -44,7 +50,7 @@ struct AndroidBluetoothMidiInterface
|
||||
static void startStopScan (bool startScanning)
|
||||
{
|
||||
JNIEnv* env = getEnv();
|
||||
LocalRef<jobject> btManager (android.activity.callObjectMethod (JuceAppActivity.getAndroidBluetoothManager));
|
||||
LocalRef<jobject> btManager (env->CallStaticObjectMethod (AndroidJuceMidiSupport, AndroidJuceMidiSupport.getAndroidBluetoothManager, getAppContext().get()));
|
||||
|
||||
if (btManager.get() != nullptr)
|
||||
env->CallVoidMethod (btManager.get(), AndroidBluetoothManager.startStopScan, (jboolean) (startScanning ? 1 : 0));
|
||||
@ -56,7 +62,7 @@ struct AndroidBluetoothMidiInterface
|
||||
|
||||
JNIEnv* env = getEnv();
|
||||
|
||||
LocalRef<jobject> btManager (android.activity.callObjectMethod (JuceAppActivity.getAndroidBluetoothManager));
|
||||
LocalRef<jobject> btManager (env->CallStaticObjectMethod (AndroidJuceMidiSupport, AndroidJuceMidiSupport.getAndroidBluetoothManager, getAppContext().get()));
|
||||
|
||||
// if this is null then bluetooth is not enabled
|
||||
if (btManager.get() == nullptr)
|
||||
@ -82,7 +88,7 @@ struct AndroidBluetoothMidiInterface
|
||||
{
|
||||
JNIEnv* env = getEnv();
|
||||
|
||||
LocalRef<jobject> btManager (android.activity.callObjectMethod (JuceAppActivity.getAndroidBluetoothManager));
|
||||
LocalRef<jobject> btManager (env->CallStaticObjectMethod (AndroidJuceMidiSupport, AndroidJuceMidiSupport.getAndroidBluetoothManager, getAppContext().get()));
|
||||
if (btManager.get() == nullptr)
|
||||
return false;
|
||||
|
||||
@ -96,7 +102,7 @@ struct AndroidBluetoothMidiInterface
|
||||
{
|
||||
JNIEnv* env = getEnv();
|
||||
|
||||
LocalRef<jobject> btManager (android.activity.callObjectMethod (JuceAppActivity.getAndroidBluetoothManager));
|
||||
LocalRef<jobject> btManager (env->CallStaticObjectMethod (AndroidJuceMidiSupport, AndroidJuceMidiSupport.getAndroidBluetoothManager, getAppContext().get()));
|
||||
|
||||
if (btManager.get() != nullptr)
|
||||
env->CallVoidMethod (btManager.get(), AndroidBluetoothManager.unpairBluetoothMidiDevice,
|
||||
@ -108,7 +114,7 @@ struct AndroidBluetoothMidiInterface
|
||||
{
|
||||
JNIEnv* env = getEnv();
|
||||
|
||||
LocalRef<jobject> btManager (android.activity.callObjectMethod (JuceAppActivity.getAndroidBluetoothManager));
|
||||
LocalRef<jobject> btManager (env->CallStaticObjectMethod (AndroidJuceMidiSupport, AndroidJuceMidiSupport.getAndroidBluetoothManager, getAppContext().get()));
|
||||
|
||||
if (btManager.get() == nullptr)
|
||||
return address;
|
||||
@ -136,7 +142,7 @@ struct AndroidBluetoothMidiInterface
|
||||
{
|
||||
JNIEnv* env = getEnv();
|
||||
|
||||
LocalRef<jobject> btManager (android.activity.callObjectMethod (JuceAppActivity.getAndroidBluetoothManager));
|
||||
LocalRef<jobject> btManager (env->CallStaticObjectMethod (AndroidJuceMidiSupport, AndroidJuceMidiSupport.getAndroidBluetoothManager, getAppContext().get()));
|
||||
|
||||
if (btManager.get() == nullptr)
|
||||
return unpaired;
|
||||
@ -485,6 +491,10 @@ bool BluetoothMidiDevicePairingDialogue::open (ModalComponentManager::Callback*
|
||||
Rectangle<int>* btBounds)
|
||||
{
|
||||
std::unique_ptr<ModalComponentManager::Callback> exitCallback (exitCallbackPtr);
|
||||
|
||||
if (getAndroidSDKVersion() < 23)
|
||||
return false;
|
||||
|
||||
auto boundsToUse = (btBounds != nullptr ? *btBounds : Rectangle<int> {});
|
||||
|
||||
if (! RuntimePermissions::isGranted (RuntimePermissions::bluetoothMidi))
|
||||
@ -502,7 +512,12 @@ bool BluetoothMidiDevicePairingDialogue::open (ModalComponentManager::Callback*
|
||||
|
||||
bool BluetoothMidiDevicePairingDialogue::isAvailable()
|
||||
{
|
||||
jobject btManager (android.activity.callObjectMethod (JuceAppActivity.getAndroidBluetoothManager));
|
||||
if (getAndroidSDKVersion() < 23)
|
||||
return false;
|
||||
|
||||
auto* env = getEnv();
|
||||
|
||||
LocalRef<jobject> btManager (env->CallStaticObjectMethod (AndroidJuceMidiSupport, AndroidJuceMidiSupport.getAndroidBluetoothManager, getAppContext().get()));
|
||||
return btManager != nullptr;
|
||||
}
|
||||
|
||||
|
@ -88,6 +88,15 @@ void AudioProcessorPlayer::setDoublePrecisionProcessing (bool doublePrecision)
|
||||
}
|
||||
}
|
||||
|
||||
void AudioProcessorPlayer::setMidiOutput (MidiOutput* midiOutputToUse)
|
||||
{
|
||||
if (midiOutput != midiOutputToUse)
|
||||
{
|
||||
const ScopedLock sl (lock);
|
||||
midiOutput = midiOutputToUse;
|
||||
}
|
||||
}
|
||||
|
||||
//==============================================================================
|
||||
void AudioProcessorPlayer::audioDeviceIOCallback (const float** const inputChannelData,
|
||||
const int numInputChannels,
|
||||
@ -163,6 +172,9 @@ void AudioProcessorPlayer::audioDeviceIOCallback (const float** const inputChann
|
||||
processor->processBlock (buffer, incomingMidi);
|
||||
}
|
||||
|
||||
if (midiOutput != nullptr)
|
||||
midiOutput->sendBlockOfMessagesNow (incomingMidi);
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -35,7 +35,8 @@ namespace juce
|
||||
give it a processor to use by calling setProcessor().
|
||||
|
||||
It's also a MidiInputCallback, so you can connect it to both an audio and midi
|
||||
input to send both streams through the processor.
|
||||
input to send both streams through the processor. To set a MidiOutput for the processor,
|
||||
use the setMidiOutput() method.
|
||||
|
||||
@see AudioProcessor, AudioProcessorGraph
|
||||
|
||||
@ -49,7 +50,7 @@ public:
|
||||
AudioProcessorPlayer (bool doDoublePrecisionProcessing = false);
|
||||
|
||||
/** Destructor. */
|
||||
virtual ~AudioProcessorPlayer();
|
||||
~AudioProcessorPlayer() override;
|
||||
|
||||
//==============================================================================
|
||||
/** Sets the processor that should be played.
|
||||
@ -68,18 +69,26 @@ public:
|
||||
*/
|
||||
MidiMessageCollector& getMidiMessageCollector() noexcept { return messageCollector; }
|
||||
|
||||
/** Sets the MIDI output that should be used, if required.
|
||||
|
||||
The MIDI output will not be deleted or owned by this object. If the MIDI output is
|
||||
deleted, pass a nullptr to this method.
|
||||
*/
|
||||
void setMidiOutput (MidiOutput* midiOutputToUse);
|
||||
|
||||
/** Switch between double and single floating point precisions processing.
|
||||
The audio IO callbacks will still operate in single floating point
|
||||
precision, however, all internal processing including the
|
||||
AudioProcessor will be processed in double floating point precision if
|
||||
the AudioProcessor supports it (see
|
||||
AudioProcessor::supportsDoublePrecisionProcessing()).
|
||||
Otherwise, the processing will remain single precision irrespective of
|
||||
the parameter doublePrecision. */
|
||||
|
||||
The audio IO callbacks will still operate in single floating point precision,
|
||||
however, all internal processing including the AudioProcessor will be processed in
|
||||
double floating point precision if the AudioProcessor supports it (see
|
||||
AudioProcessor::supportsDoublePrecisionProcessing()). Otherwise, the processing will
|
||||
remain single precision irrespective of the parameter doublePrecision.
|
||||
*/
|
||||
void setDoublePrecisionProcessing (bool doublePrecision);
|
||||
|
||||
/** Returns true if this player processes internally processes the samples with
|
||||
double floating point precision. */
|
||||
double floating point precision.
|
||||
*/
|
||||
inline bool getDoublePrecisionProcessing() { return isDoublePrecision; }
|
||||
|
||||
//==============================================================================
|
||||
@ -107,6 +116,7 @@ private:
|
||||
|
||||
MidiBuffer incomingMidi;
|
||||
MidiMessageCollector messageCollector;
|
||||
MidiOutput* midiOutput = nullptr;
|
||||
|
||||
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (AudioProcessorPlayer)
|
||||
};
|
||||
|
@ -30,9 +30,9 @@ namespace juce
|
||||
// This is an AudioTransportSource which will own it's assigned source
|
||||
struct AudioSourceOwningTransportSource : public AudioTransportSource
|
||||
{
|
||||
AudioSourceOwningTransportSource (PositionableAudioSource* s, double sampleRate) : source (s)
|
||||
AudioSourceOwningTransportSource (PositionableAudioSource* s, double sr) : source (s)
|
||||
{
|
||||
AudioTransportSource::setSource (s, 0, nullptr, sampleRate);
|
||||
AudioTransportSource::setSource (s, 0, nullptr, sr);
|
||||
}
|
||||
|
||||
~AudioSourceOwningTransportSource()
|
||||
@ -67,7 +67,7 @@ struct AutoRemovingTransportSource : public AudioTransportSource,
|
||||
startTimerHz (10);
|
||||
}
|
||||
|
||||
~AutoRemovingTransportSource()
|
||||
~AutoRemovingTransportSource() override
|
||||
{
|
||||
setSource (nullptr);
|
||||
}
|
||||
|
@ -36,14 +36,14 @@ namespace juce
|
||||
|
||||
@tags{Audio}
|
||||
*/
|
||||
class JUCE_API SoundPlayer : public AudioIODeviceCallback
|
||||
class JUCE_API SoundPlayer : public AudioIODeviceCallback
|
||||
{
|
||||
public:
|
||||
//==============================================================================
|
||||
SoundPlayer();
|
||||
|
||||
/** Destructor. */
|
||||
virtual ~SoundPlayer();
|
||||
~SoundPlayer() override;
|
||||
|
||||
//==============================================================================
|
||||
/** Plays a sound from a file. */
|
||||
|
Reference in New Issue
Block a user