Skip to content

Commit

Permalink
Upgrading to JUCE 7.0.10, which includes fixes to Timers (which were …
Browse files Browse the repository at this point in the history
…breaking on win32)
  • Loading branch information
jonoomph committed Dec 8, 2024
1 parent 840a475 commit 94ff22a
Show file tree
Hide file tree
Showing 244 changed files with 10,455 additions and 2,964 deletions.
4 changes: 2 additions & 2 deletions JuceLibraryCode/AppConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,14 @@
// BEGIN SECTION A

#ifndef JUCE_DISPLAY_SPLASH_SCREEN
#define JUCE_DISPLAY_SPLASH_SCREEN 0
#define JUCE_DISPLAY_SPLASH_SCREEN 1
#endif

// END SECTION A

#define JUCE_USE_DARK_SPLASH_SCREEN 1

#define JUCE_PROJUCER_VERSION 0x70008
#define JUCE_PROJUCER_VERSION 0x7000a

//==============================================================================
#define JUCE_MODULE_AVAILABLE_juce_audio_basics 1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
ID: juce_audio_basics
vendor: juce
version: 7.0.8
version: 7.0.10
name: JUCE audio and MIDI data classes
description: Classes for audio buffer manipulation, midi message handling, synthesis, etc.
website: http://www.juce.com/juce
Expand Down Expand Up @@ -124,3 +124,10 @@ JUCE_END_IGNORE_WARNINGS_MSVC
#include "synthesisers/juce_Synthesiser.h"
#include "audio_play_head/juce_AudioPlayHead.h"
#include "utilities/juce_AudioWorkgroup.h"
#include "midi/ump/juce_UMPBytesOnGroup.h"
#include "midi/ump/juce_UMPDeviceInfo.h"

namespace juce
{
namespace ump = universal_midi_packets;
}
Original file line number Diff line number Diff line change
Expand Up @@ -685,6 +685,11 @@ MidiMessage MidiMessage::createSysExMessage (const void* sysexData, const int da
return MidiMessage (m, dataSize + 2);
}

MidiMessage MidiMessage::createSysExMessage (Span<const std::byte> data)
{
return createSysExMessage (data.data(), (int) data.size());
}

const uint8* MidiMessage::getSysExData() const noexcept
{
return isSysEx() ? getRawData() + 1 : nullptr;
Expand Down
11 changes: 11 additions & 0 deletions JuceLibraryCode/modules/juce_audio_basics/midi/juce_MidiMessage.h
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,13 @@ class JUCE_API MidiMessage
*/
int getSysExDataSize() const noexcept;

/** Returns a span that bounds the sysex body bytes contained in this message. */
Span<const std::byte> getSysExDataSpan() const noexcept
{
return { reinterpret_cast<const std::byte*> (getSysExData()),
(size_t) getSysExDataSize() };
}

//==============================================================================
/** Returns true if this message is a 'key-down' event.
Expand Down Expand Up @@ -855,6 +862,10 @@ class JUCE_API MidiMessage
static MidiMessage createSysExMessage (const void* sysexData,
int dataSize);

/** Creates a system-exclusive message.
The data passed in is wrapped with header and tail bytes of 0xf0 and 0xf7.
*/
static MidiMessage createSysExMessage (Span<const std::byte> data);

//==============================================================================
#ifndef DOXYGEN
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
/*
==============================================================================
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::universal_midi_packets
{

/**
Holds a UMP group, and a span of bytes that were received or are to be
sent on that group. Helpful when working with sysex messages.
@tags{Audio}
*/
struct BytesOnGroup
{
uint8_t group{};
Span<const std::byte> bytes;
};

} // namespace juce::universal_midi_packets
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
/*
==============================================================================
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::universal_midi_packets
{

/**
Holds MIDI device info that may be required by certain UMP messages and
MIDI-CI messages.
@tags{Audio}
*/
struct DeviceInfo
{
std::array<std::byte, 3> manufacturer; ///< LSB first
std::array<std::byte, 2> family; ///< LSB first
std::array<std::byte, 2> modelNumber; ///< LSB first
std::array<std::byte, 4> revision;

private:
auto tie() const { return std::tie (manufacturer, family, modelNumber, revision); }

public:
bool operator== (const DeviceInfo& other) const { return tie() == other.tie(); }
bool operator!= (const DeviceInfo& other) const { return tie() != other.tie(); }

static constexpr auto marshallingVersion = std::nullopt;

template <typename Archive, typename This>
static auto serialise (Archive& archive, This& t)
{
return archive (named ("manufacturer", t.manufacturer),
named ("family", t.family),
named ("modelNumber", t.modelNumber),
named ("revision", t.revision));
}
};

} // namespace juce::universal_midi_packets
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,8 @@ struct Factory

