diff --git a/JuceLibraryCode/modules/juce_audio_processors/processors/juce_AudioProcessorParameter.h b/JuceLibraryCode/modules/juce_audio_processors/processors/juce_AudioProcessorParameter.h new file mode 100644 index 0000000..8b4d2cf --- /dev/null +++ b/JuceLibraryCode/modules/juce_audio_processors/processors/juce_AudioProcessorParameter.h @@ -0,0 +1,158 @@ +/* + ============================================================================== + + This file is part of the JUCE library. + Copyright (c) 2013 - Raw Material Software 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_AUDIOPROCESSORPARAMETER_H_INCLUDED +#define JUCE_AUDIOPROCESSORPARAMETER_H_INCLUDED + + +//============================================================================== +/** An abstract base class for parameter objects that can be added to an + AudioProcessor. + + @see AudioProcessor::addParameter +*/ +class JUCE_API AudioProcessorParameter +{ +public: + AudioProcessorParameter() noexcept; + + /** Destructor. */ + virtual ~AudioProcessorParameter(); + + /** Called by the host to find out the value of this parameter. + + Hosts will expect the value returned to be between 0 and 1.0. + + This could be called quite frequently, so try to make your code efficient. + It's also likely to be called by non-UI threads, so the code in here should + be thread-aware. + */ + virtual float getValue() const = 0; + + /** The host will call this method to change the value of one of the filter's parameters. + + The host may call this at any time, including during the audio processing + callback, so the filter has to process this very fast and avoid blocking. + + If you want to set the value of a parameter internally, e.g. from your + editor component, then don't call this directly - instead, use the + setValueNotifyingHost() method, which will also send a message to + the host telling it about the change. If the message isn't sent, the host + won't be able to automate your parameters properly. + + The value passed will be between 0 and 1.0. + */ + virtual void setValue (float newValue) = 0; + + /** Your filter can call this when it needs to change one of its parameters. + + This could happen when the editor or some other internal operation changes + a parameter. This method will call the setParameter() method to change the + value, and will then send a message to the host telling it about the change. + + Note that to make sure the host correctly handles automation, you should call + the beginChangeGesture() and endChangeGesture() methods to tell the host when + the user has started and stopped changing the parameter. + */ + void setValueNotifyingHost (float newValue); + + /** Sends a signal to the host to tell it that the user is about to start changing this + parameter. + This allows the host to know when a parameter is actively being held by the user, and + it may use this information to help it record automation. + If you call this, it must be matched by a later call to endChangeGesture(). + */ + void beginChangeGesture(); + + /** Tells the host that the user has finished changing this parameter. + This allows the host to know when a parameter is actively being held by the user, + and it may use this information to help it record automation. + A call to this method must follow a call to beginChangeGesture(). + */ + void endChangeGesture(); + + /** This should return the default value for this parameter. */ + virtual float getDefaultValue() const = 0; + + /** Returns the name to display for this parameter, which should be made + to fit within the given string length. + */ + virtual String getName (int maximumStringLength) const = 0; + + /** Some parameters may be able to return a label string for + their units. For example "Hz" or "%". + */ + virtual String getLabel() const = 0; + + /** Returns the number of discrete interval steps that this parameter's range + should be quantised into. + + If you want a continuous range of values, don't override this method, and allow + the default implementation to return AudioProcessor::getDefaultNumParameterSteps(). + If your parameter is boolean, then you may want to make this return 2. + The value that is returned may or may not be used, depending on the host. + */ + virtual int getNumSteps() const; + + /** Returns a textual version of the supplied parameter value. + The default implementation just returns the floating point value + as a string, but this could do anything you need for a custom type + of value. + */ + virtual String getText (float value, int /*maximumStringLength*/) const; + + /** Should parse a string and return the appropriate value for it. */ + virtual float getValueForText (const String& text) const = 0; + + /** This can be overridden to tell the host that this parameter operates in the + reverse direction. + (Not all plugin formats or hosts will actually use this information). + */ + virtual bool isOrientationInverted() const; + + /** Returns true if the host can automate this parameter. + By default, this returns true. + */ + virtual bool isAutomatable() const; + + /** Should return true if this parameter is a "meta" parameter. + A meta-parameter is a parameter that changes other params. It is used + by some hosts (e.g. AudioUnit hosts). + By default this returns false. + */ + virtual bool isMetaParameter() const; + + /** Returns the index of this parameter in its parent processor's parameter list. */ + int getParameterIndex() const noexcept { return parameterIndex; } + +private: + friend class AudioProcessor; + AudioProcessor* processor; + int parameterIndex; + + JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (AudioProcessorParameter) +}; + + +#endif // JUCE_AUDIOPROCESSORPARAMETER_H_INCLUDED diff --git a/JuceLibraryCode/modules/juce_core/maths/juce_NormalisableRange.h b/JuceLibraryCode/modules/juce_core/maths/juce_NormalisableRange.h new file mode 100644 index 0000000..800c616 --- /dev/null +++ b/JuceLibraryCode/modules/juce_core/maths/juce_NormalisableRange.h @@ -0,0 +1,169 @@ +/* + ============================================================================== + + This file is part of the juce_core module of the JUCE library. + Copyright (c) 2013 - Raw Material Software Ltd. + + 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 THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD + TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN + NO EVENT SHALL THE AUTHOR 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. + + ------------------------------------------------------------------------------ + + NOTE! This permissive ISC license applies ONLY to files within the juce_core module! + All other JUCE modules are covered by a dual GPL/commercial license, so if you are + using any other modules, be sure to check that you also comply with their license. + + For more details, visit www.juce.com + + ============================================================================== +*/ + +#ifndef JUCE_NORMALISABLERANGE_H_INCLUDED +#define JUCE_NORMALISABLERANGE_H_INCLUDED + + +//============================================================================== +/** + Represents a mapping between an arbitrary range of values and a + normalised 0->1 range. + + The properties of the mapping also include an optional snapping interval + and skew-factor. + + @see Range +*/ +template +class NormalisableRange +{ +public: + /** Creates a continuous range that performs a dummy mapping. */ + NormalisableRange() noexcept : start(), end (1), interval(), skew (static_cast (1)) {} + + /** Creates a copy of another range. */ + NormalisableRange (const NormalisableRange& other) noexcept + : start (other.start), end (other.end), + interval (other.interval), skew (other.skew) + { + checkInvariants(); + } + + /** Creates a copy of another range. */ + NormalisableRange& operator= (const NormalisableRange& other) noexcept + { + start = other.start; + end = other.end; + interval = other.interval; + skew = other.skew; + checkInvariants(); + return *this; + } + + /** Creates a NormalisableRange with a given range, interval and skew factor. */ + NormalisableRange (ValueType rangeStart, + ValueType rangeEnd, + ValueType intervalValue, + ValueType skewFactor) noexcept + : start (rangeStart), end (rangeEnd), + interval (intervalValue), skew (skewFactor) + { + checkInvariants(); + } + + /** Creates a NormalisableRange with a given range and interval, but a dummy skew-factor. */ + NormalisableRange (ValueType rangeStart, + ValueType rangeEnd, + ValueType intervalValue) noexcept + : start (rangeStart), end (rangeEnd), + interval (intervalValue), skew (static_cast (1)) + { + checkInvariants(); + } + + /** Creates a NormalisableRange with a given range, continuous interval, but a dummy skew-factor. */ + NormalisableRange (ValueType rangeStart, + ValueType rangeEnd) noexcept + : start (rangeStart), end (rangeEnd), + interval(), skew (static_cast (1)) + { + checkInvariants(); + } + + /** Uses the properties of this mapping to convert a non-normalised value to + its 0->1 representation. + */ + ValueType convertTo0to1 (ValueType v) const noexcept + { + ValueType proportion = (v - start) / (end - start); + + if (skew != static_cast (1)) + proportion = pow (proportion, skew); + + return proportion; + } + + /** Uses the properties of this mapping to convert a normalised 0->1 value to + its full-range representation. + */ + ValueType convertFrom0to1 (ValueType proportion) const noexcept + { + if (skew != static_cast (1) && proportion > ValueType()) + proportion = exp (log (proportion) / skew); + + return start + (end - start) * proportion; + } + + /** Takes a non-normalised value and snaps it based on the interval property of + this NormalisedRange. */ + ValueType snapToLegalValue (ValueType v) const noexcept + { + if (interval > ValueType()) + v = start + interval * std::floor ((v - start) / interval + static_cast (0.5)); + + if (v <= start || end <= start) + return start; + + if (v >= end) + return end; + + return v; + } + + /** The start of the non-normalised range. */ + ValueType start; + + /** The end of the non-normalised range. */ + ValueType end; + + /** The snapping interval that should be used (in non-normalised value). Use 0 for a continuous range. */ + ValueType interval; + + /** An optional skew factor that alters the way values are distribute across the range. + + The skew factor lets you skew the mapping logarithmically so that larger or smaller + values are given a larger proportion of the avilable space. + + A factor of 1.0 has no skewing effect at all. If the factor is < 1.0, the lower end + of the range will fill more of the slider's length; if the factor is > 1.0, the upper + end of the range will be expanded. + */ + ValueType skew; + +private: + void checkInvariants() const + { + jassert (end > start); + jassert (interval >= ValueType()); + jassert (skew > ValueType()); + } +}; + + +#endif // JUCE_NORMALISABLERANGE_H_INCLUDED diff --git a/JuceLibraryCode/modules/juce_core/system/juce_CompilerSupport.h b/JuceLibraryCode/modules/juce_core/system/juce_CompilerSupport.h new file mode 100644 index 0000000..d090956 --- /dev/null +++ b/JuceLibraryCode/modules/juce_core/system/juce_CompilerSupport.h @@ -0,0 +1,147 @@ +/* + ============================================================================== + + This file is part of the juce_core module of the JUCE library. + Copyright (c) 2013 - Raw Material Software Ltd. + + 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 THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD + TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN + NO EVENT SHALL THE AUTHOR 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. + + ------------------------------------------------------------------------------ + + NOTE! This permissive ISC license applies ONLY to files within the juce_core module! + All other JUCE modules are covered by a dual GPL/commercial license, so if you are + using any other modules, be sure to check that you also comply with their license. + + For more details, visit www.juce.com + + ============================================================================== +*/ + +#ifndef JUCE_COMPILERSUPPORT_H_INCLUDED +#define JUCE_COMPILERSUPPORT_H_INCLUDED + +/* This file has some checks to see whether the compiler supports various C++11/14 features, + When these aren't available, the code defines a few workarounds, so that we can still use + some of the newer language features like nullptr and noexcept, even on old compilers. +*/ + +//============================================================================== +// GCC +#if (__cplusplus >= 201103L || defined (__GXX_EXPERIMENTAL_CXX0X__)) && (__GNUC__ * 100 + __GNUC_MINOR__) >= 405 + #define JUCE_COMPILER_SUPPORTS_NOEXCEPT 1 + #define JUCE_COMPILER_SUPPORTS_NULLPTR 1 + #define JUCE_COMPILER_SUPPORTS_MOVE_SEMANTICS 1 + + #if (__GNUC__ * 100 + __GNUC_MINOR__) >= 407 && ! defined (JUCE_COMPILER_SUPPORTS_OVERRIDE_AND_FINAL) + #define JUCE_COMPILER_SUPPORTS_OVERRIDE_AND_FINAL 1 + #endif + + #if (__GNUC__ * 100 + __GNUC_MINOR__) >= 407 && ! defined (JUCE_DELETED_FUNCTION) + #define JUCE_DELETED_FUNCTION = delete + #endif + + #if (__GNUC__ * 100 + __GNUC_MINOR__) >= 406 && ! defined (JUCE_COMPILER_SUPPORTS_LAMBDAS) + #define JUCE_COMPILER_SUPPORTS_LAMBDAS 1 + #endif +#endif + +//============================================================================== +// Clang +#if JUCE_CLANG && defined (__has_feature) + #if __has_feature (cxx_nullptr) + #define JUCE_COMPILER_SUPPORTS_NULLPTR 1 + #endif + + #if __has_feature (cxx_noexcept) + #define JUCE_COMPILER_SUPPORTS_NOEXCEPT 1 + #endif + + #if __has_feature (cxx_rvalue_references) + #define JUCE_COMPILER_SUPPORTS_MOVE_SEMANTICS 1 + #endif + + #if __has_feature (cxx_deleted_functions) + #define JUCE_DELETED_FUNCTION = delete + #endif + + #if __has_feature (cxx_lambdas) \ + && ((JUCE_MAC && defined (MAC_OS_X_VERSION_10_8) && MAC_OS_X_VERSION_MIN_REQUIRED > MAC_OS_X_VERSION_10_8) \ + || (JUCE_IOS && defined (__IPHONE_7_0) && __IPHONE_OS_VERSION_MIN_REQUIRED >= __IPHONE_7_0) \ + || ! (JUCE_MAC || JUCE_IOS)) + #define JUCE_COMPILER_SUPPORTS_LAMBDAS 1 + #endif + + #ifndef JUCE_COMPILER_SUPPORTS_OVERRIDE_AND_FINAL + #define JUCE_COMPILER_SUPPORTS_OVERRIDE_AND_FINAL 1 + #endif + + #ifndef JUCE_COMPILER_SUPPORTS_ARC + #define JUCE_COMPILER_SUPPORTS_ARC 1 + #endif +#endif + +//============================================================================== +// MSVC +#ifdef _MSC_VER + #if _MSC_VER >= 1600 + #define JUCE_COMPILER_SUPPORTS_NULLPTR 1 + #define JUCE_COMPILER_SUPPORTS_MOVE_SEMANTICS 1 + #endif + + #if _MSC_VER >= 1700 + #define JUCE_COMPILER_SUPPORTS_OVERRIDE_AND_FINAL 1 + #define JUCE_COMPILER_SUPPORTS_LAMBDAS 1 + #endif + + #if _MSC_VER >= 1900 + #define JUCE_COMPILER_SUPPORTS_NOEXCEPT 1 + #define JUCE_DELETED_FUNCTION = delete + #endif +#endif + +//============================================================================== +// Declare some fake versions of nullptr and noexcept, for older compilers: + +#ifndef JUCE_DELETED_FUNCTION + /** This macro can be placed after a method declaration to allow the use of + the C++11 feature "= delete" on all compilers. + On newer compilers that support it, it does the C++11 "= delete", but on + older ones it's just an empty definition. + */ + #define JUCE_DELETED_FUNCTION +#endif + +#if ! DOXYGEN + #if ! JUCE_COMPILER_SUPPORTS_NOEXCEPT + #ifdef noexcept + #undef noexcept + #endif + #define noexcept throw() + #if defined (_MSC_VER) && _MSC_VER > 1600 + #define _ALLOW_KEYWORD_MACROS 1 // (to stop VC2012 complaining) + #endif + #endif + + #if ! JUCE_COMPILER_SUPPORTS_NULLPTR + #ifdef nullptr + #undef nullptr + #endif + #define nullptr (0) + #endif + + #if ! JUCE_COMPILER_SUPPORTS_OVERRIDE_AND_FINAL + #undef override + #define override + #endif +#endif + +#endif // JUCE_COMPILERSUPPORT_H_INCLUDED diff --git a/JuceLibraryCode/modules/juce_video/capture/juce_CameraDevice.cpp b/JuceLibraryCode/modules/juce_video/capture/juce_CameraDevice.cpp new file mode 100644 index 0000000..019c423 --- /dev/null +++ b/JuceLibraryCode/modules/juce_video/capture/juce_CameraDevice.cpp @@ -0,0 +1,89 @@ +/* + ============================================================================== + + This file is part of the JUCE library. + Copyright (c) 2013 - Raw Material Software 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. + + ============================================================================== +*/ + +CameraDevice::CameraDevice (const String& nm, int index, int minWidth, int minHeight, int maxWidth, int maxHeight) + : name (nm), pimpl (new Pimpl (name, index, minWidth, minHeight, maxWidth, maxHeight)) +{ +} + +CameraDevice::~CameraDevice() +{ + stopRecording(); + pimpl = nullptr; +} + +Component* CameraDevice::createViewerComponent() +{ + return new ViewerComponent (*this); +} + +void CameraDevice::startRecordingToFile (const File& file, int quality) +{ + stopRecording(); + pimpl->startRecordingToFile (file, quality); +} + +Time CameraDevice::getTimeOfFirstRecordedFrame() const +{ + return pimpl->getTimeOfFirstRecordedFrame(); +} + +void CameraDevice::stopRecording() +{ + pimpl->stopRecording(); +} + +void CameraDevice::addListener (Listener* listenerToAdd) +{ + if (listenerToAdd != nullptr) + pimpl->addListener (listenerToAdd); +} + +void CameraDevice::removeListener (Listener* listenerToRemove) +{ + if (listenerToRemove != nullptr) + pimpl->removeListener (listenerToRemove); +} + +//============================================================================== +StringArray CameraDevice::getAvailableDevices() +{ + JUCE_AUTORELEASEPOOL + { + return Pimpl::getAvailableDevices(); + } +} + +CameraDevice* CameraDevice::openDevice (int index, + int minWidth, int minHeight, + int maxWidth, int maxHeight) +{ + ScopedPointer d (new CameraDevice (getAvailableDevices() [index], index, + minWidth, minHeight, maxWidth, maxHeight)); + + if (d->pimpl->openedOk()) + return d.release(); + + return nullptr; +}