@@ -58,6 +58,7 @@ ALL_LIBS += $(MODULEDIR)/native-plugins.a | |||||
ALL_LIBS += $(MODULEDIR)/juce_audio_basics.a | ALL_LIBS += $(MODULEDIR)/juce_audio_basics.a | ||||
ALL_LIBS += $(MODULEDIR)/juce_audio_formats.a | ALL_LIBS += $(MODULEDIR)/juce_audio_formats.a | ||||
ALL_LIBS += $(MODULEDIR)/juce_core.a | ALL_LIBS += $(MODULEDIR)/juce_core.a | ||||
ALL_LIBS += $(MODULEDIR)/juce_events.a | |||||
ALL_LIBS += $(MODULEDIR)/lilv.a | ALL_LIBS += $(MODULEDIR)/lilv.a | ||||
ALL_LIBS += $(MODULEDIR)/rtmempool.a | ALL_LIBS += $(MODULEDIR)/rtmempool.a | ||||
@@ -73,7 +74,6 @@ ifeq ($(MACOS_OR_WIN32),true) | |||||
ALL_LIBS += $(MODULEDIR)/juce_audio_devices.a | ALL_LIBS += $(MODULEDIR)/juce_audio_devices.a | ||||
ALL_LIBS += $(MODULEDIR)/juce_audio_processors.a | ALL_LIBS += $(MODULEDIR)/juce_audio_processors.a | ||||
ALL_LIBS += $(MODULEDIR)/juce_data_structures.a | ALL_LIBS += $(MODULEDIR)/juce_data_structures.a | ||||
ALL_LIBS += $(MODULEDIR)/juce_events.a | |||||
ALL_LIBS += $(MODULEDIR)/juce_graphics.a | ALL_LIBS += $(MODULEDIR)/juce_graphics.a | ||||
ALL_LIBS += $(MODULEDIR)/juce_gui_basics.a | ALL_LIBS += $(MODULEDIR)/juce_gui_basics.a | ||||
ifeq ($(MACOS),true) | ifeq ($(MACOS),true) | ||||
@@ -3,12 +3,13 @@ | |||||
set -e | set -e | ||||
JUCE_MODULES_DIR="/Shared/Personal/FOSS/GIT/DISTRHO/DISTRHO-Ports/libs/juce/source/modules/" | JUCE_MODULES_DIR="/Shared/Personal/FOSS/GIT/DISTRHO/DISTRHO-Ports/libs/juce/source/modules/" | ||||
CARLA_MODULES_DIR="/home/falktx/FOSS/GIT-mine/falkTX/Carla/source/modules/" | |||||
CARLA_MODULES_DIR="/Shared/Personal/FOSS/GIT/falkTX/Carla/source/modules/" | |||||
MODULES=("juce_audio_basics juce_audio_devices juce_audio_formats juce_audio_processors juce_core juce_data_structures juce_events juce_graphics juce_gui_basics juce_gui_extra") | MODULES=("juce_audio_basics juce_audio_devices juce_audio_formats juce_audio_processors juce_core juce_data_structures juce_events juce_graphics juce_gui_basics juce_gui_extra") | ||||
for M in $MODULES; do | for M in $MODULES; do | ||||
echo $M; | echo $M; | ||||
#rm -rf $CARLA_MODULES_DIR/$M/* | |||||
cp -r -v $JUCE_MODULES_DIR/$M/* $CARLA_MODULES_DIR/$M/ | cp -r -v $JUCE_MODULES_DIR/$M/* $CARLA_MODULES_DIR/$M/ | ||||
done | done | ||||
@@ -37,9 +37,7 @@ | |||||
#if defined(CARLA_OS_MAC) || defined(CARLA_OS_WIN) | #if defined(CARLA_OS_MAC) || defined(CARLA_OS_WIN) | ||||
# include "juce_gui_basics/juce_gui_basics.h" | # include "juce_gui_basics/juce_gui_basics.h" | ||||
#else | #else | ||||
namespace juce { | |||||
# include "juce_events/messages/juce_Initialisation.h" | |||||
} // namespace juce | |||||
# include "juce_events/juce_events.h" | |||||
#endif | #endif | ||||
namespace CB = CarlaBackend; | namespace CB = CarlaBackend; | ||||
@@ -315,6 +313,8 @@ bool carla_engine_init(const char* driverName, const char* clientName) | |||||
#else | #else | ||||
gStandalone.engine->setOption(CB::ENGINE_OPTION_PROCESS_MODE, static_cast<int>(gStandalone.engineOptions.processMode), nullptr); | gStandalone.engine->setOption(CB::ENGINE_OPTION_PROCESS_MODE, static_cast<int>(gStandalone.engineOptions.processMode), nullptr); | ||||
gStandalone.engine->setOption(CB::ENGINE_OPTION_TRANSPORT_MODE, static_cast<int>(gStandalone.engineOptions.transportMode), gStandalone.engineOptions.transportExtra); | gStandalone.engine->setOption(CB::ENGINE_OPTION_TRANSPORT_MODE, static_cast<int>(gStandalone.engineOptions.transportMode), gStandalone.engineOptions.transportExtra); | ||||
juce::initialiseJuce_GUI(); | |||||
#endif | #endif | ||||
carla_engine_init_common(); | carla_engine_init_common(); | ||||
@@ -322,7 +322,6 @@ bool carla_engine_init(const char* driverName, const char* clientName) | |||||
if (gStandalone.engine->init(clientName)) | if (gStandalone.engine->init(clientName)) | ||||
{ | { | ||||
#ifndef BUILD_BRIDGE | #ifndef BUILD_BRIDGE | ||||
juce::initialiseJuce_GUI(); | |||||
if (gStandalone.logThreadEnabled && std::getenv("CARLA_LOGS_DISABLED") == nullptr) | if (gStandalone.logThreadEnabled && std::getenv("CARLA_LOGS_DISABLED") == nullptr) | ||||
gStandalone.logThread.init(); | gStandalone.logThread.init(); | ||||
#endif | #endif | ||||
@@ -334,6 +333,9 @@ bool carla_engine_init(const char* driverName, const char* clientName) | |||||
gStandalone.lastError = gStandalone.engine->getLastError(); | gStandalone.lastError = gStandalone.engine->getLastError(); | ||||
delete gStandalone.engine; | delete gStandalone.engine; | ||||
gStandalone.engine = nullptr; | gStandalone.engine = nullptr; | ||||
#ifndef BUILD_BRIDGE | |||||
juce::shutdownJuce_GUI(); | |||||
#endif | |||||
return false; | return false; | ||||
} | } | ||||
} | } | ||||
@@ -411,14 +413,14 @@ bool carla_engine_close() | |||||
if (! closed) | if (! closed) | ||||
gStandalone.lastError = gStandalone.engine->getLastError(); | gStandalone.lastError = gStandalone.engine->getLastError(); | ||||
delete gStandalone.engine; | |||||
gStandalone.engine = nullptr; | |||||
#ifndef BUILD_BRIDGE | #ifndef BUILD_BRIDGE | ||||
juce::shutdownJuce_GUI(); | juce::shutdownJuce_GUI(); | ||||
gStandalone.logThread.stop(); | gStandalone.logThread.stop(); | ||||
#endif | #endif | ||||
delete gStandalone.engine; | |||||
gStandalone.engine = nullptr; | |||||
return closed; | return closed; | ||||
} | } | ||||
@@ -1954,6 +1956,6 @@ const char* carla_get_host_osc_url_udp() | |||||
#include "CarlaPatchbayUtils.cpp" | #include "CarlaPatchbayUtils.cpp" | ||||
#include "CarlaPipeUtils.cpp" | #include "CarlaPipeUtils.cpp" | ||||
#include "CarlaStateUtils.cpp" | #include "CarlaStateUtils.cpp" | ||||
#include "CarlaJuceEvents.cpp" | |||||
#include "CarlaJuceAudioProcessors.cpp" | |||||
// ------------------------------------------------------------------------------------------------------------------- | // ------------------------------------------------------------------------------------------------------------------- |
@@ -29,6 +29,7 @@ STANDALONE_LIBS += $(MODULEDIR)/jackbridge.a | |||||
STANDALONE_LIBS += $(MODULEDIR)/juce_audio_basics.a | STANDALONE_LIBS += $(MODULEDIR)/juce_audio_basics.a | ||||
STANDALONE_LIBS += $(MODULEDIR)/juce_audio_formats.a | STANDALONE_LIBS += $(MODULEDIR)/juce_audio_formats.a | ||||
STANDALONE_LIBS += $(MODULEDIR)/juce_core.a | STANDALONE_LIBS += $(MODULEDIR)/juce_core.a | ||||
STANDALONE_LIBS += $(MODULEDIR)/juce_events.a | |||||
STANDALONE_LIBS += $(MODULEDIR)/lilv.a | STANDALONE_LIBS += $(MODULEDIR)/lilv.a | ||||
STANDALONE_LIBS += $(MODULEDIR)/native-plugins.a | STANDALONE_LIBS += $(MODULEDIR)/native-plugins.a | ||||
STANDALONE_LIBS += $(MODULEDIR)/rtmempool.a | STANDALONE_LIBS += $(MODULEDIR)/rtmempool.a | ||||
@@ -45,7 +46,6 @@ ifeq ($(MACOS_OR_WIN32),true) | |||||
STANDALONE_LIBS += $(MODULEDIR)/juce_audio_devices.a | STANDALONE_LIBS += $(MODULEDIR)/juce_audio_devices.a | ||||
STANDALONE_LIBS += $(MODULEDIR)/juce_audio_processors.a | STANDALONE_LIBS += $(MODULEDIR)/juce_audio_processors.a | ||||
STANDALONE_LIBS += $(MODULEDIR)/juce_data_structures.a | STANDALONE_LIBS += $(MODULEDIR)/juce_data_structures.a | ||||
STANDALONE_LIBS += $(MODULEDIR)/juce_events.a | |||||
STANDALONE_LIBS += $(MODULEDIR)/juce_graphics.a | STANDALONE_LIBS += $(MODULEDIR)/juce_graphics.a | ||||
STANDALONE_LIBS += $(MODULEDIR)/juce_gui_basics.a | STANDALONE_LIBS += $(MODULEDIR)/juce_gui_basics.a | ||||
ifeq ($(MACOS),true) | ifeq ($(MACOS),true) | ||||
@@ -59,12 +59,12 @@ endif | |||||
UTILS_LIBS = $(MODULEDIR)/juce_audio_basics.a | UTILS_LIBS = $(MODULEDIR)/juce_audio_basics.a | ||||
UTILS_LIBS += $(MODULEDIR)/juce_audio_formats.a | UTILS_LIBS += $(MODULEDIR)/juce_audio_formats.a | ||||
UTILS_LIBS += $(MODULEDIR)/juce_core.a | UTILS_LIBS += $(MODULEDIR)/juce_core.a | ||||
UTILS_LIBS += $(MODULEDIR)/juce_events.a | |||||
UTILS_LIBS += $(MODULEDIR)/lilv.a | UTILS_LIBS += $(MODULEDIR)/lilv.a | ||||
ifeq ($(MACOS),true) | ifeq ($(MACOS),true) | ||||
UTILS_LIBS += $(MODULEDIR)/juce_audio_processors.a | UTILS_LIBS += $(MODULEDIR)/juce_audio_processors.a | ||||
UTILS_LIBS += $(MODULEDIR)/juce_data_structures.a | UTILS_LIBS += $(MODULEDIR)/juce_data_structures.a | ||||
UTILS_LIBS += $(MODULEDIR)/juce_events.a | |||||
UTILS_LIBS += $(MODULEDIR)/juce_graphics.a | UTILS_LIBS += $(MODULEDIR)/juce_graphics.a | ||||
UTILS_LIBS += $(MODULEDIR)/juce_gui_basics.a | UTILS_LIBS += $(MODULEDIR)/juce_gui_basics.a | ||||
UTILS_LIBS += $(MODULEDIR)/juce_gui_extra.a | UTILS_LIBS += $(MODULEDIR)/juce_gui_extra.a | ||||
@@ -1340,7 +1340,7 @@ public: | |||||
int getNumPrograms() override { return 0; } | int getNumPrograms() override { return 0; } | ||||
int getCurrentProgram() override { return 0; } | int getCurrentProgram() override { return 0; } | ||||
#ifndef JUCE_AUDIO_PROCESSOR_NO_GUI | |||||
#if ! JUCE_AUDIOPROCESSOR_NO_GUI | |||||
bool hasEditor() const override { return false; } | bool hasEditor() const override { return false; } | ||||
AudioProcessorEditor* createEditor() override { return nullptr; } | AudioProcessorEditor* createEditor() override { return nullptr; } | ||||
#endif | #endif | ||||
@@ -39,22 +39,18 @@ | |||||
#if defined(CARLA_OS_MAC) || defined(CARLA_OS_WIN) | #if defined(CARLA_OS_MAC) || defined(CARLA_OS_WIN) | ||||
# include "juce_gui_basics/juce_gui_basics.h" | # include "juce_gui_basics/juce_gui_basics.h" | ||||
#else | #else | ||||
namespace juce { | |||||
# include "juce_events/messages/juce_Initialisation.h" | |||||
} // namespace juce | |||||
# include "juce_events/juce_events.h" | |||||
#endif | #endif | ||||
using juce::File; | using juce::File; | ||||
using juce::FloatVectorOperations; | using juce::FloatVectorOperations; | ||||
using juce::MemoryOutputStream; | using juce::MemoryOutputStream; | ||||
using juce::ScopedJuceInitialiser_GUI; | |||||
using juce::ScopedPointer; | using juce::ScopedPointer; | ||||
using juce::String; | using juce::String; | ||||
using juce::XmlDocument; | using juce::XmlDocument; | ||||
using juce::XmlElement; | using juce::XmlElement; | ||||
static bool gNeedsJuceHandling = false; | |||||
static int gJuceReferenceCounter = 0; | |||||
CARLA_BACKEND_START_NAMESPACE | CARLA_BACKEND_START_NAMESPACE | ||||
// ----------------------------------------------------------------------- | // ----------------------------------------------------------------------- | ||||
@@ -603,11 +599,6 @@ public: | |||||
{ | { | ||||
carla_debug("CarlaEngineNative::CarlaEngineNative()"); | carla_debug("CarlaEngineNative::CarlaEngineNative()"); | ||||
CARLA_SAFE_ASSERT_INT(gJuceReferenceCounter >= 0, gJuceReferenceCounter); | |||||
if (gNeedsJuceHandling && ++gJuceReferenceCounter == 1) | |||||
juce::initialiseJuce_GUI(); | |||||
carla_zeroChars(fTmpBuf, STR_MAX+1); | carla_zeroChars(fTmpBuf, STR_MAX+1); | ||||
pData->bufferSize = pHost->get_buffer_size(pHost->handle); | pData->bufferSize = pHost->get_buffer_size(pHost->handle); | ||||
@@ -666,9 +657,6 @@ public: | |||||
pData->graph.destroy(); | pData->graph.destroy(); | ||||
if (gNeedsJuceHandling && --gJuceReferenceCounter == 0) | |||||
juce::shutdownJuce_GUI(); | |||||
carla_debug("CarlaEngineNative::~CarlaEngineNative() - END"); | carla_debug("CarlaEngineNative::~CarlaEngineNative() - END"); | ||||
} | } | ||||
@@ -1846,6 +1834,8 @@ private: | |||||
bool fWaitForReadyMsg; | bool fWaitForReadyMsg; | ||||
char fTmpBuf[STR_MAX+1]; | char fTmpBuf[STR_MAX+1]; | ||||
const ScopedJuceInitialiser_GUI juceGuiInit; | |||||
CarlaPlugin* _getFirstPlugin() const noexcept | CarlaPlugin* _getFirstPlugin() const noexcept | ||||
{ | { | ||||
if (pData->curPluginCount == 0 || pData->plugins == nullptr) | if (pData->curPluginCount == 0 || pData->plugins == nullptr) | ||||
@@ -2097,9 +2087,6 @@ CARLA_EXPORT | |||||
const NativePluginDescriptor* carla_get_native_rack_plugin(); | const NativePluginDescriptor* carla_get_native_rack_plugin(); | ||||
const NativePluginDescriptor* carla_get_native_rack_plugin() | const NativePluginDescriptor* carla_get_native_rack_plugin() | ||||
{ | { | ||||
// if this is called then we're running as special plugin | |||||
gNeedsJuceHandling = true; | |||||
CARLA_BACKEND_USE_NAMESPACE; | CARLA_BACKEND_USE_NAMESPACE; | ||||
return &carlaRackDesc; | return &carlaRackDesc; | ||||
} | } | ||||
@@ -2108,9 +2095,6 @@ CARLA_EXPORT | |||||
const NativePluginDescriptor* carla_get_native_patchbay_plugin(); | const NativePluginDescriptor* carla_get_native_patchbay_plugin(); | ||||
const NativePluginDescriptor* carla_get_native_patchbay_plugin() | const NativePluginDescriptor* carla_get_native_patchbay_plugin() | ||||
{ | { | ||||
// if this is called then we're running as special plugin | |||||
gNeedsJuceHandling = true; | |||||
CARLA_BACKEND_USE_NAMESPACE; | CARLA_BACKEND_USE_NAMESPACE; | ||||
return &carlaPatchbayDesc; | return &carlaPatchbayDesc; | ||||
} | } | ||||
@@ -2146,7 +2130,7 @@ CARLA_BACKEND_END_NAMESPACE | |||||
#include "CarlaPatchbayUtils.cpp" | #include "CarlaPatchbayUtils.cpp" | ||||
#include "CarlaPipeUtils.cpp" | #include "CarlaPipeUtils.cpp" | ||||
#include "CarlaStateUtils.cpp" | #include "CarlaStateUtils.cpp" | ||||
#include "CarlaJuceEvents.cpp" | |||||
#include "CarlaJuceAudioProcessors.cpp" | |||||
#endif | #endif | ||||
@@ -66,8 +66,8 @@ | |||||
#define JUCE_USE_VFORK 1 | #define JUCE_USE_VFORK 1 | ||||
#if ! (defined(APPCONFIG_OS_MAC) || defined(APPCONFIG_OS_WIN)) | #if ! (defined(APPCONFIG_OS_MAC) || defined(APPCONFIG_OS_WIN)) | ||||
# define JUCE_MODAL_LOOPS_PERMITTED 0 | |||||
# define JUCE_AUDIO_PROCESSOR_NO_GUI 1 | |||||
# define JUCE_MODAL_LOOPS_PERMITTED 0 | |||||
# define JUCE_AUDIOPROCESSOR_NO_GUI 1 | |||||
#endif | #endif | ||||
// -------------------------------------------------------------------------------------------------------------------- | // -------------------------------------------------------------------------------------------------------------------- | ||||
@@ -29,5 +29,6 @@ endif | |||||
BUILD_C_FLAGS += -I. -I$(CWD)/includes | BUILD_C_FLAGS += -I. -I$(CWD)/includes | ||||
BUILD_CXX_FLAGS += -I. -I$(CWD)/includes -I$(CWD)/utils | BUILD_CXX_FLAGS += -I. -I$(CWD)/includes -I$(CWD)/utils | ||||
BUILD_CXX_FLAGS += -DJUCE_APP_CONFIG_HEADER='<AppConfig.h>' | |||||
# ---------------------------------------------------------------------------------------------------------------------------- | # ---------------------------------------------------------------------------------------------------------------------------- |
@@ -2,28 +2,25 @@ | |||||
============================================================================== | ============================================================================== | ||||
This file is part of the JUCE library. | This file is part of the JUCE library. | ||||
Copyright (c) 2015 - ROLI Ltd. | |||||
Copyright (c) 2017 - ROLI Ltd. | |||||
Permission is granted to use this software under the terms of either: | |||||
a) the GPL v2 (or any later version) | |||||
b) the Affero GPL v3 | |||||
JUCE is an open source library subject to commercial or open-source | |||||
licensing. | |||||
Details of these licenses can be found at: www.gnu.org/licenses | |||||
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 distributed in the hope that it will be useful, but WITHOUT ANY | |||||
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR | |||||
A PARTICULAR PURPOSE. See the GNU General Public License for more details. | |||||
------------------------------------------------------------------------------ | |||||
To release a closed-source product which uses JUCE, commercial licenses are | |||||
available: visit www.juce.com for more information. | |||||
JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER | |||||
EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE | |||||
DISCLAIMED. | |||||
============================================================================== | ============================================================================== | ||||
*/ | */ | ||||
#ifndef JUCE_AUDIOPLAYHEAD_H_INCLUDED | |||||
#define JUCE_AUDIOPLAYHEAD_H_INCLUDED | |||||
#pragma once | |||||
//============================================================================== | //============================================================================== | ||||
@@ -55,6 +52,8 @@ public: | |||||
fps30 = 3, | fps30 = 3, | ||||
fps2997drop = 4, | fps2997drop = 4, | ||||
fps30drop = 5, | fps30drop = 5, | ||||
fps60 = 6, | |||||
fps60drop = 7, | |||||
fpsUnknown = 99 | fpsUnknown = 99 | ||||
}; | }; | ||||
@@ -138,7 +137,16 @@ public: | |||||
multithreading issues if it's not called on the audio thread. | multithreading issues if it's not called on the audio thread. | ||||
*/ | */ | ||||
virtual bool getCurrentPosition (CurrentPositionInfo& result) = 0; | virtual bool getCurrentPosition (CurrentPositionInfo& result) = 0; | ||||
}; | |||||
/** Returns true if this object can control the transport. */ | |||||
virtual bool canControlTransport() { return false; } | |||||
#endif // JUCE_AUDIOPLAYHEAD_H_INCLUDED | |||||
/** Starts or stops the audio. */ | |||||
virtual void transportPlay (bool shouldStartPlaying) { ignoreUnused (shouldStartPlaying); } | |||||
/** Starts or stops recording the audio. */ | |||||
virtual void transportRecord (bool shouldStartRecording) { ignoreUnused (shouldStartRecording); } | |||||
/** Rewinds the audio. */ | |||||
virtual void transportRewind() {} | |||||
}; |
@@ -2,33 +2,30 @@ | |||||
============================================================================== | ============================================================================== | ||||
This file is part of the JUCE library. | This file is part of the JUCE library. | ||||
Copyright (c) 2016 - ROLI Ltd. | |||||
Copyright (c) 2017 - ROLI Ltd. | |||||
Permission is granted to use this software under the terms of the ISC license | |||||
http://www.isc.org/downloads/software-support-policy/isc-license/ | |||||
JUCE is an open source library subject to commercial or open-source | |||||
licensing. | |||||
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. | |||||
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. | |||||
THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH REGARD | |||||
TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND | |||||
FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, | |||||
OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF | |||||
USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER | |||||
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE | |||||
OF THIS SOFTWARE. | |||||
----------------------------------------------------------------------------- | |||||
To release a closed-source product which uses other parts of JUCE not | |||||
licensed under the ISC terms, commercial licenses are available: visit | |||||
www.juce.com for more information. | |||||
JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER | |||||
EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE | |||||
DISCLAIMED. | |||||
============================================================================== | ============================================================================== | ||||
*/ | */ | ||||
AudioChannelSet::AudioChannelSet (uint32 c) : channels (c) {} | AudioChannelSet::AudioChannelSet (uint32 c) : channels (c) {} | ||||
AudioChannelSet::AudioChannelSet (const Array<ChannelType>& c) | |||||
{ | |||||
for (auto channel : c) | |||||
addChannel (channel); | |||||
} | |||||
bool AudioChannelSet::operator== (const AudioChannelSet& other) const noexcept { return channels == other.channels; } | bool AudioChannelSet::operator== (const AudioChannelSet& other) const noexcept { return channels == other.channels; } | ||||
bool AudioChannelSet::operator!= (const AudioChannelSet& other) const noexcept { return channels != other.channels; } | bool AudioChannelSet::operator!= (const AudioChannelSet& other) const noexcept { return channels != other.channels; } | ||||
@@ -37,7 +34,7 @@ bool AudioChannelSet::operator< (const AudioChannelSet& other) const noexcept | |||||
String AudioChannelSet::getChannelTypeName (AudioChannelSet::ChannelType type) | String AudioChannelSet::getChannelTypeName (AudioChannelSet::ChannelType type) | ||||
{ | { | ||||
if (type >= discreteChannel0) | if (type >= discreteChannel0) | ||||
return String ("Discrete ") + String (type - discreteChannel0 + 1); | |||||
return "Discrete " + String (type - discreteChannel0 + 1); | |||||
switch (type) | switch (type) | ||||
{ | { | ||||
@@ -62,8 +59,8 @@ String AudioChannelSet::getChannelTypeName (AudioChannelSet::ChannelType type) | |||||
case wideLeft: return NEEDS_TRANS("Wide Left"); | case wideLeft: return NEEDS_TRANS("Wide Left"); | ||||
case wideRight: return NEEDS_TRANS("Wide Right"); | case wideRight: return NEEDS_TRANS("Wide Right"); | ||||
case LFE2: return NEEDS_TRANS("LFE 2"); | case LFE2: return NEEDS_TRANS("LFE 2"); | ||||
case leftSurroundSide: return NEEDS_TRANS ("Left Surround Side"); | |||||
case rightSurroundSide: return NEEDS_TRANS ("Right Surround Side"); | |||||
case leftSurroundSide: return NEEDS_TRANS("Left Surround Side"); | |||||
case rightSurroundSide: return NEEDS_TRANS("Right Surround Side"); | |||||
case ambisonicW: return NEEDS_TRANS("Ambisonic W"); | case ambisonicW: return NEEDS_TRANS("Ambisonic W"); | ||||
case ambisonicX: return NEEDS_TRANS("Ambisonic X"); | case ambisonicX: return NEEDS_TRANS("Ambisonic X"); | ||||
case ambisonicY: return NEEDS_TRANS("Ambisonic Y"); | case ambisonicY: return NEEDS_TRANS("Ambisonic Y"); | ||||
@@ -111,7 +108,7 @@ String AudioChannelSet::getAbbreviatedChannelTypeName (AudioChannelSet::ChannelT | |||||
default: break; | default: break; | ||||
} | } | ||||
return ""; | |||||
return {}; | |||||
} | } | ||||
AudioChannelSet::ChannelType AudioChannelSet::getChannelTypeFromAbbreviation (const String& abbr) | AudioChannelSet::ChannelType AudioChannelSet::getChannelTypeFromAbbreviation (const String& abbr) | ||||
@@ -120,33 +117,33 @@ AudioChannelSet::ChannelType AudioChannelSet::getChannelTypeFromAbbreviation (co | |||||
return static_cast<AudioChannelSet::ChannelType> (static_cast<int> (discreteChannel0) | return static_cast<AudioChannelSet::ChannelType> (static_cast<int> (discreteChannel0) | ||||
+ abbr.getIntValue() + 1); | + abbr.getIntValue() + 1); | ||||
if (abbr == "L") return left; | |||||
else if (abbr == "R") return right; | |||||
else if (abbr == "C") return centre; | |||||
else if (abbr == "Lfe") return LFE; | |||||
else if (abbr == "Ls") return leftSurround; | |||||
else if (abbr == "Rs") return rightSurround; | |||||
else if (abbr == "Lc") return leftCentre; | |||||
else if (abbr == "Rc") return rightCentre; | |||||
else if (abbr == "Cs") return centreSurround; | |||||
else if (abbr == "Lrs") return leftSurroundRear; | |||||
else if (abbr == "Rrs") return rightSurroundRear; | |||||
else if (abbr == "Tm") return topMiddle; | |||||
else if (abbr == "Tfl") return topFrontLeft; | |||||
else if (abbr == "Tfc") return topFrontCentre; | |||||
else if (abbr == "Tfr") return topFrontRight; | |||||
else if (abbr == "Trl") return topRearLeft; | |||||
else if (abbr == "Trc") return topRearCentre; | |||||
else if (abbr == "Trr") return topRearRight; | |||||
else if (abbr == "Wl") return wideLeft; | |||||
else if (abbr == "Wr") return wideRight; | |||||
else if (abbr == "Lfe2") return LFE2; | |||||
else if (abbr == "Lss") return leftSurroundSide; | |||||
else if (abbr == "Rss") return rightSurroundSide; | |||||
else if (abbr == "W") return ambisonicW; | |||||
else if (abbr == "X") return ambisonicX; | |||||
else if (abbr == "Y") return ambisonicY; | |||||
else if (abbr == "Z") return ambisonicZ; | |||||
if (abbr == "L") return left; | |||||
if (abbr == "R") return right; | |||||
if (abbr == "C") return centre; | |||||
if (abbr == "Lfe") return LFE; | |||||
if (abbr == "Ls") return leftSurround; | |||||
if (abbr == "Rs") return rightSurround; | |||||
if (abbr == "Lc") return leftCentre; | |||||
if (abbr == "Rc") return rightCentre; | |||||
if (abbr == "Cs") return centreSurround; | |||||
if (abbr == "Lrs") return leftSurroundRear; | |||||
if (abbr == "Rrs") return rightSurroundRear; | |||||
if (abbr == "Tm") return topMiddle; | |||||
if (abbr == "Tfl") return topFrontLeft; | |||||
if (abbr == "Tfc") return topFrontCentre; | |||||
if (abbr == "Tfr") return topFrontRight; | |||||
if (abbr == "Trl") return topRearLeft; | |||||
if (abbr == "Trc") return topRearCentre; | |||||
if (abbr == "Trr") return topRearRight; | |||||
if (abbr == "Wl") return wideLeft; | |||||
if (abbr == "Wr") return wideRight; | |||||
if (abbr == "Lfe2") return LFE2; | |||||
if (abbr == "Lss") return leftSurroundSide; | |||||
if (abbr == "Rss") return rightSurroundSide; | |||||
if (abbr == "W") return ambisonicW; | |||||
if (abbr == "X") return ambisonicX; | |||||
if (abbr == "Y") return ambisonicY; | |||||
if (abbr == "Z") return ambisonicZ; | |||||
return unknown; | return unknown; | ||||
} | } | ||||
@@ -154,11 +151,10 @@ AudioChannelSet::ChannelType AudioChannelSet::getChannelTypeFromAbbreviation (co | |||||
String AudioChannelSet::getSpeakerArrangementAsString() const | String AudioChannelSet::getSpeakerArrangementAsString() const | ||||
{ | { | ||||
StringArray speakerTypes; | StringArray speakerTypes; | ||||
Array<AudioChannelSet::ChannelType> speakers = getChannelTypes(); | |||||
for (int i = 0; i < speakers.size(); ++i) | |||||
for (auto& speaker : getChannelTypes()) | |||||
{ | { | ||||
String name = getAbbreviatedChannelTypeName (speakers.getReference (i)); | |||||
auto name = getAbbreviatedChannelTypeName (speaker); | |||||
if (name.isNotEmpty()) | if (name.isNotEmpty()) | ||||
speakerTypes.add (name); | speakerTypes.add (name); | ||||
@@ -169,12 +165,11 @@ String AudioChannelSet::getSpeakerArrangementAsString() const | |||||
AudioChannelSet AudioChannelSet::fromAbbreviatedString (const String& str) | AudioChannelSet AudioChannelSet::fromAbbreviatedString (const String& str) | ||||
{ | { | ||||
StringArray abbr = StringArray::fromTokens(str, true); | |||||
AudioChannelSet set; | AudioChannelSet set; | ||||
for (int i = 0; i < abbr.size(); ++i) | |||||
for (auto& abbr : StringArray::fromTokens (str, true)) | |||||
{ | { | ||||
AudioChannelSet::ChannelType type = getChannelTypeFromAbbreviation (abbr[i]); | |||||
auto type = getChannelTypeFromAbbreviation (abbr); | |||||
if (type != unknown) | if (type != unknown) | ||||
set.addChannel (type); | set.addChannel (type); | ||||
@@ -185,7 +180,7 @@ AudioChannelSet AudioChannelSet::fromAbbreviatedString (const String& str) | |||||
String AudioChannelSet::getDescription() const | String AudioChannelSet::getDescription() const | ||||
{ | { | ||||
if (isDiscreteLayout()) return String ("Discrete #") + String (size()); | |||||
if (isDiscreteLayout()) return "Discrete #" + String (size()); | |||||
if (*this == disabled()) return "Disabled"; | if (*this == disabled()) return "Disabled"; | ||||
if (*this == mono()) return "Mono"; | if (*this == mono()) return "Mono"; | ||||
if (*this == stereo()) return "Stereo"; | if (*this == stereo()) return "Stereo"; | ||||
@@ -194,16 +189,16 @@ String AudioChannelSet::getDescription() const | |||||
if (*this == createLRS()) return "LRS"; | if (*this == createLRS()) return "LRS"; | ||||
if (*this == createLCRS()) return "LCRS"; | if (*this == createLCRS()) return "LCRS"; | ||||
if (*this == create5point0()) return "5.1 Surround"; | |||||
if (*this == create5point1()) return "5.1 Surround (+Lfe)"; | |||||
if (*this == create6point0()) return "6.1 Surround"; | |||||
if (*this == create6point1()) return "6.1 Surround (+Lfe)"; | |||||
if (*this == create6point0Music()) return "6.1 (Music) Surround"; | |||||
if (*this == create6point1Music()) return "6.1 (Music) Surround (+Lfe)"; | |||||
if (*this == create7point0()) return "7.1 Surround"; | |||||
if (*this == create7point1()) return "7.1 Surround (Lfe)"; | |||||
if (*this == create7point0SDDS()) return "7.1 Surround SDDS"; | |||||
if (*this == create7point1SDDS()) return "7.1 Surround SDDS (+Lfe)"; | |||||
if (*this == create5point0()) return "5.0 Surround"; | |||||
if (*this == create5point1()) return "5.1 Surround"; | |||||
if (*this == create6point0()) return "6.0 Surround"; | |||||
if (*this == create6point1()) return "6.1 Surround"; | |||||
if (*this == create6point0Music()) return "6.0 (Music) Surround"; | |||||
if (*this == create6point1Music()) return "6.1 (Music) Surround"; | |||||
if (*this == create7point0()) return "7.0 Surround"; | |||||
if (*this == create7point1()) return "7.1 Surround"; | |||||
if (*this == create7point0SDDS()) return "7.0 Surround SDDS"; | |||||
if (*this == create7point1SDDS()) return "7.1 Surround SDDS"; | |||||
if (*this == quadraphonic()) return "Quadraphonic"; | if (*this == quadraphonic()) return "Quadraphonic"; | ||||
if (*this == pentagonal()) return "Pentagonal"; | if (*this == pentagonal()) return "Pentagonal"; | ||||
@@ -211,19 +206,16 @@ String AudioChannelSet::getDescription() const | |||||
if (*this == octagonal()) return "Octagonal"; | if (*this == octagonal()) return "Octagonal"; | ||||
if (*this == ambisonic()) return "Ambisonic"; | if (*this == ambisonic()) return "Ambisonic"; | ||||
return "Unknown"; | return "Unknown"; | ||||
} | } | ||||
bool AudioChannelSet::isDiscreteLayout() const noexcept | bool AudioChannelSet::isDiscreteLayout() const noexcept | ||||
{ | { | ||||
Array<AudioChannelSet::ChannelType> speakers = getChannelTypes(); | |||||
for (int i = 0; i < speakers.size(); ++i) | |||||
if (speakers.getReference (i) > ambisonicZ) | |||||
return true; | |||||
for (auto& speaker : getChannelTypes()) | |||||
if (speaker <= ambisonicZ) | |||||
return false; | |||||
return false; | |||||
return true; | |||||
} | } | ||||
int AudioChannelSet::size() const noexcept | int AudioChannelSet::size() const noexcept | ||||
@@ -244,6 +236,7 @@ AudioChannelSet::ChannelType AudioChannelSet::getTypeOfChannel (int index) const | |||||
int AudioChannelSet::getChannelIndexForType (AudioChannelSet::ChannelType type) const noexcept | int AudioChannelSet::getChannelIndexForType (AudioChannelSet::ChannelType type) const noexcept | ||||
{ | { | ||||
int idx = 0; | int idx = 0; | ||||
for (int bit = channels.findNextSetBit (0); bit >= 0; bit = channels.findNextSetBit (bit + 1)) | for (int bit = channels.findNextSetBit (0); bit >= 0; bit = channels.findNextSetBit (bit + 1)) | ||||
{ | { | ||||
if (static_cast<ChannelType> (bit) == type) | if (static_cast<ChannelType> (bit) == type) | ||||
@@ -279,27 +272,27 @@ void AudioChannelSet::removeChannel (ChannelType newChannel) | |||||
channels.clearBit (bit); | channels.clearBit (bit); | ||||
} | } | ||||
AudioChannelSet AudioChannelSet::disabled() { return AudioChannelSet(); } | |||||
AudioChannelSet AudioChannelSet::disabled() { return {}; } | |||||
AudioChannelSet AudioChannelSet::mono() { return AudioChannelSet (1u << centre); } | AudioChannelSet AudioChannelSet::mono() { return AudioChannelSet (1u << centre); } | ||||
AudioChannelSet AudioChannelSet::stereo() { return AudioChannelSet ((1u << left) | (1u << right)); } | AudioChannelSet AudioChannelSet::stereo() { return AudioChannelSet ((1u << left) | (1u << right)); } | ||||
AudioChannelSet AudioChannelSet::createLCR() { return AudioChannelSet ((1u << left) | (1u << right) | (1u << centre)); } | AudioChannelSet AudioChannelSet::createLCR() { return AudioChannelSet ((1u << left) | (1u << right) | (1u << centre)); } | ||||
AudioChannelSet AudioChannelSet::createLRS() { return AudioChannelSet ((1u << left) | (1u << right) | (1u << surround)); } | AudioChannelSet AudioChannelSet::createLRS() { return AudioChannelSet ((1u << left) | (1u << right) | (1u << surround)); } | ||||
AudioChannelSet AudioChannelSet::createLCRS() { return AudioChannelSet ((1u << left) | (1u << right) | (1u << centre) | (1u << surround)); } | AudioChannelSet AudioChannelSet::createLCRS() { return AudioChannelSet ((1u << left) | (1u << right) | (1u << centre) | (1u << surround)); } | ||||
AudioChannelSet AudioChannelSet::create5point0() { return AudioChannelSet ((1u << left) | (1u << right) | (1u << centre) | (1u << leftSurround) | (1u << rightSurround)); } | AudioChannelSet AudioChannelSet::create5point0() { return AudioChannelSet ((1u << left) | (1u << right) | (1u << centre) | (1u << leftSurround) | (1u << rightSurround)); } | ||||
AudioChannelSet AudioChannelSet::create5point1() { return AudioChannelSet ((1u << left) | (1u << right) | (1u << centre) | (1u << leftSurround) | (1u << rightSurround) | (1u << LFE)); } | |||||
AudioChannelSet AudioChannelSet::create5point1() { return AudioChannelSet ((1u << left) | (1u << right) | (1u << centre) | (1u << LFE) | (1u << leftSurround) | (1u << rightSurround)); } | |||||
AudioChannelSet AudioChannelSet::create6point0() { return AudioChannelSet ((1u << left) | (1u << right) | (1u << centre) | (1u << leftSurround) | (1u << rightSurround) | (1u << centreSurround)); } | AudioChannelSet AudioChannelSet::create6point0() { return AudioChannelSet ((1u << left) | (1u << right) | (1u << centre) | (1u << leftSurround) | (1u << rightSurround) | (1u << centreSurround)); } | ||||
AudioChannelSet AudioChannelSet::create6point1() { return AudioChannelSet ((1u << left) | (1u << right) | (1u << centre) | (1u << leftSurround) | (1u << rightSurround) | (1u << centreSurround) | (1u << LFE)); } | |||||
AudioChannelSet AudioChannelSet::create6point1() { return AudioChannelSet ((1u << left) | (1u << right) | (1u << centre) | (1u << LFE) | (1u << leftSurround) | (1u << rightSurround) | (1u << centreSurround)); } | |||||
AudioChannelSet AudioChannelSet::create6point0Music() { return AudioChannelSet ((1u << left) | (1u << right) | (1u << leftSurround) | (1u << rightSurround) | (1u << leftSurroundSide) | (1u << rightSurroundSide)); } | AudioChannelSet AudioChannelSet::create6point0Music() { return AudioChannelSet ((1u << left) | (1u << right) | (1u << leftSurround) | (1u << rightSurround) | (1u << leftSurroundSide) | (1u << rightSurroundSide)); } | ||||
AudioChannelSet AudioChannelSet::create6point1Music() { return AudioChannelSet ((1u << left) | (1u << right) | (1u << leftSurround) | (1u << rightSurround) | (1u << leftSurroundSide) | (1u << rightSurroundSide) | (1u << LFE)); } | |||||
AudioChannelSet AudioChannelSet::create6point1Music() { return AudioChannelSet ((1u << left) | (1u << right) | (1u << LFE) | (1u << leftSurround) | (1u << rightSurround) | (1u << leftSurroundSide) | (1u << rightSurroundSide)); } | |||||
AudioChannelSet AudioChannelSet::create7point0() { return AudioChannelSet ((1u << left) | (1u << right) | (1u << centre) | (1u << leftSurroundSide) | (1u << rightSurroundSide) | (1u << leftSurroundRear) | (1u << rightSurroundRear)); } | AudioChannelSet AudioChannelSet::create7point0() { return AudioChannelSet ((1u << left) | (1u << right) | (1u << centre) | (1u << leftSurroundSide) | (1u << rightSurroundSide) | (1u << leftSurroundRear) | (1u << rightSurroundRear)); } | ||||
AudioChannelSet AudioChannelSet::create7point0SDDS() { return AudioChannelSet ((1u << left) | (1u << right) | (1u << centre) | (1u << leftSurround) | (1u << rightSurround) | (1u << leftCentre) | (1u << rightCentre)); } | AudioChannelSet AudioChannelSet::create7point0SDDS() { return AudioChannelSet ((1u << left) | (1u << right) | (1u << centre) | (1u << leftSurround) | (1u << rightSurround) | (1u << leftCentre) | (1u << rightCentre)); } | ||||
AudioChannelSet AudioChannelSet::create7point1() { return AudioChannelSet ((1u << left) | (1u << right) | (1u << centre) | (1u << leftSurroundSide) | (1u << rightSurroundSide) | (1u << leftSurroundRear) | (1u << rightSurroundRear) | (1u << LFE)); } | |||||
AudioChannelSet AudioChannelSet::create7point1SDDS() { return AudioChannelSet ((1u << left) | (1u << right) | (1u << centre) | (1u << leftSurround) | (1u << rightSurround) | (1u << leftCentre) | (1u << rightCentre) | (1u << LFE)); } | |||||
AudioChannelSet AudioChannelSet::create7point1() { return AudioChannelSet ((1u << left) | (1u << right) | (1u << centre) | (1u << LFE) | (1u << leftSurroundSide) | (1u << rightSurroundSide) | (1u << leftSurroundRear) | (1u << rightSurroundRear)); } | |||||
AudioChannelSet AudioChannelSet::create7point1SDDS() { return AudioChannelSet ((1u << left) | (1u << right) | (1u << centre) | (1u << LFE) | (1u << leftSurround) | (1u << rightSurround) | (1u << leftCentre) | (1u << rightCentre)); } | |||||
AudioChannelSet AudioChannelSet::ambisonic() { return AudioChannelSet ((1u << ambisonicW) | (1u << ambisonicX) | (1u << ambisonicY) | (1u << ambisonicZ)); } | AudioChannelSet AudioChannelSet::ambisonic() { return AudioChannelSet ((1u << ambisonicW) | (1u << ambisonicX) | (1u << ambisonicY) | (1u << ambisonicZ)); } | ||||
AudioChannelSet AudioChannelSet::quadraphonic() { return AudioChannelSet ((1u << left) | (1u << right) | (1u << leftSurround) | (1u << rightSurround)); } | AudioChannelSet AudioChannelSet::quadraphonic() { return AudioChannelSet ((1u << left) | (1u << right) | (1u << leftSurround) | (1u << rightSurround)); } | ||||
AudioChannelSet AudioChannelSet::pentagonal() { return AudioChannelSet ((1u << left) | (1u << right) | (1u << centre) | (1u << leftSurroundRear) | (1u << rightSurroundRear)); } | AudioChannelSet AudioChannelSet::pentagonal() { return AudioChannelSet ((1u << left) | (1u << right) | (1u << centre) | (1u << leftSurroundRear) | (1u << rightSurroundRear)); } | ||||
AudioChannelSet AudioChannelSet::hexagonal() { return AudioChannelSet ((1u << left) | (1u << right) | (1u << leftSurroundRear) | (1u << rightSurroundRear) | (1u << centre) | (1u << centreSurround)); } | |||||
AudioChannelSet AudioChannelSet::octagonal() { return AudioChannelSet ((1u << left) | (1u << right) | (1u << leftSurround) | (1u << rightSurround) | (1u << centre) | (1u << centreSurround) | (1u << wideLeft) | (1u << wideRight)); } | |||||
AudioChannelSet AudioChannelSet::hexagonal() { return AudioChannelSet ((1u << left) | (1u << right) | (1u << centre) | (1u << centreSurround) | (1u << leftSurroundRear) | (1u << rightSurroundRear)); } | |||||
AudioChannelSet AudioChannelSet::octagonal() { return AudioChannelSet ((1u << left) | (1u << right) | (1u << centre) | (1u << leftSurround) | (1u << rightSurround) | (1u << centreSurround) | (1u << wideLeft) | (1u << wideRight)); } | |||||
AudioChannelSet AudioChannelSet::discreteChannels (int numChannels) | AudioChannelSet AudioChannelSet::discreteChannels (int numChannels) | ||||
@@ -311,30 +304,30 @@ AudioChannelSet AudioChannelSet::discreteChannels (int numChannels) | |||||
AudioChannelSet AudioChannelSet::canonicalChannelSet (int numChannels) | AudioChannelSet AudioChannelSet::canonicalChannelSet (int numChannels) | ||||
{ | { | ||||
if (numChannels == 1) return AudioChannelSet::mono(); | |||||
if (numChannels == 2) return AudioChannelSet::stereo(); | |||||
if (numChannels == 3) return AudioChannelSet::createLCR(); | |||||
if (numChannels == 4) return AudioChannelSet::quadraphonic(); | |||||
if (numChannels == 5) return AudioChannelSet::create5point0(); | |||||
if (numChannels == 6) return AudioChannelSet::create5point1(); | |||||
if (numChannels == 7) return AudioChannelSet::create7point0(); | |||||
if (numChannels == 8) return AudioChannelSet::create7point1(); | |||||
if (numChannels == 1) return AudioChannelSet::mono(); | |||||
if (numChannels == 2) return AudioChannelSet::stereo(); | |||||
if (numChannels == 3) return AudioChannelSet::createLCR(); | |||||
if (numChannels == 4) return AudioChannelSet::quadraphonic(); | |||||
if (numChannels == 5) return AudioChannelSet::create5point0(); | |||||
if (numChannels == 6) return AudioChannelSet::create5point1(); | |||||
if (numChannels == 7) return AudioChannelSet::create7point0(); | |||||
if (numChannels == 8) return AudioChannelSet::create7point1(); | |||||
return discreteChannels (numChannels); | return discreteChannels (numChannels); | ||||
} | } | ||||
AudioChannelSet AudioChannelSet::namedChannelSet (int numChannels) | AudioChannelSet AudioChannelSet::namedChannelSet (int numChannels) | ||||
{ | { | ||||
if (numChannels == 1) return AudioChannelSet::mono(); | |||||
if (numChannels == 2) return AudioChannelSet::stereo(); | |||||
if (numChannels == 3) return AudioChannelSet::createLCR(); | |||||
if (numChannels == 4) return AudioChannelSet::quadraphonic(); | |||||
if (numChannels == 5) return AudioChannelSet::create5point0(); | |||||
if (numChannels == 6) return AudioChannelSet::create5point1(); | |||||
if (numChannels == 7) return AudioChannelSet::create7point0(); | |||||
if (numChannels == 8) return AudioChannelSet::create7point1(); | |||||
return AudioChannelSet(); | |||||
if (numChannels == 1) return AudioChannelSet::mono(); | |||||
if (numChannels == 2) return AudioChannelSet::stereo(); | |||||
if (numChannels == 3) return AudioChannelSet::createLCR(); | |||||
if (numChannels == 4) return AudioChannelSet::quadraphonic(); | |||||
if (numChannels == 5) return AudioChannelSet::create5point0(); | |||||
if (numChannels == 6) return AudioChannelSet::create5point1(); | |||||
if (numChannels == 7) return AudioChannelSet::create7point0(); | |||||
if (numChannels == 8) return AudioChannelSet::create7point1(); | |||||
return {}; | |||||
} | } | ||||
Array<AudioChannelSet> AudioChannelSet::channelSetsWithNumberOfChannels (int numChannels) | Array<AudioChannelSet> AudioChannelSet::channelSetsWithNumberOfChannels (int numChannels) | ||||
@@ -393,3 +386,31 @@ Array<AudioChannelSet> AudioChannelSet::channelSetsWithNumberOfChannels (int num | |||||
return retval; | return retval; | ||||
} | } | ||||
AudioChannelSet JUCE_CALLTYPE AudioChannelSet::channelSetWithChannels (const Array<ChannelType>& channelArray) | |||||
{ | |||||
AudioChannelSet set; | |||||
for (auto ch : channelArray) | |||||
{ | |||||
jassert (! set.channels[static_cast<int> (ch)]); | |||||
set.addChannel (ch); | |||||
} | |||||
return set; | |||||
} | |||||
//============================================================================== | |||||
AudioChannelSet JUCE_CALLTYPE AudioChannelSet::fromWaveChannelMask (int32 dwChannelMask) | |||||
{ | |||||
return AudioChannelSet (static_cast<uint32> ((dwChannelMask & ((1 << 18) - 1)) << 1)); | |||||
} | |||||
int32 AudioChannelSet::getWaveChannelMask() const noexcept | |||||
{ | |||||
if (channels.getHighestBit() > topRearRight) | |||||
return -1; | |||||
return (channels.toInteger() >> 1); | |||||
} |
@@ -2,34 +2,25 @@ | |||||
============================================================================== | ============================================================================== | ||||
This file is part of the JUCE library. | This file is part of the JUCE library. | ||||
Copyright (c) 2016 - ROLI Ltd. | |||||
Copyright (c) 2017 - ROLI Ltd. | |||||
Permission is granted to use this software under the terms of the ISC license | |||||
http://www.isc.org/downloads/software-support-policy/isc-license/ | |||||
JUCE is an open source library subject to commercial or open-source | |||||
licensing. | |||||
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. | |||||
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. | |||||
THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH REGARD | |||||
TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND | |||||
FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, | |||||
OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF | |||||
USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER | |||||
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE | |||||
OF THIS SOFTWARE. | |||||
----------------------------------------------------------------------------- | |||||
To release a closed-source product which uses other parts of JUCE not | |||||
licensed under the ISC terms, commercial licenses are available: visit | |||||
www.juce.com for more information. | |||||
JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER | |||||
EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE | |||||
DISCLAIMED. | |||||
============================================================================== | ============================================================================== | ||||
*/ | */ | ||||
#ifndef JUCE_AUDIOCHANNELSET_H_INCLUDED | |||||
#define JUCE_AUDIOCHANNELSET_H_INCLUDED | |||||
#pragma once | |||||
//============================================================================== | //============================================================================== | ||||
@@ -60,21 +51,21 @@ public: | |||||
/** Creates a zero-channel set which can be used to indicate that a | /** Creates a zero-channel set which can be used to indicate that a | ||||
bus is disabled. */ | bus is disabled. */ | ||||
static AudioChannelSet disabled(); | |||||
static AudioChannelSet JUCE_CALLTYPE disabled(); | |||||
//============================================================================== | //============================================================================== | ||||
/** Creates a one-channel mono set (centre). | /** Creates a one-channel mono set (centre). | ||||
Is equivalent to: kMonoAAX (VST), AAX_eStemFormat_Mono (AAX), kAudioChannelLayoutTag_Mono (CoreAudio) | Is equivalent to: kMonoAAX (VST), AAX_eStemFormat_Mono (AAX), kAudioChannelLayoutTag_Mono (CoreAudio) | ||||
*/ | */ | ||||
static AudioChannelSet mono(); | |||||
static AudioChannelSet JUCE_CALLTYPE mono(); | |||||
/** Creates a set containing a stereo set (left, right). | /** Creates a set containing a stereo set (left, right). | ||||
Is equivalent to: kStereo (VST), AAX_eStemFormat_Stereo (AAX), kAudioChannelLayoutTag_Stereo (CoreAudio) | Is equivalent to: kStereo (VST), AAX_eStemFormat_Stereo (AAX), kAudioChannelLayoutTag_Stereo (CoreAudio) | ||||
*/ | */ | ||||
static AudioChannelSet stereo(); | |||||
static AudioChannelSet JUCE_CALLTYPE stereo(); | |||||
//============================================================================== | //============================================================================== | ||||
@@ -85,7 +76,7 @@ public: | |||||
This format is referred to as "LRC" in Cubase. | This format is referred to as "LRC" in Cubase. | ||||
This format is referred to as "LCR" in Pro Tools. | This format is referred to as "LCR" in Pro Tools. | ||||
*/ | */ | ||||
static AudioChannelSet createLCR(); | |||||
static AudioChannelSet JUCE_CALLTYPE createLCR(); | |||||
/** Creates a set containing an LRS set (left, right, surround). | /** Creates a set containing an LRS set (left, right, surround). | ||||
@@ -94,7 +85,7 @@ public: | |||||
This format is referred to as "LRS" in Cubase. | This format is referred to as "LRS" in Cubase. | ||||
*/ | */ | ||||
static AudioChannelSet createLRS(); | |||||
static AudioChannelSet JUCE_CALLTYPE createLRS(); | |||||
/** Creates a set containing an LCRS set (left, right, centre, surround). | /** Creates a set containing an LCRS set (left, right, centre, surround). | ||||
@@ -105,7 +96,7 @@ public: | |||||
This format is referred to as "LRCS" in Cubase. | This format is referred to as "LRCS" in Cubase. | ||||
This format is referred to as "LCRS" in Pro Tools. | This format is referred to as "LCRS" in Pro Tools. | ||||
*/ | */ | ||||
static AudioChannelSet createLCRS(); | |||||
static AudioChannelSet JUCE_CALLTYPE createLCRS(); | |||||
//============================================================================== | //============================================================================== | ||||
@@ -116,7 +107,7 @@ public: | |||||
This format is referred to as "5.0" in Cubase. | This format is referred to as "5.0" in Cubase. | ||||
This format is referred to as "5.0" in Pro Tools. | This format is referred to as "5.0" in Pro Tools. | ||||
*/ | */ | ||||
static AudioChannelSet create5point0(); | |||||
static AudioChannelSet JUCE_CALLTYPE create5point0(); | |||||
/** Creates a set for a 5.1 surround setup (left, right, centre, leftSurround, rightSurround, LFE). | /** Creates a set for a 5.1 surround setup (left, right, centre, leftSurround, rightSurround, LFE). | ||||
@@ -127,7 +118,7 @@ public: | |||||
This format is referred to as "5.1" in Cubase. | This format is referred to as "5.1" in Cubase. | ||||
This format is referred to as "5.1" in Pro Tools. | This format is referred to as "5.1" in Pro Tools. | ||||
*/ | */ | ||||
static AudioChannelSet create5point1(); | |||||
static AudioChannelSet JUCE_CALLTYPE create5point1(); | |||||
/** Creates a set for a 6.0 Cine surround setup (left, right, centre, leftSurround, rightSurround, centreSurround). | /** Creates a set for a 6.0 Cine surround setup (left, right, centre, leftSurround, rightSurround, centreSurround). | ||||
@@ -138,7 +129,7 @@ public: | |||||
This format is referred to as "6.0 Cine" in Cubase. | This format is referred to as "6.0 Cine" in Cubase. | ||||
This format is referred to as "6.0" in Pro Tools. | This format is referred to as "6.0" in Pro Tools. | ||||
*/ | */ | ||||
static AudioChannelSet create6point0(); | |||||
static AudioChannelSet JUCE_CALLTYPE create6point0(); | |||||
/** Creates a set for a 6.1 Cine surround setup (left, right, centre, leftSurround, rightSurround, centreSurround, LFE). | /** Creates a set for a 6.1 Cine surround setup (left, right, centre, leftSurround, rightSurround, centreSurround, LFE). | ||||
@@ -147,7 +138,7 @@ public: | |||||
This format is referred to as "6.1" in Pro Tools. | This format is referred to as "6.1" in Pro Tools. | ||||
*/ | */ | ||||
static AudioChannelSet create6point1(); | |||||
static AudioChannelSet JUCE_CALLTYPE create6point1(); | |||||
/** Creates a set for a 6.0 Music surround setup (left, right, leftSurround, rightSurround, leftSurroundSide, rightSurroundSide). | /** Creates a set for a 6.0 Music surround setup (left, right, leftSurround, rightSurround, leftSurroundSide, rightSurroundSide). | ||||
@@ -156,14 +147,14 @@ public: | |||||
This format is referred to as "6.0 Music" in Cubase. | This format is referred to as "6.0 Music" in Cubase. | ||||
*/ | */ | ||||
static AudioChannelSet create6point0Music(); | |||||
static AudioChannelSet JUCE_CALLTYPE create6point0Music(); | |||||
/** Creates a set for a 6.0 Music surround setup (left, right, leftSurround, rightSurround, leftSurroundSide, rightSurroundSide, LFE). | /** Creates a set for a 6.0 Music surround setup (left, right, leftSurround, rightSurround, leftSurroundSide, rightSurroundSide, LFE). | ||||
Is equivalent to: k61Music (VST), n/a (AAX), kAudioChannelLayoutTag_DTS_6_1_A (CoreAudio) | Is equivalent to: k61Music (VST), n/a (AAX), kAudioChannelLayoutTag_DTS_6_1_A (CoreAudio) | ||||
*/ | */ | ||||
static AudioChannelSet create6point1Music(); | |||||
static AudioChannelSet JUCE_CALLTYPE create6point1Music(); | |||||
/** Creates a set for a DTS 7.0 surround setup (left, right, centre, leftSurroundSide, rightSurroundSide, leftSurroundRear, rightSurroundRear). | /** Creates a set for a DTS 7.0 surround setup (left, right, centre, leftSurroundSide, rightSurroundSide, leftSurroundRear, rightSurroundRear). | ||||
@@ -172,7 +163,7 @@ public: | |||||
This format is referred to as "7.0" in Pro Tools. | This format is referred to as "7.0" in Pro Tools. | ||||
*/ | */ | ||||
static AudioChannelSet create7point0(); | |||||
static AudioChannelSet JUCE_CALLTYPE create7point0(); | |||||
/** Creates a set for a SDDS 7.0 surround setup (left, right, centre, leftSurround, rightSurround, leftCentre, rightCentre). | /** Creates a set for a SDDS 7.0 surround setup (left, right, centre, leftSurround, rightSurround, leftCentre, rightCentre). | ||||
@@ -181,7 +172,7 @@ public: | |||||
This format is referred to as "7.0 SDDS" in Pro Tools. | This format is referred to as "7.0 SDDS" in Pro Tools. | ||||
*/ | */ | ||||
static AudioChannelSet create7point0SDDS(); | |||||
static AudioChannelSet JUCE_CALLTYPE create7point0SDDS(); | |||||
/** Creates a set for a DTS 7.1 surround setup (left, right, centre, leftSurroundSide, rightSurroundSide, leftSurroundRear, rightSurroundRear, LFE). | /** Creates a set for a DTS 7.1 surround setup (left, right, centre, leftSurroundSide, rightSurroundSide, leftSurroundRear, rightSurroundRear, LFE). | ||||
@@ -191,7 +182,7 @@ public: | |||||
This format is referred to as "7.1 (3/4.1)" in Logic Pro. | This format is referred to as "7.1 (3/4.1)" in Logic Pro. | ||||
This format is referred to as "7.1" in Pro Tools. | This format is referred to as "7.1" in Pro Tools. | ||||
*/ | */ | ||||
static AudioChannelSet create7point1(); | |||||
static AudioChannelSet JUCE_CALLTYPE create7point1(); | |||||
/** Creates a set for a 7.1 surround setup (left, right, centre, leftSurround, rightSurround, leftCentre, rightCentre, LFE). | /** Creates a set for a 7.1 surround setup (left, right, centre, leftSurround, rightSurround, leftCentre, rightCentre, LFE). | ||||
@@ -201,7 +192,7 @@ public: | |||||
This format is referred to as "7.1 (SDDS)" in Logic Pro. | This format is referred to as "7.1 (SDDS)" in Logic Pro. | ||||
This format is referred to as "7.1 SDDS" in Pro Tools. | This format is referred to as "7.1 SDDS" in Pro Tools. | ||||
*/ | */ | ||||
static AudioChannelSet create7point1SDDS(); | |||||
static AudioChannelSet JUCE_CALLTYPE create7point1SDDS(); | |||||
//============================================================================== | //============================================================================== | ||||
@@ -209,7 +200,7 @@ public: | |||||
Is equivalent to: kBFormat (VST), n/a (AAX), kAudioChannelLayoutTag_Ambisonic_B_Format (CoreAudio) | Is equivalent to: kBFormat (VST), n/a (AAX), kAudioChannelLayoutTag_Ambisonic_B_Format (CoreAudio) | ||||
*/ | */ | ||||
static AudioChannelSet ambisonic(); | |||||
static AudioChannelSet JUCE_CALLTYPE ambisonic(); | |||||
/** Creates a set for quadraphonic surround setup (left, right, leftSurround, rightSurround) | /** Creates a set for quadraphonic surround setup (left, right, leftSurround, rightSurround) | ||||
@@ -220,45 +211,45 @@ public: | |||||
This format is referred to as "Quadro" in Cubase. | This format is referred to as "Quadro" in Cubase. | ||||
This format is referred to as "Quad" in Pro Tools. | This format is referred to as "Quad" in Pro Tools. | ||||
*/ | */ | ||||
static AudioChannelSet quadraphonic(); | |||||
static AudioChannelSet JUCE_CALLTYPE quadraphonic(); | |||||
/** Creates a set for pentagonal surround setup (left, right, centre, leftSurroundRear, rightSurroundRear). | /** Creates a set for pentagonal surround setup (left, right, centre, leftSurroundRear, rightSurroundRear). | ||||
Is equivalent to: n/a (VST), n/a (AAX), kAudioChannelLayoutTag_Pentagonal (CoreAudio) | Is equivalent to: n/a (VST), n/a (AAX), kAudioChannelLayoutTag_Pentagonal (CoreAudio) | ||||
*/ | */ | ||||
static AudioChannelSet pentagonal(); | |||||
static AudioChannelSet JUCE_CALLTYPE pentagonal(); | |||||
/** Creates a set for hexagonal surround setup (left, right, leftSurroundRear, rightSurroundRear, centre, surroundCentre). | /** Creates a set for hexagonal surround setup (left, right, leftSurroundRear, rightSurroundRear, centre, surroundCentre). | ||||
Is equivalent to: n/a (VST), n/a (AAX), kAudioChannelLayoutTag_Hexagonal (CoreAudio) | Is equivalent to: n/a (VST), n/a (AAX), kAudioChannelLayoutTag_Hexagonal (CoreAudio) | ||||
*/ | */ | ||||
static AudioChannelSet hexagonal(); | |||||
static AudioChannelSet JUCE_CALLTYPE hexagonal(); | |||||
/** Creates a set for octagonal surround setup (left, right, leftSurround, rightSurround, centre, centreSurround, wideLeft, wideRight). | /** Creates a set for octagonal surround setup (left, right, leftSurround, rightSurround, centre, centreSurround, wideLeft, wideRight). | ||||
Is equivalent to: n/a (VST), n/a (AAX), kAudioChannelLayoutTag_Octagonal (CoreAudio) | Is equivalent to: n/a (VST), n/a (AAX), kAudioChannelLayoutTag_Octagonal (CoreAudio) | ||||
*/ | */ | ||||
static AudioChannelSet octagonal(); | |||||
static AudioChannelSet JUCE_CALLTYPE octagonal(); | |||||
//============================================================================== | //============================================================================== | ||||
/** Creates a set of untyped discrete channels. */ | /** Creates a set of untyped discrete channels. */ | ||||
static AudioChannelSet discreteChannels (int numChannels); | |||||
static AudioChannelSet JUCE_CALLTYPE discreteChannels (int numChannels); | |||||
/** Create a canonical channel set for a given number of channels. | /** Create a canonical channel set for a given number of channels. | ||||
For example, numChannels = 1 will return mono, numChannels = 2 will return stereo, etc. */ | For example, numChannels = 1 will return mono, numChannels = 2 will return stereo, etc. */ | ||||
static AudioChannelSet canonicalChannelSet (int numChannels); | |||||
static AudioChannelSet JUCE_CALLTYPE canonicalChannelSet (int numChannels); | |||||
/** Create a channel set for a given number of channels which is non-discrete. | /** Create a channel set for a given number of channels which is non-discrete. | ||||
If numChannels is larger than the number of channels of the surround format | If numChannels is larger than the number of channels of the surround format | ||||
with the maximum amount of channels (currently 7.1 Surround), then this | with the maximum amount of channels (currently 7.1 Surround), then this | ||||
function returns an empty set.*/ | function returns an empty set.*/ | ||||
static AudioChannelSet namedChannelSet (int numChannels); | |||||
static AudioChannelSet JUCE_CALLTYPE namedChannelSet (int numChannels); | |||||
/** Return an array of channel sets which have a given number of channels */ | /** Return an array of channel sets which have a given number of channels */ | ||||
static Array<AudioChannelSet> channelSetsWithNumberOfChannels (int numChannels); | |||||
static Array<AudioChannelSet> JUCE_CALLTYPE channelSetsWithNumberOfChannels (int numChannels); | |||||
//============================================================================== | //============================================================================== | ||||
/** Represents different audio channel types. */ | /** Represents different audio channel types. */ | ||||
@@ -303,13 +294,13 @@ public: | |||||
}; | }; | ||||
/** Returns the name of a given channel type. For example, this method may return "Surround Left". */ | /** Returns the name of a given channel type. For example, this method may return "Surround Left". */ | ||||
static String getChannelTypeName (ChannelType); | |||||
static String JUCE_CALLTYPE getChannelTypeName (ChannelType); | |||||
/** Returns the abbreviated name of a channel type. For example, this method may return "Ls". */ | /** Returns the abbreviated name of a channel type. For example, this method may return "Ls". */ | ||||
static String getAbbreviatedChannelTypeName (ChannelType); | |||||
static String JUCE_CALLTYPE getAbbreviatedChannelTypeName (ChannelType); | |||||
/** Returns the channel type from an abbreviated name. */ | /** Returns the channel type from an abbreviated name. */ | ||||
static ChannelType getChannelTypeFromAbbreviation (const String& abbreviation); | |||||
static ChannelType JUCE_CALLTYPE getChannelTypeFromAbbreviation (const String& abbreviation); | |||||
//============================================================================== | //============================================================================== | ||||
enum | enum | ||||
@@ -360,16 +351,40 @@ public: | |||||
/** Intersect two channel layouts. */ | /** Intersect two channel layouts. */ | ||||
void intersect (const AudioChannelSet& other) { channels &= other.channels; } | void intersect (const AudioChannelSet& other) { channels &= other.channels; } | ||||
/** Creates a channel set for a list of channel types. This function will assert | |||||
if you supply a duplicate channel. | |||||
Note that this method ignores the order in which the channels are given, i.e. | |||||
two arrays with the same elements but in a different order will still result | |||||
in the same channel set. | |||||
*/ | |||||
static AudioChannelSet JUCE_CALLTYPE channelSetWithChannels (const Array<ChannelType>&); | |||||
//============================================================================== | |||||
// Conversion between wave and juce channel layout identifiers | |||||
/** Create an AudioChannelSet from a WAVEFORMATEXTENSIBLE channelMask (typically used | |||||
in .wav files). */ | |||||
static AudioChannelSet JUCE_CALLTYPE fromWaveChannelMask (int32 dwChannelMask); | |||||
/** Returns a WAVEFORMATEXTENSIBLE channelMask representation (typically used in .wav | |||||
files) of the receiver. | |||||
Returns -1 if the receiver cannot be represented in a WAVEFORMATEXTENSIBLE channelMask | |||||
representation. | |||||
*/ | |||||
int32 getWaveChannelMask() const noexcept; | |||||
//============================================================================== | //============================================================================== | ||||
bool operator== (const AudioChannelSet&) const noexcept; | bool operator== (const AudioChannelSet&) const noexcept; | ||||
bool operator!= (const AudioChannelSet&) const noexcept; | bool operator!= (const AudioChannelSet&) const noexcept; | ||||
bool operator< (const AudioChannelSet&) const noexcept; | bool operator< (const AudioChannelSet&) const noexcept; | ||||
private: | private: | ||||
//============================================================================== | |||||
BigInteger channels; | BigInteger channels; | ||||
//============================================================================== | |||||
explicit AudioChannelSet (uint32); | explicit AudioChannelSet (uint32); | ||||
explicit AudioChannelSet (const Array<ChannelType>&); | |||||
}; | }; | ||||
#endif // JUCE_AUDIOCHANNELSET_H_INCLUDED |
@@ -2,28 +2,20 @@ | |||||
============================================================================== | ============================================================================== | ||||
This file is part of the JUCE library. | This file is part of the JUCE library. | ||||
Copyright (c) 2016 - ROLI Ltd. | |||||
Copyright (c) 2017 - ROLI Ltd. | |||||
Permission is granted to use this software under the terms of the ISC license | |||||
http://www.isc.org/downloads/software-support-policy/isc-license/ | |||||
JUCE is an open source library subject to commercial or open-source | |||||
licensing. | |||||
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. | |||||
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. | |||||
THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH REGARD | |||||
TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND | |||||
FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, | |||||
OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF | |||||
USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER | |||||
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE | |||||
OF THIS SOFTWARE. | |||||
----------------------------------------------------------------------------- | |||||
To release a closed-source product which uses other parts of JUCE not | |||||
licensed under the ISC terms, commercial licenses are available: visit | |||||
www.juce.com for more information. | |||||
JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER | |||||
EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE | |||||
DISCLAIMED. | |||||
============================================================================== | ============================================================================== | ||||
*/ | */ | ||||
@@ -483,7 +475,7 @@ void AudioDataConverters::deinterleaveSamples (const float* const source, | |||||
class AudioConversionTests : public UnitTest | class AudioConversionTests : public UnitTest | ||||
{ | { | ||||
public: | public: | ||||
AudioConversionTests() : UnitTest ("Audio data conversion") {} | |||||
AudioConversionTests() : UnitTest ("Audio data conversion", "Audio") {} | |||||
template <class F1, class E1, class F2, class E2> | template <class F1, class E1, class F2, class E2> | ||||
struct Test5 | struct Test5 | ||||
@@ -2,34 +2,25 @@ | |||||
============================================================================== | ============================================================================== | ||||
This file is part of the JUCE library. | This file is part of the JUCE library. | ||||
Copyright (c) 2016 - ROLI Ltd. | |||||
Copyright (c) 2017 - ROLI Ltd. | |||||
Permission is granted to use this software under the terms of the ISC license | |||||
http://www.isc.org/downloads/software-support-policy/isc-license/ | |||||
JUCE is an open source library subject to commercial or open-source | |||||
licensing. | |||||
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. | |||||
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. | |||||
THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH REGARD | |||||
TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND | |||||
FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, | |||||
OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF | |||||
USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER | |||||
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE | |||||
OF THIS SOFTWARE. | |||||
----------------------------------------------------------------------------- | |||||
To release a closed-source product which uses other parts of JUCE not | |||||
licensed under the ISC terms, commercial licenses are available: visit | |||||
www.juce.com for more information. | |||||
JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER | |||||
EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE | |||||
DISCLAIMED. | |||||
============================================================================== | ============================================================================== | ||||
*/ | */ | ||||
#ifndef JUCE_AUDIODATACONVERTERS_H_INCLUDED | |||||
#define JUCE_AUDIODATACONVERTERS_H_INCLUDED | |||||
#pragma once | |||||
//============================================================================== | //============================================================================== | ||||
@@ -371,7 +362,7 @@ public: | |||||
{ | { | ||||
// If you're using interleaved data, call the other constructor! If you're using non-interleaved data, | // If you're using interleaved data, call the other constructor! If you're using non-interleaved data, | ||||
// you should pass NonInterleaved as the template parameter for the interleaving type! | // you should pass NonInterleaved as the template parameter for the interleaving type! | ||||
static_jassert (InterleavingType::isInterleavedType == 0); | |||||
static_assert (InterleavingType::isInterleavedType == 0, "Incorrect constructor for interleaved data"); | |||||
} | } | ||||
/** Creates a pointer from some raw data in the appropriate format with the specified number of interleaved channels. | /** Creates a pointer from some raw data in the appropriate format with the specified number of interleaved channels. | ||||
@@ -411,7 +402,8 @@ public: | |||||
*/ | */ | ||||
inline void setAsFloat (float newValue) noexcept | inline void setAsFloat (float newValue) noexcept | ||||
{ | { | ||||
static_jassert (Constness::isConst == 0); // trying to write to a const pointer! For a writeable one, use AudioData::NonConst instead! | |||||
// trying to write to a const pointer! For a writeable one, use AudioData::NonConst instead! | |||||
static_assert (Constness::isConst == 0, "Attempt to write to a const pointer"); | |||||
Endianness::setAsFloat (data, newValue); | Endianness::setAsFloat (data, newValue); | ||||
} | } | ||||
@@ -428,7 +420,8 @@ public: | |||||
*/ | */ | ||||
inline void setAsInt32 (int32 newValue) noexcept | inline void setAsInt32 (int32 newValue) noexcept | ||||
{ | { | ||||
static_jassert (Constness::isConst == 0); // trying to write to a const pointer! For a writeable one, use AudioData::NonConst instead! | |||||
// trying to write to a const pointer! For a writeable one, use AudioData::NonConst instead! | |||||
static_assert (Constness::isConst == 0, "Attempt to write to a const pointer"); | |||||
Endianness::setAsInt32 (data, newValue); | Endianness::setAsInt32 (data, newValue); | ||||
} | } | ||||
@@ -446,7 +439,8 @@ public: | |||||
*/ | */ | ||||
void convertSamples (Pointer source, int numSamples) const noexcept | void convertSamples (Pointer source, int numSamples) const noexcept | ||||
{ | { | ||||
static_jassert (Constness::isConst == 0); // trying to write to a const pointer! For a writeable one, use AudioData::NonConst instead! | |||||
// trying to write to a const pointer! For a writeable one, use AudioData::NonConst instead! | |||||
static_assert (Constness::isConst == 0, "Attempt to write to a const pointer"); | |||||
for (Pointer dest (*this); --numSamples >= 0;) | for (Pointer dest (*this); --numSamples >= 0;) | ||||
{ | { | ||||
@@ -462,7 +456,8 @@ public: | |||||
template <class OtherPointerType> | template <class OtherPointerType> | ||||
void convertSamples (OtherPointerType source, int numSamples) const noexcept | void convertSamples (OtherPointerType source, int numSamples) const noexcept | ||||
{ | { | ||||
static_jassert (Constness::isConst == 0); // trying to write to a const pointer! For a writeable one, use AudioData::NonConst instead! | |||||
// trying to write to a const pointer! For a writeable one, use AudioData::NonConst instead! | |||||
static_assert (Constness::isConst == 0, "Attempt to write to a const pointer"); | |||||
Pointer dest (*this); | Pointer dest (*this); | ||||
@@ -713,6 +708,3 @@ private: | |||||
AudioDataConverters(); | AudioDataConverters(); | ||||
JUCE_DECLARE_NON_COPYABLE (AudioDataConverters) | JUCE_DECLARE_NON_COPYABLE (AudioDataConverters) | ||||
}; | }; | ||||
#endif // JUCE_AUDIODATACONVERTERS_H_INCLUDED |
@@ -1,673 +0,0 @@ | |||||
/* | |||||
============================================================================== | |||||
This file is part of the JUCE library. | |||||
Copyright (c) 2015 - ROLI Ltd. | |||||
Permission is granted to use this software under the terms of either: | |||||
a) the GPL v2 (or any later version) | |||||
b) the Affero GPL v3 | |||||
Details of these licenses can be found at: www.gnu.org/licenses | |||||
JUCE is distributed in the hope that it will be useful, but WITHOUT ANY | |||||
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR | |||||
A PARTICULAR PURPOSE. See the GNU General Public License for more details. | |||||
------------------------------------------------------------------------------ | |||||
To release a closed-source product which uses JUCE, commercial licenses are | |||||
available: visit www.juce.com for more information. | |||||
============================================================================== | |||||
*/ | |||||
AudioSampleBuffer::AudioSampleBuffer() noexcept | |||||
: numChannels (0), size (0), allocatedBytes (0), | |||||
channels (static_cast<float**> (preallocatedChannelSpace)), | |||||
isClear (false) | |||||
{ | |||||
} | |||||
AudioSampleBuffer::AudioSampleBuffer (const int numChans, | |||||
const int numSamples) noexcept | |||||
: numChannels (numChans), | |||||
size (numSamples) | |||||
{ | |||||
jassert (numSamples >= 0); | |||||
jassert (numChans >= 0); | |||||
allocateData(); | |||||
} | |||||
AudioSampleBuffer::AudioSampleBuffer (const AudioSampleBuffer& other) noexcept | |||||
: numChannels (other.numChannels), | |||||
size (other.size), | |||||
allocatedBytes (other.allocatedBytes) | |||||
{ | |||||
if (allocatedBytes == 0) | |||||
{ | |||||
allocateChannels (other.channels, 0); | |||||
} | |||||
else | |||||
{ | |||||
allocateData(); | |||||
if (other.isClear) | |||||
{ | |||||
clear(); | |||||
} | |||||
else | |||||
{ | |||||
for (int i = 0; i < numChannels; ++i) | |||||
FloatVectorOperations::copy (channels[i], other.channels[i], size); | |||||
} | |||||
} | |||||
} | |||||
void AudioSampleBuffer::allocateData() | |||||
{ | |||||
const size_t channelListSize = sizeof (float*) * (size_t) (numChannels + 1); | |||||
allocatedBytes = (size_t) numChannels * (size_t) size * sizeof (float) + channelListSize + 32; | |||||
allocatedData.malloc (allocatedBytes); | |||||
channels = reinterpret_cast<float**> (allocatedData.getData()); | |||||
float* chan = (float*) (allocatedData + channelListSize); | |||||
for (int i = 0; i < numChannels; ++i) | |||||
{ | |||||
channels[i] = chan; | |||||
chan += size; | |||||
} | |||||
channels [numChannels] = nullptr; | |||||
isClear = false; | |||||
} | |||||
AudioSampleBuffer::AudioSampleBuffer (float* const* dataToReferTo, | |||||
const int numChans, | |||||
const int numSamples) noexcept | |||||
: numChannels (numChans), | |||||
size (numSamples), | |||||
allocatedBytes (0) | |||||
{ | |||||
jassert (dataToReferTo != nullptr); | |||||
jassert (numChans >= 0 && numSamples >= 0); | |||||
allocateChannels (dataToReferTo, 0); | |||||
} | |||||
AudioSampleBuffer::AudioSampleBuffer (float* const* dataToReferTo, | |||||
const int numChans, | |||||
const int startSample, | |||||
const int numSamples) noexcept | |||||
: numChannels (numChans), | |||||
size (numSamples), | |||||
allocatedBytes (0), | |||||
isClear (false) | |||||
{ | |||||
jassert (dataToReferTo != nullptr); | |||||
jassert (numChans >= 0 && startSample >= 0 && numSamples >= 0); | |||||
allocateChannels (dataToReferTo, startSample); | |||||
} | |||||
void AudioSampleBuffer::setDataToReferTo (float** dataToReferTo, | |||||
const int newNumChannels, | |||||
const int newNumSamples) noexcept | |||||
{ | |||||
jassert (dataToReferTo != nullptr); | |||||
jassert (newNumChannels >= 0 && newNumSamples >= 0); | |||||
if (allocatedBytes != 0) | |||||
{ | |||||
allocatedBytes = 0; | |||||
allocatedData.free(); | |||||
} | |||||
numChannels = newNumChannels; | |||||
size = newNumSamples; | |||||
allocateChannels (dataToReferTo, 0); | |||||
jassert (! isClear); | |||||
} | |||||
void AudioSampleBuffer::allocateChannels (float* const* const dataToReferTo, int offset) | |||||
{ | |||||
jassert (offset >= 0); | |||||
// (try to avoid doing a malloc here, as that'll blow up things like Pro-Tools) | |||||
if (numChannels < (int) numElementsInArray (preallocatedChannelSpace)) | |||||
{ | |||||
channels = static_cast<float**> (preallocatedChannelSpace); | |||||
} | |||||
else | |||||
{ | |||||
allocatedData.malloc ((size_t) numChannels + 1, sizeof (float*)); | |||||
channels = reinterpret_cast<float**> (allocatedData.getData()); | |||||
} | |||||
for (int i = 0; i < numChannels; ++i) | |||||
{ | |||||
// you have to pass in the same number of valid pointers as numChannels | |||||
jassert (dataToReferTo[i] != nullptr); | |||||
channels[i] = dataToReferTo[i] + offset; | |||||
} | |||||
channels [numChannels] = nullptr; | |||||
isClear = false; | |||||
} | |||||
AudioSampleBuffer& AudioSampleBuffer::operator= (const AudioSampleBuffer& other) noexcept | |||||
{ | |||||
if (this != &other) | |||||
{ | |||||
setSize (other.getNumChannels(), other.getNumSamples(), false, false, false); | |||||
if (other.isClear) | |||||
{ | |||||
clear(); | |||||
} | |||||
else | |||||
{ | |||||
isClear = false; | |||||
for (int i = 0; i < numChannels; ++i) | |||||
FloatVectorOperations::copy (channels[i], other.channels[i], size); | |||||
} | |||||
} | |||||
return *this; | |||||
} | |||||
AudioSampleBuffer::~AudioSampleBuffer() noexcept | |||||
{ | |||||
} | |||||
void AudioSampleBuffer::setSize (const int newNumChannels, | |||||
const int newNumSamples, | |||||
const bool keepExistingContent, | |||||
const bool clearExtraSpace, | |||||
const bool avoidReallocating) noexcept | |||||
{ | |||||
jassert (newNumChannels >= 0); | |||||
jassert (newNumSamples >= 0); | |||||
if (newNumSamples != size || newNumChannels != numChannels) | |||||
{ | |||||
const size_t allocatedSamplesPerChannel = ((size_t) newNumSamples + 3) & ~3u; | |||||
const size_t channelListSize = ((sizeof (float*) * (size_t) (newNumChannels + 1)) + 15) & ~15u; | |||||
const size_t newTotalBytes = ((size_t) newNumChannels * (size_t) allocatedSamplesPerChannel * sizeof (float)) | |||||
+ channelListSize + 32; | |||||
if (keepExistingContent) | |||||
{ | |||||
HeapBlock<char, true> newData; | |||||
newData.allocate (newTotalBytes, clearExtraSpace || isClear); | |||||
const size_t numSamplesToCopy = (size_t) jmin (newNumSamples, size); | |||||
float** const newChannels = reinterpret_cast<float**> (newData.getData()); | |||||
float* newChan = reinterpret_cast<float*> (newData + channelListSize); | |||||
for (int j = 0; j < newNumChannels; ++j) | |||||
{ | |||||
newChannels[j] = newChan; | |||||
newChan += allocatedSamplesPerChannel; | |||||
} | |||||
if (! isClear) | |||||
{ | |||||
const int numChansToCopy = jmin (numChannels, newNumChannels); | |||||
for (int i = 0; i < numChansToCopy; ++i) | |||||
FloatVectorOperations::copy (newChannels[i], channels[i], (int) numSamplesToCopy); | |||||
} | |||||
allocatedData.swapWith (newData); | |||||
allocatedBytes = newTotalBytes; | |||||
channels = newChannels; | |||||
} | |||||
else | |||||
{ | |||||
if (avoidReallocating && allocatedBytes >= newTotalBytes) | |||||
{ | |||||
if (clearExtraSpace || isClear) | |||||
allocatedData.clear (newTotalBytes); | |||||
} | |||||
else | |||||
{ | |||||
allocatedBytes = newTotalBytes; | |||||
allocatedData.allocate (newTotalBytes, clearExtraSpace || isClear); | |||||
channels = reinterpret_cast<float**> (allocatedData.getData()); | |||||
} | |||||
float* chan = reinterpret_cast<float*> (allocatedData + channelListSize); | |||||
for (int i = 0; i < newNumChannels; ++i) | |||||
{ | |||||
channels[i] = chan; | |||||
chan += allocatedSamplesPerChannel; | |||||
} | |||||
} | |||||
channels [newNumChannels] = 0; | |||||
size = newNumSamples; | |||||
numChannels = newNumChannels; | |||||
} | |||||
} | |||||
void AudioSampleBuffer::clear() noexcept | |||||
{ | |||||
if (! isClear) | |||||
{ | |||||
for (int i = 0; i < numChannels; ++i) | |||||
FloatVectorOperations::clear (channels[i], size); | |||||
isClear = true; | |||||
} | |||||
} | |||||
void AudioSampleBuffer::clear (const int startSample, | |||||
const int numSamples) noexcept | |||||
{ | |||||
jassert (startSample >= 0 && startSample + numSamples <= size); | |||||
if (! isClear) | |||||
{ | |||||
if (startSample == 0 && numSamples == size) | |||||
isClear = true; | |||||
for (int i = 0; i < numChannels; ++i) | |||||
FloatVectorOperations::clear (channels[i] + startSample, numSamples); | |||||
} | |||||
} | |||||
void AudioSampleBuffer::clear (const int channel, | |||||
const int startSample, | |||||
const int numSamples) noexcept | |||||
{ | |||||
jassert (isPositiveAndBelow (channel, numChannels)); | |||||
jassert (startSample >= 0 && startSample + numSamples <= size); | |||||
if (! isClear) | |||||
FloatVectorOperations::clear (channels [channel] + startSample, numSamples); | |||||
} | |||||
float AudioSampleBuffer::getSample (int channel, int index) const noexcept | |||||
{ | |||||
jassert (isPositiveAndBelow (channel, numChannels)); | |||||
jassert (isPositiveAndBelow (index, size)); | |||||
return *(channels [channel] + index); | |||||
} | |||||
void AudioSampleBuffer::setSample (int channel, int index, float newValue) noexcept | |||||
{ | |||||
jassert (isPositiveAndBelow (channel, numChannels)); | |||||
jassert (isPositiveAndBelow (index, size)); | |||||
*(channels [channel] + index) = newValue; | |||||
isClear = false; | |||||
} | |||||
void AudioSampleBuffer::addSample (int channel, int index, float valueToAdd) noexcept | |||||
{ | |||||
jassert (isPositiveAndBelow (channel, numChannels)); | |||||
jassert (isPositiveAndBelow (index, size)); | |||||
*(channels [channel] + index) += valueToAdd; | |||||
isClear = false; | |||||
} | |||||
void AudioSampleBuffer::applyGain (const int channel, | |||||
const int startSample, | |||||
int numSamples, | |||||
const float gain) noexcept | |||||
{ | |||||
jassert (isPositiveAndBelow (channel, numChannels)); | |||||
jassert (startSample >= 0 && startSample + numSamples <= size); | |||||
if (gain != 1.0f && ! isClear) | |||||
{ | |||||
float* const d = channels [channel] + startSample; | |||||
if (gain == 0.0f) | |||||
FloatVectorOperations::clear (d, numSamples); | |||||
else | |||||
FloatVectorOperations::multiply (d, gain, numSamples); | |||||
} | |||||
} | |||||
void AudioSampleBuffer::applyGainRamp (const int channel, | |||||
const int startSample, | |||||
int numSamples, | |||||
float startGain, | |||||
float endGain) noexcept | |||||
{ | |||||
if (! isClear) | |||||
{ | |||||
if (startGain == endGain) | |||||
{ | |||||
applyGain (channel, startSample, numSamples, startGain); | |||||
} | |||||
else | |||||
{ | |||||
jassert (isPositiveAndBelow (channel, numChannels)); | |||||
jassert (startSample >= 0 && startSample + numSamples <= size); | |||||
const float increment = (endGain - startGain) / numSamples; | |||||
float* d = channels [channel] + startSample; | |||||
while (--numSamples >= 0) | |||||
{ | |||||
*d++ *= startGain; | |||||
startGain += increment; | |||||
} | |||||
} | |||||
} | |||||
} | |||||
void AudioSampleBuffer::applyGain (int startSample, int numSamples, float gain) noexcept | |||||
{ | |||||
for (int i = 0; i < numChannels; ++i) | |||||
applyGain (i, startSample, numSamples, gain); | |||||
} | |||||
void AudioSampleBuffer::applyGain (const float gain) noexcept | |||||
{ | |||||
applyGain (0, size, gain); | |||||
} | |||||
void AudioSampleBuffer::applyGainRamp (int startSample, int numSamples, | |||||
float startGain, float endGain) noexcept | |||||
{ | |||||
for (int i = 0; i < numChannels; ++i) | |||||
applyGainRamp (i, startSample, numSamples, startGain, endGain); | |||||
} | |||||
void AudioSampleBuffer::addFrom (const int destChannel, | |||||
const int destStartSample, | |||||
const AudioSampleBuffer& source, | |||||
const int sourceChannel, | |||||
const int sourceStartSample, | |||||
int numSamples, | |||||
const float gain) noexcept | |||||
{ | |||||
jassert (&source != this || sourceChannel != destChannel); | |||||
jassert (isPositiveAndBelow (destChannel, numChannels)); | |||||
jassert (destStartSample >= 0 && destStartSample + numSamples <= size); | |||||
jassert (isPositiveAndBelow (sourceChannel, source.numChannels)); | |||||
jassert (sourceStartSample >= 0 && sourceStartSample + numSamples <= source.size); | |||||
if (gain != 0.0f && numSamples > 0 && ! source.isClear) | |||||
{ | |||||
float* const d = channels [destChannel] + destStartSample; | |||||
const float* const s = source.channels [sourceChannel] + sourceStartSample; | |||||
if (isClear) | |||||
{ | |||||
isClear = false; | |||||
if (gain != 1.0f) | |||||
FloatVectorOperations::copyWithMultiply (d, s, gain, numSamples); | |||||
else | |||||
FloatVectorOperations::copy (d, s, numSamples); | |||||
} | |||||
else | |||||
{ | |||||
if (gain != 1.0f) | |||||
FloatVectorOperations::addWithMultiply (d, s, gain, numSamples); | |||||
else | |||||
FloatVectorOperations::add (d, s, numSamples); | |||||
} | |||||
} | |||||
} | |||||
void AudioSampleBuffer::addFrom (const int destChannel, | |||||
const int destStartSample, | |||||
const float* source, | |||||
int numSamples, | |||||
const float gain) noexcept | |||||
{ | |||||
jassert (isPositiveAndBelow (destChannel, numChannels)); | |||||
jassert (destStartSample >= 0 && destStartSample + numSamples <= size); | |||||
jassert (source != nullptr); | |||||
if (gain != 0.0f && numSamples > 0) | |||||
{ | |||||
float* const d = channels [destChannel] + destStartSample; | |||||
if (isClear) | |||||
{ | |||||
isClear = false; | |||||
if (gain != 1.0f) | |||||
FloatVectorOperations::copyWithMultiply (d, source, gain, numSamples); | |||||
else | |||||
FloatVectorOperations::copy (d, source, numSamples); | |||||
} | |||||
else | |||||
{ | |||||
if (gain != 1.0f) | |||||
FloatVectorOperations::addWithMultiply (d, source, gain, numSamples); | |||||
else | |||||
FloatVectorOperations::add (d, source, numSamples); | |||||
} | |||||
} | |||||
} | |||||
void AudioSampleBuffer::addFromWithRamp (const int destChannel, | |||||
const int destStartSample, | |||||
const float* source, | |||||
int numSamples, | |||||
float startGain, | |||||
const float endGain) noexcept | |||||
{ | |||||
jassert (isPositiveAndBelow (destChannel, numChannels)); | |||||
jassert (destStartSample >= 0 && destStartSample + numSamples <= size); | |||||
jassert (source != nullptr); | |||||
if (startGain == endGain) | |||||
{ | |||||
addFrom (destChannel, destStartSample, source, numSamples, startGain); | |||||
} | |||||
else | |||||
{ | |||||
if (numSamples > 0 && (startGain != 0.0f || endGain != 0.0f)) | |||||
{ | |||||
isClear = false; | |||||
const float increment = (endGain - startGain) / numSamples; | |||||
float* d = channels [destChannel] + destStartSample; | |||||
while (--numSamples >= 0) | |||||
{ | |||||
*d++ += startGain * *source++; | |||||
startGain += increment; | |||||
} | |||||
} | |||||
} | |||||
} | |||||
void AudioSampleBuffer::copyFrom (const int destChannel, | |||||
const int destStartSample, | |||||
const AudioSampleBuffer& source, | |||||
const int sourceChannel, | |||||
const int sourceStartSample, | |||||
int numSamples) noexcept | |||||
{ | |||||
jassert (&source != this || sourceChannel != destChannel); | |||||
jassert (isPositiveAndBelow (destChannel, numChannels)); | |||||
jassert (destStartSample >= 0 && destStartSample + numSamples <= size); | |||||
jassert (isPositiveAndBelow (sourceChannel, source.numChannels)); | |||||
jassert (sourceStartSample >= 0 && sourceStartSample + numSamples <= source.size); | |||||
if (numSamples > 0) | |||||
{ | |||||
if (source.isClear) | |||||
{ | |||||
if (! isClear) | |||||
FloatVectorOperations::clear (channels [destChannel] + destStartSample, numSamples); | |||||
} | |||||
else | |||||
{ | |||||
isClear = false; | |||||
FloatVectorOperations::copy (channels [destChannel] + destStartSample, | |||||
source.channels [sourceChannel] + sourceStartSample, | |||||
numSamples); | |||||
} | |||||
} | |||||
} | |||||
void AudioSampleBuffer::copyFrom (const int destChannel, | |||||
const int destStartSample, | |||||
const float* source, | |||||
int numSamples) noexcept | |||||
{ | |||||
jassert (isPositiveAndBelow (destChannel, numChannels)); | |||||
jassert (destStartSample >= 0 && destStartSample + numSamples <= size); | |||||
jassert (source != nullptr); | |||||
if (numSamples > 0) | |||||
{ | |||||
isClear = false; | |||||
FloatVectorOperations::copy (channels [destChannel] + destStartSample, source, numSamples); | |||||
} | |||||
} | |||||
void AudioSampleBuffer::copyFrom (const int destChannel, | |||||
const int destStartSample, | |||||
const float* source, | |||||
int numSamples, | |||||
const float gain) noexcept | |||||
{ | |||||
jassert (isPositiveAndBelow (destChannel, numChannels)); | |||||
jassert (destStartSample >= 0 && destStartSample + numSamples <= size); | |||||
jassert (source != nullptr); | |||||
if (numSamples > 0) | |||||
{ | |||||
float* const d = channels [destChannel] + destStartSample; | |||||
if (gain != 1.0f) | |||||
{ | |||||
if (gain == 0) | |||||
{ | |||||
if (! isClear) | |||||
FloatVectorOperations::clear (d, numSamples); | |||||
} | |||||
else | |||||
{ | |||||
isClear = false; | |||||
FloatVectorOperations::copyWithMultiply (d, source, gain, numSamples); | |||||
} | |||||
} | |||||
else | |||||
{ | |||||
isClear = false; | |||||
FloatVectorOperations::copy (d, source, numSamples); | |||||
} | |||||
} | |||||
} | |||||
void AudioSampleBuffer::copyFromWithRamp (const int destChannel, | |||||
const int destStartSample, | |||||
const float* source, | |||||
int numSamples, | |||||
float startGain, | |||||
float endGain) noexcept | |||||
{ | |||||
jassert (isPositiveAndBelow (destChannel, numChannels)); | |||||
jassert (destStartSample >= 0 && destStartSample + numSamples <= size); | |||||
jassert (source != nullptr); | |||||
if (startGain == endGain) | |||||
{ | |||||
copyFrom (destChannel, destStartSample, source, numSamples, startGain); | |||||
} | |||||
else | |||||
{ | |||||
if (numSamples > 0 && (startGain != 0.0f || endGain != 0.0f)) | |||||
{ | |||||
isClear = false; | |||||
const float increment = (endGain - startGain) / numSamples; | |||||
float* d = channels [destChannel] + destStartSample; | |||||
while (--numSamples >= 0) | |||||
{ | |||||
*d++ = startGain * *source++; | |||||
startGain += increment; | |||||
} | |||||
} | |||||
} | |||||
} | |||||
void AudioSampleBuffer::reverse (int channel, int startSample, int numSamples) const noexcept | |||||
{ | |||||
jassert (isPositiveAndBelow (channel, numChannels)); | |||||
jassert (startSample >= 0 && startSample + numSamples <= size); | |||||
if (! isClear) | |||||
std::reverse (channels[channel] + startSample, | |||||
channels[channel] + startSample + numSamples); | |||||
} | |||||
void AudioSampleBuffer::reverse (int startSample, int numSamples) const noexcept | |||||
{ | |||||
for (int i = 0; i < numChannels; ++i) | |||||
reverse (i, startSample, numSamples); | |||||
} | |||||
Range<float> AudioSampleBuffer::findMinMax (const int channel, | |||||
const int startSample, | |||||
int numSamples) const noexcept | |||||
{ | |||||
jassert (isPositiveAndBelow (channel, numChannels)); | |||||
jassert (startSample >= 0 && startSample + numSamples <= size); | |||||
if (isClear) | |||||
return Range<float>(); | |||||
return FloatVectorOperations::findMinAndMax (channels [channel] + startSample, numSamples); | |||||
} | |||||
float AudioSampleBuffer::getMagnitude (const int channel, | |||||
const int startSample, | |||||
const int numSamples) const noexcept | |||||
{ | |||||
jassert (isPositiveAndBelow (channel, numChannels)); | |||||
jassert (startSample >= 0 && startSample + numSamples <= size); | |||||
if (isClear) | |||||
return 0.0f; | |||||
const Range<float> r (findMinMax (channel, startSample, numSamples)); | |||||
return jmax (r.getStart(), -r.getStart(), r.getEnd(), -r.getEnd()); | |||||
} | |||||
float AudioSampleBuffer::getMagnitude (int startSample, int numSamples) const noexcept | |||||
{ | |||||
float mag = 0.0f; | |||||
if (! isClear) | |||||
for (int i = 0; i < numChannels; ++i) | |||||
mag = jmax (mag, getMagnitude (i, startSample, numSamples)); | |||||
return mag; | |||||
} | |||||
float AudioSampleBuffer::getRMSLevel (const int channel, | |||||
const int startSample, | |||||
const int numSamples) const noexcept | |||||
{ | |||||
jassert (isPositiveAndBelow (channel, numChannels)); | |||||
jassert (startSample >= 0 && startSample + numSamples <= size); | |||||
if (numSamples <= 0 || channel < 0 || channel >= numChannels || isClear) | |||||
return 0.0f; | |||||
const float* const data = channels [channel] + startSample; | |||||
double sum = 0.0; | |||||
for (int i = 0; i < numSamples; ++i) | |||||
{ | |||||
const float sample = data [i]; | |||||
sum += sample * sample; | |||||
} | |||||
return (float) std::sqrt (sum / numSamples); | |||||
} |
@@ -2,34 +2,25 @@ | |||||
============================================================================== | ============================================================================== | ||||
This file is part of the JUCE library. | This file is part of the JUCE library. | ||||
Copyright (c) 2016 - ROLI Ltd. | |||||
Copyright (c) 2017 - ROLI Ltd. | |||||
Permission is granted to use this software under the terms of the ISC license | |||||
http://www.isc.org/downloads/software-support-policy/isc-license/ | |||||
JUCE is an open source library subject to commercial or open-source | |||||
licensing. | |||||
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. | |||||
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. | |||||
THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH REGARD | |||||
TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND | |||||
FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, | |||||
OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF | |||||
USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER | |||||
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE | |||||
OF THIS SOFTWARE. | |||||
----------------------------------------------------------------------------- | |||||
To release a closed-source product which uses other parts of JUCE not | |||||
licensed under the ISC terms, commercial licenses are available: visit | |||||
www.juce.com for more information. | |||||
JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER | |||||
EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE | |||||
DISCLAIMED. | |||||
============================================================================== | ============================================================================== | ||||
*/ | */ | ||||
#ifndef JUCE_AUDIOSAMPLEBUFFER_H_INCLUDED | |||||
#define JUCE_AUDIOSAMPLEBUFFER_H_INCLUDED | |||||
#pragma once | |||||
//============================================================================== | //============================================================================== | ||||
@@ -62,13 +53,11 @@ public: | |||||
throw a std::bad_alloc exception. | throw a std::bad_alloc exception. | ||||
*/ | */ | ||||
AudioBuffer (int numChannelsToAllocate, | AudioBuffer (int numChannelsToAllocate, | ||||
int numSamplesToAllocate) noexcept | |||||
int numSamplesToAllocate) | |||||
: numChannels (numChannelsToAllocate), | : numChannels (numChannelsToAllocate), | ||||
size (numSamplesToAllocate) | size (numSamplesToAllocate) | ||||
{ | { | ||||
jassert (size >= 0); | |||||
jassert (numChannels >= 0); | |||||
jassert (size >= 0 && numChannels >= 0); | |||||
allocateData(); | allocateData(); | ||||
} | } | ||||
@@ -89,7 +78,7 @@ public: | |||||
*/ | */ | ||||
AudioBuffer (Type* const* dataToReferTo, | AudioBuffer (Type* const* dataToReferTo, | ||||
int numChannelsToUse, | int numChannelsToUse, | ||||
int numSamples) noexcept | |||||
int numSamples) | |||||
: numChannels (numChannelsToUse), | : numChannels (numChannelsToUse), | ||||
size (numSamples), | size (numSamples), | ||||
allocatedBytes (0) | allocatedBytes (0) | ||||
@@ -118,7 +107,7 @@ public: | |||||
AudioBuffer (Type* const* dataToReferTo, | AudioBuffer (Type* const* dataToReferTo, | ||||
int numChannelsToUse, | int numChannelsToUse, | ||||
int startSample, | int startSample, | ||||
int numSamples) noexcept | |||||
int numSamples) | |||||
: numChannels (numChannelsToUse), | : numChannels (numChannelsToUse), | ||||
size (numSamples), | size (numSamples), | ||||
allocatedBytes (0), | allocatedBytes (0), | ||||
@@ -135,7 +124,7 @@ public: | |||||
using an external data buffer, in which case boths buffers will just point to the same | using an external data buffer, in which case boths buffers will just point to the same | ||||
shared block of data. | shared block of data. | ||||
*/ | */ | ||||
AudioBuffer (const AudioBuffer& other) noexcept | |||||
AudioBuffer (const AudioBuffer& other) | |||||
: numChannels (other.numChannels), | : numChannels (other.numChannels), | ||||
size (other.size), | size (other.size), | ||||
allocatedBytes (other.allocatedBytes) | allocatedBytes (other.allocatedBytes) | ||||
@@ -163,7 +152,7 @@ public: | |||||
/** Copies another buffer onto this one. | /** Copies another buffer onto this one. | ||||
This buffer's size will be changed to that of the other buffer. | This buffer's size will be changed to that of the other buffer. | ||||
*/ | */ | ||||
AudioBuffer& operator= (const AudioBuffer& other) noexcept | |||||
AudioBuffer& operator= (const AudioBuffer& other) | |||||
{ | { | ||||
if (this != &other) | if (this != &other) | ||||
{ | { | ||||
@@ -190,7 +179,6 @@ public: | |||||
*/ | */ | ||||
~AudioBuffer() noexcept {} | ~AudioBuffer() noexcept {} | ||||
#if JUCE_COMPILER_SUPPORTS_MOVE_SEMANTICS | |||||
/** Move constructor */ | /** Move constructor */ | ||||
AudioBuffer (AudioBuffer&& other) noexcept | AudioBuffer (AudioBuffer&& other) noexcept | ||||
: numChannels (other.numChannels), | : numChannels (other.numChannels), | ||||
@@ -221,16 +209,15 @@ public: | |||||
other.allocatedBytes = 0; | other.allocatedBytes = 0; | ||||
return *this; | return *this; | ||||
} | } | ||||
#endif | |||||
//============================================================================== | //============================================================================== | ||||
/** Returns the number of channels of audio data that this buffer contains. | /** Returns the number of channels of audio data that this buffer contains. | ||||
@see getSampleData | |||||
@see getNumSamples, getReadPointer, getWritePointer | |||||
*/ | */ | ||||
int getNumChannels() const noexcept { return numChannels; } | int getNumChannels() const noexcept { return numChannels; } | ||||
/** Returns the number of samples allocated in each of the buffer's channels. | /** Returns the number of samples allocated in each of the buffer's channels. | ||||
@see getSampleData | |||||
@see getNumChannels, getReadPointer, getWritePointer | |||||
*/ | */ | ||||
int getNumSamples() const noexcept { return size; } | int getNumSamples() const noexcept { return size; } | ||||
@@ -244,7 +231,7 @@ public: | |||||
const Type* getReadPointer (int channelNumber) const noexcept | const Type* getReadPointer (int channelNumber) const noexcept | ||||
{ | { | ||||
jassert (isPositiveAndBelow (channelNumber, numChannels)); | jassert (isPositiveAndBelow (channelNumber, numChannels)); | ||||
return channels [channelNumber]; | |||||
return channels[channelNumber]; | |||||
} | } | ||||
/** Returns a pointer to an array of read-only samples in one of the buffer's channels. | /** Returns a pointer to an array of read-only samples in one of the buffer's channels. | ||||
@@ -258,7 +245,7 @@ public: | |||||
{ | { | ||||
jassert (isPositiveAndBelow (channelNumber, numChannels)); | jassert (isPositiveAndBelow (channelNumber, numChannels)); | ||||
jassert (isPositiveAndBelow (sampleIndex, size)); | jassert (isPositiveAndBelow (sampleIndex, size)); | ||||
return channels [channelNumber] + sampleIndex; | |||||
return channels[channelNumber] + sampleIndex; | |||||
} | } | ||||
/** Returns a writeable pointer to one of the buffer's channels. | /** Returns a writeable pointer to one of the buffer's channels. | ||||
@@ -271,7 +258,7 @@ public: | |||||
{ | { | ||||
jassert (isPositiveAndBelow (channelNumber, numChannels)); | jassert (isPositiveAndBelow (channelNumber, numChannels)); | ||||
isClear = false; | isClear = false; | ||||
return channels [channelNumber]; | |||||
return channels[channelNumber]; | |||||
} | } | ||||
/** Returns a writeable pointer to one of the buffer's channels. | /** Returns a writeable pointer to one of the buffer's channels. | ||||
@@ -285,7 +272,7 @@ public: | |||||
jassert (isPositiveAndBelow (channelNumber, numChannels)); | jassert (isPositiveAndBelow (channelNumber, numChannels)); | ||||
jassert (isPositiveAndBelow (sampleIndex, size)); | jassert (isPositiveAndBelow (sampleIndex, size)); | ||||
isClear = false; | isClear = false; | ||||
return channels [channelNumber] + sampleIndex; | |||||
return channels[channelNumber] + sampleIndex; | |||||
} | } | ||||
/** Returns an array of pointers to the channels in the buffer. | /** Returns an array of pointers to the channels in the buffer. | ||||
@@ -326,27 +313,27 @@ public: | |||||
int newNumSamples, | int newNumSamples, | ||||
bool keepExistingContent = false, | bool keepExistingContent = false, | ||||
bool clearExtraSpace = false, | bool clearExtraSpace = false, | ||||
bool avoidReallocating = false) noexcept | |||||
bool avoidReallocating = false) | |||||
{ | { | ||||
jassert (newNumChannels >= 0); | jassert (newNumChannels >= 0); | ||||
jassert (newNumSamples >= 0); | jassert (newNumSamples >= 0); | ||||
if (newNumSamples != size || newNumChannels != numChannels) | if (newNumSamples != size || newNumChannels != numChannels) | ||||
{ | { | ||||
const size_t allocatedSamplesPerChannel = ((size_t) newNumSamples + 3) & ~3u; | |||||
const size_t channelListSize = ((sizeof (Type*) * (size_t) (newNumChannels + 1)) + 15) & ~15u; | |||||
const size_t newTotalBytes = ((size_t) newNumChannels * (size_t) allocatedSamplesPerChannel * sizeof (Type)) | |||||
+ channelListSize + 32; | |||||
const auto allocatedSamplesPerChannel = ((size_t) newNumSamples + 3) & ~3u; | |||||
const auto channelListSize = ((sizeof (Type*) * (size_t) (newNumChannels + 1)) + 15) & ~15u; | |||||
const auto newTotalBytes = ((size_t) newNumChannels * (size_t) allocatedSamplesPerChannel * sizeof (Type)) | |||||
+ channelListSize + 32; | |||||
if (keepExistingContent) | if (keepExistingContent) | ||||
{ | { | ||||
HeapBlock<char, true> newData; | HeapBlock<char, true> newData; | ||||
newData.allocate (newTotalBytes, clearExtraSpace || isClear); | newData.allocate (newTotalBytes, clearExtraSpace || isClear); | ||||
const size_t numSamplesToCopy = (size_t) jmin (newNumSamples, size); | |||||
auto numSamplesToCopy = (size_t) jmin (newNumSamples, size); | |||||
Type** const newChannels = reinterpret_cast<Type**> (newData.getData()); | |||||
Type* newChan = reinterpret_cast<Type*> (newData + channelListSize); | |||||
auto newChannels = reinterpret_cast<Type**> (newData.getData()); | |||||
auto newChan = reinterpret_cast<Type*> (newData + channelListSize); | |||||
for (int j = 0; j < newNumChannels; ++j) | for (int j = 0; j < newNumChannels; ++j) | ||||
{ | { | ||||
@@ -356,7 +343,8 @@ public: | |||||
if (! isClear) | if (! isClear) | ||||
{ | { | ||||
const int numChansToCopy = jmin (numChannels, newNumChannels); | |||||
auto numChansToCopy = jmin (numChannels, newNumChannels); | |||||
for (int i = 0; i < numChansToCopy; ++i) | for (int i = 0; i < numChansToCopy; ++i) | ||||
FloatVectorOperations::copy (newChannels[i], channels[i], (int) numSamplesToCopy); | FloatVectorOperations::copy (newChannels[i], channels[i], (int) numSamplesToCopy); | ||||
} | } | ||||
@@ -379,7 +367,8 @@ public: | |||||
channels = reinterpret_cast<Type**> (allocatedData.getData()); | channels = reinterpret_cast<Type**> (allocatedData.getData()); | ||||
} | } | ||||
Type* chan = reinterpret_cast<Type*> (allocatedData + channelListSize); | |||||
auto* chan = reinterpret_cast<Type*> (allocatedData + channelListSize); | |||||
for (int i = 0; i < newNumChannels; ++i) | for (int i = 0; i < newNumChannels; ++i) | ||||
{ | { | ||||
channels[i] = chan; | channels[i] = chan; | ||||
@@ -387,7 +376,7 @@ public: | |||||
} | } | ||||
} | } | ||||
channels [newNumChannels] = 0; | |||||
channels[newNumChannels] = 0; | |||||
size = newNumSamples; | size = newNumSamples; | ||||
numChannels = newNumChannels; | numChannels = newNumChannels; | ||||
} | } | ||||
@@ -408,12 +397,14 @@ public: | |||||
it when the buffer is deleted or resized. | it when the buffer is deleted or resized. | ||||
@param newNumChannels the number of channels to use - this must correspond to the | @param newNumChannels the number of channels to use - this must correspond to the | ||||
number of elements in the array passed in | number of elements in the array passed in | ||||
@param newStartSample the offset within the arrays at which the data begins | |||||
@param newNumSamples the number of samples to use - this must correspond to the | @param newNumSamples the number of samples to use - this must correspond to the | ||||
size of the arrays passed in | size of the arrays passed in | ||||
*/ | */ | ||||
void setDataToReferTo (Type** dataToReferTo, | void setDataToReferTo (Type** dataToReferTo, | ||||
const int newNumChannels, | |||||
const int newNumSamples) noexcept | |||||
int newNumChannels, | |||||
int newStartSample, | |||||
int newNumSamples) | |||||
{ | { | ||||
jassert (dataToReferTo != nullptr); | jassert (dataToReferTo != nullptr); | ||||
jassert (newNumChannels >= 0 && newNumSamples >= 0); | jassert (newNumChannels >= 0 && newNumSamples >= 0); | ||||
@@ -427,10 +418,35 @@ public: | |||||
numChannels = newNumChannels; | numChannels = newNumChannels; | ||||
size = newNumSamples; | size = newNumSamples; | ||||
allocateChannels (dataToReferTo, 0); | |||||
allocateChannels (dataToReferTo, newStartSample); | |||||
jassert (! isClear); | jassert (! isClear); | ||||
} | } | ||||
/** Makes this buffer point to a pre-allocated set of channel data arrays. | |||||
There's also a constructor that lets you specify arrays like this, but this | |||||
lets you change the channels dynamically. | |||||
Note that if the buffer is resized or its number of channels is changed, it | |||||
will re-allocate memory internally and copy the existing data to this new area, | |||||
so it will then stop directly addressing this memory. | |||||
@param dataToReferTo a pre-allocated array containing pointers to the data | |||||
for each channel that should be used by this buffer. The | |||||
buffer will only refer to this memory, it won't try to delete | |||||
it when the buffer is deleted or resized. | |||||
@param newNumChannels the number of channels to use - this must correspond to the | |||||
number of elements in the array passed in | |||||
@param newNumSamples the number of samples to use - this must correspond to the | |||||
size of the arrays passed in | |||||
*/ | |||||
void setDataToReferTo (Type** dataToReferTo, | |||||
int newNumChannels, | |||||
int newNumSamples) | |||||
{ | |||||
setDataToReferTo (dataToReferTo, newNumChannels, 0, newNumSamples); | |||||
} | |||||
/** Resizes this buffer to match the given one, and copies all of its content across. | /** Resizes this buffer to match the given one, and copies all of its content across. | ||||
The source buffer can contain a different floating point type, so this can be used to | The source buffer can contain a different floating point type, so this can be used to | ||||
convert between 32 and 64 bit float buffer types. | convert between 32 and 64 bit float buffer types. | ||||
@@ -446,10 +462,12 @@ public: | |||||
} | } | ||||
else | else | ||||
{ | { | ||||
isClear = false; | |||||
for (int chan = 0; chan < numChannels; ++chan) | for (int chan = 0; chan < numChannels; ++chan) | ||||
{ | { | ||||
Type* const dest = channels[chan]; | |||||
const OtherType* const src = other.getReadPointer (chan); | |||||
auto* dest = channels[chan]; | |||||
auto* src = other.getReadPointer (chan); | |||||
for (int i = 0; i < size; ++i) | for (int i = 0; i < size; ++i) | ||||
dest[i] = static_cast<Type> (src[i]); | dest[i] = static_cast<Type> (src[i]); | ||||
@@ -475,10 +493,9 @@ public: | |||||
For speed, this doesn't check whether the channel and sample number | For speed, this doesn't check whether the channel and sample number | ||||
are in-range, so be careful! | are in-range, so be careful! | ||||
*/ | */ | ||||
void clear (int startSample, | |||||
int numSamples) noexcept | |||||
void clear (int startSample, int numSamples) noexcept | |||||
{ | { | ||||
jassert (startSample >= 0 && startSample + numSamples <= size); | |||||
jassert (startSample >= 0 && numSamples >= 0 && startSample + numSamples <= size); | |||||
if (! isClear) | if (! isClear) | ||||
{ | { | ||||
@@ -495,15 +512,13 @@ public: | |||||
For speed, this doesn't check whether the channel and sample number | For speed, this doesn't check whether the channel and sample number | ||||
are in-range, so be careful! | are in-range, so be careful! | ||||
*/ | */ | ||||
void clear (int channel, | |||||
int startSample, | |||||
int numSamples) noexcept | |||||
void clear (int channel, int startSample, int numSamples) noexcept | |||||
{ | { | ||||
jassert (isPositiveAndBelow (channel, numChannels)); | jassert (isPositiveAndBelow (channel, numChannels)); | ||||
jassert (startSample >= 0 && startSample + numSamples <= size); | |||||
jassert (startSample >= 0 && numSamples >= 0 && startSample + numSamples <= size); | |||||
if (! isClear) | if (! isClear) | ||||
FloatVectorOperations::clear (channels [channel] + startSample, numSamples); | |||||
FloatVectorOperations::clear (channels[channel] + startSample, numSamples); | |||||
} | } | ||||
/** Returns true if the buffer has been entirely cleared. | /** Returns true if the buffer has been entirely cleared. | ||||
@@ -524,7 +539,7 @@ public: | |||||
{ | { | ||||
jassert (isPositiveAndBelow (channel, numChannels)); | jassert (isPositiveAndBelow (channel, numChannels)); | ||||
jassert (isPositiveAndBelow (sampleIndex, size)); | jassert (isPositiveAndBelow (sampleIndex, size)); | ||||
return *(channels [channel] + sampleIndex); | |||||
return *(channels[channel] + sampleIndex); | |||||
} | } | ||||
/** Sets a sample in the buffer. | /** Sets a sample in the buffer. | ||||
@@ -536,7 +551,7 @@ public: | |||||
{ | { | ||||
jassert (isPositiveAndBelow (destChannel, numChannels)); | jassert (isPositiveAndBelow (destChannel, numChannels)); | ||||
jassert (isPositiveAndBelow (destSample, size)); | jassert (isPositiveAndBelow (destSample, size)); | ||||
*(channels [destChannel] + destSample) = newValue; | |||||
*(channels[destChannel] + destSample) = newValue; | |||||
isClear = false; | isClear = false; | ||||
} | } | ||||
@@ -549,7 +564,7 @@ public: | |||||
{ | { | ||||
jassert (isPositiveAndBelow (destChannel, numChannels)); | jassert (isPositiveAndBelow (destChannel, numChannels)); | ||||
jassert (isPositiveAndBelow (destSample, size)); | jassert (isPositiveAndBelow (destSample, size)); | ||||
*(channels [destChannel] + destSample) += valueToAdd; | |||||
*(channels[destChannel] + destSample) += valueToAdd; | |||||
isClear = false; | isClear = false; | ||||
} | } | ||||
@@ -558,19 +573,16 @@ public: | |||||
For speed, this doesn't check whether the channel and sample number | For speed, this doesn't check whether the channel and sample number | ||||
are in-range, so be careful! | are in-range, so be careful! | ||||
*/ | */ | ||||
void applyGain (int channel, | |||||
int startSample, | |||||
int numSamples, | |||||
Type gain) noexcept | |||||
void applyGain (int channel, int startSample, int numSamples, Type gain) noexcept | |||||
{ | { | ||||
jassert (isPositiveAndBelow (channel, numChannels)); | jassert (isPositiveAndBelow (channel, numChannels)); | ||||
jassert (startSample >= 0 && startSample + numSamples <= size); | |||||
jassert (startSample >= 0 && numSamples >= 0 && startSample + numSamples <= size); | |||||
if (gain != 1.0f && ! isClear) | |||||
if (gain != (Type) 1 && ! isClear) | |||||
{ | { | ||||
Type* const d = channels [channel] + startSample; | |||||
auto* d = channels[channel] + startSample; | |||||
if (gain == 0.0f) | |||||
if (gain == 0) | |||||
FloatVectorOperations::clear (d, numSamples); | FloatVectorOperations::clear (d, numSamples); | ||||
else | else | ||||
FloatVectorOperations::multiply (d, gain, numSamples); | FloatVectorOperations::multiply (d, gain, numSamples); | ||||
@@ -582,9 +594,7 @@ public: | |||||
For speed, this doesn't check whether the sample numbers | For speed, this doesn't check whether the sample numbers | ||||
are in-range, so be careful! | are in-range, so be careful! | ||||
*/ | */ | ||||
void applyGain (int startSample, | |||||
int numSamples, | |||||
Type gain) noexcept | |||||
void applyGain (int startSample, int numSamples, Type gain) noexcept | |||||
{ | { | ||||
for (int i = 0; i < numChannels; ++i) | for (int i = 0; i < numChannels; ++i) | ||||
applyGain (i, startSample, numSamples, gain); | applyGain (i, startSample, numSamples, gain); | ||||
@@ -605,11 +615,8 @@ public: | |||||
For speed, this doesn't check whether the sample numbers | For speed, this doesn't check whether the sample numbers | ||||
are in-range, so be careful! | are in-range, so be careful! | ||||
*/ | */ | ||||
void applyGainRamp (int channel, | |||||
int startSample, | |||||
int numSamples, | |||||
Type startGain, | |||||
Type endGain) noexcept | |||||
void applyGainRamp (int channel, int startSample, int numSamples, | |||||
Type startGain, Type endGain) noexcept | |||||
{ | { | ||||
if (! isClear) | if (! isClear) | ||||
{ | { | ||||
@@ -620,10 +627,10 @@ public: | |||||
else | else | ||||
{ | { | ||||
jassert (isPositiveAndBelow (channel, numChannels)); | jassert (isPositiveAndBelow (channel, numChannels)); | ||||
jassert (startSample >= 0 && startSample + numSamples <= size); | |||||
jassert (startSample >= 0 && numSamples >= 0 && startSample + numSamples <= size); | |||||
const Type increment = (endGain - startGain) / numSamples; | |||||
Type* d = channels [channel] + startSample; | |||||
const auto increment = (endGain - startGain) / numSamples; | |||||
auto* d = channels[channel] + startSample; | |||||
while (--numSamples >= 0) | while (--numSamples >= 0) | ||||
{ | { | ||||
@@ -643,10 +650,8 @@ public: | |||||
For speed, this doesn't check whether the sample numbers | For speed, this doesn't check whether the sample numbers | ||||
are in-range, so be careful! | are in-range, so be careful! | ||||
*/ | */ | ||||
void applyGainRamp (int startSample, | |||||
int numSamples, | |||||
Type startGain, | |||||
Type endGain) noexcept | |||||
void applyGainRamp (int startSample, int numSamples, | |||||
Type startGain, Type endGain) noexcept | |||||
{ | { | ||||
for (int i = 0; i < numChannels; ++i) | for (int i = 0; i < numChannels; ++i) | ||||
applyGainRamp (i, startSample, numSamples, startGain, endGain); | applyGainRamp (i, startSample, numSamples, startGain, endGain); | ||||
@@ -675,27 +680,27 @@ public: | |||||
{ | { | ||||
jassert (&source != this || sourceChannel != destChannel); | jassert (&source != this || sourceChannel != destChannel); | ||||
jassert (isPositiveAndBelow (destChannel, numChannels)); | jassert (isPositiveAndBelow (destChannel, numChannels)); | ||||
jassert (destStartSample >= 0 && destStartSample + numSamples <= size); | |||||
jassert (destStartSample >= 0 && numSamples >= 0 && destStartSample + numSamples <= size); | |||||
jassert (isPositiveAndBelow (sourceChannel, source.numChannels)); | jassert (isPositiveAndBelow (sourceChannel, source.numChannels)); | ||||
jassert (sourceStartSample >= 0 && sourceStartSample + numSamples <= source.size); | jassert (sourceStartSample >= 0 && sourceStartSample + numSamples <= source.size); | ||||
if (gainToApplyToSource != 0.0f && numSamples > 0 && ! source.isClear) | |||||
if (gainToApplyToSource != 0 && numSamples > 0 && ! source.isClear) | |||||
{ | { | ||||
Type* const d = channels [destChannel] + destStartSample; | |||||
const Type* const s = source.channels [sourceChannel] + sourceStartSample; | |||||
auto* d = channels[destChannel] + destStartSample; | |||||
auto* s = source.channels[sourceChannel] + sourceStartSample; | |||||
if (isClear) | if (isClear) | ||||
{ | { | ||||
isClear = false; | isClear = false; | ||||
if (gainToApplyToSource != 1.0f) | |||||
if (gainToApplyToSource != (Type) 1) | |||||
FloatVectorOperations::copyWithMultiply (d, s, gainToApplyToSource, numSamples); | FloatVectorOperations::copyWithMultiply (d, s, gainToApplyToSource, numSamples); | ||||
else | else | ||||
FloatVectorOperations::copy (d, s, numSamples); | FloatVectorOperations::copy (d, s, numSamples); | ||||
} | } | ||||
else | else | ||||
{ | { | ||||
if (gainToApplyToSource != 1.0f) | |||||
if (gainToApplyToSource != (Type) 1) | |||||
FloatVectorOperations::addWithMultiply (d, s, gainToApplyToSource, numSamples); | FloatVectorOperations::addWithMultiply (d, s, gainToApplyToSource, numSamples); | ||||
else | else | ||||
FloatVectorOperations::add (d, s, numSamples); | FloatVectorOperations::add (d, s, numSamples); | ||||
@@ -722,25 +727,25 @@ public: | |||||
Type gainToApplyToSource = (Type) 1) noexcept | Type gainToApplyToSource = (Type) 1) noexcept | ||||
{ | { | ||||
jassert (isPositiveAndBelow (destChannel, numChannels)); | jassert (isPositiveAndBelow (destChannel, numChannels)); | ||||
jassert (destStartSample >= 0 && destStartSample + numSamples <= size); | |||||
jassert (destStartSample >= 0 && numSamples >= 0 && destStartSample + numSamples <= size); | |||||
jassert (source != nullptr); | jassert (source != nullptr); | ||||
if (gainToApplyToSource != 0.0f && numSamples > 0) | |||||
if (gainToApplyToSource != 0 && numSamples > 0) | |||||
{ | { | ||||
Type* const d = channels [destChannel] + destStartSample; | |||||
auto* d = channels[destChannel] + destStartSample; | |||||
if (isClear) | if (isClear) | ||||
{ | { | ||||
isClear = false; | isClear = false; | ||||
if (gainToApplyToSource != 1.0f) | |||||
if (gainToApplyToSource != (Type) 1) | |||||
FloatVectorOperations::copyWithMultiply (d, source, gainToApplyToSource, numSamples); | FloatVectorOperations::copyWithMultiply (d, source, gainToApplyToSource, numSamples); | ||||
else | else | ||||
FloatVectorOperations::copy (d, source, numSamples); | FloatVectorOperations::copy (d, source, numSamples); | ||||
} | } | ||||
else | else | ||||
{ | { | ||||
if (gainToApplyToSource != 1.0f) | |||||
if (gainToApplyToSource != (Type) 1) | |||||
FloatVectorOperations::addWithMultiply (d, source, gainToApplyToSource, numSamples); | FloatVectorOperations::addWithMultiply (d, source, gainToApplyToSource, numSamples); | ||||
else | else | ||||
FloatVectorOperations::add (d, source, numSamples); | FloatVectorOperations::add (d, source, numSamples); | ||||
@@ -767,21 +772,21 @@ public: | |||||
Type startGain, | Type startGain, | ||||
Type endGain) noexcept | Type endGain) noexcept | ||||
{ | { | ||||
jassert (isPositiveAndBelow (destChannel, numChannels)); | |||||
jassert (destStartSample >= 0 && destStartSample + numSamples <= size); | |||||
jassert (source != nullptr); | |||||
if (startGain == endGain) | if (startGain == endGain) | ||||
{ | { | ||||
addFrom (destChannel, destStartSample, source, numSamples, startGain); | addFrom (destChannel, destStartSample, source, numSamples, startGain); | ||||
} | } | ||||
else | else | ||||
{ | { | ||||
if (numSamples > 0 && (startGain != 0.0f || endGain != 0.0f)) | |||||
jassert (isPositiveAndBelow (destChannel, numChannels)); | |||||
jassert (destStartSample >= 0 && numSamples >= 0 && destStartSample + numSamples <= size); | |||||
jassert (source != nullptr); | |||||
if (numSamples > 0) | |||||
{ | { | ||||
isClear = false; | isClear = false; | ||||
const Type increment = (endGain - startGain) / numSamples; | |||||
Type* d = channels [destChannel] + destStartSample; | |||||
const auto increment = (endGain - startGain) / numSamples; | |||||
auto* d = channels[destChannel] + destStartSample; | |||||
while (--numSamples >= 0) | while (--numSamples >= 0) | ||||
{ | { | ||||
@@ -814,20 +819,20 @@ public: | |||||
jassert (isPositiveAndBelow (destChannel, numChannels)); | jassert (isPositiveAndBelow (destChannel, numChannels)); | ||||
jassert (destStartSample >= 0 && destStartSample + numSamples <= size); | jassert (destStartSample >= 0 && destStartSample + numSamples <= size); | ||||
jassert (isPositiveAndBelow (sourceChannel, source.numChannels)); | jassert (isPositiveAndBelow (sourceChannel, source.numChannels)); | ||||
jassert (sourceStartSample >= 0 && sourceStartSample + numSamples <= source.size); | |||||
jassert (sourceStartSample >= 0 && numSamples >= 0 && sourceStartSample + numSamples <= source.size); | |||||
if (numSamples > 0) | if (numSamples > 0) | ||||
{ | { | ||||
if (source.isClear) | if (source.isClear) | ||||
{ | { | ||||
if (! isClear) | if (! isClear) | ||||
FloatVectorOperations::clear (channels [destChannel] + destStartSample, numSamples); | |||||
FloatVectorOperations::clear (channels[destChannel] + destStartSample, numSamples); | |||||
} | } | ||||
else | else | ||||
{ | { | ||||
isClear = false; | isClear = false; | ||||
FloatVectorOperations::copy (channels [destChannel] + destStartSample, | |||||
source.channels [sourceChannel] + sourceStartSample, | |||||
FloatVectorOperations::copy (channels[destChannel] + destStartSample, | |||||
source.channels[sourceChannel] + sourceStartSample, | |||||
numSamples); | numSamples); | ||||
} | } | ||||
} | } | ||||
@@ -848,13 +853,13 @@ public: | |||||
int numSamples) noexcept | int numSamples) noexcept | ||||
{ | { | ||||
jassert (isPositiveAndBelow (destChannel, numChannels)); | jassert (isPositiveAndBelow (destChannel, numChannels)); | ||||
jassert (destStartSample >= 0 && destStartSample + numSamples <= size); | |||||
jassert (destStartSample >= 0 && numSamples >= 0 && destStartSample + numSamples <= size); | |||||
jassert (source != nullptr); | jassert (source != nullptr); | ||||
if (numSamples > 0) | if (numSamples > 0) | ||||
{ | { | ||||
isClear = false; | isClear = false; | ||||
FloatVectorOperations::copy (channels [destChannel] + destStartSample, source, numSamples); | |||||
FloatVectorOperations::copy (channels[destChannel] + destStartSample, source, numSamples); | |||||
} | } | ||||
} | } | ||||
@@ -875,14 +880,14 @@ public: | |||||
Type gain) noexcept | Type gain) noexcept | ||||
{ | { | ||||
jassert (isPositiveAndBelow (destChannel, numChannels)); | jassert (isPositiveAndBelow (destChannel, numChannels)); | ||||
jassert (destStartSample >= 0 && destStartSample + numSamples <= size); | |||||
jassert (destStartSample >= 0 && numSamples >= 0 && destStartSample + numSamples <= size); | |||||
jassert (source != nullptr); | jassert (source != nullptr); | ||||
if (numSamples > 0) | if (numSamples > 0) | ||||
{ | { | ||||
Type* const d = channels [destChannel] + destStartSample; | |||||
auto* d = channels[destChannel] + destStartSample; | |||||
if (gain != 1.0f) | |||||
if (gain != (Type) 1) | |||||
{ | { | ||||
if (gain == 0) | if (gain == 0) | ||||
{ | { | ||||
@@ -923,21 +928,21 @@ public: | |||||
Type startGain, | Type startGain, | ||||
Type endGain) noexcept | Type endGain) noexcept | ||||
{ | { | ||||
jassert (isPositiveAndBelow (destChannel, numChannels)); | |||||
jassert (destStartSample >= 0 && destStartSample + numSamples <= size); | |||||
jassert (source != nullptr); | |||||
if (startGain == endGain) | if (startGain == endGain) | ||||
{ | { | ||||
copyFrom (destChannel, destStartSample, source, numSamples, startGain); | copyFrom (destChannel, destStartSample, source, numSamples, startGain); | ||||
} | } | ||||
else | else | ||||
{ | { | ||||
if (numSamples > 0 && (startGain != 0.0f || endGain != 0.0f)) | |||||
jassert (isPositiveAndBelow (destChannel, numChannels)); | |||||
jassert (destStartSample >= 0 && numSamples >= 0 && destStartSample + numSamples <= size); | |||||
jassert (source != nullptr); | |||||
if (numSamples > 0) | |||||
{ | { | ||||
isClear = false; | isClear = false; | ||||
const Type increment = (endGain - startGain) / numSamples; | |||||
Type* d = channels [destChannel] + destStartSample; | |||||
const auto increment = (endGain - startGain) / numSamples; | |||||
auto* d = channels[destChannel] + destStartSample; | |||||
while (--numSamples >= 0) | while (--numSamples >= 0) | ||||
{ | { | ||||
@@ -954,41 +959,35 @@ public: | |||||
@param startSample the start sample within the channel | @param startSample the start sample within the channel | ||||
@param numSamples the number of samples to check | @param numSamples the number of samples to check | ||||
*/ | */ | ||||
Range<Type> findMinMax (int channel, | |||||
int startSample, | |||||
int numSamples) const noexcept | |||||
Range<Type> findMinMax (int channel, int startSample, int numSamples) const noexcept | |||||
{ | { | ||||
jassert (isPositiveAndBelow (channel, numChannels)); | jassert (isPositiveAndBelow (channel, numChannels)); | ||||
jassert (startSample >= 0 && startSample + numSamples <= size); | |||||
jassert (startSample >= 0 && numSamples >= 0 && startSample + numSamples <= size); | |||||
if (isClear) | if (isClear) | ||||
return Range<Type>(); | |||||
return {}; | |||||
return FloatVectorOperations::findMinAndMax (channels [channel] + startSample, numSamples); | |||||
return FloatVectorOperations::findMinAndMax (channels[channel] + startSample, numSamples); | |||||
} | } | ||||
/** Finds the highest absolute sample value within a region of a channel. */ | /** Finds the highest absolute sample value within a region of a channel. */ | ||||
Type getMagnitude (int channel, | |||||
int startSample, | |||||
int numSamples) const noexcept | |||||
Type getMagnitude (int channel, int startSample, int numSamples) const noexcept | |||||
{ | { | ||||
jassert (isPositiveAndBelow (channel, numChannels)); | jassert (isPositiveAndBelow (channel, numChannels)); | ||||
jassert (startSample >= 0 && startSample + numSamples <= size); | |||||
jassert (startSample >= 0 && numSamples >= 0 && startSample + numSamples <= size); | |||||
if (isClear) | if (isClear) | ||||
return 0.0f; | |||||
return {}; | |||||
const Range<Type> r (findMinMax (channel, startSample, numSamples)); | |||||
auto r = findMinMax (channel, startSample, numSamples); | |||||
return jmax (r.getStart(), -r.getStart(), r.getEnd(), -r.getEnd()); | return jmax (r.getStart(), -r.getStart(), r.getEnd(), -r.getEnd()); | ||||
} | } | ||||
/** Finds the highest absolute sample value within a region on all channels. */ | /** Finds the highest absolute sample value within a region on all channels. */ | ||||
Type getMagnitude (int startSample, | |||||
int numSamples) const noexcept | |||||
Type getMagnitude (int startSample, int numSamples) const noexcept | |||||
{ | { | ||||
Type mag = 0.0f; | |||||
Type mag = 0; | |||||
if (! isClear) | if (! isClear) | ||||
for (int i = 0; i < numChannels; ++i) | for (int i = 0; i < numChannels; ++i) | ||||
@@ -998,22 +997,20 @@ public: | |||||
} | } | ||||
/** Returns the root mean squared level for a region of a channel. */ | /** Returns the root mean squared level for a region of a channel. */ | ||||
Type getRMSLevel (int channel, | |||||
int startSample, | |||||
int numSamples) const noexcept | |||||
Type getRMSLevel (int channel, int startSample, int numSamples) const noexcept | |||||
{ | { | ||||
jassert (isPositiveAndBelow (channel, numChannels)); | jassert (isPositiveAndBelow (channel, numChannels)); | ||||
jassert (startSample >= 0 && startSample + numSamples <= size); | |||||
jassert (startSample >= 0 && numSamples >= 0 && startSample + numSamples <= size); | |||||
if (numSamples <= 0 || channel < 0 || channel >= numChannels || isClear) | if (numSamples <= 0 || channel < 0 || channel >= numChannels || isClear) | ||||
return 0.0f; | |||||
return {}; | |||||
const Type* const data = channels [channel] + startSample; | |||||
auto* data = channels[channel] + startSample; | |||||
double sum = 0.0; | double sum = 0.0; | ||||
for (int i = 0; i < numSamples; ++i) | for (int i = 0; i < numSamples; ++i) | ||||
{ | { | ||||
const Type sample = data [i]; | |||||
const Type sample = data[i]; | |||||
sum += sample * sample; | sum += sample * sample; | ||||
} | } | ||||
@@ -1024,7 +1021,7 @@ public: | |||||
void reverse (int channel, int startSample, int numSamples) const noexcept | void reverse (int channel, int startSample, int numSamples) const noexcept | ||||
{ | { | ||||
jassert (isPositiveAndBelow (channel, numChannels)); | jassert (isPositiveAndBelow (channel, numChannels)); | ||||
jassert (startSample >= 0 && startSample + numSamples <= size); | |||||
jassert (startSample >= 0 && numSamples >= 0 && startSample + numSamples <= size); | |||||
if (! isClear) | if (! isClear) | ||||
std::reverse (channels[channel] + startSample, | std::reverse (channels[channel] + startSample, | ||||
@@ -1045,28 +1042,29 @@ private: | |||||
size_t allocatedBytes; | size_t allocatedBytes; | ||||
Type** channels; | Type** channels; | ||||
HeapBlock<char, true> allocatedData; | HeapBlock<char, true> allocatedData; | ||||
Type* preallocatedChannelSpace [32]; | |||||
Type* preallocatedChannelSpace[32]; | |||||
bool isClear; | bool isClear; | ||||
void allocateData() | void allocateData() | ||||
{ | { | ||||
const size_t channelListSize = sizeof (Type*) * (size_t) (numChannels + 1); | |||||
jassert (size >= 0); | |||||
auto channelListSize = sizeof (Type*) * (size_t) (numChannels + 1); | |||||
allocatedBytes = (size_t) numChannels * (size_t) size * sizeof (Type) + channelListSize + 32; | allocatedBytes = (size_t) numChannels * (size_t) size * sizeof (Type) + channelListSize + 32; | ||||
allocatedData.malloc (allocatedBytes); | allocatedData.malloc (allocatedBytes); | ||||
channels = reinterpret_cast<Type**> (allocatedData.getData()); | channels = reinterpret_cast<Type**> (allocatedData.getData()); | ||||
auto* chan = (Type*) (allocatedData + channelListSize); | |||||
Type* chan = (Type*) (allocatedData + channelListSize); | |||||
for (int i = 0; i < numChannels; ++i) | for (int i = 0; i < numChannels; ++i) | ||||
{ | { | ||||
channels[i] = chan; | channels[i] = chan; | ||||
chan += size; | chan += size; | ||||
} | } | ||||
channels [numChannels] = nullptr; | |||||
channels[numChannels] = nullptr; | |||||
isClear = false; | isClear = false; | ||||
} | } | ||||
void allocateChannels (Type* const* const dataToReferTo, int offset) | |||||
void allocateChannels (Type* const* dataToReferTo, int offset) | |||||
{ | { | ||||
jassert (offset >= 0); | jassert (offset >= 0); | ||||
@@ -1089,7 +1087,7 @@ private: | |||||
channels[i] = dataToReferTo[i] + offset; | channels[i] = dataToReferTo[i] + offset; | ||||
} | } | ||||
channels [numChannels] = nullptr; | |||||
channels[numChannels] = nullptr; | |||||
isClear = false; | isClear = false; | ||||
} | } | ||||
@@ -1107,6 +1105,3 @@ private: | |||||
@see AudioBuffer | @see AudioBuffer | ||||
*/ | */ | ||||
typedef AudioBuffer<float> AudioSampleBuffer; | typedef AudioBuffer<float> AudioSampleBuffer; | ||||
#endif // JUCE_AUDIOSAMPLEBUFFER_H_INCLUDED |
@@ -2,28 +2,20 @@ | |||||
============================================================================== | ============================================================================== | ||||
This file is part of the JUCE library. | This file is part of the JUCE library. | ||||
Copyright (c) 2016 - ROLI Ltd. | |||||
Copyright (c) 2017 - ROLI Ltd. | |||||
Permission is granted to use this software under the terms of the ISC license | |||||
http://www.isc.org/downloads/software-support-policy/isc-license/ | |||||
JUCE is an open source library subject to commercial or open-source | |||||
licensing. | |||||
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. | |||||
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. | |||||
THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH REGARD | |||||
TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND | |||||
FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, | |||||
OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF | |||||
USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER | |||||
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE | |||||
OF THIS SOFTWARE. | |||||
----------------------------------------------------------------------------- | |||||
To release a closed-source product which uses other parts of JUCE not | |||||
licensed under the ISC terms, commercial licenses are available: visit | |||||
www.juce.com for more information. | |||||
JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER | |||||
EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE | |||||
DISCLAIMED. | |||||
============================================================================== | ============================================================================== | ||||
*/ | */ | ||||
@@ -697,9 +689,13 @@ void JUCE_CALLTYPE FloatVectorOperations::addWithMultiply (float* dest, const fl | |||||
void JUCE_CALLTYPE FloatVectorOperations::addWithMultiply (double* dest, const double* src, double multiplier, int num) noexcept | void JUCE_CALLTYPE FloatVectorOperations::addWithMultiply (double* dest, const double* src, double multiplier, int num) noexcept | ||||
{ | { | ||||
#if JUCE_USE_VDSP_FRAMEWORK | |||||
vDSP_vsmaD (src, 1, &multiplier, dest, 1, dest, 1, (vDSP_Length) num); | |||||
#else | |||||
JUCE_PERFORM_VEC_OP_SRC_DEST (dest[i] += src[i] * multiplier, Mode::add (d, Mode::mul (mult, s)), | JUCE_PERFORM_VEC_OP_SRC_DEST (dest[i] += src[i] * multiplier, Mode::add (d, Mode::mul (mult, s)), | ||||
JUCE_LOAD_SRC_DEST, JUCE_INCREMENT_SRC_DEST, | JUCE_LOAD_SRC_DEST, JUCE_INCREMENT_SRC_DEST, | ||||
const Mode::ParallelType mult = Mode::load1 (multiplier);) | const Mode::ParallelType mult = Mode::load1 (multiplier);) | ||||
#endif | |||||
} | } | ||||
void JUCE_CALLTYPE FloatVectorOperations::addWithMultiply (float* dest, const float* src1, const float* src2, int num) noexcept | void JUCE_CALLTYPE FloatVectorOperations::addWithMultiply (float* dest, const float* src1, const float* src2, int num) noexcept | ||||
@@ -724,6 +720,34 @@ void JUCE_CALLTYPE FloatVectorOperations::addWithMultiply (double* dest, const d | |||||
#endif | #endif | ||||
} | } | ||||
void JUCE_CALLTYPE FloatVectorOperations::subtractWithMultiply (float* dest, const float* src, float multiplier, int num) noexcept | |||||
{ | |||||
JUCE_PERFORM_VEC_OP_SRC_DEST (dest[i] -= src[i] * multiplier, Mode::sub (d, Mode::mul (mult, s)), | |||||
JUCE_LOAD_SRC_DEST, JUCE_INCREMENT_SRC_DEST, | |||||
const Mode::ParallelType mult = Mode::load1 (multiplier);) | |||||
} | |||||
void JUCE_CALLTYPE FloatVectorOperations::subtractWithMultiply (double* dest, const double* src, double multiplier, int num) noexcept | |||||
{ | |||||
JUCE_PERFORM_VEC_OP_SRC_DEST (dest[i] -= src[i] * multiplier, Mode::sub (d, Mode::mul (mult, s)), | |||||
JUCE_LOAD_SRC_DEST, JUCE_INCREMENT_SRC_DEST, | |||||
const Mode::ParallelType mult = Mode::load1 (multiplier);) | |||||
} | |||||
void JUCE_CALLTYPE FloatVectorOperations::subtractWithMultiply (float* dest, const float* src1, const float* src2, int num) noexcept | |||||
{ | |||||
JUCE_PERFORM_VEC_OP_SRC1_SRC2_DEST_DEST (dest[i] -= src1[i] * src2[i], Mode::sub (d, Mode::mul (s1, s2)), | |||||
JUCE_LOAD_SRC1_SRC2_DEST, | |||||
JUCE_INCREMENT_SRC1_SRC2_DEST, ) | |||||
} | |||||
void JUCE_CALLTYPE FloatVectorOperations::subtractWithMultiply (double* dest, const double* src1, const double* src2, int num) noexcept | |||||
{ | |||||
JUCE_PERFORM_VEC_OP_SRC1_SRC2_DEST_DEST (dest[i] -= src1[i] * src2[i], Mode::sub (d, Mode::mul (s1, s2)), | |||||
JUCE_LOAD_SRC1_SRC2_DEST, | |||||
JUCE_INCREMENT_SRC1_SRC2_DEST, ) | |||||
} | |||||
void JUCE_CALLTYPE FloatVectorOperations::multiply (float* dest, const float* src, int num) noexcept | void JUCE_CALLTYPE FloatVectorOperations::multiply (float* dest, const float* src, int num) noexcept | ||||
{ | { | ||||
#if JUCE_USE_VDSP_FRAMEWORK | #if JUCE_USE_VDSP_FRAMEWORK | ||||
@@ -1003,7 +1027,7 @@ double JUCE_CALLTYPE FloatVectorOperations::findMaximum (const double* src, int | |||||
void JUCE_CALLTYPE FloatVectorOperations::enableFlushToZeroMode (bool shouldEnable) noexcept | void JUCE_CALLTYPE FloatVectorOperations::enableFlushToZeroMode (bool shouldEnable) noexcept | ||||
{ | { | ||||
#if JUCE_USE_SSE_INTRINSICS && ! JUCE_MINGW | |||||
#if JUCE_USE_SSE_INTRINSICS | |||||
_MM_SET_FLUSH_ZERO_MODE (shouldEnable ? _MM_FLUSH_ZERO_ON : _MM_FLUSH_ZERO_OFF); | _MM_SET_FLUSH_ZERO_MODE (shouldEnable ? _MM_FLUSH_ZERO_ON : _MM_FLUSH_ZERO_OFF); | ||||
#endif | #endif | ||||
ignoreUnused (shouldEnable); | ignoreUnused (shouldEnable); | ||||
@@ -1011,7 +1035,7 @@ void JUCE_CALLTYPE FloatVectorOperations::enableFlushToZeroMode (bool shouldEnab | |||||
void JUCE_CALLTYPE FloatVectorOperations::disableDenormalisedNumberSupport() noexcept | void JUCE_CALLTYPE FloatVectorOperations::disableDenormalisedNumberSupport() noexcept | ||||
{ | { | ||||
#if JUCE_USE_SSE_INTRINSICS && ! JUCE_MINGW | |||||
#if JUCE_USE_SSE_INTRINSICS | |||||
const unsigned int mxcsr = _mm_getcsr(); | const unsigned int mxcsr = _mm_getcsr(); | ||||
_mm_setcsr (mxcsr | 0x8040); // add the DAZ and FZ bits | _mm_setcsr (mxcsr | 0x8040); // add the DAZ and FZ bits | ||||
#endif | #endif | ||||
@@ -1024,7 +1048,7 @@ void JUCE_CALLTYPE FloatVectorOperations::disableDenormalisedNumberSupport() noe | |||||
class FloatVectorOperationsTests : public UnitTest | class FloatVectorOperationsTests : public UnitTest | ||||
{ | { | ||||
public: | public: | ||||
FloatVectorOperationsTests() : UnitTest ("FloatVectorOperations") {} | |||||
FloatVectorOperationsTests() : UnitTest ("FloatVectorOperations", "Audio") {} | |||||
template <typename ValueType> | template <typename ValueType> | ||||
struct TestRunner | struct TestRunner | ||||
@@ -2,35 +2,31 @@ | |||||
============================================================================== | ============================================================================== | ||||
This file is part of the JUCE library. | This file is part of the JUCE library. | ||||
Copyright (c) 2016 - ROLI Ltd. | |||||
Copyright (c) 2017 - ROLI Ltd. | |||||
Permission is granted to use this software under the terms of the ISC license | |||||
http://www.isc.org/downloads/software-support-policy/isc-license/ | |||||
JUCE is an open source library subject to commercial or open-source | |||||
licensing. | |||||
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. | |||||
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. | |||||
THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH REGARD | |||||
TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND | |||||
FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, | |||||
OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF | |||||
USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER | |||||
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE | |||||
OF THIS SOFTWARE. | |||||
----------------------------------------------------------------------------- | |||||
To release a closed-source product which uses other parts of JUCE not | |||||
licensed under the ISC terms, commercial licenses are available: visit | |||||
www.juce.com for more information. | |||||
JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER | |||||
EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE | |||||
DISCLAIMED. | |||||
============================================================================== | ============================================================================== | ||||
*/ | */ | ||||
#ifndef JUCE_FLOATVECTOROPERATIONS_H_INCLUDED | |||||
#define JUCE_FLOATVECTOROPERATIONS_H_INCLUDED | |||||
#pragma once | |||||
#if JUCE_INTEL | |||||
#define JUCE_SNAP_TO_ZERO(n) if (! (n < -1.0e-8f || n > 1.0e-8f)) n = 0; | |||||
#else | |||||
#define JUCE_SNAP_TO_ZERO(n) | |||||
#endif | |||||
//============================================================================== | //============================================================================== | ||||
/** | /** | ||||
@@ -113,6 +109,18 @@ public: | |||||
/** Multiplies each source1 value by the corresponding source2 value, then adds it to the destination value. */ | /** Multiplies each source1 value by the corresponding source2 value, then adds it to the destination value. */ | ||||
static void JUCE_CALLTYPE addWithMultiply (double* dest, const double* src1, const double* src2, int num) noexcept; | static void JUCE_CALLTYPE addWithMultiply (double* dest, const double* src1, const double* src2, int num) noexcept; | ||||
/** Multiplies each source value by the given multiplier, then subtracts it to the destination value. */ | |||||
static void JUCE_CALLTYPE subtractWithMultiply (float* dest, const float* src, float multiplier, int numValues) noexcept; | |||||
/** Multiplies each source value by the given multiplier, then subtracts it to the destination value. */ | |||||
static void JUCE_CALLTYPE subtractWithMultiply (double* dest, const double* src, double multiplier, int numValues) noexcept; | |||||
/** Multiplies each source1 value by the corresponding source2 value, then subtracts it to the destination value. */ | |||||
static void JUCE_CALLTYPE subtractWithMultiply (float* dest, const float* src1, const float* src2, int num) noexcept; | |||||
/** Multiplies each source1 value by the corresponding source2 value, then subtracts it to the destination value. */ | |||||
static void JUCE_CALLTYPE subtractWithMultiply (double* dest, const double* src1, const double* src2, int num) noexcept; | |||||
/** Multiplies the destination values by the source values. */ | /** Multiplies the destination values by the source values. */ | ||||
static void JUCE_CALLTYPE multiply (float* dest, const float* src, int numValues) noexcept; | static void JUCE_CALLTYPE multiply (float* dest, const float* src, int numValues) noexcept; | ||||
@@ -211,6 +219,3 @@ public: | |||||
*/ | */ | ||||
static void JUCE_CALLTYPE disableDenormalisedNumberSupport() noexcept; | static void JUCE_CALLTYPE disableDenormalisedNumberSupport() noexcept; | ||||
}; | }; | ||||
#endif // JUCE_FLOATVECTOROPERATIONS_H_INCLUDED |
@@ -2,28 +2,20 @@ | |||||
============================================================================== | ============================================================================== | ||||
This file is part of the JUCE library. | This file is part of the JUCE library. | ||||
Copyright (c) 2016 - ROLI Ltd. | |||||
Copyright (c) 2017 - ROLI Ltd. | |||||
Permission is granted to use this software under the terms of the ISC license | |||||
http://www.isc.org/downloads/software-support-policy/isc-license/ | |||||
JUCE is an open source library subject to commercial or open-source | |||||
licensing. | |||||
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. | |||||
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. | |||||
THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH REGARD | |||||
TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND | |||||
FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, | |||||
OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF | |||||
USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER | |||||
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE | |||||
OF THIS SOFTWARE. | |||||
----------------------------------------------------------------------------- | |||||
To release a closed-source product which uses other parts of JUCE not | |||||
licensed under the ISC terms, commercial licenses are available: visit | |||||
www.juce.com for more information. | |||||
JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER | |||||
EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE | |||||
DISCLAIMED. | |||||
============================================================================== | ============================================================================== | ||||
*/ | */ | ||||
@@ -2,28 +2,20 @@ | |||||
============================================================================== | ============================================================================== | ||||
This file is part of the JUCE library. | This file is part of the JUCE library. | ||||
Copyright (c) 2016 - ROLI Ltd. | |||||
Copyright (c) 2017 - ROLI Ltd. | |||||
Permission is granted to use this software under the terms of the ISC license | |||||
http://www.isc.org/downloads/software-support-policy/isc-license/ | |||||
JUCE is an open source library subject to commercial or open-source | |||||
licensing. | |||||
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. | |||||
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. | |||||
THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH REGARD | |||||
TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND | |||||
FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, | |||||
OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF | |||||
USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER | |||||
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE | |||||
OF THIS SOFTWARE. | |||||
----------------------------------------------------------------------------- | |||||
To release a closed-source product which uses other parts of JUCE not | |||||
licensed under the ISC terms, commercial licenses are available: visit | |||||
www.juce.com for more information. | |||||
JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER | |||||
EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE | |||||
DISCLAIMED. | |||||
============================================================================== | ============================================================================== | ||||
*/ | */ | ||||
@@ -2,34 +2,25 @@ | |||||
============================================================================== | ============================================================================== | ||||
This file is part of the JUCE library. | This file is part of the JUCE library. | ||||
Copyright (c) 2016 - ROLI Ltd. | |||||
Copyright (c) 2017 - ROLI Ltd. | |||||
Permission is granted to use this software under the terms of the ISC license | |||||
http://www.isc.org/downloads/software-support-policy/isc-license/ | |||||
JUCE is an open source library subject to commercial or open-source | |||||
licensing. | |||||
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. | |||||
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. | |||||
THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH REGARD | |||||
TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND | |||||
FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, | |||||
OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF | |||||
USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER | |||||
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE | |||||
OF THIS SOFTWARE. | |||||
----------------------------------------------------------------------------- | |||||
To release a closed-source product which uses other parts of JUCE not | |||||
licensed under the ISC terms, commercial licenses are available: visit | |||||
www.juce.com for more information. | |||||
JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER | |||||
EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE | |||||
DISCLAIMED. | |||||
============================================================================== | ============================================================================== | ||||
*/ | */ | ||||
#ifndef JUCE_DECIBELS_H_INCLUDED | |||||
#define JUCE_DECIBELS_H_INCLUDED | |||||
#pragma once | |||||
//============================================================================== | //============================================================================== | ||||
@@ -105,6 +96,3 @@ private: | |||||
Decibels(); // This class can't be instantiated, it's just a holder for static methods.. | Decibels(); // This class can't be instantiated, it's just a holder for static methods.. | ||||
JUCE_DECLARE_NON_COPYABLE (Decibels) | JUCE_DECLARE_NON_COPYABLE (Decibels) | ||||
}; | }; | ||||
#endif // JUCE_DECIBELS_H_INCLUDED |
@@ -1,311 +0,0 @@ | |||||
/* | |||||
============================================================================== | |||||
This file is part of the JUCE library. | |||||
Copyright (c) 2016 - ROLI Ltd. | |||||
Permission is granted to use this software 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. | |||||
THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH REGARD | |||||
TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND | |||||
FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, | |||||
OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF | |||||
USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER | |||||
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE | |||||
OF THIS SOFTWARE. | |||||
----------------------------------------------------------------------------- | |||||
To release a closed-source product which uses other parts of JUCE not | |||||
licensed under the ISC terms, commercial licenses are available: visit | |||||
www.juce.com for more information. | |||||
============================================================================== | |||||
*/ | |||||
// (For the moment, we'll implement a few local operators for this complex class - one | |||||
// day we'll probably either have a juce complex class, or use the C++11 one) | |||||
static FFT::Complex operator+ (FFT::Complex a, FFT::Complex b) noexcept { FFT::Complex c = { a.r + b.r, a.i + b.i }; return c; } | |||||
static FFT::Complex operator- (FFT::Complex a, FFT::Complex b) noexcept { FFT::Complex c = { a.r - b.r, a.i - b.i }; return c; } | |||||
static FFT::Complex operator* (FFT::Complex a, FFT::Complex b) noexcept { FFT::Complex c = { a.r * b.r - a.i * b.i, a.r * b.i + a.i * b.r }; return c; } | |||||
static FFT::Complex& operator+= (FFT::Complex& a, FFT::Complex b) noexcept { a.r += b.r; a.i += b.i; return a; } | |||||
//============================================================================== | |||||
struct FFT::FFTConfig | |||||
{ | |||||
FFTConfig (int sizeOfFFT, bool isInverse) | |||||
: fftSize (sizeOfFFT), inverse (isInverse), twiddleTable ((size_t) sizeOfFFT) | |||||
{ | |||||
for (int i = 0; i < fftSize; ++i) | |||||
{ | |||||
const double phase = (isInverse ? 2.0 : -2.0) * double_Pi * i / fftSize; | |||||
twiddleTable[i].r = (float) cos (phase); | |||||
twiddleTable[i].i = (float) sin (phase); | |||||
} | |||||
const int root = (int) std::sqrt ((double) fftSize); | |||||
int divisor = 4, n = fftSize; | |||||
for (int i = 0; i < numElementsInArray (factors); ++i) | |||||
{ | |||||
while ((n % divisor) != 0) | |||||
{ | |||||
if (divisor == 2) divisor = 3; | |||||
else if (divisor == 4) divisor = 2; | |||||
else divisor += 2; | |||||
if (divisor > root) | |||||
divisor = n; | |||||
} | |||||
n /= divisor; | |||||
jassert (divisor == 1 || divisor == 2 || divisor == 4); | |||||
factors[i].radix = divisor; | |||||
factors[i].length = n; | |||||
} | |||||
} | |||||
void perform (const Complex* input, Complex* output) const noexcept | |||||
{ | |||||
perform (input, output, 1, 1, factors); | |||||
} | |||||
const int fftSize; | |||||
const bool inverse; | |||||
struct Factor { int radix, length; }; | |||||
Factor factors[32]; | |||||
HeapBlock<Complex> twiddleTable; | |||||
void perform (const Complex* input, Complex* output, const int stride, const int strideIn, const Factor* facs) const noexcept | |||||
{ | |||||
const Factor factor (*facs++); | |||||
Complex* const originalOutput = output; | |||||
const Complex* const outputEnd = output + factor.radix * factor.length; | |||||
if (stride == 1 && factor.radix <= 5) | |||||
{ | |||||
for (int i = 0; i < factor.radix; ++i) | |||||
perform (input + stride * strideIn * i, output + i * factor.length, stride * factor.radix, strideIn, facs); | |||||
butterfly (factor, output, stride); | |||||
return; | |||||
} | |||||
if (factor.length == 1) | |||||
{ | |||||
do | |||||
{ | |||||
*output++ = *input; | |||||
input += stride * strideIn; | |||||
} | |||||
while (output < outputEnd); | |||||
} | |||||
else | |||||
{ | |||||
do | |||||
{ | |||||
perform (input, output, stride * factor.radix, strideIn, facs); | |||||
input += stride * strideIn; | |||||
output += factor.length; | |||||
} | |||||
while (output < outputEnd); | |||||
} | |||||
butterfly (factor, originalOutput, stride); | |||||
} | |||||
void butterfly (const Factor factor, Complex* data, const int stride) const noexcept | |||||
{ | |||||
switch (factor.radix) | |||||
{ | |||||
case 1: break; | |||||
case 2: butterfly2 (data, stride, factor.length); return; | |||||
case 4: butterfly4 (data, stride, factor.length); return; | |||||
default: jassertfalse; break; | |||||
} | |||||
Complex* scratch = static_cast<Complex*> (alloca (sizeof (Complex) * (size_t) factor.radix)); | |||||
for (int i = 0; i < factor.length; ++i) | |||||
{ | |||||
for (int k = i, q1 = 0; q1 < factor.radix; ++q1) | |||||
{ | |||||
scratch[q1] = data[k]; | |||||
k += factor.length; | |||||
} | |||||
for (int k = i, q1 = 0; q1 < factor.radix; ++q1) | |||||
{ | |||||
int twiddleIndex = 0; | |||||
data[k] = scratch[0]; | |||||
for (int q = 1; q < factor.radix; ++q) | |||||
{ | |||||
twiddleIndex += stride * k; | |||||
if (twiddleIndex >= fftSize) | |||||
twiddleIndex -= fftSize; | |||||
data[k] += scratch[q] * twiddleTable[twiddleIndex]; | |||||
} | |||||
k += factor.length; | |||||
} | |||||
} | |||||
} | |||||
void butterfly2 (Complex* data, const int stride, const int length) const noexcept | |||||
{ | |||||
Complex* dataEnd = data + length; | |||||
const Complex* tw = twiddleTable; | |||||
for (int i = length; --i >= 0;) | |||||
{ | |||||
const Complex s (*dataEnd * *tw); | |||||
tw += stride; | |||||
*dataEnd++ = *data - s; | |||||
*data++ += s; | |||||
} | |||||
} | |||||
void butterfly4 (Complex* data, const int stride, const int length) const noexcept | |||||
{ | |||||
const int lengthX2 = length * 2; | |||||
const int lengthX3 = length * 3; | |||||
const Complex* twiddle1 = twiddleTable; | |||||
const Complex* twiddle2 = twiddle1; | |||||
const Complex* twiddle3 = twiddle1; | |||||
for (int i = length; --i >= 0;) | |||||
{ | |||||
const Complex s0 = data[length] * *twiddle1; | |||||
const Complex s1 = data[lengthX2] * *twiddle2; | |||||
const Complex s2 = data[lengthX3] * *twiddle3; | |||||
const Complex s3 = s0 + s2; | |||||
const Complex s4 = s0 - s2; | |||||
const Complex s5 = *data - s1; | |||||
*data += s1; | |||||
data[lengthX2] = *data - s3; | |||||
twiddle1 += stride; | |||||
twiddle2 += stride * 2; | |||||
twiddle3 += stride * 3; | |||||
*data += s3; | |||||
if (inverse) | |||||
{ | |||||
data[length].r = s5.r - s4.i; | |||||
data[length].i = s5.i + s4.r; | |||||
data[lengthX3].r = s5.r + s4.i; | |||||
data[lengthX3].i = s5.i - s4.r; | |||||
} | |||||
else | |||||
{ | |||||
data[length].r = s5.r + s4.i; | |||||
data[length].i = s5.i - s4.r; | |||||
data[lengthX3].r = s5.r - s4.i; | |||||
data[lengthX3].i = s5.i + s4.r; | |||||
} | |||||
++data; | |||||
} | |||||
} | |||||
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (FFTConfig) | |||||
}; | |||||
//============================================================================== | |||||
FFT::FFT (int order, bool inverse) : config (new FFTConfig (1 << order, inverse)), size (1 << order) {} | |||||
FFT::~FFT() {} | |||||
void FFT::perform (const Complex* const input, Complex* const output) const noexcept | |||||
{ | |||||
config->perform (input, output); | |||||
} | |||||
const size_t maxFFTScratchSpaceToAlloca = 256 * 1024; | |||||
void FFT::performRealOnlyForwardTransform (float* d) const noexcept | |||||
{ | |||||
const size_t scratchSize = 16 + sizeof (FFT::Complex) * (size_t) size; | |||||
if (scratchSize < maxFFTScratchSpaceToAlloca) | |||||
{ | |||||
performRealOnlyForwardTransform (static_cast<Complex*> (alloca (scratchSize)), d); | |||||
} | |||||
else | |||||
{ | |||||
HeapBlock<char> heapSpace (scratchSize); | |||||
performRealOnlyForwardTransform (reinterpret_cast<Complex*> (heapSpace.getData()), d); | |||||
} | |||||
} | |||||
void FFT::performRealOnlyInverseTransform (float* d) const noexcept | |||||
{ | |||||
const size_t scratchSize = 16 + sizeof (FFT::Complex) * (size_t) size; | |||||
if (scratchSize < maxFFTScratchSpaceToAlloca) | |||||
{ | |||||
performRealOnlyInverseTransform (static_cast<Complex*> (alloca (scratchSize)), d); | |||||
} | |||||
else | |||||
{ | |||||
HeapBlock<char> heapSpace (scratchSize); | |||||
performRealOnlyInverseTransform (reinterpret_cast<Complex*> (heapSpace.getData()), d); | |||||
} | |||||
} | |||||
void FFT::performRealOnlyForwardTransform (Complex* scratch, float* d) const noexcept | |||||
{ | |||||
// This can only be called on an FFT object that was created to do forward transforms. | |||||
jassert (! config->inverse); | |||||
for (int i = 0; i < size; ++i) | |||||
{ | |||||
scratch[i].r = d[i]; | |||||
scratch[i].i = 0; | |||||
} | |||||
perform (scratch, reinterpret_cast<Complex*> (d)); | |||||
} | |||||
void FFT::performRealOnlyInverseTransform (Complex* scratch, float* d) const noexcept | |||||
{ | |||||
// This can only be called on an FFT object that was created to do inverse transforms. | |||||
jassert (config->inverse); | |||||
perform (reinterpret_cast<const Complex*> (d), scratch); | |||||
const float scaleFactor = 1.0f / size; | |||||
for (int i = 0; i < size; ++i) | |||||
{ | |||||
d[i] = scratch[i].r * scaleFactor; | |||||
d[i + size] = scratch[i].i * scaleFactor; | |||||
} | |||||
} | |||||
void FFT::performFrequencyOnlyForwardTransform (float* d) const noexcept | |||||
{ | |||||
performRealOnlyForwardTransform (d); | |||||
const int twiceSize = size * 2; | |||||
for (int i = 0; i < twiceSize; i += 2) | |||||
{ | |||||
d[i / 2] = juce_hypot (d[i], d[i + 1]); | |||||
if (i >= size) | |||||
{ | |||||
d[i] = 0; | |||||
d[i + 1] = 0; | |||||
} | |||||
} | |||||
} |
@@ -1,101 +0,0 @@ | |||||
/* | |||||
============================================================================== | |||||
This file is part of the JUCE library. | |||||
Copyright (c) 2016 - ROLI Ltd. | |||||
Permission is granted to use this software 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. | |||||
THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH REGARD | |||||
TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND | |||||
FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, | |||||
OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF | |||||
USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER | |||||
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE | |||||
OF THIS SOFTWARE. | |||||
----------------------------------------------------------------------------- | |||||
To release a closed-source product which uses other parts of JUCE not | |||||
licensed under the ISC terms, commercial licenses are available: visit | |||||
www.juce.com for more information. | |||||
============================================================================== | |||||
*/ | |||||
/** | |||||
A very minimal FFT class. | |||||
This is only a simple low-footprint implementation and isn't tuned for speed - it may | |||||
be useful for simple applications where one of the more complex FFT libraries would be | |||||
overkill. (But in the future it may end up becoming optimised of course...) | |||||
The FFT class itself contains lookup tables, so there's some overhead in creating | |||||
one, you should create and cache an FFT object for each size/direction of transform | |||||
that you need, and re-use them to perform the actual operation. | |||||
*/ | |||||
class JUCE_API FFT | |||||
{ | |||||
public: | |||||
/** Initialises an object for performing either a forward or inverse FFT with the given size. | |||||
The the number of points the FFT will operate on will be 2 ^ order. | |||||
*/ | |||||
FFT (int order, bool isInverse); | |||||
/** Destructor. */ | |||||
~FFT(); | |||||
/** A complex number, for the purposes of the FFT class. */ | |||||
struct Complex | |||||
{ | |||||
float r; /**< Real part. */ | |||||
float i; /**< Imaginary part. */ | |||||
}; | |||||
/** Performs an out-of-place FFT, either forward or inverse depending on the mode | |||||
that was passed to this object's constructor. | |||||
The arrays must contain at least getSize() elements. | |||||
*/ | |||||
void perform (const Complex* input, Complex* output) const noexcept; | |||||
/** Performs an in-place forward transform on a block of real data. | |||||
The size of the array passed in must be 2 * getSize(), and the first half | |||||
should contain your raw input sample data. On return, the array will contain | |||||
complex frequency + phase data, and can be passed to performRealOnlyInverseTransform() | |||||
in order to convert it back to reals. | |||||
*/ | |||||
void performRealOnlyForwardTransform (float* inputOutputData) const noexcept; | |||||
/** Performs a reverse operation to data created in performRealOnlyForwardTransform(). | |||||
The size of the array passed in must be 2 * getSize(), containing complex | |||||
frequency and phase data. On return, the first half of the array will contain | |||||
the reconstituted samples. | |||||
*/ | |||||
void performRealOnlyInverseTransform (float* inputOutputData) const noexcept; | |||||
/** Takes an array and simply transforms it to the frequency spectrum. | |||||
This may be handy for things like frequency displays or analysis. | |||||
*/ | |||||
void performFrequencyOnlyForwardTransform (float* inputOutputData) const noexcept; | |||||
/** Returns the number of data points that this FFT was created to work with. */ | |||||
int getSize() const noexcept { return size; } | |||||
private: | |||||
JUCE_PUBLIC_IN_DLL_BUILD (struct FFTConfig) | |||||
ScopedPointer<FFTConfig> config; | |||||
const int size; | |||||
void performRealOnlyForwardTransform (Complex*, float*) const noexcept; | |||||
void performRealOnlyInverseTransform (Complex*, float*) const noexcept; | |||||
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (FFT) | |||||
}; |
@@ -2,38 +2,24 @@ | |||||
============================================================================== | ============================================================================== | ||||
This file is part of the JUCE library. | This file is part of the JUCE library. | ||||
Copyright (c) 2016 - ROLI Ltd. | |||||
Copyright (c) 2017 - ROLI Ltd. | |||||
Permission is granted to use this software under the terms of the ISC license | |||||
http://www.isc.org/downloads/software-support-policy/isc-license/ | |||||
JUCE is an open source library subject to commercial or open-source | |||||
licensing. | |||||
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. | |||||
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. | |||||
THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH REGARD | |||||
TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND | |||||
FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, | |||||
OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF | |||||
USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER | |||||
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE | |||||
OF THIS SOFTWARE. | |||||
----------------------------------------------------------------------------- | |||||
To release a closed-source product which uses other parts of JUCE not | |||||
licensed under the ISC terms, commercial licenses are available: visit | |||||
www.juce.com for more information. | |||||
JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER | |||||
EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE | |||||
DISCLAIMED. | |||||
============================================================================== | ============================================================================== | ||||
*/ | */ | ||||
#if JUCE_INTEL | |||||
#define JUCE_SNAP_TO_ZERO(n) if (! (n < -1.0e-8f || n > 1.0e-8f)) n = 0; | |||||
#else | |||||
#define JUCE_SNAP_TO_ZERO(n) | |||||
#endif | |||||
//============================================================================== | //============================================================================== | ||||
IIRCoefficients::IIRCoefficients() noexcept | IIRCoefficients::IIRCoefficients() noexcept | ||||
{ | { | ||||
@@ -2,34 +2,25 @@ | |||||
============================================================================== | ============================================================================== | ||||
This file is part of the JUCE library. | This file is part of the JUCE library. | ||||
Copyright (c) 2016 - ROLI Ltd. | |||||
Copyright (c) 2017 - ROLI Ltd. | |||||
Permission is granted to use this software under the terms of the ISC license | |||||
http://www.isc.org/downloads/software-support-policy/isc-license/ | |||||
JUCE is an open source library subject to commercial or open-source | |||||
licensing. | |||||
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. | |||||
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. | |||||
THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH REGARD | |||||
TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND | |||||
FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, | |||||
OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF | |||||
USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER | |||||
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE | |||||
OF THIS SOFTWARE. | |||||
----------------------------------------------------------------------------- | |||||
To release a closed-source product which uses other parts of JUCE not | |||||
licensed under the ISC terms, commercial licenses are available: visit | |||||
www.juce.com for more information. | |||||
JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER | |||||
EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE | |||||
DISCLAIMED. | |||||
============================================================================== | ============================================================================== | ||||
*/ | */ | ||||
#ifndef JUCE_IIRFILTER_H_INCLUDED | |||||
#define JUCE_IIRFILTER_H_INCLUDED | |||||
#pragma once | |||||
class IIRFilter; | class IIRFilter; | ||||
@@ -214,6 +205,3 @@ protected: | |||||
IIRFilter& operator= (const IIRFilter&); | IIRFilter& operator= (const IIRFilter&); | ||||
JUCE_LEAK_DETECTOR (IIRFilter) | JUCE_LEAK_DETECTOR (IIRFilter) | ||||
}; | }; | ||||
#endif // JUCE_IIRFILTER_H_INCLUDED |
@@ -2,28 +2,20 @@ | |||||
============================================================================== | ============================================================================== | ||||
This file is part of the JUCE library. | This file is part of the JUCE library. | ||||
Copyright (c) 2016 - ROLI Ltd. | |||||
Copyright (c) 2017 - ROLI Ltd. | |||||
Permission is granted to use this software under the terms of the ISC license | |||||
http://www.isc.org/downloads/software-support-policy/isc-license/ | |||||
JUCE is an open source library subject to commercial or open-source | |||||
licensing. | |||||
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. | |||||
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. | |||||
THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH REGARD | |||||
TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND | |||||
FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, | |||||
OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF | |||||
USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER | |||||
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE | |||||
OF THIS SOFTWARE. | |||||
----------------------------------------------------------------------------- | |||||
To release a closed-source product which uses other parts of JUCE not | |||||
licensed under the ISC terms, commercial licenses are available: visit | |||||
www.juce.com for more information. | |||||
JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER | |||||
EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE | |||||
DISCLAIMED. | |||||
============================================================================== | ============================================================================== | ||||
*/ | */ | ||||
@@ -2,28 +2,20 @@ | |||||
============================================================================== | ============================================================================== | ||||
This file is part of the JUCE library. | This file is part of the JUCE library. | ||||
Copyright (c) 2016 - ROLI Ltd. | |||||
Copyright (c) 2017 - ROLI Ltd. | |||||
Permission is granted to use this software under the terms of the ISC license | |||||
http://www.isc.org/downloads/software-support-policy/isc-license/ | |||||
JUCE is an open source library subject to commercial or open-source | |||||
licensing. | |||||
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. | |||||
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. | |||||
THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH REGARD | |||||
TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND | |||||
FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, | |||||
OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF | |||||
USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER | |||||
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE | |||||
OF THIS SOFTWARE. | |||||
----------------------------------------------------------------------------- | |||||
To release a closed-source product which uses other parts of JUCE not | |||||
licensed under the ISC terms, commercial licenses are available: visit | |||||
www.juce.com for more information. | |||||
JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER | |||||
EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE | |||||
DISCLAIMED. | |||||
============================================================================== | ============================================================================== | ||||
*/ | */ | ||||
@@ -2,34 +2,25 @@ | |||||
============================================================================== | ============================================================================== | ||||
This file is part of the JUCE library. | This file is part of the JUCE library. | ||||
Copyright (c) 2016 - ROLI Ltd. | |||||
Copyright (c) 2017 - ROLI Ltd. | |||||
Permission is granted to use this software under the terms of the ISC license | |||||
http://www.isc.org/downloads/software-support-policy/isc-license/ | |||||
JUCE is an open source library subject to commercial or open-source | |||||
licensing. | |||||
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. | |||||
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. | |||||
THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH REGARD | |||||
TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND | |||||
FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, | |||||
OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF | |||||
USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER | |||||
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE | |||||
OF THIS SOFTWARE. | |||||
----------------------------------------------------------------------------- | |||||
To release a closed-source product which uses other parts of JUCE not | |||||
licensed under the ISC terms, commercial licenses are available: visit | |||||
www.juce.com for more information. | |||||
JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER | |||||
EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE | |||||
DISCLAIMED. | |||||
============================================================================== | ============================================================================== | ||||
*/ | */ | ||||
#ifndef JUCE_LINEARSMOOTHEDVALUE_H_INCLUDED | |||||
#define JUCE_LINEARSMOOTHEDVALUE_H_INCLUDED | |||||
#pragma once | |||||
//============================================================================== | //============================================================================== | ||||
@@ -45,18 +36,20 @@ class LinearSmoothedValue | |||||
public: | public: | ||||
/** Constructor. */ | /** Constructor. */ | ||||
LinearSmoothedValue() noexcept | LinearSmoothedValue() noexcept | ||||
: currentValue (0), target (0), step (0), countdown (0), stepsToTarget (0) | |||||
{ | { | ||||
} | } | ||||
/** Constructor. */ | /** Constructor. */ | ||||
LinearSmoothedValue (FloatType initialValue) noexcept | LinearSmoothedValue (FloatType initialValue) noexcept | ||||
: currentValue (initialValue), target (initialValue), step (0), countdown (0), stepsToTarget (0) | |||||
: currentValue (initialValue), target (initialValue) | |||||
{ | { | ||||
} | } | ||||
//============================================================================== | //============================================================================== | ||||
/** Reset to a new sample rate and ramp length. */ | |||||
/** Reset to a new sample rate and ramp length. | |||||
@param sampleRate The sampling rate | |||||
@param rampLengthInSeconds The duration of the ramp in seconds | |||||
*/ | |||||
void reset (double sampleRate, double rampLengthInSeconds) noexcept | void reset (double sampleRate, double rampLengthInSeconds) noexcept | ||||
{ | { | ||||
jassert (sampleRate > 0 && rampLengthInSeconds >= 0); | jassert (sampleRate > 0 && rampLengthInSeconds >= 0); | ||||
@@ -65,7 +58,10 @@ public: | |||||
countdown = 0; | countdown = 0; | ||||
} | } | ||||
/** Set a new target value. */ | |||||
//============================================================================== | |||||
/** Set a new target value. | |||||
@param newValue New target value | |||||
*/ | |||||
void setValue (FloatType newValue) noexcept | void setValue (FloatType newValue) noexcept | ||||
{ | { | ||||
if (target != newValue) | if (target != newValue) | ||||
@@ -80,7 +76,10 @@ public: | |||||
} | } | ||||
} | } | ||||
/** Compute the next value. */ | |||||
//============================================================================== | |||||
/** Compute the next value. | |||||
@returns Smoothed value | |||||
*/ | |||||
FloatType getNextValue() noexcept | FloatType getNextValue() noexcept | ||||
{ | { | ||||
if (countdown <= 0) | if (countdown <= 0) | ||||
@@ -103,11 +102,83 @@ public: | |||||
return target; | return target; | ||||
} | } | ||||
private: | |||||
//============================================================================== | //============================================================================== | ||||
FloatType currentValue, target, step; | |||||
int countdown, stepsToTarget; | |||||
}; | |||||
/** Applies a linear smoothed gain to a stream of samples | |||||
S[i] *= gain | |||||
@param samples Pointer to a raw array of samples | |||||
@param numSamples Length of array of samples | |||||
*/ | |||||
void applyGain (FloatType* samples, int numSamples) noexcept | |||||
{ | |||||
jassert(numSamples >= 0); | |||||
if (isSmoothing()) | |||||
{ | |||||
for (int i = 0; i < numSamples; i++) | |||||
samples[i] *= getNextValue(); | |||||
} | |||||
else | |||||
{ | |||||
FloatVectorOperations::multiply (samples, target, numSamples); | |||||
} | |||||
} | |||||
//============================================================================== | |||||
/** Computes output as linear smoothed gain applied to a stream of samples. | |||||
Sout[i] = Sin[i] * gain | |||||
@param samplesOut A pointer to a raw array of output samples | |||||
@param samplesIn A pointer to a raw array of input samples | |||||
@param numSamples The length of the array of samples | |||||
*/ | |||||
void applyGain (FloatType* samplesOut, const FloatType* samplesIn, int numSamples) noexcept | |||||
{ | |||||
jassert (numSamples >= 0); | |||||
#endif // JUCE_LINEARSMOOTHEDVALUE_H_INCLUDED | |||||
if (isSmoothing()) | |||||
{ | |||||
for (int i = 0; i < numSamples; i++) | |||||
samplesOut[i] = samplesIn[i] * getNextValue(); | |||||
} | |||||
else | |||||
{ | |||||
FloatVectorOperations::multiply (samplesOut, samplesIn, target, numSamples); | |||||
} | |||||
} | |||||
//============================================================================== | |||||
/** Applies a linear smoothed gain to a buffer */ | |||||
void applyGain (AudioBuffer<FloatType>& buffer, int numSamples) noexcept | |||||
{ | |||||
jassert (numSamples >= 0); | |||||
if (isSmoothing()) | |||||
{ | |||||
if (buffer.getNumChannels() == 1) | |||||
{ | |||||
FloatType* samples = buffer.getWritePointer(0); | |||||
for (int i = 0; i < numSamples; i++) | |||||
samples[i] *= getNextValue(); | |||||
} | |||||
else | |||||
{ | |||||
for (int i = 0; i < numSamples; i++) | |||||
{ | |||||
const FloatType gain = getNextValue(); | |||||
for (int channel = 0; channel < buffer.getNumChannels(); channel++) | |||||
buffer.setSample (channel, i, buffer.getSample (channel, i) * gain); | |||||
} | |||||
} | |||||
} | |||||
else | |||||
{ | |||||
buffer.applyGain (0, numSamples, target); | |||||
} | |||||
} | |||||
private: | |||||
//============================================================================== | |||||
FloatType currentValue = 0, target = 0, step = 0; | |||||
int countdown = 0, stepsToTarget = 0; | |||||
}; |
@@ -2,34 +2,25 @@ | |||||
============================================================================== | ============================================================================== | ||||
This file is part of the JUCE library. | This file is part of the JUCE library. | ||||
Copyright (c) 2016 - ROLI Ltd. | |||||
Copyright (c) 2017 - ROLI Ltd. | |||||
Permission is granted to use this software under the terms of the ISC license | |||||
http://www.isc.org/downloads/software-support-policy/isc-license/ | |||||
JUCE is an open source library subject to commercial or open-source | |||||
licensing. | |||||
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. | |||||
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. | |||||
THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH REGARD | |||||
TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND | |||||
FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, | |||||
OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF | |||||
USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER | |||||
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE | |||||
OF THIS SOFTWARE. | |||||
----------------------------------------------------------------------------- | |||||
To release a closed-source product which uses other parts of JUCE not | |||||
licensed under the ISC terms, commercial licenses are available: visit | |||||
www.juce.com for more information. | |||||
JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER | |||||
EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE | |||||
DISCLAIMED. | |||||
============================================================================== | ============================================================================== | ||||
*/ | */ | ||||
#ifndef JUCE_REVERB_H_INCLUDED | |||||
#define JUCE_REVERB_H_INCLUDED | |||||
#pragma once | |||||
//============================================================================== | //============================================================================== | ||||
@@ -325,6 +316,3 @@ private: | |||||
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (Reverb) | JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (Reverb) | ||||
}; | }; | ||||
#endif // JUCE_REVERB_H_INCLUDED |
@@ -2,28 +2,20 @@ | |||||
============================================================================== | ============================================================================== | ||||
This file is part of the JUCE library. | This file is part of the JUCE library. | ||||
Copyright (c) 2016 - ROLI Ltd. | |||||
Copyright (c) 2017 - ROLI Ltd. | |||||
Permission is granted to use this software under the terms of the ISC license | |||||
http://www.isc.org/downloads/software-support-policy/isc-license/ | |||||
JUCE is an open source library subject to commercial or open-source | |||||
licensing. | |||||
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. | |||||
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. | |||||
THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH REGARD | |||||
TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND | |||||
FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, | |||||
OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF | |||||
USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER | |||||
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE | |||||
OF THIS SOFTWARE. | |||||
----------------------------------------------------------------------------- | |||||
To release a closed-source product which uses other parts of JUCE not | |||||
licensed under the ISC terms, commercial licenses are available: visit | |||||
www.juce.com for more information. | |||||
JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER | |||||
EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE | |||||
DISCLAIMED. | |||||
============================================================================== | ============================================================================== | ||||
*/ | */ | ||||
@@ -37,8 +29,6 @@ | |||||
#error "Incorrect use of JUCE cpp file" | #error "Incorrect use of JUCE cpp file" | ||||
#endif | #endif | ||||
#include "AppConfig.h" | |||||
#include "juce_audio_basics.h" | #include "juce_audio_basics.h" | ||||
#if JUCE_MINGW && ! defined (__SSE2__) | #if JUCE_MINGW && ! defined (__SSE2__) | ||||
@@ -96,7 +86,6 @@ namespace juce | |||||
#include "effects/juce_IIRFilterOld.cpp" | #include "effects/juce_IIRFilterOld.cpp" | ||||
#include "effects/juce_LagrangeInterpolator.cpp" | #include "effects/juce_LagrangeInterpolator.cpp" | ||||
#include "effects/juce_CatmullRomInterpolator.cpp" | #include "effects/juce_CatmullRomInterpolator.cpp" | ||||
#include "effects/juce_FFT.cpp" | |||||
#include "midi/juce_MidiBuffer.cpp" | #include "midi/juce_MidiBuffer.cpp" | ||||
#include "midi/juce_MidiFile.cpp" | #include "midi/juce_MidiFile.cpp" | ||||
#include "midi/juce_MidiKeyboardState.cpp" | #include "midi/juce_MidiKeyboardState.cpp" | ||||
@@ -115,6 +104,7 @@ namespace juce | |||||
#include "sources/juce_BufferingAudioSource.cpp" | #include "sources/juce_BufferingAudioSource.cpp" | ||||
#include "sources/juce_ChannelRemappingAudioSource.cpp" | #include "sources/juce_ChannelRemappingAudioSource.cpp" | ||||
#include "sources/juce_IIRFilterAudioSource.cpp" | #include "sources/juce_IIRFilterAudioSource.cpp" | ||||
#include "sources/juce_MemoryAudioSource.cpp" | |||||
#include "sources/juce_MixerAudioSource.cpp" | #include "sources/juce_MixerAudioSource.cpp" | ||||
#include "sources/juce_ResamplingAudioSource.cpp" | #include "sources/juce_ResamplingAudioSource.cpp" | ||||
#include "sources/juce_ReverbAudioSource.cpp" | #include "sources/juce_ReverbAudioSource.cpp" | ||||
@@ -2,28 +2,20 @@ | |||||
============================================================================== | ============================================================================== | ||||
This file is part of the JUCE library. | This file is part of the JUCE library. | ||||
Copyright (c) 2016 - ROLI Ltd. | |||||
Copyright (c) 2017 - ROLI Ltd. | |||||
Permission is granted to use this software under the terms of the ISC license | |||||
http://www.isc.org/downloads/software-support-policy/isc-license/ | |||||
JUCE is an open source library subject to commercial or open-source | |||||
licensing. | |||||
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. | |||||
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. | |||||
THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH REGARD | |||||
TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND | |||||
FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, | |||||
OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF | |||||
USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER | |||||
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE | |||||
OF THIS SOFTWARE. | |||||
----------------------------------------------------------------------------- | |||||
To release a closed-source product which uses other parts of JUCE not | |||||
licensed under the ISC terms, commercial licenses are available: visit | |||||
www.juce.com for more information. | |||||
JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER | |||||
EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE | |||||
DISCLAIMED. | |||||
============================================================================== | ============================================================================== | ||||
*/ | */ | ||||
@@ -39,7 +31,7 @@ | |||||
ID: juce_audio_basics | ID: juce_audio_basics | ||||
vendor: juce | vendor: juce | ||||
version: 4.3.1 | |||||
version: 5.1.1 | |||||
name: JUCE audio and MIDI data classes | name: JUCE audio and MIDI data classes | ||||
description: Classes for audio buffer manipulation, midi message handling, synthesis, etc. | description: Classes for audio buffer manipulation, midi message handling, synthesis, etc. | ||||
website: http://www.juce.com/juce | website: http://www.juce.com/juce | ||||
@@ -54,10 +46,10 @@ | |||||
*******************************************************************************/ | *******************************************************************************/ | ||||
#ifndef JUCE_AUDIO_BASICS_H_INCLUDED | |||||
#pragma once | |||||
#define JUCE_AUDIO_BASICS_H_INCLUDED | #define JUCE_AUDIO_BASICS_H_INCLUDED | ||||
#include "juce_core/juce_core.h" | |||||
#include <juce_core/juce_core.h> | |||||
namespace juce | namespace juce | ||||
{ | { | ||||
@@ -74,7 +66,6 @@ namespace juce | |||||
#include "effects/juce_IIRFilterOld.h" | #include "effects/juce_IIRFilterOld.h" | ||||
#include "effects/juce_LagrangeInterpolator.h" | #include "effects/juce_LagrangeInterpolator.h" | ||||
#include "effects/juce_CatmullRomInterpolator.h" | #include "effects/juce_CatmullRomInterpolator.h" | ||||
#include "effects/juce_FFT.h" | |||||
#include "effects/juce_LinearSmoothedValue.h" | #include "effects/juce_LinearSmoothedValue.h" | ||||
#include "effects/juce_Reverb.h" | #include "effects/juce_Reverb.h" | ||||
#include "midi/juce_MidiMessage.h" | #include "midi/juce_MidiMessage.h" | ||||
@@ -97,12 +88,12 @@ namespace juce | |||||
#include "sources/juce_BufferingAudioSource.h" | #include "sources/juce_BufferingAudioSource.h" | ||||
#include "sources/juce_ChannelRemappingAudioSource.h" | #include "sources/juce_ChannelRemappingAudioSource.h" | ||||
#include "sources/juce_IIRFilterAudioSource.h" | #include "sources/juce_IIRFilterAudioSource.h" | ||||
#include "sources/juce_MemoryAudioSource.h" | |||||
#include "sources/juce_MixerAudioSource.h" | #include "sources/juce_MixerAudioSource.h" | ||||
#include "sources/juce_ResamplingAudioSource.h" | #include "sources/juce_ResamplingAudioSource.h" | ||||
#include "sources/juce_ReverbAudioSource.h" | #include "sources/juce_ReverbAudioSource.h" | ||||
#include "sources/juce_ToneGeneratorAudioSource.h" | #include "sources/juce_ToneGeneratorAudioSource.h" | ||||
#include "synthesisers/juce_Synthesiser.h" | #include "synthesisers/juce_Synthesiser.h" | ||||
#include "audio_play_head/juce_AudioPlayHead.h" | |||||
} | } | ||||
#endif // JUCE_AUDIO_BASICS_H_INCLUDED |
@@ -2,28 +2,20 @@ | |||||
============================================================================== | ============================================================================== | ||||
This file is part of the JUCE library. | This file is part of the JUCE library. | ||||
Copyright (c) 2016 - ROLI Ltd. | |||||
Copyright (c) 2017 - ROLI Ltd. | |||||
Permission is granted to use this software under the terms of the ISC license | |||||
http://www.isc.org/downloads/software-support-policy/isc-license/ | |||||
JUCE is an open source library subject to commercial or open-source | |||||
licensing. | |||||
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. | |||||
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. | |||||
THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH REGARD | |||||
TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND | |||||
FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, | |||||
OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF | |||||
USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER | |||||
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE | |||||
OF THIS SOFTWARE. | |||||
----------------------------------------------------------------------------- | |||||
To release a closed-source product which uses other parts of JUCE not | |||||
licensed under the ISC terms, commercial licenses are available: visit | |||||
www.juce.com for more information. | |||||
JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER | |||||
EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE | |||||
DISCLAIMED. | |||||
============================================================================== | ============================================================================== | ||||
*/ | */ | ||||
@@ -2,34 +2,25 @@ | |||||
============================================================================== | ============================================================================== | ||||
This file is part of the JUCE library. | This file is part of the JUCE library. | ||||
Copyright (c) 2016 - ROLI Ltd. | |||||
Copyright (c) 2017 - ROLI Ltd. | |||||
Permission is granted to use this software under the terms of the ISC license | |||||
http://www.isc.org/downloads/software-support-policy/isc-license/ | |||||
JUCE is an open source library subject to commercial or open-source | |||||
licensing. | |||||
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. | |||||
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. | |||||
THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH REGARD | |||||
TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND | |||||
FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, | |||||
OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF | |||||
USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER | |||||
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE | |||||
OF THIS SOFTWARE. | |||||
----------------------------------------------------------------------------- | |||||
To release a closed-source product which uses other parts of JUCE not | |||||
licensed under the ISC terms, commercial licenses are available: visit | |||||
www.juce.com for more information. | |||||
JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER | |||||
EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE | |||||
DISCLAIMED. | |||||
============================================================================== | ============================================================================== | ||||
*/ | */ | ||||
#ifndef JUCE_MIDIBUFFER_H_INCLUDED | |||||
#define JUCE_MIDIBUFFER_H_INCLUDED | |||||
#pragma once | |||||
//============================================================================== | //============================================================================== | ||||
@@ -236,6 +227,3 @@ public: | |||||
private: | private: | ||||
JUCE_LEAK_DETECTOR (MidiBuffer) | JUCE_LEAK_DETECTOR (MidiBuffer) | ||||
}; | }; | ||||
#endif // JUCE_MIDIBUFFER_H_INCLUDED |
@@ -2,28 +2,20 @@ | |||||
============================================================================== | ============================================================================== | ||||
This file is part of the JUCE library. | This file is part of the JUCE library. | ||||
Copyright (c) 2016 - ROLI Ltd. | |||||
Copyright (c) 2017 - ROLI Ltd. | |||||
Permission is granted to use this software under the terms of the ISC license | |||||
http://www.isc.org/downloads/software-support-policy/isc-license/ | |||||
JUCE is an open source library subject to commercial or open-source | |||||
licensing. | |||||
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. | |||||
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. | |||||
THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH REGARD | |||||
TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND | |||||
FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, | |||||
OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF | |||||
USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER | |||||
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE | |||||
OF THIS SOFTWARE. | |||||
----------------------------------------------------------------------------- | |||||
To release a closed-source product which uses other parts of JUCE not | |||||
licensed under the ISC terms, commercial licenses are available: visit | |||||
www.juce.com for more information. | |||||
JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER | |||||
EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE | |||||
DISCLAIMED. | |||||
============================================================================== | ============================================================================== | ||||
*/ | */ | ||||
@@ -2,34 +2,25 @@ | |||||
============================================================================== | ============================================================================== | ||||
This file is part of the JUCE library. | This file is part of the JUCE library. | ||||
Copyright (c) 2016 - ROLI Ltd. | |||||
Copyright (c) 2017 - ROLI Ltd. | |||||
Permission is granted to use this software under the terms of the ISC license | |||||
http://www.isc.org/downloads/software-support-policy/isc-license/ | |||||
JUCE is an open source library subject to commercial or open-source | |||||
licensing. | |||||
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. | |||||
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. | |||||
THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH REGARD | |||||
TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND | |||||
FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, | |||||
OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF | |||||
USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER | |||||
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE | |||||
OF THIS SOFTWARE. | |||||
----------------------------------------------------------------------------- | |||||
To release a closed-source product which uses other parts of JUCE not | |||||
licensed under the ISC terms, commercial licenses are available: visit | |||||
www.juce.com for more information. | |||||
JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER | |||||
EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE | |||||
DISCLAIMED. | |||||
============================================================================== | ============================================================================== | ||||
*/ | */ | ||||
#ifndef JUCE_MIDIFILE_H_INCLUDED | |||||
#define JUCE_MIDIFILE_H_INCLUDED | |||||
#pragma once | |||||
//============================================================================== | //============================================================================== | ||||
@@ -187,6 +178,3 @@ private: | |||||
JUCE_LEAK_DETECTOR (MidiFile) | JUCE_LEAK_DETECTOR (MidiFile) | ||||
}; | }; | ||||
#endif // JUCE_MIDIFILE_H_INCLUDED |
@@ -2,28 +2,20 @@ | |||||
============================================================================== | ============================================================================== | ||||
This file is part of the JUCE library. | This file is part of the JUCE library. | ||||
Copyright (c) 2016 - ROLI Ltd. | |||||
Copyright (c) 2017 - ROLI Ltd. | |||||
Permission is granted to use this software under the terms of the ISC license | |||||
http://www.isc.org/downloads/software-support-policy/isc-license/ | |||||
JUCE is an open source library subject to commercial or open-source | |||||
licensing. | |||||
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. | |||||
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. | |||||
THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH REGARD | |||||
TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND | |||||
FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, | |||||
OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF | |||||
USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER | |||||
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE | |||||
OF THIS SOFTWARE. | |||||
----------------------------------------------------------------------------- | |||||
To release a closed-source product which uses other parts of JUCE not | |||||
licensed under the ISC terms, commercial licenses are available: visit | |||||
www.juce.com for more information. | |||||
JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER | |||||
EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE | |||||
DISCLAIMED. | |||||
============================================================================== | ============================================================================== | ||||
*/ | */ | ||||
@@ -2,34 +2,25 @@ | |||||
============================================================================== | ============================================================================== | ||||
This file is part of the JUCE library. | This file is part of the JUCE library. | ||||
Copyright (c) 2016 - ROLI Ltd. | |||||
Copyright (c) 2017 - ROLI Ltd. | |||||
Permission is granted to use this software under the terms of the ISC license | |||||
http://www.isc.org/downloads/software-support-policy/isc-license/ | |||||
JUCE is an open source library subject to commercial or open-source | |||||
licensing. | |||||
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. | |||||
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. | |||||
THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH REGARD | |||||
TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND | |||||
FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, | |||||
OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF | |||||
USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER | |||||
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE | |||||
OF THIS SOFTWARE. | |||||
----------------------------------------------------------------------------- | |||||
To release a closed-source product which uses other parts of JUCE not | |||||
licensed under the ISC terms, commercial licenses are available: visit | |||||
www.juce.com for more information. | |||||
JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER | |||||
EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE | |||||
DISCLAIMED. | |||||
============================================================================== | ============================================================================== | ||||
*/ | */ | ||||
#ifndef JUCE_MIDIKEYBOARDSTATE_H_INCLUDED | |||||
#define JUCE_MIDIKEYBOARDSTATE_H_INCLUDED | |||||
#pragma once | |||||
class MidiKeyboardState; | class MidiKeyboardState; | ||||
@@ -206,6 +197,3 @@ private: | |||||
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (MidiKeyboardState) | JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (MidiKeyboardState) | ||||
}; | }; | ||||
#endif // JUCE_MIDIKEYBOARDSTATE_H_INCLUDED |
@@ -2,28 +2,20 @@ | |||||
============================================================================== | ============================================================================== | ||||
This file is part of the JUCE library. | This file is part of the JUCE library. | ||||
Copyright (c) 2016 - ROLI Ltd. | |||||
Copyright (c) 2017 - ROLI Ltd. | |||||
Permission is granted to use this software under the terms of the ISC license | |||||
http://www.isc.org/downloads/software-support-policy/isc-license/ | |||||
JUCE is an open source library subject to commercial or open-source | |||||
licensing. | |||||
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. | |||||
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. | |||||
THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH REGARD | |||||
TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND | |||||
FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, | |||||
OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF | |||||
USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER | |||||
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE | |||||
OF THIS SOFTWARE. | |||||
----------------------------------------------------------------------------- | |||||
To release a closed-source product which uses other parts of JUCE not | |||||
licensed under the ISC terms, commercial licenses are available: visit | |||||
www.juce.com for more information. | |||||
JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER | |||||
EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE | |||||
DISCLAIMED. | |||||
============================================================================== | ============================================================================== | ||||
*/ | */ | ||||
@@ -44,6 +36,9 @@ namespace MidiHelpers | |||||
//============================================================================== | //============================================================================== | ||||
uint8 MidiMessage::floatValueToMidiByte (const float v) noexcept | uint8 MidiMessage::floatValueToMidiByte (const float v) noexcept | ||||
{ | { | ||||
jassert (v >= 0 && v <= 1.0f); // if your value is > 1, maybe you're passing an | |||||
// integer value to a float method by mistake? | |||||
return MidiHelpers::validVelocity (roundToInt (v * 127.0f)); | return MidiHelpers::validVelocity (roundToInt (v * 127.0f)); | ||||
} | } | ||||
@@ -100,7 +95,7 @@ int MidiMessage::getMessageLengthFromFirstByte (const uint8 firstByte) noexcept | |||||
//============================================================================== | //============================================================================== | ||||
MidiMessage::MidiMessage() noexcept | MidiMessage::MidiMessage() noexcept | ||||
: timeStamp (0), size (2) | |||||
: size (2) | |||||
{ | { | ||||
packedData.asBytes[0] = 0xf0; | packedData.asBytes[0] = 0xf0; | ||||
packedData.asBytes[1] = 0xf7; | packedData.asBytes[1] = 0xf7; | ||||
@@ -168,12 +163,12 @@ MidiMessage::MidiMessage (const void* srcData, int sz, int& numBytesUsed, const | |||||
double t, bool sysexHasEmbeddedLength) | double t, bool sysexHasEmbeddedLength) | ||||
: timeStamp (t) | : timeStamp (t) | ||||
{ | { | ||||
const uint8* src = static_cast<const uint8*> (srcData); | |||||
unsigned int byte = (unsigned int) *src; | |||||
auto src = static_cast<const uint8*> (srcData); | |||||
auto byte = (unsigned int) *src; | |||||
if (byte < 0x80) | if (byte < 0x80) | ||||
{ | { | ||||
byte = (unsigned int) (uint8) lastStatusByte; | |||||
byte = (unsigned int) lastStatusByte; | |||||
numBytesUsed = -1; | numBytesUsed = -1; | ||||
} | } | ||||
else | else | ||||
@@ -187,7 +182,7 @@ MidiMessage::MidiMessage (const void* srcData, int sz, int& numBytesUsed, const | |||||
{ | { | ||||
if (byte == 0xf0) | if (byte == 0xf0) | ||||
{ | { | ||||
const uint8* d = src; | |||||
auto d = src; | |||||
bool haveReadAllLengthBytes = ! sysexHasEmbeddedLength; | bool haveReadAllLengthBytes = ! sysexHasEmbeddedLength; | ||||
int numVariableLengthSysexBytes = 0; | int numVariableLengthSysexBytes = 0; | ||||
@@ -218,11 +213,11 @@ MidiMessage::MidiMessage (const void* srcData, int sz, int& numBytesUsed, const | |||||
src += numVariableLengthSysexBytes; | src += numVariableLengthSysexBytes; | ||||
size = 1 + (int) (d - src); | size = 1 + (int) (d - src); | ||||
uint8* dest = allocateSpace (size); | |||||
auto dest = allocateSpace (size); | |||||
*dest = (uint8) byte; | *dest = (uint8) byte; | ||||
memcpy (dest + 1, src, (size_t) (size - 1)); | memcpy (dest + 1, src, (size_t) (size - 1)); | ||||
numBytesUsed += numVariableLengthSysexBytes; // (these aren't counted in the size) | |||||
numBytesUsed += (numVariableLengthSysexBytes + size); // (these aren't counted in the size) | |||||
} | } | ||||
else if (byte == 0xff) | else if (byte == 0xff) | ||||
{ | { | ||||
@@ -230,9 +225,11 @@ MidiMessage::MidiMessage (const void* srcData, int sz, int& numBytesUsed, const | |||||
const int bytesLeft = readVariableLengthVal (src + 1, n); | const int bytesLeft = readVariableLengthVal (src + 1, n); | ||||
size = jmin (sz + 1, n + 2 + bytesLeft); | size = jmin (sz + 1, n + 2 + bytesLeft); | ||||
uint8* dest = allocateSpace (size); | |||||
auto dest = allocateSpace (size); | |||||
*dest = (uint8) byte; | *dest = (uint8) byte; | ||||
memcpy (dest + 1, src, (size_t) size - 1); | memcpy (dest + 1, src, (size_t) size - 1); | ||||
numBytesUsed += size; | |||||
} | } | ||||
else | else | ||||
{ | { | ||||
@@ -241,14 +238,14 @@ MidiMessage::MidiMessage (const void* srcData, int sz, int& numBytesUsed, const | |||||
if (size > 1) | if (size > 1) | ||||
{ | { | ||||
packedData.asBytes[1] = src[0]; | |||||
packedData.asBytes[1] = (sz > 0 ? src[0] : 0); | |||||
if (size > 2) | if (size > 2) | ||||
packedData.asBytes[2] = src[1]; | |||||
packedData.asBytes[2] = (sz > 1 ? src[1] : 0); | |||||
} | } | ||||
} | |||||
numBytesUsed += size; | |||||
numBytesUsed += jmin (size, sz + 1); | |||||
} | |||||
} | } | ||||
else | else | ||||
{ | { | ||||
@@ -285,7 +282,6 @@ MidiMessage& MidiMessage::operator= (const MidiMessage& other) | |||||
return *this; | return *this; | ||||
} | } | ||||
#if JUCE_COMPILER_SUPPORTS_MOVE_SEMANTICS | |||||
MidiMessage::MidiMessage (MidiMessage&& other) noexcept | MidiMessage::MidiMessage (MidiMessage&& other) noexcept | ||||
: timeStamp (other.timeStamp), size (other.size) | : timeStamp (other.timeStamp), size (other.size) | ||||
{ | { | ||||
@@ -301,7 +297,6 @@ MidiMessage& MidiMessage::operator= (MidiMessage&& other) noexcept | |||||
other.size = 0; | other.size = 0; | ||||
return *this; | return *this; | ||||
} | } | ||||
#endif | |||||
MidiMessage::~MidiMessage() noexcept | MidiMessage::~MidiMessage() noexcept | ||||
{ | { | ||||
@@ -313,7 +308,7 @@ uint8* MidiMessage::allocateSpace (int bytes) | |||||
{ | { | ||||
if (bytes > (int) sizeof (packedData)) | if (bytes > (int) sizeof (packedData)) | ||||
{ | { | ||||
uint8* d = static_cast<uint8*> (std::malloc ((size_t) bytes)); | |||||
auto d = static_cast<uint8*> (std::malloc ((size_t) bytes)); | |||||
packedData.allocatedData = d; | packedData.allocatedData = d; | ||||
return d; | return d; | ||||
} | } | ||||
@@ -348,7 +343,7 @@ String MidiMessage::getDescription() const | |||||
int MidiMessage::getChannel() const noexcept | int MidiMessage::getChannel() const noexcept | ||||
{ | { | ||||
const uint8* const data = getRawData(); | |||||
auto data = getRawData(); | |||||
if ((data[0] & 0xf0) != 0xf0) | if ((data[0] & 0xf0) != 0xf0) | ||||
return (data[0] & 0xf) + 1; | return (data[0] & 0xf) + 1; | ||||
@@ -360,7 +355,7 @@ bool MidiMessage::isForChannel (const int channel) const noexcept | |||||
{ | { | ||||
jassert (channel > 0 && channel <= 16); // valid channels are numbered 1 to 16 | jassert (channel > 0 && channel <= 16); // valid channels are numbered 1 to 16 | ||||
const uint8* const data = getRawData(); | |||||
auto data = getRawData(); | |||||
return ((data[0] & 0xf) == channel - 1) | return ((data[0] & 0xf) == channel - 1) | ||||
&& ((data[0] & 0xf0) != 0xf0); | && ((data[0] & 0xf0) != 0xf0); | ||||
@@ -370,7 +365,7 @@ void MidiMessage::setChannel (const int channel) noexcept | |||||
{ | { | ||||
jassert (channel > 0 && channel <= 16); // valid channels are numbered 1 to 16 | jassert (channel > 0 && channel <= 16); // valid channels are numbered 1 to 16 | ||||
uint8* const data = getData(); | |||||
auto data = getData(); | |||||
if ((data[0] & 0xf0) != (uint8) 0xf0) | if ((data[0] & 0xf0) != (uint8) 0xf0) | ||||
data[0] = (uint8) ((data[0] & (uint8) 0xf0) | data[0] = (uint8) ((data[0] & (uint8) 0xf0) | ||||
@@ -379,7 +374,7 @@ void MidiMessage::setChannel (const int channel) noexcept | |||||
bool MidiMessage::isNoteOn (const bool returnTrueForVelocity0) const noexcept | bool MidiMessage::isNoteOn (const bool returnTrueForVelocity0) const noexcept | ||||
{ | { | ||||
const uint8* const data = getRawData(); | |||||
auto data = getRawData(); | |||||
return ((data[0] & 0xf0) == 0x90) | return ((data[0] & 0xf0) == 0x90) | ||||
&& (returnTrueForVelocity0 || data[2] != 0); | && (returnTrueForVelocity0 || data[2] != 0); | ||||
@@ -387,7 +382,7 @@ bool MidiMessage::isNoteOn (const bool returnTrueForVelocity0) const noexcept | |||||
bool MidiMessage::isNoteOff (const bool returnTrueForNoteOnVelocity0) const noexcept | bool MidiMessage::isNoteOff (const bool returnTrueForNoteOnVelocity0) const noexcept | ||||
{ | { | ||||
const uint8* const data = getRawData(); | |||||
auto data = getRawData(); | |||||
return ((data[0] & 0xf0) == 0x80) | return ((data[0] & 0xf0) == 0x80) | ||||
|| (returnTrueForNoteOnVelocity0 && (data[2] == 0) && ((data[0] & 0xf0) == 0x90)); | || (returnTrueForNoteOnVelocity0 && (data[2] == 0) && ((data[0] & 0xf0) == 0x90)); | ||||
@@ -395,9 +390,7 @@ bool MidiMessage::isNoteOff (const bool returnTrueForNoteOnVelocity0) const noex | |||||
bool MidiMessage::isNoteOnOrOff() const noexcept | bool MidiMessage::isNoteOnOrOff() const noexcept | ||||
{ | { | ||||
const uint8* const data = getRawData(); | |||||
const int d = data[0] & 0xf0; | |||||
auto d = getRawData()[0] & 0xf0; | |||||
return (d == 0x90) || (d == 0x80); | return (d == 0x90) || (d == 0x80); | ||||
} | } | ||||
@@ -435,7 +428,7 @@ void MidiMessage::multiplyVelocity (const float scaleFactor) noexcept | |||||
{ | { | ||||
if (isNoteOnOrOff()) | if (isNoteOnOrOff()) | ||||
{ | { | ||||
uint8* const data = getData(); | |||||
auto data = getData(); | |||||
data[2] = MidiHelpers::validVelocity (roundToInt (scaleFactor * data[2])); | data[2] = MidiHelpers::validVelocity (roundToInt (scaleFactor * data[2])); | ||||
} | } | ||||
} | } | ||||
@@ -519,7 +512,7 @@ bool MidiMessage::isPitchWheel() const noexcept | |||||
int MidiMessage::getPitchWheelValue() const noexcept | int MidiMessage::getPitchWheelValue() const noexcept | ||||
{ | { | ||||
jassert (isPitchWheel()); | jassert (isPitchWheel()); | ||||
const uint8* const data = getRawData(); | |||||
auto data = getRawData(); | |||||
return data[1] | (data[2] << 7); | return data[1] | (data[2] << 7); | ||||
} | } | ||||
@@ -539,7 +532,7 @@ bool MidiMessage::isController() const noexcept | |||||
bool MidiMessage::isControllerOfType (const int controllerType) const noexcept | bool MidiMessage::isControllerOfType (const int controllerType) const noexcept | ||||
{ | { | ||||
const uint8* const data = getRawData(); | |||||
auto data = getRawData(); | |||||
return (data[0] & 0xf0) == 0xb0 && data[1] == controllerType; | return (data[0] & 0xf0) == 0xb0 && data[1] == controllerType; | ||||
} | } | ||||
@@ -607,7 +600,7 @@ MidiMessage MidiMessage::allNotesOff (const int channel) noexcept | |||||
bool MidiMessage::isAllNotesOff() const noexcept | bool MidiMessage::isAllNotesOff() const noexcept | ||||
{ | { | ||||
const uint8* const data = getRawData(); | |||||
auto data = getRawData(); | |||||
return (data[0] & 0xf0) == 0xb0 && data[1] == 123; | return (data[0] & 0xf0) == 0xb0 && data[1] == 123; | ||||
} | } | ||||
@@ -618,8 +611,8 @@ MidiMessage MidiMessage::allSoundOff (const int channel) noexcept | |||||
bool MidiMessage::isAllSoundOff() const noexcept | bool MidiMessage::isAllSoundOff() const noexcept | ||||
{ | { | ||||
const uint8* const data = getRawData(); | |||||
return (data[0] & 0xf0) == 0xb0 && data[1] == 120; | |||||
auto data = getRawData(); | |||||
return data[1] == 120 && (data[0] & 0xf0) == 0xb0; | |||||
} | } | ||||
MidiMessage MidiMessage::allControllersOff (const int channel) noexcept | MidiMessage MidiMessage::allControllersOff (const int channel) noexcept | ||||
@@ -629,14 +622,9 @@ MidiMessage MidiMessage::allControllersOff (const int channel) noexcept | |||||
MidiMessage MidiMessage::masterVolume (const float volume) | MidiMessage MidiMessage::masterVolume (const float volume) | ||||
{ | { | ||||
const int vol = jlimit (0, 0x3fff, roundToInt (volume * 0x4000)); | |||||
const uint8 buf[] = { 0xf0, 0x7f, 0x7f, 0x04, 0x01, | |||||
(uint8) (vol & 0x7f), | |||||
(uint8) (vol >> 7), | |||||
0xf7 }; | |||||
auto vol = jlimit (0, 0x3fff, roundToInt (volume * 0x4000)); | |||||
return MidiMessage (buf, 8); | |||||
return { 0xf0, 0x7f, 0x7f, 0x04, 0x01, vol & 0x7f, vol >> 7, 0xf7 }; | |||||
} | } | ||||
//============================================================================== | //============================================================================== | ||||
@@ -672,13 +660,14 @@ bool MidiMessage::isActiveSense() const noexcept { return *getRawData() == 0x | |||||
int MidiMessage::getMetaEventType() const noexcept | int MidiMessage::getMetaEventType() const noexcept | ||||
{ | { | ||||
const uint8* const data = getRawData(); | |||||
auto data = getRawData(); | |||||
return *data != 0xff ? -1 : data[1]; | return *data != 0xff ? -1 : data[1]; | ||||
} | } | ||||
int MidiMessage::getMetaEventLength() const noexcept | int MidiMessage::getMetaEventLength() const noexcept | ||||
{ | { | ||||
const uint8* const data = getRawData(); | |||||
auto data = getRawData(); | |||||
if (*data == 0xff) | if (*data == 0xff) | ||||
{ | { | ||||
int n; | int n; | ||||
@@ -693,7 +682,7 @@ const uint8* MidiMessage::getMetaEventData() const noexcept | |||||
jassert (isMetaEvent()); | jassert (isMetaEvent()); | ||||
int n; | int n; | ||||
const uint8* d = getRawData() + 2; | |||||
auto d = getRawData() + 2; | |||||
readVariableLengthVal (d, n); | readVariableLengthVal (d, n); | ||||
return d + n; | return d + n; | ||||
} | } | ||||
@@ -703,13 +692,14 @@ bool MidiMessage::isEndOfTrackMetaEvent() const noexcept { return getMetaEven | |||||
bool MidiMessage::isTextMetaEvent() const noexcept | bool MidiMessage::isTextMetaEvent() const noexcept | ||||
{ | { | ||||
const int t = getMetaEventType(); | |||||
auto t = getMetaEventType(); | |||||
return t > 0 && t < 16; | return t > 0 && t < 16; | ||||
} | } | ||||
String MidiMessage::getTextFromTextMetaEvent() const | String MidiMessage::getTextFromTextMetaEvent() const | ||||
{ | { | ||||
const char* const textData = reinterpret_cast<const char*> (getMetaEventData()); | |||||
auto textData = reinterpret_cast<const char*> (getMetaEventData()); | |||||
return String (CharPointer_UTF8 (textData), | return String (CharPointer_UTF8 (textData), | ||||
CharPointer_UTF8 (textData + getMetaEventLength())); | CharPointer_UTF8 (textData + getMetaEventLength())); | ||||
} | } | ||||
@@ -736,7 +726,7 @@ MidiMessage MidiMessage::textMetaEvent (int type, StringRef text) | |||||
const size_t headerLen = sizeof (header) - n; | const size_t headerLen = sizeof (header) - n; | ||||
const int totalSize = (int) (headerLen + textSize); | const int totalSize = (int) (headerLen + textSize); | ||||
uint8* const dest = result.allocateSpace (totalSize); | |||||
auto dest = result.allocateSpace (totalSize); | |||||
result.size = totalSize; | result.size = totalSize; | ||||
memcpy (dest, header + n, headerLen); | memcpy (dest, header + n, headerLen); | ||||
@@ -745,9 +735,9 @@ MidiMessage MidiMessage::textMetaEvent (int type, StringRef text) | |||||
return result; | return result; | ||||
} | } | ||||
bool MidiMessage::isTrackNameEvent() const noexcept { const uint8* data = getRawData(); return (data[1] == 3) && (*data == 0xff); } | |||||
bool MidiMessage::isTempoMetaEvent() const noexcept { const uint8* data = getRawData(); return (data[1] == 81) && (*data == 0xff); } | |||||
bool MidiMessage::isMidiChannelMetaEvent() const noexcept { const uint8* data = getRawData(); return (data[1] == 0x20) && (*data == 0xff) && (data[2] == 1); } | |||||
bool MidiMessage::isTrackNameEvent() const noexcept { auto data = getRawData(); return (data[1] == 3) && (*data == 0xff); } | |||||
bool MidiMessage::isTempoMetaEvent() const noexcept { auto data = getRawData(); return (data[1] == 81) && (*data == 0xff); } | |||||
bool MidiMessage::isMidiChannelMetaEvent() const noexcept { auto data = getRawData(); return (data[1] == 0x20) && (*data == 0xff) && (data[2] == 1); } | |||||
int MidiMessage::getMidiChannelMetaEventChannel() const noexcept | int MidiMessage::getMidiChannelMetaEventChannel() const noexcept | ||||
{ | { | ||||
@@ -760,7 +750,7 @@ double MidiMessage::getTempoSecondsPerQuarterNote() const noexcept | |||||
if (! isTempoMetaEvent()) | if (! isTempoMetaEvent()) | ||||
return 0.0; | return 0.0; | ||||
const uint8* const d = getMetaEventData(); | |||||
auto d = getMetaEventData(); | |||||
return (((unsigned int) d[0] << 16) | return (((unsigned int) d[0] << 16) | ||||
| ((unsigned int) d[1] << 8) | | ((unsigned int) d[1] << 8) | ||||
@@ -777,37 +767,33 @@ double MidiMessage::getTempoMetaEventTickLength (const short timeFormat) const n | |||||
return getTempoSecondsPerQuarterNote() / timeFormat; | return getTempoSecondsPerQuarterNote() / timeFormat; | ||||
} | } | ||||
else | |||||
{ | |||||
const int frameCode = (-timeFormat) >> 8; | |||||
double framesPerSecond; | |||||
switch (frameCode) | |||||
{ | |||||
case 24: framesPerSecond = 24.0; break; | |||||
case 25: framesPerSecond = 25.0; break; | |||||
case 29: framesPerSecond = 29.97; break; | |||||
case 30: framesPerSecond = 30.0; break; | |||||
default: framesPerSecond = 30.0; break; | |||||
} | |||||
const int frameCode = (-timeFormat) >> 8; | |||||
double framesPerSecond; | |||||
return (1.0 / framesPerSecond) / (timeFormat & 0xff); | |||||
switch (frameCode) | |||||
{ | |||||
case 24: framesPerSecond = 24.0; break; | |||||
case 25: framesPerSecond = 25.0; break; | |||||
case 29: framesPerSecond = 30.0 * 1000.0 / 1001.0; break; | |||||
case 30: framesPerSecond = 30.0; break; | |||||
default: framesPerSecond = 30.0; break; | |||||
} | } | ||||
return (1.0 / framesPerSecond) / (timeFormat & 0xff); | |||||
} | } | ||||
MidiMessage MidiMessage::tempoMetaEvent (int microsecondsPerQuarterNote) noexcept | MidiMessage MidiMessage::tempoMetaEvent (int microsecondsPerQuarterNote) noexcept | ||||
{ | { | ||||
const uint8 d[] = { 0xff, 81, 3, | |||||
(uint8) (microsecondsPerQuarterNote >> 16), | |||||
(uint8) (microsecondsPerQuarterNote >> 8), | |||||
(uint8) microsecondsPerQuarterNote }; | |||||
return MidiMessage (d, 6, 0.0); | |||||
return { 0xff, 81, 3, | |||||
(uint8) (microsecondsPerQuarterNote >> 16), | |||||
(uint8) (microsecondsPerQuarterNote >> 8), | |||||
(uint8) microsecondsPerQuarterNote }; | |||||
} | } | ||||
bool MidiMessage::isTimeSignatureMetaEvent() const noexcept | bool MidiMessage::isTimeSignatureMetaEvent() const noexcept | ||||
{ | { | ||||
const uint8* const data = getRawData(); | |||||
auto data = getRawData(); | |||||
return (data[1] == 0x58) && (*data == (uint8) 0xff); | return (data[1] == 0x58) && (*data == (uint8) 0xff); | ||||
} | } | ||||
@@ -815,7 +801,7 @@ void MidiMessage::getTimeSignatureInfo (int& numerator, int& denominator) const | |||||
{ | { | ||||
if (isTimeSignatureMetaEvent()) | if (isTimeSignatureMetaEvent()) | ||||
{ | { | ||||
const uint8* const d = getMetaEventData(); | |||||
auto d = getMetaEventData(); | |||||
numerator = d[0]; | numerator = d[0]; | ||||
denominator = 1 << d[1]; | denominator = 1 << d[1]; | ||||
} | } | ||||
@@ -837,14 +823,12 @@ MidiMessage MidiMessage::timeSignatureMetaEvent (const int numerator, const int | |||||
++powerOfTwo; | ++powerOfTwo; | ||||
} | } | ||||
const uint8 d[] = { 0xff, 0x58, 0x04, (uint8) numerator, (uint8) powerOfTwo, 1, 96 }; | |||||
return MidiMessage (d, 7, 0.0); | |||||
return { 0xff, 0x58, 0x04, numerator, powerOfTwo, 1, 96 }; | |||||
} | } | ||||
MidiMessage MidiMessage::midiChannelMetaEvent (const int channel) noexcept | MidiMessage MidiMessage::midiChannelMetaEvent (const int channel) noexcept | ||||
{ | { | ||||
const uint8 d[] = { 0xff, 0x20, 0x01, (uint8) jlimit (0, 0xff, channel - 1) }; | |||||
return MidiMessage (d, 4, 0.0); | |||||
return { 0xff, 0x20, 0x01, jlimit (0, 0xff, channel - 1) }; | |||||
} | } | ||||
bool MidiMessage::isKeySignatureMetaEvent() const noexcept | bool MidiMessage::isKeySignatureMetaEvent() const noexcept | ||||
@@ -866,37 +850,36 @@ MidiMessage MidiMessage::keySignatureMetaEvent (int numberOfSharpsOrFlats, bool | |||||
{ | { | ||||
jassert (numberOfSharpsOrFlats >= -7 && numberOfSharpsOrFlats <= 7); | jassert (numberOfSharpsOrFlats >= -7 && numberOfSharpsOrFlats <= 7); | ||||
const uint8 d[] = { 0xff, 0x59, 0x02, (uint8) numberOfSharpsOrFlats, isMinorKey ? (uint8) 1 : (uint8) 0 }; | |||||
return MidiMessage (d, 5, 0.0); | |||||
return { 0xff, 0x59, 0x02, numberOfSharpsOrFlats, isMinorKey ? 1 : 0 }; | |||||
} | } | ||||
MidiMessage MidiMessage::endOfTrack() noexcept | MidiMessage MidiMessage::endOfTrack() noexcept | ||||
{ | { | ||||
return MidiMessage (0xff, 0x2f, 0, 0.0); | |||||
return { 0xff, 0x2f, 0x00 }; | |||||
} | } | ||||
//============================================================================== | //============================================================================== | ||||
bool MidiMessage::isSongPositionPointer() const noexcept { return *getRawData() == 0xf2; } | bool MidiMessage::isSongPositionPointer() const noexcept { return *getRawData() == 0xf2; } | ||||
int MidiMessage::getSongPositionPointerMidiBeat() const noexcept { const uint8* data = getRawData(); return data[1] | (data[2] << 7); } | |||||
int MidiMessage::getSongPositionPointerMidiBeat() const noexcept { auto data = getRawData(); return data[1] | (data[2] << 7); } | |||||
MidiMessage MidiMessage::songPositionPointer (const int positionInMidiBeats) noexcept | MidiMessage MidiMessage::songPositionPointer (const int positionInMidiBeats) noexcept | ||||
{ | { | ||||
return MidiMessage (0xf2, | |||||
positionInMidiBeats & 127, | |||||
(positionInMidiBeats >> 7) & 127); | |||||
return { 0xf2, | |||||
positionInMidiBeats & 127, | |||||
(positionInMidiBeats >> 7) & 127 }; | |||||
} | } | ||||
bool MidiMessage::isMidiStart() const noexcept { return *getRawData() == 0xfa; } | |||||
MidiMessage MidiMessage::midiStart() noexcept { return MidiMessage (0xfa); } | |||||
bool MidiMessage::isMidiStart() const noexcept { return *getRawData() == 0xfa; } | |||||
MidiMessage MidiMessage::midiStart() noexcept { return MidiMessage (0xfa); } | |||||
bool MidiMessage::isMidiContinue() const noexcept { return *getRawData() == 0xfb; } | |||||
MidiMessage MidiMessage::midiContinue() noexcept { return MidiMessage (0xfb); } | |||||
bool MidiMessage::isMidiContinue() const noexcept { return *getRawData() == 0xfb; } | |||||
MidiMessage MidiMessage::midiContinue() noexcept { return MidiMessage (0xfb); } | |||||
bool MidiMessage::isMidiStop() const noexcept { return *getRawData() == 0xfc; } | |||||
MidiMessage MidiMessage::midiStop() noexcept { return MidiMessage (0xfc); } | |||||
bool MidiMessage::isMidiStop() const noexcept { return *getRawData() == 0xfc; } | |||||
MidiMessage MidiMessage::midiStop() noexcept { return MidiMessage (0xfc); } | |||||
bool MidiMessage::isMidiClock() const noexcept { return *getRawData() == 0xf8; } | |||||
MidiMessage MidiMessage::midiClock() noexcept { return MidiMessage (0xf8); } | |||||
bool MidiMessage::isMidiClock() const noexcept { return *getRawData() == 0xf8; } | |||||
MidiMessage MidiMessage::midiClock() noexcept { return MidiMessage (0xf8); } | |||||
bool MidiMessage::isQuarterFrame() const noexcept { return *getRawData() == 0xf1; } | bool MidiMessage::isQuarterFrame() const noexcept { return *getRawData() == 0xf1; } | ||||
int MidiMessage::getQuarterFrameSequenceNumber() const noexcept { return ((int) getRawData()[1]) >> 4; } | int MidiMessage::getQuarterFrameSequenceNumber() const noexcept { return ((int) getRawData()[1]) >> 4; } | ||||
@@ -909,7 +892,7 @@ MidiMessage MidiMessage::quarterFrame (const int sequenceNumber, const int value | |||||
bool MidiMessage::isFullFrame() const noexcept | bool MidiMessage::isFullFrame() const noexcept | ||||
{ | { | ||||
const uint8* const data = getRawData(); | |||||
auto data = getRawData(); | |||||
return data[0] == 0xf0 | return data[0] == 0xf0 | ||||
&& data[1] == 0x7f | && data[1] == 0x7f | ||||
@@ -923,7 +906,7 @@ void MidiMessage::getFullFrameParameters (int& hours, int& minutes, int& seconds | |||||
{ | { | ||||
jassert (isFullFrame()); | jassert (isFullFrame()); | ||||
const uint8* const data = getRawData(); | |||||
auto data = getRawData(); | |||||
timecodeType = (SmpteTimecodeType) (data[5] >> 5); | timecodeType = (SmpteTimecodeType) (data[5] >> 5); | ||||
hours = data[5] & 0x1f; | hours = data[5] & 0x1f; | ||||
minutes = data[6]; | minutes = data[6]; | ||||
@@ -931,23 +914,19 @@ void MidiMessage::getFullFrameParameters (int& hours, int& minutes, int& seconds | |||||
frames = data[8]; | frames = data[8]; | ||||
} | } | ||||
MidiMessage MidiMessage::fullFrame (const int hours, const int minutes, | |||||
const int seconds, const int frames, | |||||
MidiMessage MidiMessage::fullFrame (int hours, int minutes, int seconds, int frames, | |||||
MidiMessage::SmpteTimecodeType timecodeType) | MidiMessage::SmpteTimecodeType timecodeType) | ||||
{ | { | ||||
const uint8 d[] = { 0xf0, 0x7f, 0x7f, 0x01, 0x01, | |||||
(uint8) ((hours & 0x01f) | (timecodeType << 5)), | |||||
(uint8) minutes, | |||||
(uint8) seconds, | |||||
(uint8) frames, | |||||
0xf7 }; | |||||
return MidiMessage (d, 10, 0.0); | |||||
return { 0xf0, 0x7f, 0x7f, 0x01, 0x01, | |||||
(hours & 0x01f) | (timecodeType << 5), | |||||
minutes, seconds, frames, | |||||
0xf7 }; | |||||
} | } | ||||
bool MidiMessage::isMidiMachineControlMessage() const noexcept | bool MidiMessage::isMidiMachineControlMessage() const noexcept | ||||
{ | { | ||||
const uint8* const data = getRawData(); | |||||
auto data = getRawData(); | |||||
return data[0] == 0xf0 | return data[0] == 0xf0 | ||||
&& data[1] == 0x7f | && data[1] == 0x7f | ||||
&& data[3] == 0x06 | && data[3] == 0x06 | ||||
@@ -963,15 +942,14 @@ MidiMessage::MidiMachineControlCommand MidiMessage::getMidiMachineControlCommand | |||||
MidiMessage MidiMessage::midiMachineControlCommand (MidiMessage::MidiMachineControlCommand command) | MidiMessage MidiMessage::midiMachineControlCommand (MidiMessage::MidiMachineControlCommand command) | ||||
{ | { | ||||
const uint8 d[] = { 0xf0, 0x7f, 0, 6, (uint8) command, 0xf7 }; | |||||
return MidiMessage (d, 6, 0.0); | |||||
return { 0xf0, 0x7f, 0, 6, command, 0xf7 }; | |||||
} | } | ||||
//============================================================================== | //============================================================================== | ||||
bool MidiMessage::isMidiMachineControlGoto (int& hours, int& minutes, int& seconds, int& frames) const noexcept | bool MidiMessage::isMidiMachineControlGoto (int& hours, int& minutes, int& seconds, int& frames) const noexcept | ||||
{ | { | ||||
const uint8* const data = getRawData(); | |||||
auto data = getRawData(); | |||||
if (size >= 12 | if (size >= 12 | ||||
&& data[0] == 0xf0 | && data[0] == 0xf0 | ||||
&& data[1] == 0x7f | && data[1] == 0x7f | ||||
@@ -993,14 +971,7 @@ bool MidiMessage::isMidiMachineControlGoto (int& hours, int& minutes, int& secon | |||||
MidiMessage MidiMessage::midiMachineControlGoto (int hours, int minutes, int seconds, int frames) | MidiMessage MidiMessage::midiMachineControlGoto (int hours, int minutes, int seconds, int frames) | ||||
{ | { | ||||
const uint8 d[] = { 0xf0, 0x7f, 0, 6, 0x44, 6, 1, | |||||
(uint8) hours, | |||||
(uint8) minutes, | |||||
(uint8) seconds, | |||||
(uint8) frames, | |||||
0xf7 }; | |||||
return MidiMessage (d, 12, 0.0); | |||||
return { 0xf0, 0x7f, 0, 6, 0x44, 6, 1, hours, minutes, seconds, frames, 0xf7 }; | |||||
} | } | ||||
//============================================================================== | //============================================================================== | ||||
@@ -1020,7 +991,7 @@ String MidiMessage::getMidiNoteName (int note, bool useSharps, bool includeOctav | |||||
return s; | return s; | ||||
} | } | ||||
return String(); | |||||
return {}; | |||||
} | } | ||||
double MidiMessage::getMidiNoteInHertz (const int noteNumber, const double frequencyOfA) noexcept | double MidiMessage::getMidiNoteInHertz (const int noteNumber, const double frequencyOfA) noexcept | ||||
@@ -2,34 +2,25 @@ | |||||
============================================================================== | ============================================================================== | ||||
This file is part of the JUCE library. | This file is part of the JUCE library. | ||||
Copyright (c) 2016 - ROLI Ltd. | |||||
Copyright (c) 2017 - ROLI Ltd. | |||||
Permission is granted to use this software under the terms of the ISC license | |||||
http://www.isc.org/downloads/software-support-policy/isc-license/ | |||||
JUCE is an open source library subject to commercial or open-source | |||||
licensing. | |||||
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. | |||||
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. | |||||
THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH REGARD | |||||
TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND | |||||
FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, | |||||
OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF | |||||
USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER | |||||
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE | |||||
OF THIS SOFTWARE. | |||||
----------------------------------------------------------------------------- | |||||
To release a closed-source product which uses other parts of JUCE not | |||||
licensed under the ISC terms, commercial licenses are available: visit | |||||
www.juce.com for more information. | |||||
JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER | |||||
EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE | |||||
DISCLAIMED. | |||||
============================================================================== | ============================================================================== | ||||
*/ | */ | ||||
#ifndef JUCE_MIDIMESSAGE_H_INCLUDED | |||||
#define JUCE_MIDIMESSAGE_H_INCLUDED | |||||
#pragma once | |||||
//============================================================================== | //============================================================================== | ||||
@@ -69,6 +60,18 @@ public: | |||||
*/ | */ | ||||
MidiMessage (int byte1, double timeStamp = 0) noexcept; | MidiMessage (int byte1, double timeStamp = 0) noexcept; | ||||
/** Creates a midi message from a list of bytes. */ | |||||
template <typename... Data> | |||||
MidiMessage (int byte1, int byte2, int byte3, Data... otherBytes) : size (3 + sizeof... (otherBytes)) | |||||
{ | |||||
// this checks that the length matches the data.. | |||||
jassert (size > 3 || byte1 >= 0xf0 || getMessageLengthFromFirstByte ((uint8) byte1) == size); | |||||
const uint8 data[] = { (uint8) byte1, (uint8) byte2, (uint8) byte3, static_cast<uint8> (otherBytes)... }; | |||||
memcpy (allocateSpace (size), data, (size_t) size); | |||||
} | |||||
/** Creates a midi message from a block of data. */ | /** Creates a midi message from a block of data. */ | ||||
MidiMessage (const void* data, int numBytes, double timeStamp = 0); | MidiMessage (const void* data, int numBytes, double timeStamp = 0); | ||||
@@ -115,10 +118,11 @@ public: | |||||
/** Copies this message from another one. */ | /** Copies this message from another one. */ | ||||
MidiMessage& operator= (const MidiMessage& other); | MidiMessage& operator= (const MidiMessage& other); | ||||
#if JUCE_COMPILER_SUPPORTS_MOVE_SEMANTICS | |||||
/** Move constructor */ | |||||
MidiMessage (MidiMessage&&) noexcept; | MidiMessage (MidiMessage&&) noexcept; | ||||
/** Move assignment operator */ | |||||
MidiMessage& operator= (MidiMessage&&) noexcept; | MidiMessage& operator= (MidiMessage&&) noexcept; | ||||
#endif | |||||
//============================================================================== | //============================================================================== | ||||
/** Returns a pointer to the raw midi data. | /** Returns a pointer to the raw midi data. | ||||
@@ -473,7 +477,6 @@ public: | |||||
bool isControllerOfType (int controllerType) const noexcept; | bool isControllerOfType (int controllerType) const noexcept; | ||||
/** Creates a controller message. | /** Creates a controller message. | ||||
@param channel the midi channel, in the range 1 to 16 | @param channel the midi channel, in the range 1 to 16 | ||||
@param controllerType the type of controller | @param controllerType the type of controller | ||||
@param value the controller value | @param value the controller value | ||||
@@ -494,21 +497,18 @@ public: | |||||
bool isAllSoundOff() const noexcept; | bool isAllSoundOff() const noexcept; | ||||
/** Creates an all-notes-off message. | /** Creates an all-notes-off message. | ||||
@param channel the midi channel, in the range 1 to 16 | @param channel the midi channel, in the range 1 to 16 | ||||
@see isAllNotesOff | @see isAllNotesOff | ||||
*/ | */ | ||||
static MidiMessage allNotesOff (int channel) noexcept; | static MidiMessage allNotesOff (int channel) noexcept; | ||||
/** Creates an all-sound-off message. | /** Creates an all-sound-off message. | ||||
@param channel the midi channel, in the range 1 to 16 | @param channel the midi channel, in the range 1 to 16 | ||||
@see isAllSoundOff | @see isAllSoundOff | ||||
*/ | */ | ||||
static MidiMessage allSoundOff (int channel) noexcept; | static MidiMessage allSoundOff (int channel) noexcept; | ||||
/** Creates an all-controllers-off message. | /** Creates an all-controllers-off message. | ||||
@param channel the midi channel, in the range 1 to 16 | @param channel the midi channel, in the range 1 to 16 | ||||
*/ | */ | ||||
static MidiMessage allControllersOff (int channel) noexcept; | static MidiMessage allControllersOff (int channel) noexcept; | ||||
@@ -928,7 +928,7 @@ private: | |||||
}; | }; | ||||
PackedData packedData; | PackedData packedData; | ||||
double timeStamp; | |||||
double timeStamp = 0; | |||||
int size; | int size; | ||||
#endif | #endif | ||||
@@ -936,5 +936,3 @@ private: | |||||
inline uint8* getData() const noexcept { return isHeapAllocated() ? packedData.allocatedData : (uint8*) packedData.asBytes; } | inline uint8* getData() const noexcept { return isHeapAllocated() ? packedData.allocatedData : (uint8*) packedData.asBytes; } | ||||
uint8* allocateSpace (int); | uint8* allocateSpace (int); | ||||
}; | }; | ||||
#endif // JUCE_MIDIMESSAGE_H_INCLUDED |
@@ -2,32 +2,30 @@ | |||||
============================================================================== | ============================================================================== | ||||
This file is part of the JUCE library. | This file is part of the JUCE library. | ||||
Copyright (c) 2016 - ROLI Ltd. | |||||
Copyright (c) 2017 - ROLI Ltd. | |||||
Permission is granted to use this software under the terms of the ISC license | |||||
http://www.isc.org/downloads/software-support-policy/isc-license/ | |||||
JUCE is an open source library subject to commercial or open-source | |||||
licensing. | |||||
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. | |||||
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. | |||||
THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH REGARD | |||||
TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND | |||||
FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, | |||||
OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF | |||||
USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER | |||||
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE | |||||
OF THIS SOFTWARE. | |||||
----------------------------------------------------------------------------- | |||||
To release a closed-source product which uses other parts of JUCE not | |||||
licensed under the ISC terms, commercial licenses are available: visit | |||||
www.juce.com for more information. | |||||
JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER | |||||
EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE | |||||
DISCLAIMED. | |||||
============================================================================== | ============================================================================== | ||||
*/ | */ | ||||
MidiMessageSequence::MidiEventHolder::MidiEventHolder (const MidiMessage& mm) : message (mm) {} | |||||
MidiMessageSequence::MidiEventHolder::MidiEventHolder (MidiMessage&& mm) : message (static_cast<MidiMessage&&> (mm)) {} | |||||
MidiMessageSequence::MidiEventHolder::~MidiEventHolder() {} | |||||
//============================================================================== | |||||
MidiMessageSequence::MidiMessageSequence() | MidiMessageSequence::MidiMessageSequence() | ||||
{ | { | ||||
} | } | ||||
@@ -45,15 +43,25 @@ MidiMessageSequence& MidiMessageSequence::operator= (const MidiMessageSequence& | |||||
return *this; | return *this; | ||||
} | } | ||||
void MidiMessageSequence::swapWith (MidiMessageSequence& other) noexcept | |||||
MidiMessageSequence::MidiMessageSequence (MidiMessageSequence&& other) noexcept | |||||
: list (static_cast<OwnedArray<MidiEventHolder>&&> (other.list)) | |||||
{} | |||||
MidiMessageSequence& MidiMessageSequence::operator= (MidiMessageSequence&& other) noexcept | |||||
{ | { | ||||
list.swapWith (other.list); | |||||
list = static_cast<OwnedArray<MidiEventHolder>&&> (other.list); | |||||
return *this; | |||||
} | } | ||||
MidiMessageSequence::~MidiMessageSequence() | MidiMessageSequence::~MidiMessageSequence() | ||||
{ | { | ||||
} | } | ||||
void MidiMessageSequence::swapWith (MidiMessageSequence& other) noexcept | |||||
{ | |||||
list.swapWith (other.list); | |||||
} | |||||
void MidiMessageSequence::clear() | void MidiMessageSequence::clear() | ||||
{ | { | ||||
list.clear(); | list.clear(); | ||||
@@ -64,34 +72,37 @@ int MidiMessageSequence::getNumEvents() const noexcept | |||||
return list.size(); | return list.size(); | ||||
} | } | ||||
MidiMessageSequence::MidiEventHolder* MidiMessageSequence::getEventPointer (const int index) const noexcept | |||||
MidiMessageSequence::MidiEventHolder* MidiMessageSequence::getEventPointer (int index) const noexcept | |||||
{ | { | ||||
return list [index]; | |||||
return list[index]; | |||||
} | } | ||||
double MidiMessageSequence::getTimeOfMatchingKeyUp (const int index) const noexcept | |||||
MidiMessageSequence::MidiEventHolder** MidiMessageSequence::begin() const noexcept { return list.begin(); } | |||||
MidiMessageSequence::MidiEventHolder** MidiMessageSequence::end() const noexcept { return list.end(); } | |||||
double MidiMessageSequence::getTimeOfMatchingKeyUp (int index) const noexcept | |||||
{ | { | ||||
if (const MidiEventHolder* const meh = list [index]) | |||||
if (auto* meh = list[index]) | |||||
if (meh->noteOffObject != nullptr) | if (meh->noteOffObject != nullptr) | ||||
return meh->noteOffObject->message.getTimeStamp(); | return meh->noteOffObject->message.getTimeStamp(); | ||||
return 0.0; | return 0.0; | ||||
} | } | ||||
int MidiMessageSequence::getIndexOfMatchingKeyUp (const int index) const noexcept | |||||
int MidiMessageSequence::getIndexOfMatchingKeyUp (int index) const noexcept | |||||
{ | { | ||||
if (const MidiEventHolder* const meh = list [index]) | |||||
if (auto* meh = list [index]) | |||||
return list.indexOf (meh->noteOffObject); | return list.indexOf (meh->noteOffObject); | ||||
return -1; | return -1; | ||||
} | } | ||||
int MidiMessageSequence::getIndexOf (const MidiEventHolder* const event) const noexcept | |||||
int MidiMessageSequence::getIndexOf (const MidiEventHolder* event) const noexcept | |||||
{ | { | ||||
return list.indexOf (event); | return list.indexOf (event); | ||||
} | } | ||||
int MidiMessageSequence::getNextIndexAtTime (const double timeStamp) const noexcept | |||||
int MidiMessageSequence::getNextIndexAtTime (double timeStamp) const noexcept | |||||
{ | { | ||||
const int numEvents = list.size(); | const int numEvents = list.size(); | ||||
@@ -116,32 +127,38 @@ double MidiMessageSequence::getEndTime() const noexcept | |||||
double MidiMessageSequence::getEventTime (const int index) const noexcept | double MidiMessageSequence::getEventTime (const int index) const noexcept | ||||
{ | { | ||||
if (const MidiEventHolder* const meh = list [index]) | |||||
if (auto* meh = list [index]) | |||||
return meh->message.getTimeStamp(); | return meh->message.getTimeStamp(); | ||||
return 0.0; | return 0.0; | ||||
} | } | ||||
//============================================================================== | //============================================================================== | ||||
MidiMessageSequence::MidiEventHolder* MidiMessageSequence::addEvent (const MidiMessage& newMessage, | |||||
double timeAdjustment) | |||||
MidiMessageSequence::MidiEventHolder* MidiMessageSequence::addEvent (MidiEventHolder* newEvent, double timeAdjustment) | |||||
{ | { | ||||
MidiEventHolder* const newOne = new MidiEventHolder (newMessage); | |||||
timeAdjustment += newMessage.getTimeStamp(); | |||||
newOne->message.setTimeStamp (timeAdjustment); | |||||
newEvent->message.addToTimeStamp (timeAdjustment); | |||||
auto time = newEvent->message.getTimeStamp(); | |||||
int i; | int i; | ||||
for (i = list.size(); --i >= 0;) | for (i = list.size(); --i >= 0;) | ||||
if (list.getUnchecked(i)->message.getTimeStamp() <= timeAdjustment) | |||||
if (list.getUnchecked(i)->message.getTimeStamp() <= time) | |||||
break; | break; | ||||
list.insert (i + 1, newOne); | |||||
return newOne; | |||||
list.insert (i + 1, newEvent); | |||||
return newEvent; | |||||
} | |||||
MidiMessageSequence::MidiEventHolder* MidiMessageSequence::addEvent (const MidiMessage& newMessage, double timeAdjustment) | |||||
{ | |||||
return addEvent (new MidiEventHolder (newMessage), timeAdjustment); | |||||
} | |||||
MidiMessageSequence::MidiEventHolder* MidiMessageSequence::addEvent (MidiMessage&& newMessage, double timeAdjustment) | |||||
{ | |||||
return addEvent (new MidiEventHolder (static_cast<MidiMessage&&> (newMessage)), timeAdjustment); | |||||
} | } | ||||
void MidiMessageSequence::deleteEvent (const int index, | |||||
const bool deleteMatchingNoteUp) | |||||
void MidiMessageSequence::deleteEvent (int index, bool deleteMatchingNoteUp) | |||||
{ | { | ||||
if (isPositiveAndBelow (index, list.size())) | if (isPositiveAndBelow (index, list.size())) | ||||
{ | { | ||||
@@ -152,23 +169,11 @@ void MidiMessageSequence::deleteEvent (const int index, | |||||
} | } | ||||
} | } | ||||
struct MidiMessageSequenceSorter | |||||
{ | |||||
static int compareElements (const MidiMessageSequence::MidiEventHolder* const first, | |||||
const MidiMessageSequence::MidiEventHolder* const second) noexcept | |||||
{ | |||||
const double diff = first->message.getTimeStamp() - second->message.getTimeStamp(); | |||||
return (diff > 0) - (diff < 0); | |||||
} | |||||
}; | |||||
void MidiMessageSequence::addSequence (const MidiMessageSequence& other, double timeAdjustment) | void MidiMessageSequence::addSequence (const MidiMessageSequence& other, double timeAdjustment) | ||||
{ | { | ||||
for (int i = 0; i < other.list.size(); ++i) | |||||
for (auto* m : other) | |||||
{ | { | ||||
const MidiMessage& m = other.list.getUnchecked(i)->message; | |||||
MidiEventHolder* const newOne = new MidiEventHolder (m); | |||||
auto newOne = new MidiEventHolder (m->message); | |||||
newOne->message.addToTimeStamp (timeAdjustment); | newOne->message.addToTimeStamp (timeAdjustment); | ||||
list.add (newOne); | list.add (newOne); | ||||
} | } | ||||
@@ -181,16 +186,14 @@ void MidiMessageSequence::addSequence (const MidiMessageSequence& other, | |||||
double firstAllowableTime, | double firstAllowableTime, | ||||
double endOfAllowableDestTimes) | double endOfAllowableDestTimes) | ||||
{ | { | ||||
for (int i = 0; i < other.list.size(); ++i) | |||||
for (auto* m : other) | |||||
{ | { | ||||
const MidiMessage& m = other.list.getUnchecked(i)->message; | |||||
const double t = m.getTimeStamp() + timeAdjustment; | |||||
auto t = m->message.getTimeStamp() + timeAdjustment; | |||||
if (t >= firstAllowableTime && t < endOfAllowableDestTimes) | if (t >= firstAllowableTime && t < endOfAllowableDestTimes) | ||||
{ | { | ||||
MidiEventHolder* const newOne = new MidiEventHolder (m); | |||||
auto newOne = new MidiEventHolder (m->message); | |||||
newOne->message.setTimeStamp (t); | newOne->message.setTimeStamp (t); | ||||
list.add (newOne); | list.add (newOne); | ||||
} | } | ||||
} | } | ||||
@@ -198,7 +201,16 @@ void MidiMessageSequence::addSequence (const MidiMessageSequence& other, | |||||
sort(); | sort(); | ||||
} | } | ||||
//============================================================================== | |||||
struct MidiMessageSequenceSorter | |||||
{ | |||||
static int compareElements (const MidiMessageSequence::MidiEventHolder* first, | |||||
const MidiMessageSequence::MidiEventHolder* second) noexcept | |||||
{ | |||||
auto diff = first->message.getTimeStamp() - second->message.getTimeStamp(); | |||||
return (diff > 0) - (diff < 0); | |||||
} | |||||
}; | |||||
void MidiMessageSequence::sort() noexcept | void MidiMessageSequence::sort() noexcept | ||||
{ | { | ||||
MidiMessageSequenceSorter sorter; | MidiMessageSequenceSorter sorter; | ||||
@@ -209,30 +221,32 @@ void MidiMessageSequence::updateMatchedPairs() noexcept | |||||
{ | { | ||||
for (int i = 0; i < list.size(); ++i) | for (int i = 0; i < list.size(); ++i) | ||||
{ | { | ||||
MidiEventHolder* const meh = list.getUnchecked(i); | |||||
const MidiMessage& m1 = meh->message; | |||||
auto* meh = list.getUnchecked(i); | |||||
auto& m1 = meh->message; | |||||
if (m1.isNoteOn()) | if (m1.isNoteOn()) | ||||
{ | { | ||||
meh->noteOffObject = nullptr; | meh->noteOffObject = nullptr; | ||||
const int note = m1.getNoteNumber(); | |||||
const int chan = m1.getChannel(); | |||||
const int len = list.size(); | |||||
auto note = m1.getNoteNumber(); | |||||
auto chan = m1.getChannel(); | |||||
auto len = list.size(); | |||||
for (int j = i + 1; j < len; ++j) | for (int j = i + 1; j < len; ++j) | ||||
{ | { | ||||
const MidiMessage& m = list.getUnchecked(j)->message; | |||||
auto* meh2 = list.getUnchecked(j); | |||||
auto& m = meh2->message; | |||||
if (m.getNoteNumber() == note && m.getChannel() == chan) | if (m.getNoteNumber() == note && m.getChannel() == chan) | ||||
{ | { | ||||
if (m.isNoteOff()) | if (m.isNoteOff()) | ||||
{ | { | ||||
meh->noteOffObject = list[j]; | |||||
meh->noteOffObject = meh2; | |||||
break; | break; | ||||
} | } | ||||
else if (m.isNoteOn()) | |||||
if (m.isNoteOn()) | |||||
{ | { | ||||
MidiEventHolder* const newEvent = new MidiEventHolder (MidiMessage::noteOff (chan, note)); | |||||
auto newEvent = new MidiEventHolder (MidiMessage::noteOff (chan, note)); | |||||
list.insert (j, newEvent); | list.insert (j, newEvent); | ||||
newEvent->message.setTimeStamp (m.getTimeStamp()); | newEvent->message.setTimeStamp (m.getTimeStamp()); | ||||
meh->noteOffObject = newEvent; | meh->noteOffObject = newEvent; | ||||
@@ -244,13 +258,11 @@ void MidiMessageSequence::updateMatchedPairs() noexcept | |||||
} | } | ||||
} | } | ||||
void MidiMessageSequence::addTimeToMessages (const double delta) noexcept | |||||
void MidiMessageSequence::addTimeToMessages (double delta) noexcept | |||||
{ | { | ||||
for (int i = list.size(); --i >= 0;) | |||||
{ | |||||
MidiMessage& mm = list.getUnchecked(i)->message; | |||||
mm.setTimeStamp (mm.getTimeStamp() + delta); | |||||
} | |||||
if (delta != 0) | |||||
for (auto* m : list) | |||||
m->message.addToTimeStamp (delta); | |||||
} | } | ||||
//============================================================================== | //============================================================================== | ||||
@@ -258,24 +270,17 @@ void MidiMessageSequence::extractMidiChannelMessages (const int channelNumberToE | |||||
MidiMessageSequence& destSequence, | MidiMessageSequence& destSequence, | ||||
const bool alsoIncludeMetaEvents) const | const bool alsoIncludeMetaEvents) const | ||||
{ | { | ||||
for (int i = 0; i < list.size(); ++i) | |||||
{ | |||||
const MidiMessage& mm = list.getUnchecked(i)->message; | |||||
if (mm.isForChannel (channelNumberToExtract) || (alsoIncludeMetaEvents && mm.isMetaEvent())) | |||||
destSequence.addEvent (mm); | |||||
} | |||||
for (auto* meh : list) | |||||
if (meh->message.isForChannel (channelNumberToExtract) | |||||
|| (alsoIncludeMetaEvents && meh->message.isMetaEvent())) | |||||
destSequence.addEvent (meh->message); | |||||
} | } | ||||
void MidiMessageSequence::extractSysExMessages (MidiMessageSequence& destSequence) const | void MidiMessageSequence::extractSysExMessages (MidiMessageSequence& destSequence) const | ||||
{ | { | ||||
for (int i = 0; i < list.size(); ++i) | |||||
{ | |||||
const MidiMessage& mm = list.getUnchecked(i)->message; | |||||
if (mm.isSysEx()) | |||||
destSequence.addEvent (mm); | |||||
} | |||||
for (auto* meh : list) | |||||
if (meh->message.isSysEx()) | |||||
destSequence.addEvent (meh->message); | |||||
} | } | ||||
void MidiMessageSequence::deleteMidiChannelMessages (const int channelNumberToRemove) | void MidiMessageSequence::deleteMidiChannelMessages (const int channelNumberToRemove) | ||||
@@ -293,15 +298,15 @@ void MidiMessageSequence::deleteSysExMessages() | |||||
} | } | ||||
//============================================================================== | //============================================================================== | ||||
void MidiMessageSequence::createControllerUpdatesForTime (const int channelNumber, const double time, Array<MidiMessage>& dest) | |||||
void MidiMessageSequence::createControllerUpdatesForTime (int channelNumber, double time, Array<MidiMessage>& dest) | |||||
{ | { | ||||
bool doneProg = false; | bool doneProg = false; | ||||
bool donePitchWheel = false; | bool donePitchWheel = false; | ||||
bool doneControllers[128] = { 0 }; | |||||
bool doneControllers[128] = {}; | |||||
for (int i = list.size(); --i >= 0;) | for (int i = list.size(); --i >= 0;) | ||||
{ | { | ||||
const MidiMessage& mm = list.getUnchecked(i)->message; | |||||
auto& mm = list.getUnchecked(i)->message; | |||||
if (mm.isForChannel (channelNumber) && mm.getTimeStamp() <= time) | if (mm.isForChannel (channelNumber) && mm.getTimeStamp() <= time) | ||||
{ | { | ||||
@@ -329,14 +334,3 @@ void MidiMessageSequence::createControllerUpdatesForTime (const int channelNumbe | |||||
} | } | ||||
} | } | ||||
} | } | ||||
//============================================================================== | |||||
MidiMessageSequence::MidiEventHolder::MidiEventHolder (const MidiMessage& mm) | |||||
: message (mm), noteOffObject (nullptr) | |||||
{ | |||||
} | |||||
MidiMessageSequence::MidiEventHolder::~MidiEventHolder() | |||||
{ | |||||
} |
@@ -2,34 +2,25 @@ | |||||
============================================================================== | ============================================================================== | ||||
This file is part of the JUCE library. | This file is part of the JUCE library. | ||||
Copyright (c) 2016 - ROLI Ltd. | |||||
Copyright (c) 2017 - ROLI Ltd. | |||||
Permission is granted to use this software under the terms of the ISC license | |||||
http://www.isc.org/downloads/software-support-policy/isc-license/ | |||||
JUCE is an open source library subject to commercial or open-source | |||||
licensing. | |||||
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. | |||||
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. | |||||
THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH REGARD | |||||
TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND | |||||
FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, | |||||
OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF | |||||
USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER | |||||
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE | |||||
OF THIS SOFTWARE. | |||||
----------------------------------------------------------------------------- | |||||
To release a closed-source product which uses other parts of JUCE not | |||||
licensed under the ISC terms, commercial licenses are available: visit | |||||
www.juce.com for more information. | |||||
JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER | |||||
EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE | |||||
DISCLAIMED. | |||||
============================================================================== | ============================================================================== | ||||
*/ | */ | ||||
#ifndef JUCE_MIDIMESSAGESEQUENCE_H_INCLUDED | |||||
#define JUCE_MIDIMESSAGESEQUENCE_H_INCLUDED | |||||
#pragma once | |||||
//============================================================================== | //============================================================================== | ||||
@@ -54,17 +45,11 @@ public: | |||||
/** Replaces this sequence with another one. */ | /** Replaces this sequence with another one. */ | ||||
MidiMessageSequence& operator= (const MidiMessageSequence&); | MidiMessageSequence& operator= (const MidiMessageSequence&); | ||||
#if JUCE_COMPILER_SUPPORTS_MOVE_SEMANTICS | |||||
MidiMessageSequence (MidiMessageSequence&& other) noexcept | |||||
: list (static_cast<OwnedArray<MidiEventHolder>&&> (other.list)) | |||||
{} | |||||
/** Move constructor */ | |||||
MidiMessageSequence (MidiMessageSequence&&) noexcept; | |||||
MidiMessageSequence& operator= (MidiMessageSequence&& other) noexcept | |||||
{ | |||||
list = static_cast<OwnedArray<MidiEventHolder>&&> (other.list); | |||||
return *this; | |||||
} | |||||
#endif | |||||
/** Move assignment operator */ | |||||
MidiMessageSequence& operator= (MidiMessageSequence&&) noexcept; | |||||
/** Destructor. */ | /** Destructor. */ | ||||
~MidiMessageSequence(); | ~MidiMessageSequence(); | ||||
@@ -95,12 +80,13 @@ public: | |||||
note-offs up-to-date after events have been moved around in the sequence | note-offs up-to-date after events have been moved around in the sequence | ||||
or deleted. | or deleted. | ||||
*/ | */ | ||||
MidiEventHolder* noteOffObject; | |||||
MidiEventHolder* noteOffObject = nullptr; | |||||
private: | private: | ||||
//============================================================================== | //============================================================================== | ||||
friend class MidiMessageSequence; | friend class MidiMessageSequence; | ||||
MidiEventHolder (const MidiMessage&); | MidiEventHolder (const MidiMessage&); | ||||
MidiEventHolder (MidiMessage&&); | |||||
JUCE_LEAK_DETECTOR (MidiEventHolder) | JUCE_LEAK_DETECTOR (MidiEventHolder) | ||||
}; | }; | ||||
@@ -114,6 +100,12 @@ public: | |||||
/** Returns a pointer to one of the events. */ | /** Returns a pointer to one of the events. */ | ||||
MidiEventHolder* getEventPointer (int index) const noexcept; | MidiEventHolder* getEventPointer (int index) const noexcept; | ||||
/** Iterator for the list of MidiEventHolders */ | |||||
MidiEventHolder** begin() const noexcept; | |||||
/** Iterator for the list of MidiEventHolders */ | |||||
MidiEventHolder** end() const noexcept; | |||||
/** Returns the time of the note-up that matches the note-on at this index. | /** Returns the time of the note-up that matches the note-on at this index. | ||||
If the event at this index isn't a note-on, it'll just return 0. | If the event at this index isn't a note-on, it'll just return 0. | ||||
@see MidiMessageSequence::MidiEventHolder::noteOffObject | @see MidiMessageSequence::MidiEventHolder::noteOffObject | ||||
@@ -164,8 +156,21 @@ public: | |||||
that will be inserted | that will be inserted | ||||
@see updateMatchedPairs | @see updateMatchedPairs | ||||
*/ | */ | ||||
MidiEventHolder* addEvent (const MidiMessage& newMessage, | |||||
double timeAdjustment = 0); | |||||
MidiEventHolder* addEvent (const MidiMessage& newMessage, double timeAdjustment = 0); | |||||
/** Inserts a midi message into the sequence. | |||||
The index at which the new message gets inserted will depend on its timestamp, | |||||
because the sequence is kept sorted. | |||||
Remember to call updateMatchedPairs() after adding note-on events. | |||||
@param newMessage the new message to add (an internal copy will be made) | |||||
@param timeAdjustment an optional value to add to the timestamp of the message | |||||
that will be inserted | |||||
@see updateMatchedPairs | |||||
*/ | |||||
MidiEventHolder* addEvent (MidiMessage&& newMessage, double timeAdjustment = 0); | |||||
/** Deletes one of the events in the sequence. | /** Deletes one of the events in the sequence. | ||||
@@ -285,8 +290,7 @@ private: | |||||
friend class MidiFile; | friend class MidiFile; | ||||
OwnedArray<MidiEventHolder> list; | OwnedArray<MidiEventHolder> list; | ||||
MidiEventHolder* addEvent (MidiEventHolder*, double); | |||||
JUCE_LEAK_DETECTOR (MidiMessageSequence) | JUCE_LEAK_DETECTOR (MidiMessageSequence) | ||||
}; | }; | ||||
#endif // JUCE_MIDIMESSAGESEQUENCE_H_INCLUDED |
@@ -2,28 +2,20 @@ | |||||
============================================================================== | ============================================================================== | ||||
This file is part of the JUCE library. | This file is part of the JUCE library. | ||||
Copyright (c) 2016 - ROLI Ltd. | |||||
Copyright (c) 2017 - ROLI Ltd. | |||||
Permission is granted to use this software under the terms of the ISC license | |||||
http://www.isc.org/downloads/software-support-policy/isc-license/ | |||||
JUCE is an open source library subject to commercial or open-source | |||||
licensing. | |||||
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. | |||||
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. | |||||
THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH REGARD | |||||
TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND | |||||
FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, | |||||
OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF | |||||
USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER | |||||
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE | |||||
OF THIS SOFTWARE. | |||||
----------------------------------------------------------------------------- | |||||
To release a closed-source product which uses other parts of JUCE not | |||||
licensed under the ISC terms, commercial licenses are available: visit | |||||
www.juce.com for more information. | |||||
JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER | |||||
EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE | |||||
DISCLAIMED. | |||||
============================================================================== | ============================================================================== | ||||
*/ | */ | ||||
@@ -171,7 +163,7 @@ MidiBuffer MidiRPNGenerator::generate (int midiChannel, | |||||
class MidiRPNDetectorTests : public UnitTest | class MidiRPNDetectorTests : public UnitTest | ||||
{ | { | ||||
public: | public: | ||||
MidiRPNDetectorTests() : UnitTest ("MidiRPNDetector class") {} | |||||
MidiRPNDetectorTests() : UnitTest ("MidiRPNDetector class", "MIDI/MPE") {} | |||||
void runTest() override | void runTest() override | ||||
{ | { | ||||
@@ -313,7 +305,7 @@ static MidiRPNDetectorTests MidiRPNDetectorUnitTests; | |||||
class MidiRPNGeneratorTests : public UnitTest | class MidiRPNGeneratorTests : public UnitTest | ||||
{ | { | ||||
public: | public: | ||||
MidiRPNGeneratorTests() : UnitTest ("MidiRPNGenerator class") {} | |||||
MidiRPNGeneratorTests() : UnitTest ("MidiRPNGenerator class", "MIDI/MPE") {} | |||||
void runTest() override | void runTest() override | ||||
{ | { | ||||
@@ -369,7 +361,7 @@ private: | |||||
expectEquals (result.channel, expected.channel); | expectEquals (result.channel, expected.channel); | ||||
expectEquals (result.parameterNumber, expected.parameterNumber); | expectEquals (result.parameterNumber, expected.parameterNumber); | ||||
expectEquals (result.value, expected.value); | expectEquals (result.value, expected.value); | ||||
expect (result.isNRPN == expected.isNRPN), | |||||
expect (result.isNRPN == expected.isNRPN); | |||||
expect (result.is14BitValue == expected.is14BitValue); | expect (result.is14BitValue == expected.is14BitValue); | ||||
} | } | ||||
}; | }; | ||||
@@ -2,34 +2,25 @@ | |||||
============================================================================== | ============================================================================== | ||||
This file is part of the JUCE library. | This file is part of the JUCE library. | ||||
Copyright (c) 2016 - ROLI Ltd. | |||||
Copyright (c) 2017 - ROLI Ltd. | |||||
Permission is granted to use this software under the terms of the ISC license | |||||
http://www.isc.org/downloads/software-support-policy/isc-license/ | |||||
JUCE is an open source library subject to commercial or open-source | |||||
licensing. | |||||
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. | |||||
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. | |||||
THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH REGARD | |||||
TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND | |||||
FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, | |||||
OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF | |||||
USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER | |||||
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE | |||||
OF THIS SOFTWARE. | |||||
----------------------------------------------------------------------------- | |||||
To release a closed-source product which uses other parts of JUCE not | |||||
licensed under the ISC terms, commercial licenses are available: visit | |||||
www.juce.com for more information. | |||||
JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER | |||||
EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE | |||||
DISCLAIMED. | |||||
============================================================================== | ============================================================================== | ||||
*/ | */ | ||||
#ifndef JUCE_MIDIRPNDETECTOR_H_INCLUDED | |||||
#define JUCE_MIDIRPNDETECTOR_H_INCLUDED | |||||
#pragma once | |||||
//============================================================================== | //============================================================================== | ||||
@@ -153,6 +144,3 @@ public: | |||||
bool isNRPN = false, | bool isNRPN = false, | ||||
bool use14BitValue = true); | bool use14BitValue = true); | ||||
}; | }; | ||||
#endif // JUCE_MIDIRPNDETECTOR_H_INCLUDED |
@@ -2,28 +2,20 @@ | |||||
============================================================================== | ============================================================================== | ||||
This file is part of the JUCE library. | This file is part of the JUCE library. | ||||
Copyright (c) 2016 - ROLI Ltd. | |||||
Copyright (c) 2017 - ROLI Ltd. | |||||
Permission is granted to use this software under the terms of the ISC license | |||||
http://www.isc.org/downloads/software-support-policy/isc-license/ | |||||
JUCE is an open source library subject to commercial or open-source | |||||
licensing. | |||||
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. | |||||
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. | |||||
THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH REGARD | |||||
TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND | |||||
FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, | |||||
OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF | |||||
USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER | |||||
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE | |||||
OF THIS SOFTWARE. | |||||
----------------------------------------------------------------------------- | |||||
To release a closed-source product which uses other parts of JUCE not | |||||
licensed under the ISC terms, commercial licenses are available: visit | |||||
www.juce.com for more information. | |||||
JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER | |||||
EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE | |||||
DISCLAIMED. | |||||
============================================================================== | ============================================================================== | ||||
*/ | */ | ||||
@@ -703,7 +695,7 @@ class MPEInstrumentTests : public UnitTest | |||||
{ | { | ||||
public: | public: | ||||
MPEInstrumentTests() | MPEInstrumentTests() | ||||
: UnitTest ("MPEInstrument class") | |||||
: UnitTest ("MPEInstrument class", "MIDI/MPE") | |||||
{ | { | ||||
// using two MPE zones with the following layout for testing | // using two MPE zones with the following layout for testing | ||||
// | // | ||||
@@ -2,34 +2,25 @@ | |||||
============================================================================== | ============================================================================== | ||||
This file is part of the JUCE library. | This file is part of the JUCE library. | ||||
Copyright (c) 2016 - ROLI Ltd. | |||||
Copyright (c) 2017 - ROLI Ltd. | |||||
Permission is granted to use this software under the terms of the ISC license | |||||
http://www.isc.org/downloads/software-support-policy/isc-license/ | |||||
JUCE is an open source library subject to commercial or open-source | |||||
licensing. | |||||
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. | |||||
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. | |||||
THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH REGARD | |||||
TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND | |||||
FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, | |||||
OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF | |||||
USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER | |||||
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE | |||||
OF THIS SOFTWARE. | |||||
----------------------------------------------------------------------------- | |||||
To release a closed-source product which uses other parts of JUCE not | |||||
licensed under the ISC terms, commercial licenses are available: visit | |||||
www.juce.com for more information. | |||||
JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER | |||||
EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE | |||||
DISCLAIMED. | |||||
============================================================================== | ============================================================================== | ||||
*/ | */ | ||||
#ifndef JUCE_MPEINSTRUMENT_H_INCLUDED | |||||
#define JUCE_MPEINSTRUMENT_H_INCLUDED | |||||
#pragma once | |||||
//============================================================================== | //============================================================================== | ||||
@@ -383,6 +374,3 @@ private: | |||||
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (MPEInstrument) | JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (MPEInstrument) | ||||
}; | }; | ||||
#endif // JUCE_MPE_H_INCLUDED |
@@ -2,28 +2,20 @@ | |||||
============================================================================== | ============================================================================== | ||||
This file is part of the JUCE library. | This file is part of the JUCE library. | ||||
Copyright (c) 2016 - ROLI Ltd. | |||||
Copyright (c) 2017 - ROLI Ltd. | |||||
Permission is granted to use this software under the terms of the ISC license | |||||
http://www.isc.org/downloads/software-support-policy/isc-license/ | |||||
JUCE is an open source library subject to commercial or open-source | |||||
licensing. | |||||
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. | |||||
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. | |||||
THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH REGARD | |||||
TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND | |||||
FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, | |||||
OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF | |||||
USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER | |||||
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE | |||||
OF THIS SOFTWARE. | |||||
----------------------------------------------------------------------------- | |||||
To release a closed-source product which uses other parts of JUCE not | |||||
licensed under the ISC terms, commercial licenses are available: visit | |||||
www.juce.com for more information. | |||||
JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER | |||||
EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE | |||||
DISCLAIMED. | |||||
============================================================================== | ============================================================================== | ||||
*/ | */ | ||||
@@ -79,7 +71,7 @@ MidiBuffer MPEMessages::setZoneLayout (const MPEZoneLayout& layout) | |||||
class MPEMessagesTests : public UnitTest | class MPEMessagesTests : public UnitTest | ||||
{ | { | ||||
public: | public: | ||||
MPEMessagesTests() : UnitTest ("MPEMessages class") {} | |||||
MPEMessagesTests() : UnitTest ("MPEMessages class", "MIDI/MPE") {} | |||||
void runTest() override | void runTest() override | ||||
{ | { | ||||
@@ -2,34 +2,25 @@ | |||||
============================================================================== | ============================================================================== | ||||
This file is part of the JUCE library. | This file is part of the JUCE library. | ||||
Copyright (c) 2016 - ROLI Ltd. | |||||
Copyright (c) 2017 - ROLI Ltd. | |||||
Permission is granted to use this software under the terms of the ISC license | |||||
http://www.isc.org/downloads/software-support-policy/isc-license/ | |||||
JUCE is an open source library subject to commercial or open-source | |||||
licensing. | |||||
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. | |||||
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. | |||||
THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH REGARD | |||||
TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND | |||||
FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, | |||||
OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF | |||||
USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER | |||||
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE | |||||
OF THIS SOFTWARE. | |||||
----------------------------------------------------------------------------- | |||||
To release a closed-source product which uses other parts of JUCE not | |||||
licensed under the ISC terms, commercial licenses are available: visit | |||||
www.juce.com for more information. | |||||
JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER | |||||
EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE | |||||
DISCLAIMED. | |||||
============================================================================== | ============================================================================== | ||||
*/ | */ | ||||
#ifndef JUCE_MPEMESSAGES_H_INCLUDED | |||||
#define JUCE_MPEMESSAGES_H_INCLUDED | |||||
#pragma once | |||||
//============================================================================== | //============================================================================== | ||||
@@ -96,7 +87,3 @@ public: | |||||
*/ | */ | ||||
static const int zoneLayoutMessagesRpnNumber = 6; | static const int zoneLayoutMessagesRpnNumber = 6; | ||||
}; | }; | ||||
#endif // JUCE_MPEMESSAGES_H_INCLUDED |
@@ -2,28 +2,20 @@ | |||||
============================================================================== | ============================================================================== | ||||
This file is part of the JUCE library. | This file is part of the JUCE library. | ||||
Copyright (c) 2016 - ROLI Ltd. | |||||
Copyright (c) 2017 - ROLI Ltd. | |||||
Permission is granted to use this software under the terms of the ISC license | |||||
http://www.isc.org/downloads/software-support-policy/isc-license/ | |||||
JUCE is an open source library subject to commercial or open-source | |||||
licensing. | |||||
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. | |||||
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. | |||||
THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH REGARD | |||||
TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND | |||||
FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, | |||||
OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF | |||||
USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER | |||||
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE | |||||
OF THIS SOFTWARE. | |||||
----------------------------------------------------------------------------- | |||||
To release a closed-source product which uses other parts of JUCE not | |||||
licensed under the ISC terms, commercial licenses are available: visit | |||||
www.juce.com for more information. | |||||
JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER | |||||
EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE | |||||
DISCLAIMED. | |||||
============================================================================== | ============================================================================== | ||||
*/ | */ | ||||
@@ -107,7 +99,7 @@ bool MPENote::operator!= (const MPENote& other) const noexcept | |||||
class MPENoteTests : public UnitTest | class MPENoteTests : public UnitTest | ||||
{ | { | ||||
public: | public: | ||||
MPENoteTests() : UnitTest ("MPENote class") {} | |||||
MPENoteTests() : UnitTest ("MPENote class", "MIDI/MPE") {} | |||||
//============================================================================== | //============================================================================== | ||||
void runTest() override | void runTest() override | ||||
@@ -2,34 +2,25 @@ | |||||
============================================================================== | ============================================================================== | ||||
This file is part of the JUCE library. | This file is part of the JUCE library. | ||||
Copyright (c) 2016 - ROLI Ltd. | |||||
Copyright (c) 2017 - ROLI Ltd. | |||||
Permission is granted to use this software under the terms of the ISC license | |||||
http://www.isc.org/downloads/software-support-policy/isc-license/ | |||||
JUCE is an open source library subject to commercial or open-source | |||||
licensing. | |||||
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. | |||||
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. | |||||
THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH REGARD | |||||
TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND | |||||
FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, | |||||
OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF | |||||
USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER | |||||
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE | |||||
OF THIS SOFTWARE. | |||||
----------------------------------------------------------------------------- | |||||
To release a closed-source product which uses other parts of JUCE not | |||||
licensed under the ISC terms, commercial licenses are available: visit | |||||
www.juce.com for more information. | |||||
JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER | |||||
EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE | |||||
DISCLAIMED. | |||||
============================================================================== | ============================================================================== | ||||
*/ | */ | ||||
#ifndef JUCE_MPENOTE_H_INCLUDED | |||||
#define JUCE_MPENOTE_H_INCLUDED | |||||
#pragma once | |||||
//============================================================================== | //============================================================================== | ||||
@@ -181,6 +172,3 @@ struct JUCE_API MPENote | |||||
/** Returns true if two notes are different notes, determined by their unique ID. */ | /** Returns true if two notes are different notes, determined by their unique ID. */ | ||||
bool operator!= (const MPENote& other) const noexcept; | bool operator!= (const MPENote& other) const noexcept; | ||||
}; | }; | ||||
#endif // JUCE_MPENOTE_H_INCLUDED |
@@ -2,28 +2,20 @@ | |||||
============================================================================== | ============================================================================== | ||||
This file is part of the JUCE library. | This file is part of the JUCE library. | ||||
Copyright (c) 2016 - ROLI Ltd. | |||||
Copyright (c) 2017 - ROLI Ltd. | |||||
Permission is granted to use this software under the terms of the ISC license | |||||
http://www.isc.org/downloads/software-support-policy/isc-license/ | |||||
JUCE is an open source library subject to commercial or open-source | |||||
licensing. | |||||
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. | |||||
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. | |||||
THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH REGARD | |||||
TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND | |||||
FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, | |||||
OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF | |||||
USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER | |||||
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE | |||||
OF THIS SOFTWARE. | |||||
----------------------------------------------------------------------------- | |||||
To release a closed-source product which uses other parts of JUCE not | |||||
licensed under the ISC terms, commercial licenses are available: visit | |||||
www.juce.com for more information. | |||||
JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER | |||||
EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE | |||||
DISCLAIMED. | |||||
============================================================================== | ============================================================================== | ||||
*/ | */ | ||||
@@ -32,7 +24,7 @@ MPESynthesiser::MPESynthesiser() | |||||
{ | { | ||||
} | } | ||||
MPESynthesiser::MPESynthesiser (MPEInstrument* instrument) : MPESynthesiserBase (instrument) | |||||
MPESynthesiser::MPESynthesiser (MPEInstrument* mpeInstrument) : MPESynthesiserBase (mpeInstrument) | |||||
{ | { | ||||
} | } | ||||
@@ -2,34 +2,25 @@ | |||||
============================================================================== | ============================================================================== | ||||
This file is part of the JUCE library. | This file is part of the JUCE library. | ||||
Copyright (c) 2016 - ROLI Ltd. | |||||
Copyright (c) 2017 - ROLI Ltd. | |||||
Permission is granted to use this software under the terms of the ISC license | |||||
http://www.isc.org/downloads/software-support-policy/isc-license/ | |||||
JUCE is an open source library subject to commercial or open-source | |||||
licensing. | |||||
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. | |||||
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. | |||||
THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH REGARD | |||||
TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND | |||||
FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, | |||||
OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF | |||||
USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER | |||||
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE | |||||
OF THIS SOFTWARE. | |||||
----------------------------------------------------------------------------- | |||||
To release a closed-source product which uses other parts of JUCE not | |||||
licensed under the ISC terms, commercial licenses are available: visit | |||||
www.juce.com for more information. | |||||
JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER | |||||
EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE | |||||
DISCLAIMED. | |||||
============================================================================== | ============================================================================== | ||||
*/ | */ | ||||
#ifndef JUCE_MPESynthesiser_H_INCLUDED | |||||
#define JUCE_MPESynthesiser_H_INCLUDED | |||||
#pragma once | |||||
//============================================================================== | //============================================================================== | ||||
@@ -314,6 +305,3 @@ private: | |||||
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (MPESynthesiser) | JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (MPESynthesiser) | ||||
}; | }; | ||||
#endif // JUCE_MPESynthesiser_H_INCLUDED |
@@ -2,28 +2,20 @@ | |||||
============================================================================== | ============================================================================== | ||||
This file is part of the JUCE library. | This file is part of the JUCE library. | ||||
Copyright (c) 2016 - ROLI Ltd. | |||||
Copyright (c) 2017 - ROLI Ltd. | |||||
Permission is granted to use this software under the terms of the ISC license | |||||
http://www.isc.org/downloads/software-support-policy/isc-license/ | |||||
JUCE is an open source library subject to commercial or open-source | |||||
licensing. | |||||
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. | |||||
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. | |||||
THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH REGARD | |||||
TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND | |||||
FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, | |||||
OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF | |||||
USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER | |||||
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE | |||||
OF THIS SOFTWARE. | |||||
----------------------------------------------------------------------------- | |||||
To release a closed-source product which uses other parts of JUCE not | |||||
licensed under the ISC terms, commercial licenses are available: visit | |||||
www.juce.com for more information. | |||||
JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER | |||||
EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE | |||||
DISCLAIMED. | |||||
============================================================================== | ============================================================================== | ||||
*/ | */ | ||||
@@ -2,34 +2,25 @@ | |||||
============================================================================== | ============================================================================== | ||||
This file is part of the JUCE library. | This file is part of the JUCE library. | ||||
Copyright (c) 2016 - ROLI Ltd. | |||||
Copyright (c) 2017 - ROLI Ltd. | |||||
Permission is granted to use this software under the terms of the ISC license | |||||
http://www.isc.org/downloads/software-support-policy/isc-license/ | |||||
JUCE is an open source library subject to commercial or open-source | |||||
licensing. | |||||
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. | |||||
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. | |||||
THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH REGARD | |||||
TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND | |||||
FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, | |||||
OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF | |||||
USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER | |||||
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE | |||||
OF THIS SOFTWARE. | |||||
----------------------------------------------------------------------------- | |||||
To release a closed-source product which uses other parts of JUCE not | |||||
licensed under the ISC terms, commercial licenses are available: visit | |||||
www.juce.com for more information. | |||||
JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER | |||||
EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE | |||||
DISCLAIMED. | |||||
============================================================================== | ============================================================================== | ||||
*/ | */ | ||||
#ifndef JUCE_MPESynthesiserBase_H_INCLUDED | |||||
#define JUCE_MPESynthesiserBase_H_INCLUDED | |||||
#pragma once | |||||
//============================================================================== | //============================================================================== | ||||
@@ -213,6 +204,3 @@ private: | |||||
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (MPESynthesiserBase) | JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (MPESynthesiserBase) | ||||
}; | }; | ||||
#endif // JUCE_MPESynthesiserBase_H_INCLUDED |
@@ -2,28 +2,20 @@ | |||||
============================================================================== | ============================================================================== | ||||
This file is part of the JUCE library. | This file is part of the JUCE library. | ||||
Copyright (c) 2016 - ROLI Ltd. | |||||
Copyright (c) 2017 - ROLI Ltd. | |||||
Permission is granted to use this software under the terms of the ISC license | |||||
http://www.isc.org/downloads/software-support-policy/isc-license/ | |||||
JUCE is an open source library subject to commercial or open-source | |||||
licensing. | |||||
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. | |||||
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. | |||||
THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH REGARD | |||||
TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND | |||||
FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, | |||||
OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF | |||||
USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER | |||||
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE | |||||
OF THIS SOFTWARE. | |||||
----------------------------------------------------------------------------- | |||||
To release a closed-source product which uses other parts of JUCE not | |||||
licensed under the ISC terms, commercial licenses are available: visit | |||||
www.juce.com for more information. | |||||
JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER | |||||
EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE | |||||
DISCLAIMED. | |||||
============================================================================== | ============================================================================== | ||||
*/ | */ | ||||
@@ -2,34 +2,25 @@ | |||||
============================================================================== | ============================================================================== | ||||
This file is part of the JUCE library. | This file is part of the JUCE library. | ||||
Copyright (c) 2016 - ROLI Ltd. | |||||
Copyright (c) 2017 - ROLI Ltd. | |||||
Permission is granted to use this software under the terms of the ISC license | |||||
http://www.isc.org/downloads/software-support-policy/isc-license/ | |||||
JUCE is an open source library subject to commercial or open-source | |||||
licensing. | |||||
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. | |||||
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. | |||||
THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH REGARD | |||||
TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND | |||||
FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, | |||||
OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF | |||||
USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER | |||||
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE | |||||
OF THIS SOFTWARE. | |||||
----------------------------------------------------------------------------- | |||||
To release a closed-source product which uses other parts of JUCE not | |||||
licensed under the ISC terms, commercial licenses are available: visit | |||||
www.juce.com for more information. | |||||
JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER | |||||
EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE | |||||
DISCLAIMED. | |||||
============================================================================== | ============================================================================== | ||||
*/ | */ | ||||
#ifndef JUCE_MPEVoice_H_INCLUDED | |||||
#define JUCE_MPEVoice_H_INCLUDED | |||||
#pragma once | |||||
//============================================================================== | //============================================================================== | ||||
/** | /** | ||||
@@ -192,6 +183,3 @@ private: | |||||
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (MPESynthesiserVoice) | JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (MPESynthesiserVoice) | ||||
}; | }; | ||||
#endif // JUCE_MPEVoice_H_INCLUDED |
@@ -2,28 +2,20 @@ | |||||
============================================================================== | ============================================================================== | ||||
This file is part of the JUCE library. | This file is part of the JUCE library. | ||||
Copyright (c) 2016 - ROLI Ltd. | |||||
Copyright (c) 2017 - ROLI Ltd. | |||||
Permission is granted to use this software under the terms of the ISC license | |||||
http://www.isc.org/downloads/software-support-policy/isc-license/ | |||||
JUCE is an open source library subject to commercial or open-source | |||||
licensing. | |||||
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. | |||||
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. | |||||
THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH REGARD | |||||
TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND | |||||
FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, | |||||
OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF | |||||
USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER | |||||
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE | |||||
OF THIS SOFTWARE. | |||||
----------------------------------------------------------------------------- | |||||
To release a closed-source product which uses other parts of JUCE not | |||||
licensed under the ISC terms, commercial licenses are available: visit | |||||
www.juce.com for more information. | |||||
JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER | |||||
EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE | |||||
DISCLAIMED. | |||||
============================================================================== | ============================================================================== | ||||
*/ | */ | ||||
@@ -97,7 +89,7 @@ bool MPEValue::operator!= (const MPEValue& other) const noexcept | |||||
class MPEValueTests : public UnitTest | class MPEValueTests : public UnitTest | ||||
{ | { | ||||
public: | public: | ||||
MPEValueTests() : UnitTest ("MPEValue class") {} | |||||
MPEValueTests() : UnitTest ("MPEValue class", "MIDI/MPE") {} | |||||
void runTest() override | void runTest() override | ||||
{ | { | ||||
@@ -2,34 +2,25 @@ | |||||
============================================================================== | ============================================================================== | ||||
This file is part of the JUCE library. | This file is part of the JUCE library. | ||||
Copyright (c) 2016 - ROLI Ltd. | |||||
Copyright (c) 2017 - ROLI Ltd. | |||||
Permission is granted to use this software under the terms of the ISC license | |||||
http://www.isc.org/downloads/software-support-policy/isc-license/ | |||||
JUCE is an open source library subject to commercial or open-source | |||||
licensing. | |||||
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. | |||||
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. | |||||
THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH REGARD | |||||
TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND | |||||
FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, | |||||
OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF | |||||
USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER | |||||
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE | |||||
OF THIS SOFTWARE. | |||||
----------------------------------------------------------------------------- | |||||
To release a closed-source product which uses other parts of JUCE not | |||||
licensed under the ISC terms, commercial licenses are available: visit | |||||
www.juce.com for more information. | |||||
JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER | |||||
EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE | |||||
DISCLAIMED. | |||||
============================================================================== | ============================================================================== | ||||
*/ | */ | ||||
#ifndef JUCE_MPEVALUE_H_INCLUDED | |||||
#define JUCE_MPEVALUE_H_INCLUDED | |||||
#pragma once | |||||
//============================================================================== | //============================================================================== | ||||
@@ -97,6 +88,3 @@ private: | |||||
MPEValue (int normalisedValue); | MPEValue (int normalisedValue); | ||||
int normalisedValue; | int normalisedValue; | ||||
}; | }; | ||||
#endif // JUCE_MPEVALUE_H_INCLUDED |
@@ -2,28 +2,20 @@ | |||||
============================================================================== | ============================================================================== | ||||
This file is part of the JUCE library. | This file is part of the JUCE library. | ||||
Copyright (c) 2016 - ROLI Ltd. | |||||
Copyright (c) 2017 - ROLI Ltd. | |||||
Permission is granted to use this software under the terms of the ISC license | |||||
http://www.isc.org/downloads/software-support-policy/isc-license/ | |||||
JUCE is an open source library subject to commercial or open-source | |||||
licensing. | |||||
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. | |||||
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. | |||||
THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH REGARD | |||||
TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND | |||||
FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, | |||||
OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF | |||||
USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER | |||||
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE | |||||
OF THIS SOFTWARE. | |||||
----------------------------------------------------------------------------- | |||||
To release a closed-source product which uses other parts of JUCE not | |||||
licensed under the ISC terms, commercial licenses are available: visit | |||||
www.juce.com for more information. | |||||
JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER | |||||
EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE | |||||
DISCLAIMED. | |||||
============================================================================== | ============================================================================== | ||||
*/ | */ | ||||
@@ -171,7 +163,7 @@ bool MPEZone::operator!= (const MPEZone& other) const noexcept | |||||
class MPEZoneTests : public UnitTest | class MPEZoneTests : public UnitTest | ||||
{ | { | ||||
public: | public: | ||||
MPEZoneTests() : UnitTest ("MPEZone class") {} | |||||
MPEZoneTests() : UnitTest ("MPEZone class", "MIDI/MPE") {} | |||||
void runTest() override | void runTest() override | ||||
{ | { | ||||
@@ -2,34 +2,25 @@ | |||||
============================================================================== | ============================================================================== | ||||
This file is part of the JUCE library. | This file is part of the JUCE library. | ||||
Copyright (c) 2016 - ROLI Ltd. | |||||
Copyright (c) 2017 - ROLI Ltd. | |||||
Permission is granted to use this software under the terms of the ISC license | |||||
http://www.isc.org/downloads/software-support-policy/isc-license/ | |||||
JUCE is an open source library subject to commercial or open-source | |||||
licensing. | |||||
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. | |||||
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. | |||||
THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH REGARD | |||||
TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND | |||||
FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, | |||||
OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF | |||||
USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER | |||||
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE | |||||
OF THIS SOFTWARE. | |||||
----------------------------------------------------------------------------- | |||||
To release a closed-source product which uses other parts of JUCE not | |||||
licensed under the ISC terms, commercial licenses are available: visit | |||||
www.juce.com for more information. | |||||
JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER | |||||
EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE | |||||
DISCLAIMED. | |||||
============================================================================== | ============================================================================== | ||||
*/ | */ | ||||
#ifndef JUCE_MPEZONE_H_INCLUDED | |||||
#define JUCE_MPEZONE_H_INCLUDED | |||||
#pragma once | |||||
//============================================================================== | //============================================================================== | ||||
@@ -147,6 +138,3 @@ private: | |||||
int perNotePitchbendRange; | int perNotePitchbendRange; | ||||
int masterPitchbendRange; | int masterPitchbendRange; | ||||
}; | }; | ||||
#endif // JUCE_MPEZONE_H_INCLUDED |
@@ -2,28 +2,20 @@ | |||||
============================================================================== | ============================================================================== | ||||
This file is part of the JUCE library. | This file is part of the JUCE library. | ||||
Copyright (c) 2016 - ROLI Ltd. | |||||
Copyright (c) 2017 - ROLI Ltd. | |||||
Permission is granted to use this software under the terms of the ISC license | |||||
http://www.isc.org/downloads/software-support-policy/isc-license/ | |||||
JUCE is an open source library subject to commercial or open-source | |||||
licensing. | |||||
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. | |||||
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. | |||||
THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH REGARD | |||||
TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND | |||||
FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, | |||||
OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF | |||||
USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER | |||||
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE | |||||
OF THIS SOFTWARE. | |||||
----------------------------------------------------------------------------- | |||||
To release a closed-source product which uses other parts of JUCE not | |||||
licensed under the ISC terms, commercial licenses are available: visit | |||||
www.juce.com for more information. | |||||
JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER | |||||
EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE | |||||
DISCLAIMED. | |||||
============================================================================== | ============================================================================== | ||||
*/ | */ | ||||
@@ -212,7 +204,7 @@ void MPEZoneLayout::removeListener (Listener* const listenerToRemove) noexcept | |||||
class MPEZoneLayoutTests : public UnitTest | class MPEZoneLayoutTests : public UnitTest | ||||
{ | { | ||||
public: | public: | ||||
MPEZoneLayoutTests() : UnitTest ("MPEZoneLayout class") {} | |||||
MPEZoneLayoutTests() : UnitTest ("MPEZoneLayout class", "MIDI/MPE") {} | |||||
void runTest() override | void runTest() override | ||||
{ | { | ||||
@@ -2,34 +2,25 @@ | |||||
============================================================================== | ============================================================================== | ||||
This file is part of the JUCE library. | This file is part of the JUCE library. | ||||
Copyright (c) 2016 - ROLI Ltd. | |||||
Copyright (c) 2017 - ROLI Ltd. | |||||
Permission is granted to use this software under the terms of the ISC license | |||||
http://www.isc.org/downloads/software-support-policy/isc-license/ | |||||
JUCE is an open source library subject to commercial or open-source | |||||
licensing. | |||||
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. | |||||
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. | |||||
THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH REGARD | |||||
TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND | |||||
FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, | |||||
OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF | |||||
USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER | |||||
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE | |||||
OF THIS SOFTWARE. | |||||
----------------------------------------------------------------------------- | |||||
To release a closed-source product which uses other parts of JUCE not | |||||
licensed under the ISC terms, commercial licenses are available: visit | |||||
www.juce.com for more information. | |||||
JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER | |||||
EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE | |||||
DISCLAIMED. | |||||
============================================================================== | ============================================================================== | ||||
*/ | */ | ||||
#ifndef JUCE_MPEZONELAYOUT_H_INCLUDED | |||||
#define JUCE_MPEZONELAYOUT_H_INCLUDED | |||||
#pragma once | |||||
//============================================================================== | //============================================================================== | ||||
@@ -166,6 +157,3 @@ private: | |||||
void processZoneLayoutRpnMessage (MidiRPNMessage); | void processZoneLayoutRpnMessage (MidiRPNMessage); | ||||
void processPitchbendRangeRpnMessage (MidiRPNMessage); | void processPitchbendRangeRpnMessage (MidiRPNMessage); | ||||
}; | }; | ||||
#endif // JUCE_MPEZONELAYOUT_H_INCLUDED |
@@ -0,0 +1,307 @@ | |||||
/* | |||||
============================================================================== | |||||
This file is part of the JUCE library. | |||||
Copyright (c) 2017 - ROLI Ltd. | |||||
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. | |||||
============================================================================== | |||||
*/ | |||||
#pragma once | |||||
#if JUCE_MAC || JUCE_IOS | |||||
struct CoreAudioLayouts | |||||
{ | |||||
//============================================================================== | |||||
/** Convert CoreAudio's native AudioChannelLayout to JUCE's AudioChannelSet. | |||||
Note that this method cannot preserve the order of channels. | |||||
*/ | |||||
static AudioChannelSet fromCoreAudio (const AudioChannelLayout& layout) | |||||
{ | |||||
return AudioChannelSet::channelSetWithChannels (getCoreAudioLayoutChannels (layout)); | |||||
} | |||||
/** Convert JUCE's AudioChannelSet to CoreAudio's AudioChannelLayoutTag. | |||||
Note that this method cannot preserve the order of channels. | |||||
*/ | |||||
static AudioChannelLayoutTag toCoreAudio (const AudioChannelSet& set) | |||||
{ | |||||
for (auto* tbl = SpeakerLayoutTable::get(); tbl->tag != 0; ++tbl) | |||||
{ | |||||
AudioChannelSet caSet; | |||||
for (int i = 0; i < numElementsInArray (tbl->channelTypes) | |||||
&& tbl->channelTypes[i] != AudioChannelSet::unknown; ++i) | |||||
caSet.addChannel (tbl->channelTypes[i]); | |||||
if (caSet == set) | |||||
return tbl->tag; | |||||
} | |||||
return kAudioChannelLayoutTag_DiscreteInOrder | static_cast<AudioChannelLayoutTag> (set.size()); | |||||
} | |||||
static const Array<AudioChannelLayoutTag>& getKnownCoreAudioTags() | |||||
{ | |||||
static Array<AudioChannelLayoutTag> tags (createKnownCoreAudioTags()); | |||||
return tags; | |||||
} | |||||
//============================================================================== | |||||
/** Convert CoreAudio's native AudioChannelLayout to an array of JUCE ChannelTypes. */ | |||||
static Array<AudioChannelSet::ChannelType> getCoreAudioLayoutChannels (const AudioChannelLayout& layout) | |||||
{ | |||||
switch (layout.mChannelLayoutTag) | |||||
{ | |||||
case kAudioChannelLayoutTag_UseChannelBitmap: | |||||
return AudioChannelSet::fromWaveChannelMask (static_cast<int> (layout.mChannelBitmap)).getChannelTypes(); | |||||
case kAudioChannelLayoutTag_UseChannelDescriptions: | |||||
{ | |||||
Array<AudioChannelSet::ChannelType> channels; | |||||
for (UInt32 i = 0; i < layout.mNumberChannelDescriptions; ++i) | |||||
channels.addIfNotAlreadyThere (getChannelTypeFromAudioChannelLabel (layout.mChannelDescriptions[i].mChannelLabel)); | |||||
// different speaker mappings may point to the same JUCE speaker so fill up | |||||
// this array with discrete channels | |||||
for (int j = 0; channels.size() < static_cast<int> (layout.mNumberChannelDescriptions); ++j) | |||||
channels.addIfNotAlreadyThere (static_cast<AudioChannelSet::ChannelType> (AudioChannelSet::discreteChannel0 + j)); | |||||
return channels; | |||||
} | |||||
case kAudioChannelLayoutTag_DiscreteInOrder: | |||||
return AudioChannelSet::discreteChannels (static_cast<int> (layout.mChannelLayoutTag) & 0xffff).getChannelTypes(); | |||||
default: | |||||
break; | |||||
} | |||||
return getSpeakerLayoutForCoreAudioTag (layout.mChannelLayoutTag); | |||||
} | |||||
//============================================================================== | |||||
/* Convert between a CoreAudio and JUCE channel indices - and vice versa. */ | |||||
// TODO: Fabian remove this | |||||
// static int convertChannelIndex (const AudioChannelLayout& caLayout, const AudioChannelSet& juceLayout, int index, bool fromJUCE) | |||||
// { | |||||
// auto coreAudioChannels = getCoreAudioLayoutChannels (caLayout); | |||||
// | |||||
// jassert (juceLayout.size() == coreAudioChannels.size()); | |||||
// jassert (index >= 0 && index < juceLayout.size()); | |||||
// | |||||
// return (fromJUCE ? coreAudioChannels.indexOf (juceLayout.getTypeOfChannel (index)) | |||||
// : juceLayout.getChannelIndexForType (coreAudioChannels.getReference (index))); | |||||
// } | |||||
private: | |||||
//============================================================================== | |||||
struct LayoutTagSpeakerList | |||||
{ | |||||
AudioChannelLayoutTag tag; | |||||
AudioChannelSet::ChannelType channelTypes[16]; | |||||
}; | |||||
static Array<AudioChannelSet::ChannelType> getSpeakerLayoutForCoreAudioTag (AudioChannelLayoutTag tag) | |||||
{ | |||||
Array<AudioChannelSet::ChannelType> speakers; | |||||
for (auto* tbl = SpeakerLayoutTable::get(); tbl->tag != 0; ++tbl) | |||||
{ | |||||
if (tag == tbl->tag) | |||||
{ | |||||
for (int i = 0; i < numElementsInArray (tbl->channelTypes) | |||||
&& tbl->channelTypes[i] != AudioChannelSet::unknown; ++i) | |||||
speakers.add (tbl->channelTypes[i]); | |||||
return speakers; | |||||
} | |||||
} | |||||
auto numChannels = tag & 0xffff; | |||||
for (UInt32 i = 0; i < numChannels; ++i) | |||||
speakers.add (static_cast<AudioChannelSet::ChannelType> (AudioChannelSet::discreteChannel0 + i)); | |||||
return speakers; | |||||
} | |||||
static Array<AudioChannelLayoutTag> createKnownCoreAudioTags() | |||||
{ | |||||
Array<AudioChannelLayoutTag> tags; | |||||
for (auto* tbl = SpeakerLayoutTable::get(); tbl->tag != 0; ++tbl) | |||||
tags.addIfNotAlreadyThere (tbl->tag); | |||||
return tags; | |||||
} | |||||
//============================================================================== | |||||
// This list has been derived from https://pastebin.com/24dQ4BPJ | |||||
// Apple channel labels have been replaced by JUCE channel names | |||||
// This means that some layouts will be identical in JUCE but not in CoreAudio | |||||
// In Apple's official definition the following tags exist with the same speaker layout and order | |||||
// even when *not* represented in JUCE channels | |||||
// kAudioChannelLayoutTag_Binaural = kAudioChannelLayoutTag_Stereo | |||||
// kAudioChannelLayoutTag_MPEG_5_0_B = kAudioChannelLayoutTag_Pentagonal | |||||
// kAudioChannelLayoutTag_ITU_2_2 = kAudioChannelLayoutTag_Quadraphonic | |||||
// kAudioChannelLayoutTag_AudioUnit_6_0 = kAudioChannelLayoutTag_Hexagonal | |||||
struct SpeakerLayoutTable : AudioChannelSet // save us some typing | |||||
{ | |||||
static LayoutTagSpeakerList* get() noexcept | |||||
{ | |||||
static LayoutTagSpeakerList tbl[] = { | |||||
// list layouts for which there is a corresponding named AudioChannelSet first | |||||
{ kAudioChannelLayoutTag_Mono, { centre } }, | |||||
{ kAudioChannelLayoutTag_Stereo, { left, right } }, | |||||
{ kAudioChannelLayoutTag_MPEG_3_0_A, { left, right, centre } }, | |||||
{ kAudioChannelLayoutTag_ITU_2_1, { left, right, centreSurround } }, | |||||
{ kAudioChannelLayoutTag_MPEG_4_0_A, { left, right, centre, centreSurround } }, | |||||
{ kAudioChannelLayoutTag_MPEG_5_0_A, { left, right, centre, leftSurround, rightSurround } }, | |||||
{ kAudioChannelLayoutTag_MPEG_5_1_A, { left, right, centre, LFE, leftSurround, rightSurround } }, | |||||
{ kAudioChannelLayoutTag_AudioUnit_6_0, { left, right, leftSurround, rightSurround, centre, centreSurround } }, | |||||
{ kAudioChannelLayoutTag_MPEG_6_1_A, { left, right, centre, LFE, leftSurround, rightSurround, centreSurround } }, | |||||
{ kAudioChannelLayoutTag_DTS_6_0_A, { leftSurroundSide, rightSurroundSide, left, right, leftSurround, rightSurround } }, | |||||
{ kAudioChannelLayoutTag_DTS_6_1_A, { leftSurroundSide, rightSurroundSide, left, right, leftSurround, rightSurround, LFE } }, | |||||
{ kAudioChannelLayoutTag_AudioUnit_7_0, { left, right, leftSurroundSide, rightSurroundSide, centre, leftSurroundRear, rightSurroundRear } }, | |||||
{ kAudioChannelLayoutTag_AudioUnit_7_0_Front, { left, right, leftSurround, rightSurround, centre, leftCentre, rightCentre } }, | |||||
{ kAudioChannelLayoutTag_MPEG_7_1_C, { left, right, centre, LFE, leftSurroundSide, rightSurroundSide, leftSurroundRear, rightSurroundRear } }, | |||||
{ kAudioChannelLayoutTag_MPEG_7_1_A, { left, right, centre, LFE, leftSurround, rightSurround, leftCentre, rightCentre } }, | |||||
{ kAudioChannelLayoutTag_Ambisonic_B_Format, { ambisonicW, ambisonicX, ambisonicY, ambisonicZ } }, | |||||
{ kAudioChannelLayoutTag_Quadraphonic, { left, right, leftSurround, rightSurround } }, | |||||
{ kAudioChannelLayoutTag_Pentagonal, { left, right, leftSurroundRear, rightSurroundRear, centre } }, | |||||
{ kAudioChannelLayoutTag_Hexagonal, { left, right, leftSurroundRear, rightSurroundRear, centre, centreSurround } }, | |||||
{ kAudioChannelLayoutTag_Octagonal, { left, right, leftSurround, rightSurround, centre, centreSurround, wideLeft, wideRight } }, | |||||
// more uncommon layouts | |||||
{ kAudioChannelLayoutTag_StereoHeadphones, { left, right } }, | |||||
{ kAudioChannelLayoutTag_MatrixStereo, { left, right } }, | |||||
{ kAudioChannelLayoutTag_MidSide, { centre, discreteChannel0 } }, | |||||
{ kAudioChannelLayoutTag_XY, { ambisonicX, ambisonicY } }, | |||||
{ kAudioChannelLayoutTag_Binaural, { left, right } }, | |||||
{ kAudioChannelLayoutTag_Cube, { left, right, leftSurround, rightSurround, topFrontLeft, topFrontRight, topRearLeft, topRearRight } }, | |||||
{ kAudioChannelLayoutTag_MPEG_3_0_B, { centre, left, right } }, | |||||
{ kAudioChannelLayoutTag_MPEG_4_0_B, { centre, left, right, centreSurround } }, | |||||
{ kAudioChannelLayoutTag_MPEG_5_0_B, { left, right, leftSurround, rightSurround, centre } }, | |||||
{ kAudioChannelLayoutTag_MPEG_5_0_C, { left, centre, right, leftSurround, rightSurround } }, | |||||
{ kAudioChannelLayoutTag_MPEG_5_0_D, { centre, left, right, leftSurround, rightSurround } }, | |||||
{ kAudioChannelLayoutTag_MPEG_5_1_B, { left, right, leftSurround, rightSurround, centre, LFE } }, | |||||
{ kAudioChannelLayoutTag_MPEG_5_1_C, { left, centre, right, leftSurround, rightSurround, LFE } }, | |||||
{ kAudioChannelLayoutTag_MPEG_5_1_D, { centre, left, right, leftSurround, rightSurround, LFE } }, | |||||
{ kAudioChannelLayoutTag_MPEG_7_1_B, { centre, leftCentre, rightCentre, left, right, leftSurround, rightSurround, LFE } }, | |||||
{ kAudioChannelLayoutTag_Emagic_Default_7_1, { left, right, leftSurround, rightSurround, centre, LFE, leftCentre, rightCentre } }, | |||||
{ kAudioChannelLayoutTag_SMPTE_DTV, { left, right, centre, LFE, leftSurround, rightSurround, discreteChannel0 /* leftMatrixTotal */, (ChannelType) (discreteChannel0 + 1) /* rightMatrixTotal */} }, | |||||
{ kAudioChannelLayoutTag_ITU_2_2, { left, right, leftSurround, rightSurround } }, | |||||
{ kAudioChannelLayoutTag_DVD_4, { left, right, LFE } }, | |||||
{ kAudioChannelLayoutTag_DVD_5, { left, right, LFE, centreSurround } }, | |||||
{ kAudioChannelLayoutTag_DVD_6, { left, right, LFE, leftSurround, rightSurround } }, | |||||
{ kAudioChannelLayoutTag_DVD_10, { left, right, centre, LFE } }, | |||||
{ kAudioChannelLayoutTag_DVD_11, { left, right, centre, LFE, centreSurround } }, | |||||
{ kAudioChannelLayoutTag_DVD_18, { left, right, leftSurround, rightSurround, LFE } }, | |||||
{ kAudioChannelLayoutTag_AAC_6_0, { centre, left, right, leftSurround, rightSurround, centreSurround } }, | |||||
{ kAudioChannelLayoutTag_AAC_6_1, { centre, left, right, leftSurround, rightSurround, centreSurround, LFE } }, | |||||
{ kAudioChannelLayoutTag_AAC_7_0, { centre, left, right, leftSurround, rightSurround, leftSurroundRear, rightSurroundRear } }, | |||||
{ kAudioChannelLayoutTag_AAC_7_1_B, { centre, left, right, leftSurround, rightSurround, leftSurroundRear, rightSurroundRear, LFE } }, | |||||
{ kAudioChannelLayoutTag_AAC_7_1_C, { centre, left, right, leftSurround, rightSurround, LFE, topFrontLeft, topFrontRight } }, | |||||
{ kAudioChannelLayoutTag_AAC_Octagonal, { centre, left, right, leftSurround, rightSurround, leftSurroundRear, rightSurroundRear, centreSurround } }, | |||||
{ kAudioChannelLayoutTag_TMH_10_2_std, { left, right, centre, topFrontCentre, leftSurroundSide, rightSurroundSide, leftSurround, rightSurround, topFrontLeft, topFrontRight, wideLeft, wideRight, topRearCentre, centreSurround, LFE, LFE2 } }, | |||||
{ kAudioChannelLayoutTag_AC3_1_0_1, { centre, LFE } }, | |||||
{ kAudioChannelLayoutTag_AC3_3_0, { left, centre, right } }, | |||||
{ kAudioChannelLayoutTag_AC3_3_1, { left, centre, right, centreSurround } }, | |||||
{ kAudioChannelLayoutTag_AC3_3_0_1, { left, centre, right, LFE } }, | |||||
{ kAudioChannelLayoutTag_AC3_2_1_1, { left, right, centreSurround, LFE } }, | |||||
{ kAudioChannelLayoutTag_AC3_3_1_1, { left, centre, right, centreSurround, LFE } }, | |||||
{ kAudioChannelLayoutTag_EAC_6_0_A, { left, centre, right, leftSurround, rightSurround, centreSurround } }, | |||||
{ kAudioChannelLayoutTag_EAC_7_0_A, { left, centre, right, leftSurround, rightSurround, leftSurroundRear, rightSurroundRear } }, | |||||
{ kAudioChannelLayoutTag_EAC3_6_1_A, { left, centre, right, leftSurround, rightSurround, LFE, centreSurround } }, | |||||
{ kAudioChannelLayoutTag_EAC3_6_1_B, { left, centre, right, leftSurround, rightSurround, LFE, centreSurround } }, | |||||
{ kAudioChannelLayoutTag_EAC3_6_1_C, { left, centre, right, leftSurround, rightSurround, LFE, topFrontCentre } }, | |||||
{ kAudioChannelLayoutTag_EAC3_7_1_A, { left, centre, right, leftSurround, rightSurround, LFE, leftSurroundRear, rightSurroundRear } }, | |||||
{ kAudioChannelLayoutTag_EAC3_7_1_B, { left, centre, right, leftSurround, rightSurround, LFE, leftCentre, rightCentre } }, | |||||
{ kAudioChannelLayoutTag_EAC3_7_1_C, { left, centre, right, leftSurround, rightSurround, LFE, leftSurroundSide, rightSurroundSide } }, | |||||
{ kAudioChannelLayoutTag_EAC3_7_1_D, { left, centre, right, leftSurround, rightSurround, LFE, wideLeft, wideRight } }, | |||||
{ kAudioChannelLayoutTag_EAC3_7_1_E, { left, centre, right, leftSurround, rightSurround, LFE, topFrontLeft, topFrontRight } }, | |||||
{ kAudioChannelLayoutTag_EAC3_7_1_F, { left, centre, right, leftSurround, rightSurround, LFE, centreSurround, topMiddle } }, | |||||
{ kAudioChannelLayoutTag_EAC3_7_1_G, { left, centre, right, leftSurround, rightSurround, LFE, centreSurround, topFrontCentre } }, | |||||
{ kAudioChannelLayoutTag_EAC3_7_1_H, { left, centre, right, leftSurround, rightSurround, LFE, centreSurround, topFrontCentre } }, | |||||
{ kAudioChannelLayoutTag_DTS_3_1, { centre, left, right, LFE } }, | |||||
{ kAudioChannelLayoutTag_DTS_4_1, { centre, left, right, centreSurround, LFE } }, | |||||
{ kAudioChannelLayoutTag_DTS_6_0_B, { centre, left, right, leftSurroundRear, rightSurroundRear, centreSurround } }, | |||||
{ kAudioChannelLayoutTag_DTS_6_0_C, { centre, centreSurround, left, right, leftSurroundRear, rightSurroundRear } }, | |||||
{ kAudioChannelLayoutTag_DTS_6_1_B, { centre, left, right, leftSurroundRear, rightSurroundRear, centreSurround, LFE } }, | |||||
{ kAudioChannelLayoutTag_DTS_6_1_C, { centre, centreSurround, left, right, leftSurroundRear, rightSurroundRear, LFE } }, | |||||
{ kAudioChannelLayoutTag_DTS_6_1_D, { centre, left, right, leftSurround, rightSurround, LFE, centreSurround } }, | |||||
{ kAudioChannelLayoutTag_DTS_7_0, { leftCentre, centre, rightCentre, left, right, leftSurround, rightSurround } }, | |||||
{ kAudioChannelLayoutTag_DTS_7_1, { leftCentre, centre, rightCentre, left, right, leftSurround, rightSurround, LFE } }, | |||||
{ kAudioChannelLayoutTag_DTS_8_0_A, { leftCentre, rightCentre, left, right, leftSurround, rightSurround, leftSurroundRear, rightSurroundRear } }, | |||||
{ kAudioChannelLayoutTag_DTS_8_0_B, { leftCentre, centre, rightCentre, left, right, leftSurround, centreSurround, rightSurround } }, | |||||
{ kAudioChannelLayoutTag_DTS_8_1_A, { leftCentre, rightCentre, left, right, leftSurround, rightSurround, leftSurroundRear, rightSurroundRear, LFE } }, | |||||
{ kAudioChannelLayoutTag_DTS_8_1_B, { leftCentre, centre, rightCentre, left, right, leftSurround, centreSurround, rightSurround, LFE } }, | |||||
{ 0, {} } | |||||
}; | |||||
return tbl; | |||||
} | |||||
}; | |||||
//============================================================================== | |||||
static AudioChannelSet::ChannelType getChannelTypeFromAudioChannelLabel (AudioChannelLabel label) noexcept | |||||
{ | |||||
if (label >= kAudioChannelLabel_Discrete_0 && label <= kAudioChannelLabel_Discrete_65535) | |||||
{ | |||||
const unsigned int discreteChannelNum = label - kAudioChannelLabel_Discrete_0; | |||||
return static_cast<AudioChannelSet::ChannelType> (AudioChannelSet::discreteChannel0 + discreteChannelNum); | |||||
} | |||||
switch (label) | |||||
{ | |||||
case kAudioChannelLabel_Center: | |||||
case kAudioChannelLabel_Mono: return AudioChannelSet::centre; | |||||
case kAudioChannelLabel_Left: | |||||
case kAudioChannelLabel_HeadphonesLeft: return AudioChannelSet::left; | |||||
case kAudioChannelLabel_Right: | |||||
case kAudioChannelLabel_HeadphonesRight: return AudioChannelSet::right; | |||||
case kAudioChannelLabel_LFEScreen: return AudioChannelSet::LFE; | |||||
case kAudioChannelLabel_LeftSurround: return AudioChannelSet::leftSurround; | |||||
case kAudioChannelLabel_RightSurround: return AudioChannelSet::rightSurround; | |||||
case kAudioChannelLabel_LeftCenter: return AudioChannelSet::leftCentre; | |||||
case kAudioChannelLabel_RightCenter: return AudioChannelSet::rightCentre; | |||||
case kAudioChannelLabel_CenterSurround: return AudioChannelSet::surround; | |||||
case kAudioChannelLabel_LeftSurroundDirect: return AudioChannelSet::leftSurroundSide; | |||||
case kAudioChannelLabel_RightSurroundDirect: return AudioChannelSet::rightSurroundSide; | |||||
case kAudioChannelLabel_TopCenterSurround: return AudioChannelSet::topMiddle; | |||||
case kAudioChannelLabel_VerticalHeightLeft: return AudioChannelSet::topFrontLeft; | |||||
case kAudioChannelLabel_VerticalHeightRight: return AudioChannelSet::topFrontRight; | |||||
case kAudioChannelLabel_VerticalHeightCenter: return AudioChannelSet::topFrontCentre; | |||||
case kAudioChannelLabel_TopBackLeft: return AudioChannelSet::topRearLeft; | |||||
case kAudioChannelLabel_RearSurroundLeft: return AudioChannelSet::leftSurroundRear; | |||||
case kAudioChannelLabel_TopBackRight: return AudioChannelSet::topRearRight; | |||||
case kAudioChannelLabel_RearSurroundRight: return AudioChannelSet::rightSurroundRear; | |||||
case kAudioChannelLabel_TopBackCenter: return AudioChannelSet::topRearCentre; | |||||
case kAudioChannelLabel_LFE2: return AudioChannelSet::LFE2; | |||||
case kAudioChannelLabel_LeftWide: return AudioChannelSet::wideLeft; | |||||
case kAudioChannelLabel_RightWide: return AudioChannelSet::wideRight; | |||||
case kAudioChannelLabel_Ambisonic_W: return AudioChannelSet::ambisonicW; | |||||
case kAudioChannelLabel_Ambisonic_X: return AudioChannelSet::ambisonicX; | |||||
case kAudioChannelLabel_Ambisonic_Y: return AudioChannelSet::ambisonicY; | |||||
case kAudioChannelLabel_Ambisonic_Z: return AudioChannelSet::ambisonicZ; | |||||
default: return AudioChannelSet::unknown; | |||||
} | |||||
} | |||||
}; | |||||
#endif |
@@ -2,34 +2,25 @@ | |||||
============================================================================== | ============================================================================== | ||||
This file is part of the JUCE library. | This file is part of the JUCE library. | ||||
Copyright (c) 2016 - ROLI Ltd. | |||||
Copyright (c) 2017 - ROLI Ltd. | |||||
Permission is granted to use this software under the terms of the ISC license | |||||
http://www.isc.org/downloads/software-support-policy/isc-license/ | |||||
JUCE is an open source library subject to commercial or open-source | |||||
licensing. | |||||
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. | |||||
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. | |||||
THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH REGARD | |||||
TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND | |||||
FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, | |||||
OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF | |||||
USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER | |||||
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE | |||||
OF THIS SOFTWARE. | |||||
----------------------------------------------------------------------------- | |||||
To release a closed-source product which uses other parts of JUCE not | |||||
licensed under the ISC terms, commercial licenses are available: visit | |||||
www.juce.com for more information. | |||||
JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER | |||||
EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE | |||||
DISCLAIMED. | |||||
============================================================================== | ============================================================================== | ||||
*/ | */ | ||||
#ifndef JUCE_AUDIOSOURCE_H_INCLUDED | |||||
#define JUCE_AUDIOSOURCE_H_INCLUDED | |||||
#pragma once | |||||
//============================================================================== | //============================================================================== | ||||
@@ -182,6 +173,3 @@ public: | |||||
*/ | */ | ||||
virtual void getNextAudioBlock (const AudioSourceChannelInfo& bufferToFill) = 0; | virtual void getNextAudioBlock (const AudioSourceChannelInfo& bufferToFill) = 0; | ||||
}; | }; | ||||
#endif // JUCE_AUDIOSOURCE_H_INCLUDED |
@@ -2,28 +2,20 @@ | |||||
============================================================================== | ============================================================================== | ||||
This file is part of the JUCE library. | This file is part of the JUCE library. | ||||
Copyright (c) 2016 - ROLI Ltd. | |||||
Copyright (c) 2017 - ROLI Ltd. | |||||
Permission is granted to use this software under the terms of the ISC license | |||||
http://www.isc.org/downloads/software-support-policy/isc-license/ | |||||
JUCE is an open source library subject to commercial or open-source | |||||
licensing. | |||||
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. | |||||
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. | |||||
THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH REGARD | |||||
TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND | |||||
FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, | |||||
OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF | |||||
USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER | |||||
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE | |||||
OF THIS SOFTWARE. | |||||
----------------------------------------------------------------------------- | |||||
To release a closed-source product which uses other parts of JUCE not | |||||
licensed under the ISC terms, commercial licenses are available: visit | |||||
www.juce.com for more information. | |||||
JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER | |||||
EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE | |||||
DISCLAIMED. | |||||
============================================================================== | ============================================================================== | ||||
*/ | */ | ||||
@@ -2,34 +2,25 @@ | |||||
============================================================================== | ============================================================================== | ||||
This file is part of the JUCE library. | This file is part of the JUCE library. | ||||
Copyright (c) 2016 - ROLI Ltd. | |||||
Copyright (c) 2017 - ROLI Ltd. | |||||
Permission is granted to use this software under the terms of the ISC license | |||||
http://www.isc.org/downloads/software-support-policy/isc-license/ | |||||
JUCE is an open source library subject to commercial or open-source | |||||
licensing. | |||||
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. | |||||
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. | |||||
THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH REGARD | |||||
TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND | |||||
FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, | |||||
OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF | |||||
USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER | |||||
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE | |||||
OF THIS SOFTWARE. | |||||
----------------------------------------------------------------------------- | |||||
To release a closed-source product which uses other parts of JUCE not | |||||
licensed under the ISC terms, commercial licenses are available: visit | |||||
www.juce.com for more information. | |||||
JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER | |||||
EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE | |||||
DISCLAIMED. | |||||
============================================================================== | ============================================================================== | ||||
*/ | */ | ||||
#ifndef JUCE_BUFFERINGAUDIOSOURCE_H_INCLUDED | |||||
#define JUCE_BUFFERINGAUDIOSOURCE_H_INCLUDED | |||||
#pragma once | |||||
//============================================================================== | //============================================================================== | ||||
@@ -122,6 +113,3 @@ private: | |||||
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (BufferingAudioSource) | JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (BufferingAudioSource) | ||||
}; | }; | ||||
#endif // JUCE_BUFFERINGAUDIOSOURCE_H_INCLUDED |
@@ -2,28 +2,20 @@ | |||||
============================================================================== | ============================================================================== | ||||
This file is part of the JUCE library. | This file is part of the JUCE library. | ||||
Copyright (c) 2016 - ROLI Ltd. | |||||
Copyright (c) 2017 - ROLI Ltd. | |||||
Permission is granted to use this software under the terms of the ISC license | |||||
http://www.isc.org/downloads/software-support-policy/isc-license/ | |||||
JUCE is an open source library subject to commercial or open-source | |||||
licensing. | |||||
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. | |||||
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. | |||||
THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH REGARD | |||||
TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND | |||||
FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, | |||||
OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF | |||||
USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER | |||||
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE | |||||
OF THIS SOFTWARE. | |||||
----------------------------------------------------------------------------- | |||||
To release a closed-source product which uses other parts of JUCE not | |||||
licensed under the ISC terms, commercial licenses are available: visit | |||||
www.juce.com for more information. | |||||
JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER | |||||
EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE | |||||
DISCLAIMED. | |||||
============================================================================== | ============================================================================== | ||||
*/ | */ | ||||
@@ -2,34 +2,25 @@ | |||||
============================================================================== | ============================================================================== | ||||
This file is part of the JUCE library. | This file is part of the JUCE library. | ||||
Copyright (c) 2016 - ROLI Ltd. | |||||
Copyright (c) 2017 - ROLI Ltd. | |||||
Permission is granted to use this software under the terms of the ISC license | |||||
http://www.isc.org/downloads/software-support-policy/isc-license/ | |||||
JUCE is an open source library subject to commercial or open-source | |||||
licensing. | |||||
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. | |||||
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. | |||||
THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH REGARD | |||||
TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND | |||||
FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, | |||||
OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF | |||||
USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER | |||||
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE | |||||
OF THIS SOFTWARE. | |||||
----------------------------------------------------------------------------- | |||||
To release a closed-source product which uses other parts of JUCE not | |||||
licensed under the ISC terms, commercial licenses are available: visit | |||||
www.juce.com for more information. | |||||
JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER | |||||
EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE | |||||
DISCLAIMED. | |||||
============================================================================== | ============================================================================== | ||||
*/ | */ | ||||
#ifndef JUCE_CHANNELREMAPPINGAUDIOSOURCE_H_INCLUDED | |||||
#define JUCE_CHANNELREMAPPINGAUDIOSOURCE_H_INCLUDED | |||||
#pragma once | |||||
//============================================================================== | //============================================================================== | ||||
@@ -144,6 +135,3 @@ private: | |||||
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (ChannelRemappingAudioSource) | JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (ChannelRemappingAudioSource) | ||||
}; | }; | ||||
#endif // JUCE_CHANNELREMAPPINGAUDIOSOURCE_H_INCLUDED |
@@ -2,28 +2,20 @@ | |||||
============================================================================== | ============================================================================== | ||||
This file is part of the JUCE library. | This file is part of the JUCE library. | ||||
Copyright (c) 2016 - ROLI Ltd. | |||||
Copyright (c) 2017 - ROLI Ltd. | |||||
Permission is granted to use this software under the terms of the ISC license | |||||
http://www.isc.org/downloads/software-support-policy/isc-license/ | |||||
JUCE is an open source library subject to commercial or open-source | |||||
licensing. | |||||
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. | |||||
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. | |||||
THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH REGARD | |||||
TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND | |||||
FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, | |||||
OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF | |||||
USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER | |||||
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE | |||||
OF THIS SOFTWARE. | |||||
----------------------------------------------------------------------------- | |||||
To release a closed-source product which uses other parts of JUCE not | |||||
licensed under the ISC terms, commercial licenses are available: visit | |||||
www.juce.com for more information. | |||||
JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER | |||||
EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE | |||||
DISCLAIMED. | |||||
============================================================================== | ============================================================================== | ||||
*/ | */ | ||||
@@ -2,34 +2,25 @@ | |||||
============================================================================== | ============================================================================== | ||||
This file is part of the JUCE library. | This file is part of the JUCE library. | ||||
Copyright (c) 2016 - ROLI Ltd. | |||||
Copyright (c) 2017 - ROLI Ltd. | |||||
Permission is granted to use this software under the terms of the ISC license | |||||
http://www.isc.org/downloads/software-support-policy/isc-license/ | |||||
JUCE is an open source library subject to commercial or open-source | |||||
licensing. | |||||
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. | |||||
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. | |||||
THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH REGARD | |||||
TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND | |||||
FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, | |||||
OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF | |||||
USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER | |||||
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE | |||||
OF THIS SOFTWARE. | |||||
----------------------------------------------------------------------------- | |||||
To release a closed-source product which uses other parts of JUCE not | |||||
licensed under the ISC terms, commercial licenses are available: visit | |||||
www.juce.com for more information. | |||||
JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER | |||||
EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE | |||||
DISCLAIMED. | |||||
============================================================================== | ============================================================================== | ||||
*/ | */ | ||||
#ifndef JUCE_IIRFILTERAUDIOSOURCE_H_INCLUDED | |||||
#define JUCE_IIRFILTERAUDIOSOURCE_H_INCLUDED | |||||
#pragma once | |||||
//============================================================================== | //============================================================================== | ||||
@@ -71,6 +62,3 @@ private: | |||||
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (IIRFilterAudioSource) | JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (IIRFilterAudioSource) | ||||
}; | }; | ||||
#endif // JUCE_IIRFILTERAUDIOSOURCE_H_INCLUDED |
@@ -0,0 +1,66 @@ | |||||
/* | |||||
============================================================================== | |||||
This file is part of the JUCE library. | |||||
Copyright (c) 2017 - ROLI Ltd. | |||||
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. | |||||
============================================================================== | |||||
*/ | |||||
//============================================================================== | |||||
MemoryAudioSource::MemoryAudioSource (AudioBuffer<float>& bufferToUse, bool copyMemory, bool shouldLoop) | |||||
: isLooping (shouldLoop) | |||||
{ | |||||
if (copyMemory) | |||||
buffer.makeCopyOf (bufferToUse); | |||||
else | |||||
buffer.setDataToReferTo (bufferToUse.getArrayOfWritePointers(), | |||||
bufferToUse.getNumChannels(), | |||||
bufferToUse.getNumSamples()); | |||||
} | |||||
//============================================================================== | |||||
void MemoryAudioSource::prepareToPlay (int /*samplesPerBlockExpected*/, double /*sampleRate*/) | |||||
{ | |||||
position = 0; | |||||
} | |||||
void MemoryAudioSource::releaseResources() {} | |||||
void MemoryAudioSource::getNextAudioBlock (const AudioSourceChannelInfo& bufferToFill) | |||||
{ | |||||
auto& dst = *bufferToFill.buffer; | |||||
auto channels = jmin (dst.getNumChannels(), buffer.getNumChannels()); | |||||
auto max = 0, pos = 0; | |||||
auto n = buffer.getNumSamples(), m = bufferToFill.numSamples; | |||||
for (auto i = position; (i < n || isLooping) && (pos < m); i += max) | |||||
{ | |||||
max = jmin (m - pos, n - (i % n)); | |||||
int ch = 0; | |||||
for (; ch < channels; ++ch) | |||||
dst.copyFrom (ch, bufferToFill.startSample + pos, buffer, ch, i % n, max); | |||||
for (; ch < dst.getNumChannels(); ++ch) | |||||
dst.clear (ch, bufferToFill.startSample + pos, max); | |||||
pos += max; | |||||
} | |||||
if (pos < m) | |||||
dst.clear (bufferToFill.startSample + pos, m - pos); | |||||
} |
@@ -0,0 +1,61 @@ | |||||
/* | |||||
============================================================================== | |||||
This file is part of the JUCE library. | |||||
Copyright (c) 2017 - ROLI Ltd. | |||||
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. | |||||
============================================================================== | |||||
*/ | |||||
#pragma once | |||||
//============================================================================== | |||||
/** | |||||
An AudioSource which takes some float audio data as an input. | |||||
*/ | |||||
class JUCE_API MemoryAudioSource : public AudioSource | |||||
{ | |||||
public: | |||||
//============================================================================== | |||||
/** Creates a MemoryAudioSource by providing an audio buffer. | |||||
If copyMemory is true then the buffer will be copied into an internal | |||||
buffer which will be owned by the MemoryAudioSource. If copyMemory is | |||||
false, then you must ensure that the lifetime of the audio buffer is | |||||
at least as long as the MemoryAudioSource. | |||||
*/ | |||||
MemoryAudioSource (AudioBuffer<float>& audioBuffer, bool copyMemory, bool shouldLoop = false); | |||||
//============================================================================== | |||||
/** Implementation of the AudioSource method. */ | |||||
void prepareToPlay (int samplesPerBlockExpected, double sampleRate) override; | |||||
/** Implementation of the AudioSource method. */ | |||||
void releaseResources() override; | |||||
/** Implementation of the AudioSource method. */ | |||||
void getNextAudioBlock (const AudioSourceChannelInfo& bufferToFill) override; | |||||
private: | |||||
//============================================================================== | |||||
AudioBuffer<float> buffer; | |||||
int position = 0; | |||||
bool isLooping; | |||||
//============================================================================== | |||||
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (MemoryAudioSource) | |||||
}; |
@@ -2,28 +2,20 @@ | |||||
============================================================================== | ============================================================================== | ||||
This file is part of the JUCE library. | This file is part of the JUCE library. | ||||
Copyright (c) 2016 - ROLI Ltd. | |||||
Copyright (c) 2017 - ROLI Ltd. | |||||
Permission is granted to use this software under the terms of the ISC license | |||||
http://www.isc.org/downloads/software-support-policy/isc-license/ | |||||
JUCE is an open source library subject to commercial or open-source | |||||
licensing. | |||||
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. | |||||
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. | |||||
THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH REGARD | |||||
TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND | |||||
FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, | |||||
OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF | |||||
USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER | |||||
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE | |||||
OF THIS SOFTWARE. | |||||
----------------------------------------------------------------------------- | |||||
To release a closed-source product which uses other parts of JUCE not | |||||
licensed under the ISC terms, commercial licenses are available: visit | |||||
www.juce.com for more information. | |||||
JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER | |||||
EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE | |||||
DISCLAIMED. | |||||
============================================================================== | ============================================================================== | ||||
*/ | */ | ||||
@@ -2,34 +2,25 @@ | |||||
============================================================================== | ============================================================================== | ||||
This file is part of the JUCE library. | This file is part of the JUCE library. | ||||
Copyright (c) 2016 - ROLI Ltd. | |||||
Copyright (c) 2017 - ROLI Ltd. | |||||
Permission is granted to use this software under the terms of the ISC license | |||||
http://www.isc.org/downloads/software-support-policy/isc-license/ | |||||
JUCE is an open source library subject to commercial or open-source | |||||
licensing. | |||||
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. | |||||
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. | |||||
THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH REGARD | |||||
TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND | |||||
FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, | |||||
OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF | |||||
USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER | |||||
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE | |||||
OF THIS SOFTWARE. | |||||
----------------------------------------------------------------------------- | |||||
To release a closed-source product which uses other parts of JUCE not | |||||
licensed under the ISC terms, commercial licenses are available: visit | |||||
www.juce.com for more information. | |||||
JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER | |||||
EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE | |||||
DISCLAIMED. | |||||
============================================================================== | ============================================================================== | ||||
*/ | */ | ||||
#ifndef JUCE_MIXERAUDIOSOURCE_H_INCLUDED | |||||
#define JUCE_MIXERAUDIOSOURCE_H_INCLUDED | |||||
#pragma once | |||||
//============================================================================== | //============================================================================== | ||||
@@ -102,6 +93,3 @@ private: | |||||
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (MixerAudioSource) | JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (MixerAudioSource) | ||||
}; | }; | ||||
#endif // JUCE_MIXERAUDIOSOURCE_H_INCLUDED |
@@ -2,34 +2,25 @@ | |||||
============================================================================== | ============================================================================== | ||||
This file is part of the JUCE library. | This file is part of the JUCE library. | ||||
Copyright (c) 2016 - ROLI Ltd. | |||||
Copyright (c) 2017 - ROLI Ltd. | |||||
Permission is granted to use this software under the terms of the ISC license | |||||
http://www.isc.org/downloads/software-support-policy/isc-license/ | |||||
JUCE is an open source library subject to commercial or open-source | |||||
licensing. | |||||
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. | |||||
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. | |||||
THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH REGARD | |||||
TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND | |||||
FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, | |||||
OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF | |||||
USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER | |||||
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE | |||||
OF THIS SOFTWARE. | |||||
----------------------------------------------------------------------------- | |||||
To release a closed-source product which uses other parts of JUCE not | |||||
licensed under the ISC terms, commercial licenses are available: visit | |||||
www.juce.com for more information. | |||||
JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER | |||||
EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE | |||||
DISCLAIMED. | |||||
============================================================================== | ============================================================================== | ||||
*/ | */ | ||||
#ifndef JUCE_POSITIONABLEAUDIOSOURCE_H_INCLUDED | |||||
#define JUCE_POSITIONABLEAUDIOSOURCE_H_INCLUDED | |||||
#pragma once | |||||
//============================================================================== | //============================================================================== | ||||
@@ -79,6 +70,3 @@ public: | |||||
/** Tells the source whether you'd like it to play in a loop. */ | /** Tells the source whether you'd like it to play in a loop. */ | ||||
virtual void setLooping (bool shouldLoop) { ignoreUnused (shouldLoop); } | virtual void setLooping (bool shouldLoop) { ignoreUnused (shouldLoop); } | ||||
}; | }; | ||||
#endif // JUCE_POSITIONABLEAUDIOSOURCE_H_INCLUDED |
@@ -2,28 +2,20 @@ | |||||
============================================================================== | ============================================================================== | ||||
This file is part of the JUCE library. | This file is part of the JUCE library. | ||||
Copyright (c) 2016 - ROLI Ltd. | |||||
Copyright (c) 2017 - ROLI Ltd. | |||||
Permission is granted to use this software under the terms of the ISC license | |||||
http://www.isc.org/downloads/software-support-policy/isc-license/ | |||||
JUCE is an open source library subject to commercial or open-source | |||||
licensing. | |||||
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. | |||||
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. | |||||
THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH REGARD | |||||
TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND | |||||
FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, | |||||
OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF | |||||
USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER | |||||
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE | |||||
OF THIS SOFTWARE. | |||||
----------------------------------------------------------------------------- | |||||
To release a closed-source product which uses other parts of JUCE not | |||||
licensed under the ISC terms, commercial licenses are available: visit | |||||
www.juce.com for more information. | |||||
JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER | |||||
EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE | |||||
DISCLAIMED. | |||||
============================================================================== | ============================================================================== | ||||
*/ | */ | ||||
@@ -2,34 +2,25 @@ | |||||
============================================================================== | ============================================================================== | ||||
This file is part of the JUCE library. | This file is part of the JUCE library. | ||||
Copyright (c) 2016 - ROLI Ltd. | |||||
Copyright (c) 2017 - ROLI Ltd. | |||||
Permission is granted to use this software under the terms of the ISC license | |||||
http://www.isc.org/downloads/software-support-policy/isc-license/ | |||||
JUCE is an open source library subject to commercial or open-source | |||||
licensing. | |||||
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. | |||||
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. | |||||
THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH REGARD | |||||
TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND | |||||
FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, | |||||
OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF | |||||
USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER | |||||
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE | |||||
OF THIS SOFTWARE. | |||||
----------------------------------------------------------------------------- | |||||
To release a closed-source product which uses other parts of JUCE not | |||||
licensed under the ISC terms, commercial licenses are available: visit | |||||
www.juce.com for more information. | |||||
JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER | |||||
EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE | |||||
DISCLAIMED. | |||||
============================================================================== | ============================================================================== | ||||
*/ | */ | ||||
#ifndef JUCE_RESAMPLINGAUDIOSOURCE_H_INCLUDED | |||||
#define JUCE_RESAMPLINGAUDIOSOURCE_H_INCLUDED | |||||
#pragma once | |||||
//============================================================================== | //============================================================================== | ||||
@@ -108,6 +99,3 @@ private: | |||||
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (ResamplingAudioSource) | JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (ResamplingAudioSource) | ||||
}; | }; | ||||
#endif // JUCE_RESAMPLINGAUDIOSOURCE_H_INCLUDED |
@@ -2,28 +2,20 @@ | |||||
============================================================================== | ============================================================================== | ||||
This file is part of the JUCE library. | This file is part of the JUCE library. | ||||
Copyright (c) 2016 - ROLI Ltd. | |||||
Copyright (c) 2017 - ROLI Ltd. | |||||
Permission is granted to use this software under the terms of the ISC license | |||||
http://www.isc.org/downloads/software-support-policy/isc-license/ | |||||
JUCE is an open source library subject to commercial or open-source | |||||
licensing. | |||||
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. | |||||
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. | |||||
THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH REGARD | |||||
TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND | |||||
FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, | |||||
OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF | |||||
USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER | |||||
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE | |||||
OF THIS SOFTWARE. | |||||
----------------------------------------------------------------------------- | |||||
To release a closed-source product which uses other parts of JUCE not | |||||
licensed under the ISC terms, commercial licenses are available: visit | |||||
www.juce.com for more information. | |||||
JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER | |||||
EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE | |||||
DISCLAIMED. | |||||
============================================================================== | ============================================================================== | ||||
*/ | */ | ||||
@@ -2,34 +2,25 @@ | |||||
============================================================================== | ============================================================================== | ||||
This file is part of the JUCE library. | This file is part of the JUCE library. | ||||
Copyright (c) 2016 - ROLI Ltd. | |||||
Copyright (c) 2017 - ROLI Ltd. | |||||
Permission is granted to use this software under the terms of the ISC license | |||||
http://www.isc.org/downloads/software-support-policy/isc-license/ | |||||
JUCE is an open source library subject to commercial or open-source | |||||
licensing. | |||||
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. | |||||
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. | |||||
THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH REGARD | |||||
TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND | |||||
FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, | |||||
OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF | |||||
USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER | |||||
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE | |||||
OF THIS SOFTWARE. | |||||
----------------------------------------------------------------------------- | |||||
To release a closed-source product which uses other parts of JUCE not | |||||
licensed under the ISC terms, commercial licenses are available: visit | |||||
www.juce.com for more information. | |||||
JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER | |||||
EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE | |||||
DISCLAIMED. | |||||
============================================================================== | ============================================================================== | ||||
*/ | */ | ||||
#ifndef JUCE_REVERBAUDIOSOURCE_H_INCLUDED | |||||
#define JUCE_REVERBAUDIOSOURCE_H_INCLUDED | |||||
#pragma once | |||||
//============================================================================== | //============================================================================== | ||||
@@ -77,6 +68,3 @@ private: | |||||
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (ReverbAudioSource) | JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (ReverbAudioSource) | ||||
}; | }; | ||||
#endif // JUCE_REVERBAUDIOSOURCE_H_INCLUDED |
@@ -2,28 +2,20 @@ | |||||
============================================================================== | ============================================================================== | ||||
This file is part of the JUCE library. | This file is part of the JUCE library. | ||||
Copyright (c) 2016 - ROLI Ltd. | |||||
Copyright (c) 2017 - ROLI Ltd. | |||||
Permission is granted to use this software under the terms of the ISC license | |||||
http://www.isc.org/downloads/software-support-policy/isc-license/ | |||||
JUCE is an open source library subject to commercial or open-source | |||||
licensing. | |||||
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. | |||||
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. | |||||
THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH REGARD | |||||
TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND | |||||
FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, | |||||
OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF | |||||
USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER | |||||
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE | |||||
OF THIS SOFTWARE. | |||||
----------------------------------------------------------------------------- | |||||
To release a closed-source product which uses other parts of JUCE not | |||||
licensed under the ISC terms, commercial licenses are available: visit | |||||
www.juce.com for more information. | |||||
JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER | |||||
EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE | |||||
DISCLAIMED. | |||||
============================================================================== | ============================================================================== | ||||
*/ | */ | ||||
@@ -2,34 +2,25 @@ | |||||
============================================================================== | ============================================================================== | ||||
This file is part of the JUCE library. | This file is part of the JUCE library. | ||||
Copyright (c) 2016 - ROLI Ltd. | |||||
Copyright (c) 2017 - ROLI Ltd. | |||||
Permission is granted to use this software under the terms of the ISC license | |||||
http://www.isc.org/downloads/software-support-policy/isc-license/ | |||||
JUCE is an open source library subject to commercial or open-source | |||||
licensing. | |||||
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. | |||||
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. | |||||
THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH REGARD | |||||
TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND | |||||
FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, | |||||
OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF | |||||
USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER | |||||
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE | |||||
OF THIS SOFTWARE. | |||||
----------------------------------------------------------------------------- | |||||
To release a closed-source product which uses other parts of JUCE not | |||||
licensed under the ISC terms, commercial licenses are available: visit | |||||
www.juce.com for more information. | |||||
JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER | |||||
EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE | |||||
DISCLAIMED. | |||||
============================================================================== | ============================================================================== | ||||
*/ | */ | ||||
#ifndef JUCE_TONEGENERATORAUDIOSOURCE_H_INCLUDED | |||||
#define JUCE_TONEGENERATORAUDIOSOURCE_H_INCLUDED | |||||
#pragma once | |||||
//============================================================================== | //============================================================================== | ||||
@@ -74,6 +65,3 @@ private: | |||||
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (ToneGeneratorAudioSource) | JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (ToneGeneratorAudioSource) | ||||
}; | }; | ||||
#endif // JUCE_TONEGENERATORAUDIOSOURCE_H_INCLUDED |
@@ -2,28 +2,20 @@ | |||||
============================================================================== | ============================================================================== | ||||
This file is part of the JUCE library. | This file is part of the JUCE library. | ||||
Copyright (c) 2016 - ROLI Ltd. | |||||
Copyright (c) 2017 - ROLI Ltd. | |||||
Permission is granted to use this software under the terms of the ISC license | |||||
http://www.isc.org/downloads/software-support-policy/isc-license/ | |||||
JUCE is an open source library subject to commercial or open-source | |||||
licensing. | |||||
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. | |||||
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. | |||||
THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH REGARD | |||||
TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND | |||||
FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, | |||||
OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF | |||||
USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER | |||||
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE | |||||
OF THIS SOFTWARE. | |||||
----------------------------------------------------------------------------- | |||||
To release a closed-source product which uses other parts of JUCE not | |||||
licensed under the ISC terms, commercial licenses are available: visit | |||||
www.juce.com for more information. | |||||
JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER | |||||
EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE | |||||
DISCLAIMED. | |||||
============================================================================== | ============================================================================== | ||||
*/ | */ | ||||
@@ -2,34 +2,25 @@ | |||||
============================================================================== | ============================================================================== | ||||
This file is part of the JUCE library. | This file is part of the JUCE library. | ||||
Copyright (c) 2016 - ROLI Ltd. | |||||
Copyright (c) 2017 - ROLI Ltd. | |||||
Permission is granted to use this software under the terms of the ISC license | |||||
http://www.isc.org/downloads/software-support-policy/isc-license/ | |||||
JUCE is an open source library subject to commercial or open-source | |||||
licensing. | |||||
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. | |||||
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. | |||||
THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH REGARD | |||||
TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND | |||||
FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, | |||||
OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF | |||||
USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER | |||||
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE | |||||
OF THIS SOFTWARE. | |||||
----------------------------------------------------------------------------- | |||||
To release a closed-source product which uses other parts of JUCE not | |||||
licensed under the ISC terms, commercial licenses are available: visit | |||||
www.juce.com for more information. | |||||
JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER | |||||
EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE | |||||
DISCLAIMED. | |||||
============================================================================== | ============================================================================== | ||||
*/ | */ | ||||
#ifndef JUCE_SYNTHESISER_H_INCLUDED | |||||
#define JUCE_SYNTHESISER_H_INCLUDED | |||||
#pragma once | |||||
//============================================================================== | //============================================================================== | ||||
@@ -641,6 +632,3 @@ private: | |||||
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (Synthesiser) | JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (Synthesiser) | ||||
}; | }; | ||||
#endif // JUCE_SYNTHESISER_H_INCLUDED |
@@ -1,169 +0,0 @@ | |||||
/* | |||||
============================================================================== | |||||
This file is part of the JUCE library. | |||||
Copyright (c) 2015 - ROLI Ltd. | |||||
Permission is granted to use this software under the terms of either: | |||||
a) the GPL v2 (or any later version) | |||||
b) the Affero GPL v3 | |||||
Details of these licenses can be found at: www.gnu.org/licenses | |||||
JUCE is distributed in the hope that it will be useful, but WITHOUT ANY | |||||
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR | |||||
A PARTICULAR PURPOSE. See the GNU General Public License for more details. | |||||
------------------------------------------------------------------------------ | |||||
To release a closed-source product which uses JUCE, commercial licenses are | |||||
available: visit www.juce.com for more information. | |||||
============================================================================== | |||||
*/ | |||||
#ifndef JUCE_AUDIOCDBURNER_H_INCLUDED | |||||
#define JUCE_AUDIOCDBURNER_H_INCLUDED | |||||
#if JUCE_USE_CDBURNER || DOXYGEN | |||||
//============================================================================== | |||||
/** | |||||
*/ | |||||
class AudioCDBurner : public ChangeBroadcaster | |||||
{ | |||||
public: | |||||
//============================================================================== | |||||
/** Returns a list of available optical drives. | |||||
Use openDevice() to open one of the items from this list. | |||||
*/ | |||||
static StringArray findAvailableDevices(); | |||||
/** Tries to open one of the optical drives. | |||||
The deviceIndex is an index into the array returned by findAvailableDevices(). | |||||
*/ | |||||
static AudioCDBurner* openDevice (const int deviceIndex); | |||||
/** Destructor. */ | |||||
~AudioCDBurner(); | |||||
//============================================================================== | |||||
enum DiskState | |||||
{ | |||||
unknown, /**< An error condition, if the device isn't responding. */ | |||||
trayOpen, /**< The drive is currently open. Note that a slot-loading drive | |||||
may seem to be permanently open. */ | |||||
noDisc, /**< The drive has no disk in it. */ | |||||
writableDiskPresent, /**< The drive contains a writeable disk. */ | |||||
readOnlyDiskPresent /**< The drive contains a read-only disk. */ | |||||
}; | |||||
/** Returns the current status of the device. | |||||
To get informed when the drive's status changes, attach a ChangeListener to | |||||
the AudioCDBurner. | |||||
*/ | |||||
DiskState getDiskState() const; | |||||
/** Returns true if there's a writable disk in the drive. */ | |||||
bool isDiskPresent() const; | |||||
/** Sends an eject signal to the drive. | |||||
The eject will happen asynchronously, so you can use getDiskState() and | |||||
waitUntilStateChange() to monitor its progress. | |||||
*/ | |||||
bool openTray(); | |||||
/** Blocks the current thread until the drive's state changes, or until the timeout expires. | |||||
@returns the device's new state | |||||
*/ | |||||
DiskState waitUntilStateChange (int timeOutMilliseconds); | |||||
//============================================================================== | |||||
/** Returns the set of possible write speeds that the device can handle. | |||||
These are as a multiple of 'normal' speed, so e.g. '24x' returns 24, etc. | |||||
Note that if there's no media present in the drive, this value may be unavailable! | |||||
@see setWriteSpeed, getWriteSpeed | |||||
*/ | |||||
Array<int> getAvailableWriteSpeeds() const; | |||||
//============================================================================== | |||||
/** Tries to enable or disable buffer underrun safety on devices that support it. | |||||
@returns true if it's now enabled. If the device doesn't support it, this | |||||
will always return false. | |||||
*/ | |||||
bool setBufferUnderrunProtection (bool shouldBeEnabled); | |||||
//============================================================================== | |||||
/** Returns the number of free blocks on the disk. | |||||
There are 75 blocks per second, at 44100Hz. | |||||
*/ | |||||
int getNumAvailableAudioBlocks() const; | |||||
/** Adds a track to be written. | |||||
The source passed-in here will be kept by this object, and it will | |||||
be used and deleted at some point in the future, either during the | |||||
burn() method or when this AudioCDBurner object is deleted. Your caller | |||||
method shouldn't keep a reference to it or use it again after passing | |||||
it in here. | |||||
*/ | |||||
bool addAudioTrack (AudioSource* source, int numSamples); | |||||
//============================================================================== | |||||
/** Receives progress callbacks during a cd-burn operation. | |||||
@see AudioCDBurner::burn() | |||||
*/ | |||||
class BurnProgressListener | |||||
{ | |||||
public: | |||||
BurnProgressListener() noexcept {} | |||||
virtual ~BurnProgressListener() {} | |||||
/** Called at intervals to report on the progress of the AudioCDBurner. | |||||
To cancel the burn, return true from this method. | |||||
*/ | |||||
virtual bool audioCDBurnProgress (float proportionComplete) = 0; | |||||
}; | |||||
/** Runs the burn process. | |||||
This method will block until the operation is complete. | |||||
@param listener the object to receive callbacks about progress | |||||
@param ejectDiscAfterwards whether to eject the disk after the burn completes | |||||
@param performFakeBurnForTesting if true, no data will actually be written to the disk | |||||
@param writeSpeed one of the write speeds from getAvailableWriteSpeeds(), or | |||||
0 or less to mean the fastest speed. | |||||
*/ | |||||
String burn (BurnProgressListener* listener, | |||||
bool ejectDiscAfterwards, | |||||
bool performFakeBurnForTesting, | |||||
int writeSpeed); | |||||
/** If a burn operation is currently in progress, this tells it to stop | |||||
as soon as possible. | |||||
It's also possible to stop the burn process by returning true from | |||||
BurnProgressListener::audioCDBurnProgress() | |||||
*/ | |||||
void abortBurn(); | |||||
private: | |||||
//============================================================================== | |||||
AudioCDBurner (const int deviceIndex); | |||||
class Pimpl; | |||||
friend struct ContainerDeletePolicy<Pimpl>; | |||||
ScopedPointer<Pimpl> pimpl; | |||||
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (AudioCDBurner) | |||||
}; | |||||
#endif | |||||
#endif // JUCE_AUDIOCDBURNER_H_INCLUDED |
@@ -1,57 +0,0 @@ | |||||
/* | |||||
============================================================================== | |||||
This file is part of the JUCE library. | |||||
Copyright (c) 2015 - ROLI Ltd. | |||||
Permission is granted to use this software under the terms of either: | |||||
a) the GPL v2 (or any later version) | |||||
b) the Affero GPL v3 | |||||
Details of these licenses can be found at: www.gnu.org/licenses | |||||
JUCE is distributed in the hope that it will be useful, but WITHOUT ANY | |||||
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR | |||||
A PARTICULAR PURPOSE. See the GNU General Public License for more details. | |||||
------------------------------------------------------------------------------ | |||||
To release a closed-source product which uses JUCE, commercial licenses are | |||||
available: visit www.juce.com for more information. | |||||
============================================================================== | |||||
*/ | |||||
#if JUCE_USE_CDREADER | |||||
int AudioCDReader::getNumTracks() const | |||||
{ | |||||
return trackStartSamples.size() - 1; | |||||
} | |||||
int AudioCDReader::getPositionOfTrackStart (int trackNum) const | |||||
{ | |||||
return trackStartSamples [trackNum]; | |||||
} | |||||
const Array<int>& AudioCDReader::getTrackOffsets() const | |||||
{ | |||||
return trackStartSamples; | |||||
} | |||||
int AudioCDReader::getCDDBId() | |||||
{ | |||||
int checksum = 0; | |||||
const int numTracks = getNumTracks(); | |||||
for (int i = 0; i < numTracks; ++i) | |||||
for (int offset = (trackStartSamples.getUnchecked(i) + 88200) / 44100; offset > 0; offset /= 10) | |||||
checksum += offset % 10; | |||||
const int length = (trackStartSamples.getLast() - trackStartSamples.getFirst()) / 44100; | |||||
// CCLLLLTT: checksum, length, tracks | |||||
return ((checksum & 0xff) << 24) | (length << 8) | numTracks; | |||||
} | |||||
#endif |
@@ -1,174 +0,0 @@ | |||||
/* | |||||
============================================================================== | |||||
This file is part of the JUCE library. | |||||
Copyright (c) 2015 - ROLI Ltd. | |||||
Permission is granted to use this software under the terms of either: | |||||
a) the GPL v2 (or any later version) | |||||
b) the Affero GPL v3 | |||||
Details of these licenses can be found at: www.gnu.org/licenses | |||||
JUCE is distributed in the hope that it will be useful, but WITHOUT ANY | |||||
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR | |||||
A PARTICULAR PURPOSE. See the GNU General Public License for more details. | |||||
------------------------------------------------------------------------------ | |||||
To release a closed-source product which uses JUCE, commercial licenses are | |||||
available: visit www.juce.com for more information. | |||||
============================================================================== | |||||
*/ | |||||
#ifndef JUCE_AUDIOCDREADER_H_INCLUDED | |||||
#define JUCE_AUDIOCDREADER_H_INCLUDED | |||||
#if JUCE_USE_CDREADER || DOXYGEN | |||||
//============================================================================== | |||||
/** | |||||
A type of AudioFormatReader that reads from an audio CD. | |||||
One of these can be used to read a CD as if it's one big audio stream. Use the | |||||
getPositionOfTrackStart() method to find where the individual tracks are | |||||
within the stream. | |||||
@see AudioFormatReader | |||||
*/ | |||||
class JUCE_API AudioCDReader : public AudioFormatReader | |||||
{ | |||||
public: | |||||
//============================================================================== | |||||
/** Returns a list of names of Audio CDs currently available for reading. | |||||
If there's a CD drive but no CD in it, this might return an empty list, or | |||||
possibly a device that can be opened but which has no tracks, depending | |||||
on the platform. | |||||
@see createReaderForCD | |||||
*/ | |||||
static StringArray getAvailableCDNames(); | |||||
/** Tries to create an AudioFormatReader that can read from an Audio CD. | |||||
@param index the index of one of the available CDs - use getAvailableCDNames() | |||||
to find out how many there are. | |||||
@returns a new AudioCDReader object, or nullptr if it couldn't be created. The | |||||
caller will be responsible for deleting the object returned. | |||||
*/ | |||||
static AudioCDReader* createReaderForCD (const int index); | |||||
//============================================================================== | |||||
/** Destructor. */ | |||||
~AudioCDReader(); | |||||
/** Implementation of the AudioFormatReader method. */ | |||||
bool readSamples (int** destSamples, int numDestChannels, int startOffsetInDestBuffer, | |||||
int64 startSampleInFile, int numSamples) override; | |||||
/** Checks whether the CD has been removed from the drive. */ | |||||
bool isCDStillPresent() const; | |||||
/** Returns the total number of tracks (audio + data). */ | |||||
int getNumTracks() const; | |||||
/** Finds the sample offset of the start of a track. | |||||
@param trackNum the track number, where trackNum = 0 is the first track | |||||
and trackNum = getNumTracks() means the end of the CD. | |||||
*/ | |||||
int getPositionOfTrackStart (int trackNum) const; | |||||
/** Returns true if a given track is an audio track. | |||||
@param trackNum the track number, where 0 is the first track. | |||||
*/ | |||||
bool isTrackAudio (int trackNum) const; | |||||
/** Returns an array of sample offsets for the start of each track, followed by | |||||
the sample position of the end of the CD. | |||||
*/ | |||||
const Array<int>& getTrackOffsets() const; | |||||
/** Refreshes the object's table of contents. | |||||
If the disc has been ejected and a different one put in since this | |||||
object was created, this will cause it to update its idea of how many tracks | |||||
there are, etc. | |||||
*/ | |||||
void refreshTrackLengths(); | |||||
/** Enables scanning for indexes within tracks. | |||||
@see getLastIndex | |||||
*/ | |||||
void enableIndexScanning (bool enabled); | |||||
/** Returns the index number found during the last read() call. | |||||
Index scanning is turned off by default - turn it on with enableIndexScanning(). | |||||
Then when the read() method is called, if it comes across an index within that | |||||
block, the index number is stored and returned by this method. | |||||
Some devices might not support indexes, of course. | |||||
(If you don't know what CD indexes are, it's unlikely you'll ever need them). | |||||
@see enableIndexScanning | |||||
*/ | |||||
int getLastIndex() const; | |||||
/** Scans a track to find the position of any indexes within it. | |||||
@param trackNumber the track to look in, where 0 is the first track on the disc | |||||
@returns an array of sample positions of any index points found (not including | |||||
the index that marks the start of the track) | |||||
*/ | |||||
Array<int> findIndexesInTrack (const int trackNumber); | |||||
/** Returns the CDDB id number for the CD. | |||||
It's not a great way of identifying a disc, but it's traditional. | |||||
*/ | |||||
int getCDDBId(); | |||||
/** Tries to eject the disk. | |||||
Ejecting the disk might not actually be possible, e.g. if some other process is using it. | |||||
*/ | |||||
void ejectDisk(); | |||||
//============================================================================== | |||||
enum | |||||
{ | |||||
framesPerSecond = 75, | |||||
samplesPerFrame = 44100 / framesPerSecond | |||||
}; | |||||
private: | |||||
//============================================================================== | |||||
Array<int> trackStartSamples; | |||||
#if JUCE_MAC | |||||
File volumeDir; | |||||
Array<File> tracks; | |||||
int currentReaderTrack; | |||||
ScopedPointer<AudioFormatReader> reader; | |||||
AudioCDReader (const File& volume); | |||||
#elif JUCE_WINDOWS | |||||
bool audioTracks [100]; | |||||
void* handle; | |||||
MemoryBlock buffer; | |||||
bool indexingEnabled; | |||||
int lastIndex, firstFrameInBuffer, samplesInBuffer; | |||||
AudioCDReader (void* handle); | |||||
int getIndexAt (int samplePos); | |||||
#elif JUCE_LINUX | |||||
AudioCDReader(); | |||||
#endif | |||||
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (AudioCDReader) | |||||
}; | |||||
#endif | |||||
#endif // JUCE_AUDIOCDREADER_H_INCLUDED |
@@ -2,28 +2,20 @@ | |||||
============================================================================== | ============================================================================== | ||||
This file is part of the JUCE library. | This file is part of the JUCE library. | ||||
Copyright (c) 2016 - ROLI Ltd. | |||||
Copyright (c) 2017 - ROLI Ltd. | |||||
Permission is granted to use this software under the terms of the ISC license | |||||
http://www.isc.org/downloads/software-support-policy/isc-license/ | |||||
JUCE is an open source library subject to commercial or open-source | |||||
licensing. | |||||
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. | |||||
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. | |||||
THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH REGARD | |||||
TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND | |||||
FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, | |||||
OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF | |||||
USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER | |||||
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE | |||||
OF THIS SOFTWARE. | |||||
----------------------------------------------------------------------------- | |||||
To release a closed-source product which uses other parts of JUCE not | |||||
licensed under the ISC terms, commercial licenses are available: visit | |||||
www.juce.com for more information. | |||||
JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER | |||||
EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE | |||||
DISCLAIMED. | |||||
============================================================================== | ============================================================================== | ||||
*/ | */ | ||||
@@ -442,7 +434,7 @@ String AudioDeviceManager::setAudioDeviceSetup (const AudioDeviceSetup& newSetup | |||||
jassert (&newSetup != ¤tSetup); // this will have no effect | jassert (&newSetup != ¤tSetup); // this will have no effect | ||||
if (newSetup == currentSetup && currentAudioDevice != nullptr) | if (newSetup == currentSetup && currentAudioDevice != nullptr) | ||||
return String(); | |||||
return {}; | |||||
if (! (newSetup == currentSetup)) | if (! (newSetup == currentSetup)) | ||||
sendChangeMessage(); | sendChangeMessage(); | ||||
@@ -462,7 +454,7 @@ String AudioDeviceManager::setAudioDeviceSetup (const AudioDeviceSetup& newSetup | |||||
if (treatAsChosenDevice) | if (treatAsChosenDevice) | ||||
updateXml(); | updateXml(); | ||||
return String(); | |||||
return {}; | |||||
} | } | ||||
if (currentSetup.inputDeviceName != newInputDeviceName | if (currentSetup.inputDeviceName != newInputDeviceName | ||||
@@ -2,34 +2,25 @@ | |||||
============================================================================== | ============================================================================== | ||||
This file is part of the JUCE library. | This file is part of the JUCE library. | ||||
Copyright (c) 2016 - ROLI Ltd. | |||||
Copyright (c) 2017 - ROLI Ltd. | |||||
Permission is granted to use this software under the terms of the ISC license | |||||
http://www.isc.org/downloads/software-support-policy/isc-license/ | |||||
JUCE is an open source library subject to commercial or open-source | |||||
licensing. | |||||
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. | |||||
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. | |||||
THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH REGARD | |||||
TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND | |||||
FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, | |||||
OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF | |||||
USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER | |||||
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE | |||||
OF THIS SOFTWARE. | |||||
----------------------------------------------------------------------------- | |||||
To release a closed-source product which uses other parts of JUCE not | |||||
licensed under the ISC terms, commercial licenses are available: visit | |||||
www.juce.com for more information. | |||||
JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER | |||||
EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE | |||||
DISCLAIMED. | |||||
============================================================================== | ============================================================================== | ||||
*/ | */ | ||||
#ifndef JUCE_AUDIODEVICEMANAGER_H_INCLUDED | |||||
#define JUCE_AUDIODEVICEMANAGER_H_INCLUDED | |||||
#pragma once | |||||
//============================================================================== | //============================================================================== | ||||
@@ -527,5 +518,3 @@ private: | |||||
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (AudioDeviceManager) | JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (AudioDeviceManager) | ||||
}; | }; | ||||
#endif // JUCE_AUDIODEVICEMANAGER_H_INCLUDED |
@@ -2,28 +2,20 @@ | |||||
============================================================================== | ============================================================================== | ||||
This file is part of the JUCE library. | This file is part of the JUCE library. | ||||
Copyright (c) 2016 - ROLI Ltd. | |||||
Copyright (c) 2017 - ROLI Ltd. | |||||
Permission is granted to use this software under the terms of the ISC license | |||||
http://www.isc.org/downloads/software-support-policy/isc-license/ | |||||
JUCE is an open source library subject to commercial or open-source | |||||
licensing. | |||||
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. | |||||
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. | |||||
THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH REGARD | |||||
TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND | |||||
FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, | |||||
OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF | |||||
USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER | |||||
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE | |||||
OF THIS SOFTWARE. | |||||
----------------------------------------------------------------------------- | |||||
To release a closed-source product which uses other parts of JUCE not | |||||
licensed under the ISC terms, commercial licenses are available: visit | |||||
www.juce.com for more information. | |||||
JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER | |||||
EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE | |||||
DISCLAIMED. | |||||
============================================================================== | ============================================================================== | ||||
*/ | */ | ||||
@@ -2,34 +2,25 @@ | |||||
============================================================================== | ============================================================================== | ||||
This file is part of the JUCE library. | This file is part of the JUCE library. | ||||
Copyright (c) 2016 - ROLI Ltd. | |||||
Copyright (c) 2017 - ROLI Ltd. | |||||
Permission is granted to use this software under the terms of the ISC license | |||||
http://www.isc.org/downloads/software-support-policy/isc-license/ | |||||
JUCE is an open source library subject to commercial or open-source | |||||
licensing. | |||||
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. | |||||
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. | |||||
THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH REGARD | |||||
TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND | |||||
FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, | |||||
OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF | |||||
USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER | |||||
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE | |||||
OF THIS SOFTWARE. | |||||
----------------------------------------------------------------------------- | |||||
To release a closed-source product which uses other parts of JUCE not | |||||
licensed under the ISC terms, commercial licenses are available: visit | |||||
www.juce.com for more information. | |||||
JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER | |||||
EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE | |||||
DISCLAIMED. | |||||
============================================================================== | ============================================================================== | ||||
*/ | */ | ||||
#ifndef JUCE_AUDIOIODEVICE_H_INCLUDED | |||||
#define JUCE_AUDIOIODEVICE_H_INCLUDED | |||||
#pragma once | |||||
class AudioIODevice; | class AudioIODevice; | ||||
@@ -310,6 +301,3 @@ protected: | |||||
/** @internal */ | /** @internal */ | ||||
String name, typeName; | String name, typeName; | ||||
}; | }; | ||||
#endif // JUCE_AUDIOIODEVICE_H_INCLUDED |
@@ -2,28 +2,20 @@ | |||||
============================================================================== | ============================================================================== | ||||
This file is part of the JUCE library. | This file is part of the JUCE library. | ||||
Copyright (c) 2016 - ROLI Ltd. | |||||
Copyright (c) 2017 - ROLI Ltd. | |||||
Permission is granted to use this software under the terms of the ISC license | |||||
http://www.isc.org/downloads/software-support-policy/isc-license/ | |||||
JUCE is an open source library subject to commercial or open-source | |||||
licensing. | |||||
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. | |||||
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. | |||||
THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH REGARD | |||||
TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND | |||||
FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, | |||||
OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF | |||||
USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER | |||||
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE | |||||
OF THIS SOFTWARE. | |||||
----------------------------------------------------------------------------- | |||||
To release a closed-source product which uses other parts of JUCE not | |||||
licensed under the ISC terms, commercial licenses are available: visit | |||||
www.juce.com for more information. | |||||
JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER | |||||
EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE | |||||
DISCLAIMED. | |||||
============================================================================== | ============================================================================== | ||||
*/ | */ | ||||
@@ -2,34 +2,25 @@ | |||||
============================================================================== | ============================================================================== | ||||
This file is part of the JUCE library. | This file is part of the JUCE library. | ||||
Copyright (c) 2016 - ROLI Ltd. | |||||
Copyright (c) 2017 - ROLI Ltd. | |||||
Permission is granted to use this software under the terms of the ISC license | |||||
http://www.isc.org/downloads/software-support-policy/isc-license/ | |||||
JUCE is an open source library subject to commercial or open-source | |||||
licensing. | |||||
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. | |||||
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. | |||||
THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH REGARD | |||||
TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND | |||||
FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, | |||||
OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF | |||||
USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER | |||||
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE | |||||
OF THIS SOFTWARE. | |||||
----------------------------------------------------------------------------- | |||||
To release a closed-source product which uses other parts of JUCE not | |||||
licensed under the ISC terms, commercial licenses are available: visit | |||||
www.juce.com for more information. | |||||
JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER | |||||
EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE | |||||
DISCLAIMED. | |||||
============================================================================== | ============================================================================== | ||||
*/ | */ | ||||
#ifndef JUCE_AUDIOIODEVICETYPE_H_INCLUDED | |||||
#define JUCE_AUDIOIODEVICETYPE_H_INCLUDED | |||||
#pragma once | |||||
//============================================================================== | //============================================================================== | ||||
@@ -183,6 +174,3 @@ private: | |||||
JUCE_DECLARE_NON_COPYABLE (AudioIODeviceType) | JUCE_DECLARE_NON_COPYABLE (AudioIODeviceType) | ||||
}; | }; | ||||
#endif // JUCE_AUDIOIODEVICETYPE_H_INCLUDED |
@@ -2,34 +2,25 @@ | |||||
============================================================================== | ============================================================================== | ||||
This file is part of the JUCE library. | This file is part of the JUCE library. | ||||
Copyright (c) 2016 - ROLI Ltd. | |||||
Copyright (c) 2017 - ROLI Ltd. | |||||
Permission is granted to use this software under the terms of the ISC license | |||||
http://www.isc.org/downloads/software-support-policy/isc-license/ | |||||
JUCE is an open source library subject to commercial or open-source | |||||
licensing. | |||||
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. | |||||
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. | |||||
THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH REGARD | |||||
TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND | |||||
FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, | |||||
OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF | |||||
USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER | |||||
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE | |||||
OF THIS SOFTWARE. | |||||
----------------------------------------------------------------------------- | |||||
To release a closed-source product which uses other parts of JUCE not | |||||
licensed under the ISC terms, commercial licenses are available: visit | |||||
www.juce.com for more information. | |||||
JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER | |||||
EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE | |||||
DISCLAIMED. | |||||
============================================================================== | ============================================================================== | ||||
*/ | */ | ||||
#ifndef JUCE_SYSTEMAUDIOVOLUME_H_INCLUDED | |||||
#define JUCE_SYSTEMAUDIOVOLUME_H_INCLUDED | |||||
#pragma once | |||||
//============================================================================== | //============================================================================== | ||||
@@ -62,6 +53,3 @@ private: | |||||
SystemAudioVolume(); // Don't instantiate this class, just call its static fns. | SystemAudioVolume(); // Don't instantiate this class, just call its static fns. | ||||
JUCE_DECLARE_NON_COPYABLE (SystemAudioVolume) | JUCE_DECLARE_NON_COPYABLE (SystemAudioVolume) | ||||
}; | }; | ||||
#endif // JUCE_SYSTEMAUDIOVOLUME_H_INCLUDED |
@@ -2,28 +2,20 @@ | |||||
============================================================================== | ============================================================================== | ||||
This file is part of the JUCE library. | This file is part of the JUCE library. | ||||
Copyright (c) 2016 - ROLI Ltd. | |||||
Copyright (c) 2017 - ROLI Ltd. | |||||
Permission is granted to use this software under the terms of the ISC license | |||||
http://www.isc.org/downloads/software-support-policy/isc-license/ | |||||
JUCE is an open source library subject to commercial or open-source | |||||
licensing. | |||||
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. | |||||
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. | |||||
THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH REGARD | |||||
TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND | |||||
FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, | |||||
OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF | |||||
USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER | |||||
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE | |||||
OF THIS SOFTWARE. | |||||
----------------------------------------------------------------------------- | |||||
To release a closed-source product which uses other parts of JUCE not | |||||
licensed under the ISC terms, commercial licenses are available: visit | |||||
www.juce.com for more information. | |||||
JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER | |||||
EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE | |||||
DISCLAIMED. | |||||
============================================================================== | ============================================================================== | ||||
*/ | */ | ||||
@@ -37,14 +29,20 @@ | |||||
#error "Incorrect use of JUCE cpp file" | #error "Incorrect use of JUCE cpp file" | ||||
#endif | #endif | ||||
#include "AppConfig.h" | |||||
#define JUCE_CORE_INCLUDE_OBJC_HELPERS 1 | #define JUCE_CORE_INCLUDE_OBJC_HELPERS 1 | ||||
#define JUCE_CORE_INCLUDE_COM_SMART_PTR 1 | #define JUCE_CORE_INCLUDE_COM_SMART_PTR 1 | ||||
#define JUCE_CORE_INCLUDE_JNI_HELPERS 1 | #define JUCE_CORE_INCLUDE_JNI_HELPERS 1 | ||||
#define JUCE_CORE_INCLUDE_NATIVE_HEADERS 1 | #define JUCE_CORE_INCLUDE_NATIVE_HEADERS 1 | ||||
#define JUCE_EVENTS_INCLUDE_WIN32_MESSAGE_WINDOW 1 | #define JUCE_EVENTS_INCLUDE_WIN32_MESSAGE_WINDOW 1 | ||||
#ifndef JUCE_USE_WINRT_MIDI | |||||
#define JUCE_USE_WINRT_MIDI 0 | |||||
#endif | |||||
#if JUCE_USE_WINRT_MIDI | |||||
#define JUCE_EVENTS_INCLUDE_WINRT_WRAPPER 1 | |||||
#endif | |||||
#include "juce_audio_devices.h" | #include "juce_audio_devices.h" | ||||
//============================================================================== | //============================================================================== | ||||
@@ -72,6 +70,30 @@ | |||||
#include <mmreg.h> | #include <mmreg.h> | ||||
#endif | #endif | ||||
#if JUCE_USE_WINRT_MIDI | |||||
/* If you cannot find any of the header files below then you are probably | |||||
attempting to use the Windows 10 Bluetooth Low Energy API. For this to work you | |||||
need to install version 10.0.14393.0 of the Windows Standalone SDK and add the | |||||
path to the WinRT headers to your build system. This path should have the form | |||||
"C:\Program Files (x86)\Windows Kits\10\Include\10.0.14393.0\winrt". | |||||
Also please note that Microsoft's Bluetooth MIDI stack has multiple issues, so | |||||
this API is EXPERIMENTAL - use at your own risk! | |||||
*/ | |||||
#include <windows.devices.h> | |||||
#include <windows.devices.midi.h> | |||||
#include <windows.devices.enumeration.h> | |||||
#include <wrl/event.h> | |||||
#if JUCE_MSVC | |||||
#pragma warning (push) | |||||
#pragma warning (disable: 4467) | |||||
#endif | |||||
#include <robuffer.h> | |||||
#if JUCE_MSVC | |||||
#pragma warning (pop) | |||||
#endif | |||||
#endif | |||||
#if JUCE_ASIO | #if JUCE_ASIO | ||||
/* This is very frustrating - we only need to use a handful of definitions from | /* This is very frustrating - we only need to use a handful of definitions from | ||||
a couple of the header files in Steinberg's ASIO SDK, and it'd be easy to copy | a couple of the header files in Steinberg's ASIO SDK, and it'd be easy to copy | ||||
@@ -2,28 +2,20 @@ | |||||
============================================================================== | ============================================================================== | ||||
This file is part of the JUCE library. | This file is part of the JUCE library. | ||||
Copyright (c) 2016 - ROLI Ltd. | |||||
Copyright (c) 2017 - ROLI Ltd. | |||||
Permission is granted to use this software under the terms of the ISC license | |||||
http://www.isc.org/downloads/software-support-policy/isc-license/ | |||||
JUCE is an open source library subject to commercial or open-source | |||||
licensing. | |||||
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. | |||||
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. | |||||
THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH REGARD | |||||
TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND | |||||
FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, | |||||
OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF | |||||
USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER | |||||
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE | |||||
OF THIS SOFTWARE. | |||||
----------------------------------------------------------------------------- | |||||
To release a closed-source product which uses other parts of JUCE not | |||||
licensed under the ISC terms, commercial licenses are available: visit | |||||
www.juce.com for more information. | |||||
JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER | |||||
EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE | |||||
DISCLAIMED. | |||||
============================================================================== | ============================================================================== | ||||
*/ | */ | ||||
@@ -39,7 +31,7 @@ | |||||
ID: juce_audio_devices | ID: juce_audio_devices | ||||
vendor: juce | vendor: juce | ||||
version: 4.3.1 | |||||
version: 5.1.1 | |||||
name: JUCE audio and MIDI I/O device classes | name: JUCE audio and MIDI I/O device classes | ||||
description: Classes to play and record from audio and MIDI I/O devices | description: Classes to play and record from audio and MIDI I/O devices | ||||
website: http://www.juce.com/juce | website: http://www.juce.com/juce | ||||
@@ -56,12 +48,16 @@ | |||||
*******************************************************************************/ | *******************************************************************************/ | ||||
#ifndef JUCE_AUDIO_DEVICES_H_INCLUDED | |||||
#pragma once | |||||
#define JUCE_AUDIO_DEVICES_H_INCLUDED | #define JUCE_AUDIO_DEVICES_H_INCLUDED | ||||
#include <juce_events/juce_events.h> | #include <juce_events/juce_events.h> | ||||
#include <juce_audio_basics/juce_audio_basics.h> | #include <juce_audio_basics/juce_audio_basics.h> | ||||
#if JUCE_MODULE_AVAILABLE_juce_graphics | |||||
#include <juce_graphics/juce_graphics.h> | |||||
#endif | |||||
//============================================================================== | //============================================================================== | ||||
/** Config: JUCE_ASIO | /** Config: JUCE_ASIO | ||||
Enables ASIO audio devices (MS Windows only). | Enables ASIO audio devices (MS Windows only). | ||||
@@ -123,20 +119,42 @@ | |||||
#endif | #endif | ||||
#endif | #endif | ||||
/** Config: JUCE_USE_WINRT_MIDI | |||||
*** | |||||
EXPERIMENTAL - Microsoft's Bluetooth MIDI stack has multiple issues, | |||||
use at your own risk! | |||||
*** | |||||
Enables the use of the Windows Runtime API for MIDI, which supports | |||||
Bluetooth Low Energy connections on computers with the Anniversary Update | |||||
of Windows 10. | |||||
To compile with this flag requires version 10.0.14393.0 of the Windows | |||||
Standalone SDK and you must add the path to the WinRT headers. This path | |||||
should be something similar to | |||||
"C:\Program Files (x86)\Windows Kits\10\Include\10.0.14393.0\winrt". | |||||
*/ | |||||
#ifndef JUCE_USE_WINRT_MIDI | |||||
#define JUCE_USE_WINRT_MIDI 0 | |||||
#endif | |||||
//============================================================================== | //============================================================================== | ||||
namespace juce | namespace juce | ||||
{ | { | ||||
#include "audio_io/juce_AudioIODevice.h" | |||||
#include "audio_io/juce_AudioIODeviceType.h" | |||||
#include "audio_io/juce_SystemAudioVolume.h" | |||||
#include "midi_io/juce_MidiInput.h" | #include "midi_io/juce_MidiInput.h" | ||||
#include "midi_io/juce_MidiMessageCollector.h" | #include "midi_io/juce_MidiMessageCollector.h" | ||||
#include "midi_io/juce_MidiOutput.h" | #include "midi_io/juce_MidiOutput.h" | ||||
#include "audio_io/juce_AudioIODevice.h" | |||||
#include "audio_io/juce_AudioIODeviceType.h" | |||||
#include "audio_io/juce_SystemAudioVolume.h" | |||||
#include "sources/juce_AudioSourcePlayer.h" | #include "sources/juce_AudioSourcePlayer.h" | ||||
#include "sources/juce_AudioTransportSource.h" | #include "sources/juce_AudioTransportSource.h" | ||||
#include "audio_io/juce_AudioDeviceManager.h" | #include "audio_io/juce_AudioDeviceManager.h" | ||||
} | |||||
#if JUCE_IOS | |||||
#include "native/juce_ios_Audio.h" | |||||
#endif | |||||
#endif // JUCE_AUDIO_DEVICES_H_INCLUDED | |||||
} |
@@ -2,34 +2,25 @@ | |||||
============================================================================== | ============================================================================== | ||||
This file is part of the JUCE library. | This file is part of the JUCE library. | ||||
Copyright (c) 2016 - ROLI Ltd. | |||||
Copyright (c) 2017 - ROLI Ltd. | |||||
Permission is granted to use this software under the terms of the ISC license | |||||
http://www.isc.org/downloads/software-support-policy/isc-license/ | |||||
JUCE is an open source library subject to commercial or open-source | |||||
licensing. | |||||
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. | |||||
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. | |||||
THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH REGARD | |||||
TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND | |||||
FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, | |||||
OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF | |||||
USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER | |||||
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE | |||||
OF THIS SOFTWARE. | |||||
----------------------------------------------------------------------------- | |||||
To release a closed-source product which uses other parts of JUCE not | |||||
licensed under the ISC terms, commercial licenses are available: visit | |||||
www.juce.com for more information. | |||||
JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER | |||||
EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE | |||||
DISCLAIMED. | |||||
============================================================================== | ============================================================================== | ||||
*/ | */ | ||||
#ifndef JUCE_MIDIINPUT_H_INCLUDED | |||||
#define JUCE_MIDIINPUT_H_INCLUDED | |||||
#pragma once | |||||
class MidiInput; | class MidiInput; | ||||
@@ -173,13 +164,10 @@ public: | |||||
private: | private: | ||||
//============================================================================== | //============================================================================== | ||||
String name; | String name; | ||||
void* internal; | |||||
void* internal = nullptr; | |||||
// The input objects are created with the openDevice() method. | // The input objects are created with the openDevice() method. | ||||
explicit MidiInput (const String&); | explicit MidiInput (const String&); | ||||
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (MidiInput) | JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (MidiInput) | ||||
}; | }; | ||||
#endif // JUCE_MIDIINPUT_H_INCLUDED |
@@ -2,35 +2,25 @@ | |||||
============================================================================== | ============================================================================== | ||||
This file is part of the JUCE library. | This file is part of the JUCE library. | ||||
Copyright (c) 2016 - ROLI Ltd. | |||||
Copyright (c) 2017 - ROLI Ltd. | |||||
Permission is granted to use this software under the terms of the ISC license | |||||
http://www.isc.org/downloads/software-support-policy/isc-license/ | |||||
JUCE is an open source library subject to commercial or open-source | |||||
licensing. | |||||
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. | |||||
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. | |||||
THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH REGARD | |||||
TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND | |||||
FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, | |||||
OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF | |||||
USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER | |||||
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE | |||||
OF THIS SOFTWARE. | |||||
----------------------------------------------------------------------------- | |||||
To release a closed-source product which uses other parts of JUCE not | |||||
licensed under the ISC terms, commercial licenses are available: visit | |||||
www.juce.com for more information. | |||||
JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER | |||||
EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE | |||||
DISCLAIMED. | |||||
============================================================================== | ============================================================================== | ||||
*/ | */ | ||||
MidiMessageCollector::MidiMessageCollector() | MidiMessageCollector::MidiMessageCollector() | ||||
: lastCallbackTime (0), | |||||
sampleRate (44100.0001) | |||||
{ | { | ||||
} | } | ||||
@@ -44,6 +34,9 @@ void MidiMessageCollector::reset (const double newSampleRate) | |||||
jassert (newSampleRate > 0); | jassert (newSampleRate > 0); | ||||
const ScopedLock sl (midiCallbackLock); | const ScopedLock sl (midiCallbackLock); | ||||
#if JUCE_DEBUG | |||||
hasCalledReset = true; | |||||
#endif | |||||
sampleRate = newSampleRate; | sampleRate = newSampleRate; | ||||
incomingMessages.clear(); | incomingMessages.clear(); | ||||
lastCallbackTime = Time::getMillisecondCounterHiRes(); | lastCallbackTime = Time::getMillisecondCounterHiRes(); | ||||
@@ -51,8 +44,9 @@ void MidiMessageCollector::reset (const double newSampleRate) | |||||
void MidiMessageCollector::addMessageToQueue (const MidiMessage& message) | void MidiMessageCollector::addMessageToQueue (const MidiMessage& message) | ||||
{ | { | ||||
// you need to call reset() to set the correct sample rate before using this object | |||||
jassert (sampleRate != 44100.0001); | |||||
#if JUCE_DEBUG | |||||
jassert (hasCalledReset); // you need to call reset() to set the correct sample rate before using this object | |||||
#endif | |||||
// the messages that come in here need to be time-stamped correctly - see MidiInput | // the messages that come in here need to be time-stamped correctly - see MidiInput | ||||
// for details of what the number should be. | // for details of what the number should be. | ||||
@@ -60,8 +54,7 @@ void MidiMessageCollector::addMessageToQueue (const MidiMessage& message) | |||||
const ScopedLock sl (midiCallbackLock); | const ScopedLock sl (midiCallbackLock); | ||||
const int sampleNumber | |||||
= (int) ((message.getTimeStamp() - 0.001 * lastCallbackTime) * sampleRate); | |||||
auto sampleNumber = (int) ((message.getTimeStamp() - 0.001 * lastCallbackTime) * sampleRate); | |||||
incomingMessages.addEvent (message, sampleNumber); | incomingMessages.addEvent (message, sampleNumber); | ||||
@@ -74,12 +67,14 @@ void MidiMessageCollector::addMessageToQueue (const MidiMessage& message) | |||||
void MidiMessageCollector::removeNextBlockOfMessages (MidiBuffer& destBuffer, | void MidiMessageCollector::removeNextBlockOfMessages (MidiBuffer& destBuffer, | ||||
const int numSamples) | const int numSamples) | ||||
{ | { | ||||
// you need to call reset() to set the correct sample rate before using this object | |||||
jassert (sampleRate != 44100.0001); | |||||
#if JUCE_DEBUG | |||||
jassert (hasCalledReset); // you need to call reset() to set the correct sample rate before using this object | |||||
#endif | |||||
jassert (numSamples > 0); | jassert (numSamples > 0); | ||||
const double timeNow = Time::getMillisecondCounterHiRes(); | |||||
const double msElapsed = timeNow - lastCallbackTime; | |||||
auto timeNow = Time::getMillisecondCounterHiRes(); | |||||
auto msElapsed = timeNow - lastCallbackTime; | |||||
const ScopedLock sl (midiCallbackLock); | const ScopedLock sl (midiCallbackLock); | ||||
lastCallbackTime = timeNow; | lastCallbackTime = timeNow; | ||||
@@ -87,7 +82,6 @@ void MidiMessageCollector::removeNextBlockOfMessages (MidiBuffer& destBuffer, | |||||
if (! incomingMessages.isEmpty()) | if (! incomingMessages.isEmpty()) | ||||
{ | { | ||||
int numSourceSamples = jmax (1, roundToInt (msElapsed * 0.001 * sampleRate)); | int numSourceSamples = jmax (1, roundToInt (msElapsed * 0.001 * sampleRate)); | ||||
int startSample = 0; | int startSample = 0; | ||||
int scale = 1 << 16; | int scale = 1 << 16; | ||||
@@ -2,34 +2,25 @@ | |||||
============================================================================== | ============================================================================== | ||||
This file is part of the JUCE library. | This file is part of the JUCE library. | ||||
Copyright (c) 2016 - ROLI Ltd. | |||||
Copyright (c) 2017 - ROLI Ltd. | |||||
Permission is granted to use this software under the terms of the ISC license | |||||
http://www.isc.org/downloads/software-support-policy/isc-license/ | |||||
JUCE is an open source library subject to commercial or open-source | |||||
licensing. | |||||
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. | |||||
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. | |||||
THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH REGARD | |||||
TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND | |||||
FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, | |||||
OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF | |||||
USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER | |||||
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE | |||||
OF THIS SOFTWARE. | |||||
----------------------------------------------------------------------------- | |||||
To release a closed-source product which uses other parts of JUCE not | |||||
licensed under the ISC terms, commercial licenses are available: visit | |||||
www.juce.com for more information. | |||||
JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER | |||||
EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE | |||||
DISCLAIMED. | |||||
============================================================================== | ============================================================================== | ||||
*/ | */ | ||||
#ifndef JUCE_MIDIMESSAGECOLLECTOR_H_INCLUDED | |||||
#define JUCE_MIDIMESSAGECOLLECTOR_H_INCLUDED | |||||
#pragma once | |||||
//============================================================================== | //============================================================================== | ||||
@@ -98,13 +89,13 @@ public: | |||||
private: | private: | ||||
//============================================================================== | //============================================================================== | ||||
double lastCallbackTime; | |||||
double lastCallbackTime = 0; | |||||
CriticalSection midiCallbackLock; | CriticalSection midiCallbackLock; | ||||
MidiBuffer incomingMessages; | MidiBuffer incomingMessages; | ||||
double sampleRate; | |||||
double sampleRate = 44100.0; | |||||
#if JUCE_DEBUG | |||||
bool hasCalledReset = false; | |||||
#endif | |||||
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (MidiMessageCollector) | JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (MidiMessageCollector) | ||||
}; | }; | ||||
#endif // JUCE_MIDIMESSAGECOLLECTOR_H_INCLUDED |
@@ -2,28 +2,20 @@ | |||||
============================================================================== | ============================================================================== | ||||
This file is part of the JUCE library. | This file is part of the JUCE library. | ||||
Copyright (c) 2016 - ROLI Ltd. | |||||
Copyright (c) 2017 - ROLI Ltd. | |||||
Permission is granted to use this software under the terms of the ISC license | |||||
http://www.isc.org/downloads/software-support-policy/isc-license/ | |||||
JUCE is an open source library subject to commercial or open-source | |||||
licensing. | |||||
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. | |||||
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. | |||||
THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH REGARD | |||||
TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND | |||||
FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, | |||||
OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF | |||||
USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER | |||||
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE | |||||
OF THIS SOFTWARE. | |||||
----------------------------------------------------------------------------- | |||||
To release a closed-source product which uses other parts of JUCE not | |||||
licensed under the ISC terms, commercial licenses are available: visit | |||||
www.juce.com for more information. | |||||
JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER | |||||
EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE | |||||
DISCLAIMED. | |||||
============================================================================== | ============================================================================== | ||||
*/ | */ | ||||
@@ -38,7 +30,7 @@ struct MidiOutput::PendingMessage | |||||
PendingMessage* next; | PendingMessage* next; | ||||
}; | }; | ||||
MidiOutput::MidiOutput(const String& midiName) | |||||
MidiOutput::MidiOutput (const String& midiName) | |||||
: Thread ("midi out"), | : Thread ("midi out"), | ||||
internal (nullptr), | internal (nullptr), | ||||
firstMessage (nullptr), | firstMessage (nullptr), | ||||
@@ -2,34 +2,25 @@ | |||||
============================================================================== | ============================================================================== | ||||
This file is part of the JUCE library. | This file is part of the JUCE library. | ||||
Copyright (c) 2016 - ROLI Ltd. | |||||
Copyright (c) 2017 - ROLI Ltd. | |||||
Permission is granted to use this software under the terms of the ISC license | |||||
http://www.isc.org/downloads/software-support-policy/isc-license/ | |||||
JUCE is an open source library subject to commercial or open-source | |||||
licensing. | |||||
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. | |||||
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. | |||||
THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH REGARD | |||||
TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND | |||||
FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, | |||||
OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF | |||||
USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER | |||||
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE | |||||
OF THIS SOFTWARE. | |||||
----------------------------------------------------------------------------- | |||||
To release a closed-source product which uses other parts of JUCE not | |||||
licensed under the ISC terms, commercial licenses are available: visit | |||||
www.juce.com for more information. | |||||
JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER | |||||
EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE | |||||
DISCLAIMED. | |||||
============================================================================== | ============================================================================== | ||||
*/ | */ | ||||
#ifndef JUCE_MIDIOUTPUT_H_INCLUDED | |||||
#define JUCE_MIDIOUTPUT_H_INCLUDED | |||||
#pragma once | |||||
//============================================================================== | //============================================================================== | ||||
@@ -137,17 +128,14 @@ public: | |||||
private: | private: | ||||
//============================================================================== | //============================================================================== | ||||
void* internal; | |||||
void* internal = nullptr; | |||||
CriticalSection lock; | CriticalSection lock; | ||||
struct PendingMessage; | struct PendingMessage; | ||||
PendingMessage* firstMessage; | PendingMessage* firstMessage; | ||||
String name; | String name; | ||||
MidiOutput(const String& midiName); // These objects are created with the openDevice() method. | |||||
MidiOutput (const String& midiName); // These objects are created with the openDevice() method. | |||||
void run() override; | void run() override; | ||||
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (MidiOutput) | JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (MidiOutput) | ||||
}; | }; | ||||
#endif // JUCE_MIDIOUTPUT_H_INCLUDED |
@@ -2,34 +2,25 @@ | |||||
============================================================================== | ============================================================================== | ||||
This file is part of the JUCE library. | This file is part of the JUCE library. | ||||
Copyright (c) 2016 - ROLI Ltd. | |||||
Copyright (c) 2017 - ROLI Ltd. | |||||
Permission is granted to use this software under the terms of the ISC license | |||||
http://www.isc.org/downloads/software-support-policy/isc-license/ | |||||
JUCE is an open source library subject to commercial or open-source | |||||
licensing. | |||||
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. | |||||
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. | |||||
THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH REGARD | |||||
TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND | |||||
FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, | |||||
OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF | |||||
USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER | |||||
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE | |||||
OF THIS SOFTWARE. | |||||
----------------------------------------------------------------------------- | |||||
To release a closed-source product which uses other parts of JUCE not | |||||
licensed under the ISC terms, commercial licenses are available: visit | |||||
www.juce.com for more information. | |||||
JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER | |||||
EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE | |||||
DISCLAIMED. | |||||
============================================================================== | ============================================================================== | ||||
*/ | */ | ||||
#ifndef JUCE_MIDIDATACONCATENATOR_H_INCLUDED | |||||
#define JUCE_MIDIDATACONCATENATOR_H_INCLUDED | |||||
#pragma once | |||||
//============================================================================== | //============================================================================== | ||||
/** | /** | ||||
@@ -196,5 +187,3 @@ private: | |||||
JUCE_DECLARE_NON_COPYABLE (MidiDataConcatenator) | JUCE_DECLARE_NON_COPYABLE (MidiDataConcatenator) | ||||
}; | }; | ||||
#endif // JUCE_MIDIDATACONCATENATOR_H_INCLUDED |
@@ -2,28 +2,20 @@ | |||||
============================================================================== | ============================================================================== | ||||
This file is part of the JUCE library. | This file is part of the JUCE library. | ||||
Copyright (c) 2016 - ROLI Ltd. | |||||
Copyright (c) 2017 - ROLI Ltd. | |||||
Permission is granted to use this software under the terms of the ISC license | |||||
http://www.isc.org/downloads/software-support-policy/isc-license/ | |||||
JUCE is an open source library subject to commercial or open-source | |||||
licensing. | |||||
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. | |||||
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. | |||||
THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH REGARD | |||||
TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND | |||||
FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, | |||||
OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF | |||||
USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER | |||||
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE | |||||
OF THIS SOFTWARE. | |||||
----------------------------------------------------------------------------- | |||||
To release a closed-source product which uses other parts of JUCE not | |||||
licensed under the ISC terms, commercial licenses are available: visit | |||||
www.juce.com for more information. | |||||
JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER | |||||
EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE | |||||
DISCLAIMED. | |||||
============================================================================== | ============================================================================== | ||||
*/ | */ | ||||
@@ -199,7 +191,7 @@ public: | |||||
numDeviceOutputChannels = 2; | numDeviceOutputChannels = 2; | ||||
outputDevice = GlobalRef (env->NewObject (AudioTrack, AudioTrack.constructor, | outputDevice = GlobalRef (env->NewObject (AudioTrack, AudioTrack.constructor, | ||||
STREAM_MUSIC, sampleRate, CHANNEL_OUT_STEREO, ENCODING_PCM_16BIT, | STREAM_MUSIC, sampleRate, CHANNEL_OUT_STEREO, ENCODING_PCM_16BIT, | ||||
(jint) (minBufferSizeOut * numDeviceOutputChannels * sizeof (int16)), MODE_STREAM)); | |||||
(jint) (minBufferSizeOut * numDeviceOutputChannels * static_cast<int> (sizeof (int16))), MODE_STREAM)); | |||||
int outputDeviceState = env->CallIntMethod (outputDevice, AudioTrack.getState); | int outputDeviceState = env->CallIntMethod (outputDevice, AudioTrack.getState); | ||||
if (outputDeviceState > 0) | if (outputDeviceState > 0) | ||||
@@ -232,7 +224,7 @@ public: | |||||
0 /* (default audio source) */, sampleRate, | 0 /* (default audio source) */, sampleRate, | ||||
numDeviceInputChannelsAvailable > 1 ? CHANNEL_IN_STEREO : CHANNEL_IN_MONO, | numDeviceInputChannelsAvailable > 1 ? CHANNEL_IN_STEREO : CHANNEL_IN_MONO, | ||||
ENCODING_PCM_16BIT, | ENCODING_PCM_16BIT, | ||||
(jint) (minBufferSizeIn * numDeviceInputChannels * sizeof (int16)))); | |||||
(jint) (minBufferSizeIn * numDeviceInputChannels * static_cast<int> (sizeof (int16))))); | |||||
int inputDeviceState = env->CallIntMethod (inputDevice, AudioRecord.getState); | int inputDeviceState = env->CallIntMethod (inputDevice, AudioRecord.getState); | ||||
if (inputDeviceState > 0) | if (inputDeviceState > 0) | ||||
@@ -441,9 +433,9 @@ public: | |||||
//============================================================================== | //============================================================================== | ||||
void scanForDevices() {} | void scanForDevices() {} | ||||
StringArray getDeviceNames (bool wantInputNames) const { return StringArray (javaAudioTypeName); } | |||||
int getDefaultDeviceIndex (bool forInput) const { return 0; } | |||||
int getIndexOfDevice (AudioIODevice* device, bool asInput) const { return device != nullptr ? 0 : -1; } | |||||
StringArray getDeviceNames (bool) const { return StringArray (javaAudioTypeName); } | |||||
int getDefaultDeviceIndex (bool) const { return 0; } | |||||
int getIndexOfDevice (AudioIODevice* device, bool) const { return device != nullptr ? 0 : -1; } | |||||
bool hasSeparateInputsAndOutputs() const { return false; } | bool hasSeparateInputsAndOutputs() const { return false; } | ||||
AudioIODevice* createDevice (const String& outputDeviceName, | AudioIODevice* createDevice (const String& outputDeviceName, | ||||