std::array<uint32_t, 2> words;

size_t index = 0;

for (auto& word : words)
word = ByteOrder::bigEndianInt (bytes.data() + 4 * index++);
for (const auto [index, word] : enumerate (words))
word = ByteOrder::bigEndianInt (bytes.data() + 4 * index);

return PacketX2 { words };
}
Expand All @@ -79,10 +77,8 @@ struct Factory

std::array<uint32_t, 4> words;

size_t index = 0;

for (auto& word : words)
word = ByteOrder::bigEndianInt (bytes.data() + 4 * index++);
for (const auto [index, word] : enumerate (words))
word = ByteOrder::bigEndianInt (bytes.data() + 4 * index);

return PacketX4 { words };
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -989,22 +989,12 @@ class UniversalMidiPacketTests final : public UnitTest
}
}

#if JUCE_WINDOWS && ! JUCE_MINGW
#define JUCE_CHECKED_ITERATOR(msg, size) \
stdext::checked_array_iterator<std::remove_reference_t<decltype (msg)>> ((msg), (size_t) (size))
#else
#define JUCE_CHECKED_ITERATOR(msg, size) (msg)
#endif

static bool equal (const MidiMessage& a, const MidiMessage& b) noexcept
{
return a.getRawDataSize() == b.getRawDataSize()
&& std::equal (a.getRawData(), a.getRawData() + a.getRawDataSize(),
JUCE_CHECKED_ITERATOR (b.getRawData(), b.getRawDataSize()));
&& std::equal (a.getRawData(), a.getRawData() + a.getRawDataSize(), b.getRawData());
}

#undef JUCE_CHECKED_ITERATOR

static bool equal (const MidiBuffer& a, const MidiBuffer& b) noexcept
{
return a.data == b.data;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -381,6 +381,17 @@ class MPEZoneLayoutTests final : public UnitTest
expectEquals (layout.getLowerZone().numMemberChannels, 3);
expectEquals (layout.getLowerZone().perNotePitchbendRange, 48);
expectEquals (layout.getLowerZone().masterPitchbendRange, 2);

const auto masterPitchBend = 0x0c;
layout.processNextMidiEvent ({ 0xb0, 0x64, 0x00 });
layout.processNextMidiEvent ({ 0xb0, 0x06, masterPitchBend });

expectEquals (layout.getLowerZone().masterPitchbendRange, masterPitchBend);

const auto newPitchBend = 0x0d;
layout.processNextMidiEvent ({ 0xb0, 0x06, newPitchBend });

expectEquals (layout.getLowerZone().masterPitchbendRange, newPitchBend);
}
}
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,21 @@ void AudioWorkgroup::join (WorkgroupToken& token) const
token.reset();
}

size_t AudioWorkgroup::getMaxParallelThreadCount() const
{
#if JUCE_AUDIOWORKGROUP_TYPES_AVAILABLE

if (@available (macos 11.0, ios 14.0, *))
{
if (auto wg = WorkgroupProvider::getWorkgroup (*this))
return (size_t) os_workgroup_max_parallel_threads (wg, nullptr);
}

#endif

return 0;
}

AudioWorkgroup::operator bool() const { return WorkgroupProvider::getWorkgroup (*this) != nullptr; }

#if JUCE_AUDIOWORKGROUP_TYPES_AVAILABLE
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,13 @@ class AudioWorkgroup
*/
void reset() { erased = nullptr; }

/** Returns the recommended maximum number of parallel threads that should join this workgroup.
This recommendation is based on the workgroup attributes and current hardware, but not on
system load. On a very busy system, it may be more effective to use fewer parallel threads.
*/
size_t getMaxParallelThreadCount() const;

private:
const WorkgroupProvider* getWorkgroupProvider() const { return erased != nullptr ? erased() : nullptr; }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ class Interpolators
sign = (sincPosition < 0 ? -1 : 1);
}

if (approximatelyEqual (sincPosition, 0.0f))
if (exactlyEqual (sincPosition, 0.0f))
result += inputs[samplePosition];
else if (sincPosition < floatCrossings && sincPosition > -floatCrossings)
result += inputs[samplePosition] * windowedSinc (firstFrac, index);
Expand Down Expand Up @@ -158,7 +158,8 @@ class Interpolators
Note that the resampler is stateful, so when there's a break in the continuity
of the input stream you're feeding it, you should call reset() before feeding
it any new data. And like with any other stateful filter, if you're resampling
multiple channels, make sure each one uses its own LinearInterpolator object.
multiple channels, make sure each one uses its own WindowedSincInterpolator
object.
@see GenericInterpolator
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,9 @@ namespace juce
"-Wzero-as-null-pointer-constant",
"-Winconsistent-missing-destructor-override",
"-Wshadow-field-in-constructor",
"-Wshadow-field")
"-Wshadow-field",
"-Wsign-conversion",
"-Wswitch-enum")
#include <oboe/Oboe.h>
JUCE_END_IGNORE_WARNINGS_GCC_LIKE

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
ID: juce_audio_devices
vendor: juce
version: 7.0.8
version: 7.0.10
name: JUCE audio and MIDI I/O device classes
description: Classes to play and record from audio and MIDI I/O devices
website: http://www.juce.com/juce
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -979,7 +979,7 @@ class ALSAAudioIODeviceType final : public AudioIODeviceType
#endif
}

~ALSAAudioIODeviceType()
~ALSAAudioIODeviceType() override
{
#if ! JUCE_ALSA_LOGGING
snd_lib_error_set_handler (nullptr);
Expand All @@ -989,7 +989,7 @@ class ALSAAudioIODeviceType final : public AudioIODeviceType
}

//==============================================================================
void scanForDevices()
void scanForDevices() override
{
if (hasScanned)
return;
Expand All @@ -1011,24 +1011,24 @@ class ALSAAudioIODeviceType final : public AudioIODeviceType
outputNames.appendNumbersToDuplicates (false, true);
}

StringArray getDeviceNames (bool wantInputNames) const
StringArray getDeviceNames (bool wantInputNames) const override
{
jassert (hasScanned); // need to call scanForDevices() before doing this

return wantInputNames ? inputNames : outputNames;
}

int getDefaultDeviceIndex (bool forInput) const
int getDefaultDeviceIndex (bool forInput) const override
{
jassert (hasScanned); // need to call scanForDevices() before doing this

auto idx = (forInput ? inputIds : outputIds).indexOf ("default");
return idx >= 0 ? idx : 0;
}

bool hasSeparateInputsAndOutputs() const { return true; }
bool hasSeparateInputsAndOutputs() const override { return true; }

int getIndexOfDevice (AudioIODevice* device, bool asInput) const
int getIndexOfDevice (AudioIODevice* device, bool asInput) const override
{
jassert (hasScanned); // need to call scanForDevices() before doing this

Expand All @@ -1040,7 +1040,7 @@ class ALSAAudioIODeviceType final : public AudioIODeviceType
}

AudioIODevice* createDevice (const String& outputDeviceName,
const String& inputDeviceName)
const String& inputDeviceName) override
{
jassert (hasScanned); // need to call scanForDevices() before doing this

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ struct iOSAudioIODevice::Pimpl final : public AsyncUpdater

static void setAudioSessionCategory (NSString* category)
{
NSUInteger options = AVAudioSessionCategoryOptionAllowAirPlay;
NSUInteger options = 0;

#if ! JUCE_DISABLE_AUDIO_MIXING_WITH_OTHER_APPS
options |= AVAudioSessionCategoryOptionMixWithOthers; // Alternatively AVAudioSessionCategoryOptionDuckOthers
Expand All @@ -285,7 +285,8 @@ struct iOSAudioIODevice::Pimpl final : public AsyncUpdater
if (category == AVAudioSessionCategoryPlayAndRecord)
{
options |= AVAudioSessionCategoryOptionDefaultToSpeaker
| AVAudioSessionCategoryOptionAllowBluetooth;
| AVAudioSessionCategoryOptionAllowBluetooth
| AVAudioSessionCategoryOptionAllowAirPlay;

if (@available (iOS 10.0, *))
options |= AVAudioSessionCategoryOptionAllowBluetoothA2DP;
Expand Down
Loading

0 comments on commit 94ff22a

Please sign in to comment.