| @@ -2,7 +2,7 @@ | |||||
| ============================================================================== | ============================================================================== | ||||
| This file is part of the JUCE library. | This file is part of the JUCE library. | ||||
| Copyright (c) 2013 - Raw Material Software Ltd. | |||||
| Copyright (c) 2015 - ROLI Ltd. | |||||
| Permission is granted to use this software under the terms of either: | Permission is granted to use this software under the terms of either: | ||||
| a) the GPL v2 (or any later version) | a) the GPL v2 (or any later version) | ||||
| @@ -579,7 +579,7 @@ public: | |||||
| } | } | ||||
| }; | }; | ||||
| void runTest() | |||||
| void runTest() override | |||||
| { | { | ||||
| Random r = getRandom(); | Random r = getRandom(); | ||||
| beginTest ("Round-trip conversion: Int8"); | beginTest ("Round-trip conversion: Int8"); | ||||
| @@ -2,7 +2,7 @@ | |||||
| ============================================================================== | ============================================================================== | ||||
| This file is part of the JUCE library. | This file is part of the JUCE library. | ||||
| Copyright (c) 2013 - Raw Material Software Ltd. | |||||
| Copyright (c) 2015 - ROLI Ltd. | |||||
| Permission is granted to use this software under the terms of either: | Permission is granted to use this software under the terms of either: | ||||
| a) the GPL v2 (or any later version) | a) the GPL v2 (or any later version) | ||||
| @@ -2,7 +2,7 @@ | |||||
| ============================================================================== | ============================================================================== | ||||
| This file is part of the JUCE library. | This file is part of the JUCE library. | ||||
| Copyright (c) 2013 - Raw Material Software Ltd. | |||||
| Copyright (c) 2015 - ROLI Ltd. | |||||
| Permission is granted to use this software under the terms of either: | Permission is granted to use this software under the terms of either: | ||||
| a) the GPL v2 (or any later version) | a) the GPL v2 (or any later version) | ||||
| @@ -2,7 +2,7 @@ | |||||
| ============================================================================== | ============================================================================== | ||||
| This file is part of the JUCE library. | This file is part of the JUCE library. | ||||
| Copyright (c) 2013 - Raw Material Software Ltd. | |||||
| Copyright (c) 2015 - ROLI Ltd. | |||||
| Permission is granted to use this software under the terms of either: | Permission is granted to use this software under the terms of either: | ||||
| a) the GPL v2 (or any later version) | a) the GPL v2 (or any later version) | ||||
| @@ -2,7 +2,7 @@ | |||||
| ============================================================================== | ============================================================================== | ||||
| This file is part of the JUCE library. | This file is part of the JUCE library. | ||||
| Copyright (c) 2013 - Raw Material Software Ltd. | |||||
| Copyright (c) 2015 - ROLI Ltd. | |||||
| Permission is granted to use this software under the terms of either: | Permission is granted to use this software under the terms of either: | ||||
| a) the GPL v2 (or any later version) | a) the GPL v2 (or any later version) | ||||
| @@ -1146,7 +1146,7 @@ public: | |||||
| } | } | ||||
| }; | }; | ||||
| void runTest() | |||||
| void runTest() override | |||||
| { | { | ||||
| beginTest ("FloatVectorOperations"); | beginTest ("FloatVectorOperations"); | ||||
| @@ -2,7 +2,7 @@ | |||||
| ============================================================================== | ============================================================================== | ||||
| This file is part of the JUCE library. | This file is part of the JUCE library. | ||||
| Copyright (c) 2013 - Raw Material Software Ltd. | |||||
| Copyright (c) 2015 - ROLI Ltd. | |||||
| Permission is granted to use this software under the terms of either: | Permission is granted to use this software under the terms of either: | ||||
| a) the GPL v2 (or any later version) | a) the GPL v2 (or any later version) | ||||
| @@ -2,7 +2,7 @@ | |||||
| ============================================================================== | ============================================================================== | ||||
| This file is part of the JUCE library. | This file is part of the JUCE library. | ||||
| Copyright (c) 2013 - Raw Material Software Ltd. | |||||
| Copyright (c) 2015 - ROLI Ltd. | |||||
| Permission is granted to use this software under the terms of either: | Permission is granted to use this software under the terms of either: | ||||
| a) the GPL v2 (or any later version) | a) the GPL v2 (or any later version) | ||||
| @@ -2,7 +2,7 @@ | |||||
| ============================================================================== | ============================================================================== | ||||
| This file is part of the JUCE library. | This file is part of the JUCE library. | ||||
| Copyright (c) 2013 - Raw Material Software Ltd. | |||||
| Copyright (c) 2015 - ROLI Ltd. | |||||
| Permission is granted to use this software under the terms of either: | Permission is granted to use this software under the terms of either: | ||||
| a) the GPL v2 (or any later version) | a) the GPL v2 (or any later version) | ||||
| @@ -225,13 +225,43 @@ void FFT::perform (const Complex* const input, Complex* const output) const noex | |||||
| config->perform (input, output); | config->perform (input, output); | ||||
| } | } | ||||
| const size_t maxFFTScratchSpaceToAlloca = 256 * 1024; | |||||
| void FFT::performRealOnlyForwardTransform (float* d) const noexcept | 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) | |||||
| { | |||||
| performRealOnlyForwardTransform (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. | // This can only be called on an FFT object that was created to do forward transforms. | ||||
| jassert (! config->inverse); | jassert (! config->inverse); | ||||
| Complex* const scratch = static_cast<Complex*> (alloca (16 + sizeof (Complex) * (size_t) size)); | |||||
| for (int i = 0; i < size; ++i) | for (int i = 0; i < size; ++i) | ||||
| { | { | ||||
| scratch[i].r = d[i]; | scratch[i].r = d[i]; | ||||
| @@ -241,13 +271,11 @@ void FFT::performRealOnlyForwardTransform (float* d) const noexcept | |||||
| perform (scratch, reinterpret_cast<Complex*> (d)); | perform (scratch, reinterpret_cast<Complex*> (d)); | ||||
| } | } | ||||
| void FFT::performRealOnlyInverseTransform (float* d) const noexcept | |||||
| 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. | // This can only be called on an FFT object that was created to do inverse transforms. | ||||
| jassert (config->inverse); | jassert (config->inverse); | ||||
| Complex* const scratch = static_cast<Complex*> (alloca (16 + sizeof (Complex) * (size_t) size)); | |||||
| perform (reinterpret_cast<const Complex*> (d), scratch); | perform (reinterpret_cast<const Complex*> (d), scratch); | ||||
| const float scaleFactor = 1.0f / size; | const float scaleFactor = 1.0f / size; | ||||
| @@ -2,7 +2,7 @@ | |||||
| ============================================================================== | ============================================================================== | ||||
| This file is part of the JUCE library. | This file is part of the JUCE library. | ||||
| Copyright (c) 2013 - Raw Material Software Ltd. | |||||
| Copyright (c) 2015 - ROLI Ltd. | |||||
| Permission is granted to use this software under the terms of either: | Permission is granted to use this software under the terms of either: | ||||
| a) the GPL v2 (or any later version) | a) the GPL v2 (or any later version) | ||||
| @@ -84,9 +84,12 @@ public: | |||||
| int getSize() const noexcept { return size; } | int getSize() const noexcept { return size; } | ||||
| private: | private: | ||||
| struct FFTConfig; | |||||
| JUCE_PUBLIC_IN_DLL_BUILD (struct FFTConfig) | |||||
| ScopedPointer<FFTConfig> config; | ScopedPointer<FFTConfig> config; | ||||
| const int size; | const int size; | ||||
| void performRealOnlyForwardTransform (Complex*, float*) const noexcept; | |||||
| void performRealOnlyInverseTransform (Complex*, float*) const noexcept; | |||||
| JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (FFT) | JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (FFT) | ||||
| }; | }; | ||||
| @@ -2,7 +2,7 @@ | |||||
| ============================================================================== | ============================================================================== | ||||
| This file is part of the JUCE library. | This file is part of the JUCE library. | ||||
| Copyright (c) 2013 - Raw Material Software Ltd. | |||||
| Copyright (c) 2015 - ROLI Ltd. | |||||
| Permission is granted to use this software under the terms of either: | Permission is granted to use this software under the terms of either: | ||||
| a) the GPL v2 (or any later version) | a) the GPL v2 (or any later version) | ||||
| @@ -2,7 +2,7 @@ | |||||
| ============================================================================== | ============================================================================== | ||||
| This file is part of the JUCE library. | This file is part of the JUCE library. | ||||
| Copyright (c) 2013 - Raw Material Software Ltd. | |||||
| Copyright (c) 2015 - ROLI Ltd. | |||||
| Permission is granted to use this software under the terms of either: | Permission is granted to use this software under the terms of either: | ||||
| a) the GPL v2 (or any later version) | a) the GPL v2 (or any later version) | ||||
| @@ -2,7 +2,7 @@ | |||||
| ============================================================================== | ============================================================================== | ||||
| This file is part of the JUCE library. | This file is part of the JUCE library. | ||||
| Copyright (c) 2013 - Raw Material Software Ltd. | |||||
| Copyright (c) 2015 - ROLI Ltd. | |||||
| Permission is granted to use this software under the terms of either: | Permission is granted to use this software under the terms of either: | ||||
| a) the GPL v2 (or any later version) | a) the GPL v2 (or any later version) | ||||
| @@ -2,7 +2,7 @@ | |||||
| ============================================================================== | ============================================================================== | ||||
| This file is part of the JUCE library. | This file is part of the JUCE library. | ||||
| Copyright (c) 2013 - Raw Material Software Ltd. | |||||
| Copyright (c) 2015 - ROLI Ltd. | |||||
| Permission is granted to use this software under the terms of either: | Permission is granted to use this software under the terms of either: | ||||
| a) the GPL v2 (or any later version) | a) the GPL v2 (or any later version) | ||||
| @@ -2,7 +2,7 @@ | |||||
| ============================================================================== | ============================================================================== | ||||
| This file is part of the JUCE library. | This file is part of the JUCE library. | ||||
| Copyright (c) 2013 - Raw Material Software Ltd. | |||||
| Copyright (c) 2015 - ROLI Ltd. | |||||
| Permission is granted to use this software under the terms of either: | Permission is granted to use this software under the terms of either: | ||||
| a) the GPL v2 (or any later version) | a) the GPL v2 (or any later version) | ||||
| @@ -2,7 +2,7 @@ | |||||
| ============================================================================== | ============================================================================== | ||||
| This file is part of the JUCE library. | This file is part of the JUCE library. | ||||
| Copyright (c) 2013 - Raw Material Software Ltd. | |||||
| Copyright (c) 2015 - ROLI Ltd. | |||||
| Permission is granted to use this software under the terms of either: | Permission is granted to use this software under the terms of either: | ||||
| a) the GPL v2 (or any later version) | a) the GPL v2 (or any later version) | ||||
| @@ -40,6 +40,10 @@ | |||||
| #define JUCE_USE_SSE_INTRINSICS 0 | #define JUCE_USE_SSE_INTRINSICS 0 | ||||
| #endif | #endif | ||||
| #if JUCE_MINGW | |||||
| #define alloca __builtin_alloca | |||||
| #endif | |||||
| #ifndef JUCE_USE_SSE_INTRINSICS | #ifndef JUCE_USE_SSE_INTRINSICS | ||||
| #define JUCE_USE_SSE_INTRINSICS 1 | #define JUCE_USE_SSE_INTRINSICS 1 | ||||
| #endif | #endif | ||||
| @@ -2,7 +2,7 @@ | |||||
| ============================================================================== | ============================================================================== | ||||
| This file is part of the JUCE library. | This file is part of the JUCE library. | ||||
| Copyright (c) 2013 - Raw Material Software Ltd. | |||||
| Copyright (c) 2015 - ROLI Ltd. | |||||
| Permission is granted to use this software under the terms of either: | Permission is granted to use this software under the terms of either: | ||||
| a) the GPL v2 (or any later version) | a) the GPL v2 (or any later version) | ||||
| @@ -2,7 +2,7 @@ | |||||
| ============================================================================== | ============================================================================== | ||||
| This file is part of the JUCE library. | This file is part of the JUCE library. | ||||
| Copyright (c) 2013 - Raw Material Software Ltd. | |||||
| Copyright (c) 2015 - ROLI Ltd. | |||||
| Permission is granted to use this software under the terms of either: | Permission is granted to use this software under the terms of either: | ||||
| a) the GPL v2 (or any later version) | a) the GPL v2 (or any later version) | ||||
| @@ -2,7 +2,7 @@ | |||||
| ============================================================================== | ============================================================================== | ||||
| This file is part of the JUCE library. | This file is part of the JUCE library. | ||||
| Copyright (c) 2013 - Raw Material Software Ltd. | |||||
| Copyright (c) 2015 - ROLI Ltd. | |||||
| Permission is granted to use this software under the terms of either: | Permission is granted to use this software under the terms of either: | ||||
| a) the GPL v2 (or any later version) | a) the GPL v2 (or any later version) | ||||
| @@ -2,7 +2,7 @@ | |||||
| ============================================================================== | ============================================================================== | ||||
| This file is part of the JUCE library. | This file is part of the JUCE library. | ||||
| Copyright (c) 2013 - Raw Material Software Ltd. | |||||
| Copyright (c) 2015 - ROLI Ltd. | |||||
| Permission is granted to use this software under the terms of either: | Permission is granted to use this software under the terms of either: | ||||
| a) the GPL v2 (or any later version) | a) the GPL v2 (or any later version) | ||||
| @@ -2,7 +2,7 @@ | |||||
| ============================================================================== | ============================================================================== | ||||
| This file is part of the JUCE library. | This file is part of the JUCE library. | ||||
| Copyright (c) 2013 - Raw Material Software Ltd. | |||||
| Copyright (c) 2015 - ROLI Ltd. | |||||
| Permission is granted to use this software under the terms of either: | Permission is granted to use this software under the terms of either: | ||||
| a) the GPL v2 (or any later version) | a) the GPL v2 (or any later version) | ||||
| @@ -2,7 +2,7 @@ | |||||
| ============================================================================== | ============================================================================== | ||||
| This file is part of the JUCE library. | This file is part of the JUCE library. | ||||
| Copyright (c) 2013 - Raw Material Software Ltd. | |||||
| Copyright (c) 2015 - ROLI Ltd. | |||||
| Permission is granted to use this software under the terms of either: | Permission is granted to use this software under the terms of either: | ||||
| a) the GPL v2 (or any later version) | a) the GPL v2 (or any later version) | ||||
| @@ -81,7 +81,7 @@ void MidiKeyboardState::noteOnInternal (const int midiChannel, const int midiNo | |||||
| } | } | ||||
| } | } | ||||
| void MidiKeyboardState::noteOff (const int midiChannel, const int midiNoteNumber) | |||||
| void MidiKeyboardState::noteOff (const int midiChannel, const int midiNoteNumber, const float velocity) | |||||
| { | { | ||||
| const ScopedLock sl (lock); | const ScopedLock sl (lock); | ||||
| @@ -91,18 +91,18 @@ void MidiKeyboardState::noteOff (const int midiChannel, const int midiNoteNumber | |||||
| eventsToAdd.addEvent (MidiMessage::noteOff (midiChannel, midiNoteNumber), timeNow); | eventsToAdd.addEvent (MidiMessage::noteOff (midiChannel, midiNoteNumber), timeNow); | ||||
| eventsToAdd.clear (0, timeNow - 500); | eventsToAdd.clear (0, timeNow - 500); | ||||
| noteOffInternal (midiChannel, midiNoteNumber); | |||||
| noteOffInternal (midiChannel, midiNoteNumber, velocity); | |||||
| } | } | ||||
| } | } | ||||
| void MidiKeyboardState::noteOffInternal (const int midiChannel, const int midiNoteNumber) | |||||
| void MidiKeyboardState::noteOffInternal (const int midiChannel, const int midiNoteNumber, const float velocity) | |||||
| { | { | ||||
| if (isNoteOn (midiChannel, midiNoteNumber)) | if (isNoteOn (midiChannel, midiNoteNumber)) | ||||
| { | { | ||||
| noteStates [midiNoteNumber] &= ~(1 << (midiChannel - 1)); | noteStates [midiNoteNumber] &= ~(1 << (midiChannel - 1)); | ||||
| for (int i = listeners.size(); --i >= 0;) | for (int i = listeners.size(); --i >= 0;) | ||||
| listeners.getUnchecked(i)->handleNoteOff (this, midiChannel, midiNoteNumber); | |||||
| listeners.getUnchecked(i)->handleNoteOff (this, midiChannel, midiNoteNumber, velocity); | |||||
| } | } | ||||
| } | } | ||||
| @@ -118,7 +118,7 @@ void MidiKeyboardState::allNotesOff (const int midiChannel) | |||||
| else | else | ||||
| { | { | ||||
| for (int i = 0; i < 128; ++i) | for (int i = 0; i < 128; ++i) | ||||
| noteOff (midiChannel, i); | |||||
| noteOff (midiChannel, i, 0.0f); | |||||
| } | } | ||||
| } | } | ||||
| @@ -130,12 +130,12 @@ void MidiKeyboardState::processNextMidiEvent (const MidiMessage& message) | |||||
| } | } | ||||
| else if (message.isNoteOff()) | else if (message.isNoteOff()) | ||||
| { | { | ||||
| noteOffInternal (message.getChannel(), message.getNoteNumber()); | |||||
| noteOffInternal (message.getChannel(), message.getNoteNumber(), message.getFloatVelocity()); | |||||
| } | } | ||||
| else if (message.isAllNotesOff()) | else if (message.isAllNotesOff()) | ||||
| { | { | ||||
| for (int i = 0; i < 128; ++i) | for (int i = 0; i < 128; ++i) | ||||
| noteOffInternal (message.getChannel(), i); | |||||
| noteOffInternal (message.getChannel(), i, 0.0f); | |||||
| } | } | ||||
| } | } | ||||
| @@ -2,7 +2,7 @@ | |||||
| ============================================================================== | ============================================================================== | ||||
| This file is part of the JUCE library. | This file is part of the JUCE library. | ||||
| Copyright (c) 2013 - Raw Material Software Ltd. | |||||
| Copyright (c) 2015 - ROLI Ltd. | |||||
| Permission is granted to use this software under the terms of either: | Permission is granted to use this software under the terms of either: | ||||
| a) the GPL v2 (or any later version) | a) the GPL v2 (or any later version) | ||||
| @@ -64,7 +64,7 @@ public: | |||||
| careful not to block, and avoid any UI activity in the callback. | careful not to block, and avoid any UI activity in the callback. | ||||
| */ | */ | ||||
| virtual void handleNoteOff (MidiKeyboardState* source, | virtual void handleNoteOff (MidiKeyboardState* source, | ||||
| int midiChannel, int midiNoteNumber) = 0; | |||||
| int midiChannel, int midiNoteNumber, float velocity) = 0; | |||||
| }; | }; | ||||
| @@ -135,7 +135,7 @@ public: | |||||
| But if the note isn't acutally down for the given channel, this method will in fact do nothing. | But if the note isn't acutally down for the given channel, this method will in fact do nothing. | ||||
| */ | */ | ||||
| void noteOff (int midiChannel, int midiNoteNumber); | |||||
| void noteOff (int midiChannel, int midiNoteNumber, float velocity); | |||||
| /** This will turn off any currently-down notes for the given midi channel. | /** This will turn off any currently-down notes for the given midi channel. | ||||
| @@ -196,7 +196,7 @@ private: | |||||
| Array <MidiKeyboardStateListener*> listeners; | Array <MidiKeyboardStateListener*> listeners; | ||||
| void noteOnInternal (int midiChannel, int midiNoteNumber, float velocity); | void noteOnInternal (int midiChannel, int midiNoteNumber, float velocity); | ||||
| void noteOffInternal (int midiChannel, int midiNoteNumber); | |||||
| void noteOffInternal (int midiChannel, int midiNoteNumber, float velocity); | |||||
| JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (MidiKeyboardState) | JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (MidiKeyboardState) | ||||
| }; | }; | ||||
| @@ -2,7 +2,7 @@ | |||||
| ============================================================================== | ============================================================================== | ||||
| This file is part of the JUCE library. | This file is part of the JUCE library. | ||||
| Copyright (c) 2013 - Raw Material Software Ltd. | |||||
| Copyright (c) 2015 - ROLI Ltd. | |||||
| Permission is granted to use this software under the terms of either: | Permission is granted to use this software under the terms of either: | ||||
| a) the GPL v2 (or any later version) | a) the GPL v2 (or any later version) | ||||
| @@ -33,6 +33,11 @@ namespace MidiHelpers | |||||
| { | { | ||||
| return (uint8) jlimit (0, 127, v); | return (uint8) jlimit (0, 127, v); | ||||
| } | } | ||||
| inline uint8 floatVelocityToByte (const float v) noexcept | |||||
| { | |||||
| return validVelocity (roundToInt (v * 127.0f)); | |||||
| } | |||||
| } | } | ||||
| //============================================================================== | //============================================================================== | ||||
| @@ -386,7 +391,7 @@ float MidiMessage::getFloatVelocity() const noexcept | |||||
| void MidiMessage::setVelocity (const float newVelocity) noexcept | void MidiMessage::setVelocity (const float newVelocity) noexcept | ||||
| { | { | ||||
| if (isNoteOnOrOff()) | if (isNoteOnOrOff()) | ||||
| getData()[2] = MidiHelpers::validVelocity (roundToInt (newVelocity * 127.0f)); | |||||
| getData()[2] = MidiHelpers::floatVelocityToByte (newVelocity); | |||||
| } | } | ||||
| void MidiMessage::multiplyVelocity (const float scaleFactor) noexcept | void MidiMessage::multiplyVelocity (const float scaleFactor) noexcept | ||||
| @@ -522,11 +527,6 @@ MidiMessage MidiMessage::controllerEvent (const int channel, const int controlle | |||||
| controllerType & 127, value & 127); | controllerType & 127, value & 127); | ||||
| } | } | ||||
| MidiMessage MidiMessage::noteOn (const int channel, const int noteNumber, const float velocity) noexcept | |||||
| { | |||||
| return noteOn (channel, noteNumber, (uint8) (velocity * 127.0f + 0.5f)); | |||||
| } | |||||
| MidiMessage MidiMessage::noteOn (const int channel, const int noteNumber, const uint8 velocity) noexcept | MidiMessage MidiMessage::noteOn (const int channel, const int noteNumber, const uint8 velocity) noexcept | ||||
| { | { | ||||
| jassert (channel > 0 && channel <= 16); | jassert (channel > 0 && channel <= 16); | ||||
| @@ -536,6 +536,11 @@ MidiMessage MidiMessage::noteOn (const int channel, const int noteNumber, const | |||||
| noteNumber & 127, MidiHelpers::validVelocity (velocity)); | noteNumber & 127, MidiHelpers::validVelocity (velocity)); | ||||
| } | } | ||||
| MidiMessage MidiMessage::noteOn (const int channel, const int noteNumber, const float velocity) noexcept | |||||
| { | |||||
| return noteOn (channel, noteNumber, MidiHelpers::floatVelocityToByte (velocity)); | |||||
| } | |||||
| MidiMessage MidiMessage::noteOff (const int channel, const int noteNumber, uint8 velocity) noexcept | MidiMessage MidiMessage::noteOff (const int channel, const int noteNumber, uint8 velocity) noexcept | ||||
| { | { | ||||
| jassert (channel > 0 && channel <= 16); | jassert (channel > 0 && channel <= 16); | ||||
| @@ -545,6 +550,19 @@ MidiMessage MidiMessage::noteOff (const int channel, const int noteNumber, uint8 | |||||
| noteNumber & 127, MidiHelpers::validVelocity (velocity)); | noteNumber & 127, MidiHelpers::validVelocity (velocity)); | ||||
| } | } | ||||
| MidiMessage MidiMessage::noteOff (const int channel, const int noteNumber, float velocity) noexcept | |||||
| { | |||||
| return noteOff (channel, noteNumber, MidiHelpers::floatVelocityToByte (velocity)); | |||||
| } | |||||
| MidiMessage MidiMessage::noteOff (const int channel, const int noteNumber) noexcept | |||||
| { | |||||
| jassert (channel > 0 && channel <= 16); | |||||
| jassert (isPositiveAndBelow (noteNumber, (int) 128)); | |||||
| return MidiMessage (MidiHelpers::initialByte (0x80, channel), noteNumber & 127, 0); | |||||
| } | |||||
| MidiMessage MidiMessage::allNotesOff (const int channel) noexcept | MidiMessage MidiMessage::allNotesOff (const int channel) noexcept | ||||
| { | { | ||||
| return controllerEvent (channel, 123, 0); | return controllerEvent (channel, 123, 0); | ||||
| @@ -2,7 +2,7 @@ | |||||
| ============================================================================== | ============================================================================== | ||||
| This file is part of the JUCE library. | This file is part of the JUCE library. | ||||
| Copyright (c) 2013 - Raw Material Software Ltd. | |||||
| Copyright (c) 2015 - ROLI Ltd. | |||||
| Permission is granted to use this software under the terms of either: | Permission is granted to use this software under the terms of either: | ||||
| a) the GPL v2 (or any later version) | a) the GPL v2 (or any later version) | ||||
| @@ -234,6 +234,15 @@ public: | |||||
| */ | */ | ||||
| bool isNoteOff (bool returnTrueForNoteOnVelocity0 = true) const noexcept; | bool isNoteOff (bool returnTrueForNoteOnVelocity0 = true) const noexcept; | ||||
| /** Creates a key-up message. | |||||
| @param channel the midi channel, in the range 1 to 16 | |||||
| @param noteNumber the key number, 0 to 127 | |||||
| @param velocity in the range 0 to 1.0 | |||||
| @see isNoteOff | |||||
| */ | |||||
| static MidiMessage noteOff (int channel, int noteNumber, float velocity) noexcept; | |||||
| /** Creates a key-up message. | /** Creates a key-up message. | ||||
| @param channel the midi channel, in the range 1 to 16 | @param channel the midi channel, in the range 1 to 16 | ||||
| @@ -241,7 +250,15 @@ public: | |||||
| @param velocity in the range 0 to 127 | @param velocity in the range 0 to 127 | ||||
| @see isNoteOff | @see isNoteOff | ||||
| */ | */ | ||||
| static MidiMessage noteOff (int channel, int noteNumber, uint8 velocity = 0) noexcept; | |||||
| static MidiMessage noteOff (int channel, int noteNumber, uint8 velocity) noexcept; | |||||
| /** Creates a key-up message. | |||||
| @param channel the midi channel, in the range 1 to 16 | |||||
| @param noteNumber the key number, 0 to 127 | |||||
| @see isNoteOff | |||||
| */ | |||||
| static MidiMessage noteOff (int channel, int noteNumber) noexcept; | |||||
| /** Returns true if this message is a 'key-down' or 'key-up' event. | /** Returns true if this message is a 'key-down' or 'key-up' event. | ||||
| @@ -2,7 +2,7 @@ | |||||
| ============================================================================== | ============================================================================== | ||||
| This file is part of the JUCE library. | This file is part of the JUCE library. | ||||
| Copyright (c) 2013 - Raw Material Software Ltd. | |||||
| Copyright (c) 2015 - ROLI Ltd. | |||||
| Permission is granted to use this software under the terms of either: | Permission is granted to use this software under the terms of either: | ||||
| a) the GPL v2 (or any later version) | a) the GPL v2 (or any later version) | ||||
| @@ -2,7 +2,7 @@ | |||||
| ============================================================================== | ============================================================================== | ||||
| This file is part of the JUCE library. | This file is part of the JUCE library. | ||||
| Copyright (c) 2013 - Raw Material Software Ltd. | |||||
| Copyright (c) 2015 - ROLI Ltd. | |||||
| Permission is granted to use this software under the terms of either: | Permission is granted to use this software under the terms of either: | ||||
| a) the GPL v2 (or any later version) | a) the GPL v2 (or any later version) | ||||
| @@ -2,7 +2,7 @@ | |||||
| ============================================================================== | ============================================================================== | ||||
| This file is part of the JUCE library. | This file is part of the JUCE library. | ||||
| Copyright (c) 2013 - Raw Material Software Ltd. | |||||
| Copyright (c) 2015 - ROLI Ltd. | |||||
| Permission is granted to use this software under the terms of either: | Permission is granted to use this software under the terms of either: | ||||
| a) the GPL v2 (or any later version) | a) the GPL v2 (or any later version) | ||||
| @@ -2,7 +2,7 @@ | |||||
| ============================================================================== | ============================================================================== | ||||
| This file is part of the JUCE library. | This file is part of the JUCE library. | ||||
| Copyright (c) 2013 - Raw Material Software Ltd. | |||||
| Copyright (c) 2015 - ROLI Ltd. | |||||
| Permission is granted to use this software under the terms of either: | Permission is granted to use this software under the terms of either: | ||||
| a) the GPL v2 (or any later version) | a) the GPL v2 (or any later version) | ||||
| @@ -2,7 +2,7 @@ | |||||
| ============================================================================== | ============================================================================== | ||||
| This file is part of the JUCE library. | This file is part of the JUCE library. | ||||
| Copyright (c) 2013 - Raw Material Software Ltd. | |||||
| Copyright (c) 2015 - ROLI Ltd. | |||||
| Permission is granted to use this software under the terms of either: | Permission is granted to use this software under the terms of either: | ||||
| a) the GPL v2 (or any later version) | a) the GPL v2 (or any later version) | ||||
| @@ -2,7 +2,7 @@ | |||||
| ============================================================================== | ============================================================================== | ||||
| This file is part of the JUCE library. | This file is part of the JUCE library. | ||||
| Copyright (c) 2013 - Raw Material Software Ltd. | |||||
| Copyright (c) 2015 - ROLI Ltd. | |||||
| Permission is granted to use this software under the terms of either: | Permission is granted to use this software under the terms of either: | ||||
| a) the GPL v2 (or any later version) | a) the GPL v2 (or any later version) | ||||
| @@ -2,7 +2,7 @@ | |||||
| ============================================================================== | ============================================================================== | ||||
| This file is part of the JUCE library. | This file is part of the JUCE library. | ||||
| Copyright (c) 2013 - Raw Material Software Ltd. | |||||
| Copyright (c) 2015 - ROLI Ltd. | |||||
| Permission is granted to use this software under the terms of either: | Permission is granted to use this software under the terms of either: | ||||
| a) the GPL v2 (or any later version) | a) the GPL v2 (or any later version) | ||||
| @@ -2,7 +2,7 @@ | |||||
| ============================================================================== | ============================================================================== | ||||
| This file is part of the JUCE library. | This file is part of the JUCE library. | ||||
| Copyright (c) 2013 - Raw Material Software Ltd. | |||||
| Copyright (c) 2015 - ROLI Ltd. | |||||
| Permission is granted to use this software under the terms of either: | Permission is granted to use this software under the terms of either: | ||||
| a) the GPL v2 (or any later version) | a) the GPL v2 (or any later version) | ||||
| @@ -2,7 +2,7 @@ | |||||
| ============================================================================== | ============================================================================== | ||||
| This file is part of the JUCE library. | This file is part of the JUCE library. | ||||
| Copyright (c) 2013 - Raw Material Software Ltd. | |||||
| Copyright (c) 2015 - ROLI Ltd. | |||||
| Permission is granted to use this software under the terms of either: | Permission is granted to use this software under the terms of either: | ||||
| a) the GPL v2 (or any later version) | a) the GPL v2 (or any later version) | ||||
| @@ -2,7 +2,7 @@ | |||||
| ============================================================================== | ============================================================================== | ||||
| This file is part of the JUCE library. | This file is part of the JUCE library. | ||||
| Copyright (c) 2013 - Raw Material Software Ltd. | |||||
| Copyright (c) 2015 - ROLI Ltd. | |||||
| Permission is granted to use this software under the terms of either: | Permission is granted to use this software under the terms of either: | ||||
| a) the GPL v2 (or any later version) | a) the GPL v2 (or any later version) | ||||
| @@ -2,7 +2,7 @@ | |||||
| ============================================================================== | ============================================================================== | ||||
| This file is part of the JUCE library. | This file is part of the JUCE library. | ||||
| Copyright (c) 2013 - Raw Material Software Ltd. | |||||
| Copyright (c) 2015 - ROLI Ltd. | |||||
| Permission is granted to use this software under the terms of either: | Permission is granted to use this software under the terms of either: | ||||
| a) the GPL v2 (or any later version) | a) the GPL v2 (or any later version) | ||||
| @@ -2,7 +2,7 @@ | |||||
| ============================================================================== | ============================================================================== | ||||
| This file is part of the JUCE library. | This file is part of the JUCE library. | ||||
| Copyright (c) 2013 - Raw Material Software Ltd. | |||||
| Copyright (c) 2015 - ROLI Ltd. | |||||
| Permission is granted to use this software under the terms of either: | Permission is granted to use this software under the terms of either: | ||||
| a) the GPL v2 (or any later version) | a) the GPL v2 (or any later version) | ||||
| @@ -2,7 +2,7 @@ | |||||
| ============================================================================== | ============================================================================== | ||||
| This file is part of the JUCE library. | This file is part of the JUCE library. | ||||
| Copyright (c) 2013 - Raw Material Software Ltd. | |||||
| Copyright (c) 2015 - ROLI Ltd. | |||||
| Permission is granted to use this software under the terms of either: | Permission is granted to use this software under the terms of either: | ||||
| a) the GPL v2 (or any later version) | a) the GPL v2 (or any later version) | ||||
| @@ -2,7 +2,7 @@ | |||||
| ============================================================================== | ============================================================================== | ||||
| This file is part of the JUCE library. | This file is part of the JUCE library. | ||||
| Copyright (c) 2013 - Raw Material Software Ltd. | |||||
| Copyright (c) 2015 - ROLI Ltd. | |||||
| Permission is granted to use this software under the terms of either: | Permission is granted to use this software under the terms of either: | ||||
| a) the GPL v2 (or any later version) | a) the GPL v2 (or any later version) | ||||
| @@ -2,7 +2,7 @@ | |||||
| ============================================================================== | ============================================================================== | ||||
| This file is part of the JUCE library. | This file is part of the JUCE library. | ||||
| Copyright (c) 2013 - Raw Material Software Ltd. | |||||
| Copyright (c) 2015 - ROLI Ltd. | |||||
| Permission is granted to use this software under the terms of either: | Permission is granted to use this software under the terms of either: | ||||
| a) the GPL v2 (or any later version) | a) the GPL v2 (or any later version) | ||||
| @@ -2,7 +2,7 @@ | |||||
| ============================================================================== | ============================================================================== | ||||
| This file is part of the JUCE library. | This file is part of the JUCE library. | ||||
| Copyright (c) 2013 - Raw Material Software Ltd. | |||||
| Copyright (c) 2015 - ROLI Ltd. | |||||
| Permission is granted to use this software under the terms of either: | Permission is granted to use this software under the terms of either: | ||||
| a) the GPL v2 (or any later version) | a) the GPL v2 (or any later version) | ||||
| @@ -2,7 +2,7 @@ | |||||
| ============================================================================== | ============================================================================== | ||||
| This file is part of the JUCE library. | This file is part of the JUCE library. | ||||
| Copyright (c) 2013 - Raw Material Software Ltd. | |||||
| Copyright (c) 2015 - ROLI Ltd. | |||||
| Permission is granted to use this software under the terms of either: | Permission is granted to use this software under the terms of either: | ||||
| a) the GPL v2 (or any later version) | a) the GPL v2 (or any later version) | ||||
| @@ -2,7 +2,7 @@ | |||||
| ============================================================================== | ============================================================================== | ||||
| This file is part of the JUCE library. | This file is part of the JUCE library. | ||||
| Copyright (c) 2013 - Raw Material Software Ltd. | |||||
| Copyright (c) 2015 - ROLI Ltd. | |||||
| Permission is granted to use this software under the terms of either: | Permission is granted to use this software under the terms of either: | ||||
| a) the GPL v2 (or any later version) | a) the GPL v2 (or any later version) | ||||
| @@ -2,7 +2,7 @@ | |||||
| ============================================================================== | ============================================================================== | ||||
| This file is part of the JUCE library. | This file is part of the JUCE library. | ||||
| Copyright (c) 2013 - Raw Material Software Ltd. | |||||
| Copyright (c) 2015 - ROLI Ltd. | |||||
| Permission is granted to use this software under the terms of either: | Permission is granted to use this software under the terms of either: | ||||
| a) the GPL v2 (or any later version) | a) the GPL v2 (or any later version) | ||||
| @@ -2,7 +2,7 @@ | |||||
| ============================================================================== | ============================================================================== | ||||
| This file is part of the JUCE library. | This file is part of the JUCE library. | ||||
| Copyright (c) 2013 - Raw Material Software Ltd. | |||||
| Copyright (c) 2015 - ROLI Ltd. | |||||
| Permission is granted to use this software under the terms of either: | Permission is granted to use this software under the terms of either: | ||||
| a) the GPL v2 (or any later version) | a) the GPL v2 (or any later version) | ||||
| @@ -571,7 +571,6 @@ protected: | |||||
| int midiNoteNumber) const; | int midiNoteNumber) const; | ||||
| /** Starts a specified voice playing a particular sound. | /** Starts a specified voice playing a particular sound. | ||||
| You'll probably never need to call this, it's used internally by noteOn(), but | You'll probably never need to call this, it's used internally by noteOn(), but | ||||
| may be needed by subclasses for custom behaviours. | may be needed by subclasses for custom behaviours. | ||||
| */ | */ | ||||
| @@ -581,6 +580,13 @@ protected: | |||||
| int midiNoteNumber, | int midiNoteNumber, | ||||
| float velocity); | float velocity); | ||||
| /** Stops a given voice. | |||||
| You should never need to call this, it's used internally by noteOff, but is protected | |||||
| in case it's useful for some custom subclasses. It basically just calls through to | |||||
| SynthesiserVoice::stopNote(), and has some assertions to sanity-check a few things. | |||||
| */ | |||||
| void stopVoice (SynthesiserVoice*, float velocity, bool allowTailOff); | |||||
| /** Can be overridden to do custom handling of incoming midi events. */ | /** Can be overridden to do custom handling of incoming midi events. */ | ||||
| virtual void handleMidiEvent (const MidiMessage&); | virtual void handleMidiEvent (const MidiMessage&); | ||||
| @@ -592,8 +598,6 @@ private: | |||||
| bool shouldStealNotes; | bool shouldStealNotes; | ||||
| BigInteger sustainPedalsDown; | BigInteger sustainPedalsDown; | ||||
| void stopVoice (SynthesiserVoice*, float velocity, bool allowTailOff); | |||||
| #if JUCE_CATCH_DEPRECATED_CODE_MISUSE | #if JUCE_CATCH_DEPRECATED_CODE_MISUSE | ||||
| // Note the new parameters for these methods. | // Note the new parameters for these methods. | ||||
| virtual int findFreeVoice (const bool) const { return 0; } | virtual int findFreeVoice (const bool) const { return 0; } | ||||
| @@ -2,7 +2,7 @@ | |||||
| ============================================================================== | ============================================================================== | ||||
| This file is part of the JUCE library. | This file is part of the JUCE library. | ||||
| Copyright (c) 2013 - Raw Material Software Ltd. | |||||
| Copyright (c) 2015 - ROLI Ltd. | |||||
| Permission is granted to use this software under the terms of either: | Permission is granted to use this software under the terms of either: | ||||
| a) the GPL v2 (or any later version) | a) the GPL v2 (or any later version) | ||||
| @@ -2,7 +2,7 @@ | |||||
| ============================================================================== | ============================================================================== | ||||
| This file is part of the JUCE library. | This file is part of the JUCE library. | ||||
| Copyright (c) 2013 - Raw Material Software Ltd. | |||||
| Copyright (c) 2015 - ROLI Ltd. | |||||
| Permission is granted to use this software under the terms of either: | Permission is granted to use this software under the terms of either: | ||||
| a) the GPL v2 (or any later version) | a) the GPL v2 (or any later version) | ||||
| @@ -2,7 +2,7 @@ | |||||
| ============================================================================== | ============================================================================== | ||||
| This file is part of the JUCE library. | This file is part of the JUCE library. | ||||
| Copyright (c) 2013 - Raw Material Software Ltd. | |||||
| Copyright (c) 2015 - ROLI Ltd. | |||||
| Permission is granted to use this software under the terms of either: | Permission is granted to use this software under the terms of either: | ||||
| a) the GPL v2 (or any later version) | a) the GPL v2 (or any later version) | ||||
| @@ -2,7 +2,7 @@ | |||||
| ============================================================================== | ============================================================================== | ||||
| This file is part of the JUCE library. | This file is part of the JUCE library. | ||||
| Copyright (c) 2013 - Raw Material Software Ltd. | |||||
| Copyright (c) 2015 - ROLI Ltd. | |||||
| Permission is granted to use this software under the terms of either: | Permission is granted to use this software under the terms of either: | ||||
| a) the GPL v2 (or any later version) | a) the GPL v2 (or any later version) | ||||
| @@ -2,7 +2,7 @@ | |||||
| ============================================================================== | ============================================================================== | ||||
| This file is part of the JUCE library. | This file is part of the JUCE library. | ||||
| Copyright (c) 2013 - Raw Material Software Ltd. | |||||
| Copyright (c) 2015 - ROLI Ltd. | |||||
| Permission is granted to use this software under the terms of either: | Permission is granted to use this software under the terms of either: | ||||
| a) the GPL v2 (or any later version) | a) the GPL v2 (or any later version) | ||||
| @@ -2,7 +2,7 @@ | |||||
| ============================================================================== | ============================================================================== | ||||
| This file is part of the JUCE library. | This file is part of the JUCE library. | ||||
| Copyright (c) 2013 - Raw Material Software Ltd. | |||||
| Copyright (c) 2015 - ROLI Ltd. | |||||
| Permission is granted to use this software under the terms of either: | Permission is granted to use this software under the terms of either: | ||||
| a) the GPL v2 (or any later version) | a) the GPL v2 (or any later version) | ||||
| @@ -2,7 +2,7 @@ | |||||
| ============================================================================== | ============================================================================== | ||||
| This file is part of the JUCE library. | This file is part of the JUCE library. | ||||
| Copyright (c) 2013 - Raw Material Software Ltd. | |||||
| Copyright (c) 2015 - ROLI Ltd. | |||||
| Permission is granted to use this software under the terms of either: | Permission is granted to use this software under the terms of either: | ||||
| a) the GPL v2 (or any later version) | a) the GPL v2 (or any later version) | ||||
| @@ -2,7 +2,7 @@ | |||||
| ============================================================================== | ============================================================================== | ||||
| This file is part of the JUCE library. | This file is part of the JUCE library. | ||||
| Copyright (c) 2013 - Raw Material Software Ltd. | |||||
| Copyright (c) 2015 - ROLI Ltd. | |||||
| Permission is granted to use this software under the terms of either: | Permission is granted to use this software under the terms of either: | ||||
| a) the GPL v2 (or any later version) | a) the GPL v2 (or any later version) | ||||
| @@ -2,7 +2,7 @@ | |||||
| ============================================================================== | ============================================================================== | ||||
| This file is part of the JUCE library. | This file is part of the JUCE library. | ||||
| Copyright (c) 2013 - Raw Material Software Ltd. | |||||
| Copyright (c) 2015 - ROLI Ltd. | |||||
| Permission is granted to use this software under the terms of either: | Permission is granted to use this software under the terms of either: | ||||
| a) the GPL v2 (or any later version) | a) the GPL v2 (or any later version) | ||||
| @@ -2,7 +2,7 @@ | |||||
| ============================================================================== | ============================================================================== | ||||
| This file is part of the JUCE library. | This file is part of the JUCE library. | ||||
| Copyright (c) 2013 - Raw Material Software Ltd. | |||||
| Copyright (c) 2015 - ROLI Ltd. | |||||
| Permission is granted to use this software under the terms of either: | Permission is granted to use this software under the terms of either: | ||||
| a) the GPL v2 (or any later version) | a) the GPL v2 (or any later version) | ||||
| @@ -2,7 +2,7 @@ | |||||
| ============================================================================== | ============================================================================== | ||||
| This file is part of the JUCE library. | This file is part of the JUCE library. | ||||
| Copyright (c) 2013 - Raw Material Software Ltd. | |||||
| Copyright (c) 2015 - ROLI Ltd. | |||||
| Permission is granted to use this software under the terms of either: | Permission is granted to use this software under the terms of either: | ||||
| a) the GPL v2 (or any later version) | a) the GPL v2 (or any later version) | ||||
| @@ -2,7 +2,7 @@ | |||||
| ============================================================================== | ============================================================================== | ||||
| This file is part of the JUCE library. | This file is part of the JUCE library. | ||||
| Copyright (c) 2013 - Raw Material Software Ltd. | |||||
| Copyright (c) 2015 - ROLI Ltd. | |||||
| Permission is granted to use this software under the terms of either: | Permission is granted to use this software under the terms of either: | ||||
| a) the GPL v2 (or any later version) | a) the GPL v2 (or any later version) | ||||
| @@ -2,7 +2,7 @@ | |||||
| ============================================================================== | ============================================================================== | ||||
| This file is part of the JUCE library. | This file is part of the JUCE library. | ||||
| Copyright (c) 2013 - Raw Material Software Ltd. | |||||
| Copyright (c) 2015 - ROLI Ltd. | |||||
| Permission is granted to use this software under the terms of either: | Permission is granted to use this software under the terms of either: | ||||
| a) the GPL v2 (or any later version) | a) the GPL v2 (or any later version) | ||||
| @@ -2,7 +2,7 @@ | |||||
| ============================================================================== | ============================================================================== | ||||
| This file is part of the JUCE library. | This file is part of the JUCE library. | ||||
| Copyright (c) 2013 - Raw Material Software Ltd. | |||||
| Copyright (c) 2015 - ROLI Ltd. | |||||
| Permission is granted to use this software under the terms of either: | Permission is granted to use this software under the terms of either: | ||||
| a) the GPL v2 (or any later version) | a) the GPL v2 (or any later version) | ||||
| @@ -33,12 +33,12 @@ MidiMessageCollector::~MidiMessageCollector() | |||||
| } | } | ||||
| //============================================================================== | //============================================================================== | ||||
| void MidiMessageCollector::reset (const double sampleRate_) | |||||
| void MidiMessageCollector::reset (const double newSampleRate) | |||||
| { | { | ||||
| jassert (sampleRate_ > 0); | |||||
| jassert (newSampleRate > 0); | |||||
| const ScopedLock sl (midiCallbackLock); | const ScopedLock sl (midiCallbackLock); | ||||
| sampleRate = sampleRate_; | |||||
| sampleRate = newSampleRate; | |||||
| incomingMessages.clear(); | incomingMessages.clear(); | ||||
| lastCallbackTime = Time::getMillisecondCounterHiRes(); | lastCallbackTime = Time::getMillisecondCounterHiRes(); | ||||
| } | } | ||||
| @@ -139,9 +139,9 @@ void MidiMessageCollector::handleNoteOn (MidiKeyboardState*, int midiChannel, in | |||||
| addMessageToQueue (m); | addMessageToQueue (m); | ||||
| } | } | ||||
| void MidiMessageCollector::handleNoteOff (MidiKeyboardState*, int midiChannel, int midiNoteNumber) | |||||
| void MidiMessageCollector::handleNoteOff (MidiKeyboardState*, int midiChannel, int midiNoteNumber, float velocity) | |||||
| { | { | ||||
| MidiMessage m (MidiMessage::noteOff (midiChannel, midiNoteNumber)); | |||||
| MidiMessage m (MidiMessage::noteOff (midiChannel, midiNoteNumber, velocity)); | |||||
| m.setTimeStamp (Time::getMillisecondCounterHiRes() * 0.001); | m.setTimeStamp (Time::getMillisecondCounterHiRes() * 0.001); | ||||
| addMessageToQueue (m); | addMessageToQueue (m); | ||||
| @@ -2,7 +2,7 @@ | |||||
| ============================================================================== | ============================================================================== | ||||
| This file is part of the JUCE library. | This file is part of the JUCE library. | ||||
| Copyright (c) 2013 - Raw Material Software Ltd. | |||||
| Copyright (c) 2015 - ROLI Ltd. | |||||
| Permission is granted to use this software under the terms of either: | Permission is granted to use this software under the terms of either: | ||||
| a) the GPL v2 (or any later version) | a) the GPL v2 (or any later version) | ||||
| @@ -86,7 +86,7 @@ public: | |||||
| /** @internal */ | /** @internal */ | ||||
| void handleNoteOn (MidiKeyboardState*, int midiChannel, int midiNoteNumber, float velocity) override; | void handleNoteOn (MidiKeyboardState*, int midiChannel, int midiNoteNumber, float velocity) override; | ||||
| /** @internal */ | /** @internal */ | ||||
| void handleNoteOff (MidiKeyboardState*, int midiChannel, int midiNoteNumber) override; | |||||
| void handleNoteOff (MidiKeyboardState*, int midiChannel, int midiNoteNumber, float velocity) override; | |||||
| /** @internal */ | /** @internal */ | ||||
| void handleIncomingMidiMessage (MidiInput*, const MidiMessage&) override; | void handleIncomingMidiMessage (MidiInput*, const MidiMessage&) override; | ||||
| @@ -2,7 +2,7 @@ | |||||
| ============================================================================== | ============================================================================== | ||||
| This file is part of the JUCE library. | This file is part of the JUCE library. | ||||
| Copyright (c) 2013 - Raw Material Software Ltd. | |||||
| Copyright (c) 2015 - ROLI Ltd. | |||||
| Permission is granted to use this software under the terms of either: | Permission is granted to use this software under the terms of either: | ||||
| a) the GPL v2 (or any later version) | a) the GPL v2 (or any later version) | ||||
| @@ -32,10 +32,11 @@ struct MidiOutput::PendingMessage | |||||
| PendingMessage* next; | PendingMessage* next; | ||||
| }; | }; | ||||
| MidiOutput::MidiOutput() | |||||
| MidiOutput::MidiOutput(const String& midiName) | |||||
| : Thread ("midi out"), | : Thread ("midi out"), | ||||
| internal (nullptr), | internal (nullptr), | ||||
| firstMessage (nullptr) | |||||
| firstMessage (nullptr), | |||||
| name (midiName) | |||||
| { | { | ||||
| } | } | ||||
| @@ -2,7 +2,7 @@ | |||||
| ============================================================================== | ============================================================================== | ||||
| This file is part of the JUCE library. | This file is part of the JUCE library. | ||||
| Copyright (c) 2013 - Raw Material Software Ltd. | |||||
| Copyright (c) 2015 - ROLI Ltd. | |||||
| Permission is granted to use this software under the terms of either: | Permission is granted to use this software under the terms of either: | ||||
| a) the GPL v2 (or any later version) | a) the GPL v2 (or any later version) | ||||
| @@ -84,6 +84,9 @@ public: | |||||
| /** Destructor. */ | /** Destructor. */ | ||||
| ~MidiOutput(); | ~MidiOutput(); | ||||
| /** Returns the name of this device. */ | |||||
| const String& getName() const noexcept { return name; } | |||||
| /** Makes this device output a midi message. | /** Makes this device output a midi message. | ||||
| @see MidiMessage | @see MidiMessage | ||||
| */ | */ | ||||
| @@ -131,8 +134,9 @@ private: | |||||
| CriticalSection lock; | CriticalSection lock; | ||||
| struct PendingMessage; | struct PendingMessage; | ||||
| PendingMessage* firstMessage; | PendingMessage* firstMessage; | ||||
| String name; | |||||
| MidiOutput(); // 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) | ||||
| @@ -2,7 +2,7 @@ | |||||
| ============================================================================== | ============================================================================== | ||||
| This file is part of the JUCE library. | This file is part of the JUCE library. | ||||
| Copyright (c) 2013 - Raw Material Software Ltd. | |||||
| Copyright (c) 2015 - ROLI Ltd. | |||||
| Permission is granted to use this software under the terms of either: | Permission is granted to use this software under the terms of either: | ||||
| a) the GPL v2 (or any later version) | a) the GPL v2 (or any later version) | ||||
| @@ -2,7 +2,7 @@ | |||||
| ============================================================================== | ============================================================================== | ||||
| This file is part of the JUCE library. | This file is part of the JUCE library. | ||||
| Copyright (c) 2013 - Raw Material Software Ltd. | |||||
| Copyright (c) 2015 - ROLI Ltd. | |||||
| Permission is granted to use this software under the terms of either: | Permission is granted to use this software under the terms of either: | ||||
| a) the GPL v2 (or any later version) | a) the GPL v2 (or any later version) | ||||
| @@ -2,7 +2,7 @@ | |||||
| ============================================================================== | ============================================================================== | ||||
| This file is part of the JUCE library. | This file is part of the JUCE library. | ||||
| Copyright (c) 2013 - Raw Material Software Ltd. | |||||
| Copyright (c) 2015 - ROLI Ltd. | |||||
| Permission is granted to use this software under the terms of either: | Permission is granted to use this software under the terms of either: | ||||
| a) the GPL v2 (or any later version) | a) the GPL v2 (or any later version) | ||||
| @@ -2,7 +2,7 @@ | |||||
| ============================================================================== | ============================================================================== | ||||
| This file is part of the JUCE library. | This file is part of the JUCE library. | ||||
| Copyright (c) 2013 - Raw Material Software Ltd. | |||||
| Copyright (c) 2015 - ROLI Ltd. | |||||
| Permission is granted to use this software under the terms of either: | Permission is granted to use this software under the terms of either: | ||||
| a) the GPL v2 (or any later version) | a) the GPL v2 (or any later version) | ||||
| @@ -2,7 +2,7 @@ | |||||
| ============================================================================== | ============================================================================== | ||||
| This file is part of the JUCE library. | This file is part of the JUCE library. | ||||
| Copyright (c) 2013 - Raw Material Software Ltd. | |||||
| Copyright (c) 2015 - ROLI Ltd. | |||||
| Permission is granted to use this software under the terms of either: | Permission is granted to use this software under the terms of either: | ||||
| a) the GPL v2 (or any later version) | a) the GPL v2 (or any later version) | ||||
| @@ -2,7 +2,7 @@ | |||||
| ============================================================================== | ============================================================================== | ||||
| This file is part of the JUCE library. | This file is part of the JUCE library. | ||||
| Copyright (c) 2013 - Raw Material Software Ltd. | |||||
| Copyright (c) 2015 - ROLI Ltd. | |||||
| Permission is granted to use this software under the terms of either: | Permission is granted to use this software under the terms of either: | ||||
| a) the GPL v2 (or any later version) | a) the GPL v2 (or any later version) | ||||
| @@ -2,7 +2,7 @@ | |||||
| ============================================================================== | ============================================================================== | ||||
| This file is part of the JUCE library. | This file is part of the JUCE library. | ||||
| Copyright (c) 2013 - Raw Material Software Ltd. | |||||
| Copyright (c) 2015 - ROLI Ltd. | |||||
| Permission is granted to use this software under the terms of either: | Permission is granted to use this software under the terms of either: | ||||
| a) the GPL v2 (or any later version) | a) the GPL v2 (or any later version) | ||||
| @@ -2,7 +2,7 @@ | |||||
| ============================================================================== | ============================================================================== | ||||
| This file is part of the JUCE library. | This file is part of the JUCE library. | ||||
| Copyright (c) 2013 - Raw Material Software Ltd. | |||||
| Copyright (c) 2015 - ROLI Ltd. | |||||
| Permission is granted to use this software under the terms of either: | Permission is granted to use this software under the terms of either: | ||||
| a) the GPL v2 (or any later version) | a) the GPL v2 (or any later version) | ||||
| @@ -2,7 +2,7 @@ | |||||
| ============================================================================== | ============================================================================== | ||||
| This file is part of the JUCE library. | This file is part of the JUCE library. | ||||
| Copyright (c) 2013 - Raw Material Software Ltd. | |||||
| Copyright (c) 2015 - ROLI Ltd. | |||||
| Permission is granted to use this software under the terms of either: | Permission is granted to use this software under the terms of either: | ||||
| a) the GPL v2 (or any later version) | a) the GPL v2 (or any later version) | ||||
| @@ -497,7 +497,7 @@ MidiOutput* MidiOutput::openDevice (int deviceIndex) | |||||
| if (port.isValid()) | if (port.isValid()) | ||||
| { | { | ||||
| newDevice = new MidiOutput(); | |||||
| newDevice = new MidiOutput (devices [deviceIndex]); | |||||
| newDevice->internal = new MidiOutputDevice (newDevice, port); | newDevice->internal = new MidiOutputDevice (newDevice, port); | ||||
| } | } | ||||
| @@ -512,7 +512,7 @@ MidiOutput* MidiOutput::createNewDevice (const String& deviceName) | |||||
| if (port.isValid()) | if (port.isValid()) | ||||
| { | { | ||||
| newDevice = new MidiOutput(); | |||||
| newDevice = new MidiOutput (deviceName); | |||||
| newDevice->internal = new MidiOutputDevice (newDevice, port); | newDevice->internal = new MidiOutputDevice (newDevice, port); | ||||
| } | } | ||||
| @@ -2,7 +2,7 @@ | |||||
| ============================================================================== | ============================================================================== | ||||
| This file is part of the JUCE library. | This file is part of the JUCE library. | ||||
| Copyright (c) 2013 - Raw Material Software Ltd. | |||||
| Copyright (c) 2015 - ROLI Ltd. | |||||
| Permission is granted to use this software under the terms of either: | Permission is granted to use this software under the terms of either: | ||||
| a) the GPL v2 (or any later version) | a) the GPL v2 (or any later version) | ||||
| @@ -2,7 +2,7 @@ | |||||
| ============================================================================== | ============================================================================== | ||||
| This file is part of the JUCE library. | This file is part of the JUCE library. | ||||
| Copyright (c) 2013 - Raw Material Software Ltd. | |||||
| Copyright (c) 2015 - ROLI Ltd. | |||||
| Permission is granted to use this software under the terms of either: | Permission is granted to use this software under the terms of either: | ||||
| a) the GPL v2 (or any later version) | a) the GPL v2 (or any later version) | ||||
| @@ -2,7 +2,7 @@ | |||||
| ============================================================================== | ============================================================================== | ||||
| This file is part of the JUCE library. | This file is part of the JUCE library. | ||||
| Copyright (c) 2013 - Raw Material Software Ltd. | |||||
| Copyright (c) 2015 - ROLI Ltd. | |||||
| Permission is granted to use this software under the terms of either: | Permission is granted to use this software under the terms of either: | ||||
| a) the GPL v2 (or any later version) | a) the GPL v2 (or any later version) | ||||
| @@ -28,10 +28,15 @@ | |||||
| #define JUCE_COREAUDIOLOG(a) | #define JUCE_COREAUDIOLOG(a) | ||||
| #endif | #endif | ||||
| #ifdef __clang__ | |||||
| #pragma clang diagnostic push | |||||
| #pragma clang diagnostic ignored "-Wnonnull" // aovid some spurious 10.11 SDK warnings | |||||
| #endif | |||||
| //============================================================================== | //============================================================================== | ||||
| struct SystemVol | struct SystemVol | ||||
| { | { | ||||
| SystemVol (AudioObjectPropertySelector selector) | |||||
| SystemVol (AudioObjectPropertySelector selector) noexcept | |||||
| : outputDeviceID (kAudioObjectUnknown) | : outputDeviceID (kAudioObjectUnknown) | ||||
| { | { | ||||
| addr.mScope = kAudioObjectPropertyScopeGlobal; | addr.mScope = kAudioObjectPropertyScopeGlobal; | ||||
| @@ -56,7 +61,7 @@ struct SystemVol | |||||
| } | } | ||||
| } | } | ||||
| float getGain() | |||||
| float getGain() const noexcept | |||||
| { | { | ||||
| Float32 gain = 0; | Float32 gain = 0; | ||||
| @@ -70,7 +75,7 @@ struct SystemVol | |||||
| return (float) gain; | return (float) gain; | ||||
| } | } | ||||
| bool setGain (float gain) | |||||
| bool setGain (float gain) const noexcept | |||||
| { | { | ||||
| if (outputDeviceID != kAudioObjectUnknown && canSetVolume()) | if (outputDeviceID != kAudioObjectUnknown && canSetVolume()) | ||||
| { | { | ||||
| @@ -84,7 +89,7 @@ struct SystemVol | |||||
| return false; | return false; | ||||
| } | } | ||||
| bool isMuted() | |||||
| bool isMuted() const noexcept | |||||
| { | { | ||||
| UInt32 muted = 0; | UInt32 muted = 0; | ||||
| @@ -98,7 +103,7 @@ struct SystemVol | |||||
| return muted != 0; | return muted != 0; | ||||
| } | } | ||||
| bool setMuted (bool mute) | |||||
| bool setMuted (bool mute) const noexcept | |||||
| { | { | ||||
| if (outputDeviceID != kAudioObjectUnknown && canSetVolume()) | if (outputDeviceID != kAudioObjectUnknown && canSetVolume()) | ||||
| { | { | ||||
| @@ -116,7 +121,7 @@ private: | |||||
| AudioDeviceID outputDeviceID; | AudioDeviceID outputDeviceID; | ||||
| AudioObjectPropertyAddress addr; | AudioObjectPropertyAddress addr; | ||||
| bool canSetVolume() | |||||
| bool canSetVolume() const noexcept | |||||
| { | { | ||||
| Boolean isSettable = NO; | Boolean isSettable = NO; | ||||
| return AudioHardwareServiceIsPropertySettable (outputDeviceID, &addr, &isSettable) == noErr | return AudioHardwareServiceIsPropertySettable (outputDeviceID, &addr, &isSettable) == noErr | ||||
| @@ -124,6 +129,10 @@ private: | |||||
| } | } | ||||
| }; | }; | ||||
| #ifdef __clang__ | |||||
| #pragma clang diagnostic pop | |||||
| #endif | |||||
| #define JUCE_SYSTEMAUDIOVOL_IMPLEMENTED 1 | #define JUCE_SYSTEMAUDIOVOL_IMPLEMENTED 1 | ||||
| float JUCE_CALLTYPE SystemAudioVolume::getGain() { return SystemVol (kAudioHardwareServiceDeviceProperty_VirtualMasterVolume).getGain(); } | float JUCE_CALLTYPE SystemAudioVolume::getGain() { return SystemVol (kAudioHardwareServiceDeviceProperty_VirtualMasterVolume).getGain(); } | ||||
| bool JUCE_CALLTYPE SystemAudioVolume::setGain (float gain) { return SystemVol (kAudioHardwareServiceDeviceProperty_VirtualMasterVolume).setGain (gain); } | bool JUCE_CALLTYPE SystemAudioVolume::setGain (float gain) { return SystemVol (kAudioHardwareServiceDeviceProperty_VirtualMasterVolume).setGain (gain); } | ||||
| @@ -2,7 +2,7 @@ | |||||
| ============================================================================== | ============================================================================== | ||||
| This file is part of the JUCE library. | This file is part of the JUCE library. | ||||
| Copyright (c) 2013 - Raw Material Software Ltd. | |||||
| Copyright (c) 2015 - ROLI Ltd. | |||||
| Permission is granted to use this software under the terms of either: | Permission is granted to use this software under the terms of either: | ||||
| a) the GPL v2 (or any later version) | a) the GPL v2 (or any later version) | ||||
| @@ -332,10 +332,11 @@ MidiOutput* MidiOutput::openDevice (int index) | |||||
| { | { | ||||
| MIDIClientRef client = CoreMidiHelpers::getGlobalMidiClient(); | MIDIClientRef client = CoreMidiHelpers::getGlobalMidiClient(); | ||||
| MIDIPortRef port; | MIDIPortRef port; | ||||
| String deviceName = CoreMidiHelpers::getConnectedEndpointName (endPoint); | |||||
| if (client != 0 && CHECK_ERROR (MIDIOutputPortCreate (client, pname.cfString, &port))) | if (client != 0 && CHECK_ERROR (MIDIOutputPortCreate (client, pname.cfString, &port))) | ||||
| { | { | ||||
| mo = new MidiOutput(); | |||||
| mo = new MidiOutput (deviceName); | |||||
| mo->internal = new CoreMidiHelpers::MidiPortAndEndpoint (port, endPoint); | mo->internal = new CoreMidiHelpers::MidiPortAndEndpoint (port, endPoint); | ||||
| } | } | ||||
| } | } | ||||
| @@ -354,7 +355,7 @@ MidiOutput* MidiOutput::createNewDevice (const String& deviceName) | |||||
| if (client != 0 && CHECK_ERROR (MIDISourceCreate (client, name.cfString, &endPoint))) | if (client != 0 && CHECK_ERROR (MIDISourceCreate (client, name.cfString, &endPoint))) | ||||
| { | { | ||||
| MidiOutput* mo = new MidiOutput(); | |||||
| MidiOutput* mo = new MidiOutput (deviceName); | |||||
| mo->internal = new CoreMidiHelpers::MidiPortAndEndpoint (0, endPoint); | mo->internal = new CoreMidiHelpers::MidiPortAndEndpoint (0, endPoint); | ||||
| return mo; | return mo; | ||||
| } | } | ||||
| @@ -2,7 +2,7 @@ | |||||
| ============================================================================== | ============================================================================== | ||||
| This file is part of the JUCE library. | This file is part of the JUCE library. | ||||
| Copyright (c) 2013 - Raw Material Software Ltd. | |||||
| Copyright (c) 2015 - ROLI Ltd. | |||||
| Permission is granted to use this software under the terms of either: | Permission is granted to use this software under the terms of either: | ||||
| a) the GPL v2 (or any later version) | a) the GPL v2 (or any later version) | ||||
| @@ -2,7 +2,7 @@ | |||||
| ============================================================================== | ============================================================================== | ||||
| This file is part of the JUCE library. | This file is part of the JUCE library. | ||||
| Copyright (c) 2013 - Raw Material Software Ltd. | |||||
| Copyright (c) 2015 - ROLI Ltd. | |||||
| Permission is granted to use this software under the terms of either: | Permission is granted to use this software under the terms of either: | ||||
| a) the GPL v2 (or any later version) | a) the GPL v2 (or any later version) | ||||
| @@ -2,7 +2,7 @@ | |||||
| ============================================================================== | ============================================================================== | ||||
| This file is part of the JUCE library. | This file is part of the JUCE library. | ||||
| Copyright (c) 2013 - Raw Material Software Ltd. | |||||
| Copyright (c) 2015 - ROLI Ltd. | |||||
| Permission is granted to use this software under the terms of either: | Permission is granted to use this software under the terms of either: | ||||
| a) the GPL v2 (or any later version) | a) the GPL v2 (or any later version) | ||||
| @@ -2,7 +2,7 @@ | |||||
| ============================================================================== | ============================================================================== | ||||
| This file is part of the JUCE library. | This file is part of the JUCE library. | ||||
| Copyright (c) 2013 - Raw Material Software Ltd. | |||||
| Copyright (c) 2015 - ROLI Ltd. | |||||
| Permission is granted to use this software under the terms of either: | Permission is granted to use this software under the terms of either: | ||||
| a) the GPL v2 (or any later version) | a) the GPL v2 (or any later version) | ||||
| @@ -640,7 +640,7 @@ public: | |||||
| DWORD dwsize1 = 0; | DWORD dwsize1 = 0; | ||||
| DWORD dwsize2 = 0; | DWORD dwsize2 = 0; | ||||
| HRESULT hr = pInputBuffer->Lock ((DWORD) readOffset, (DWORD) bytesPerBuffer, | |||||
| hr = pInputBuffer->Lock ((DWORD) readOffset, (DWORD) bytesPerBuffer, | |||||
| (void**) &buf1, &dwsize1, | (void**) &buf1, &dwsize1, | ||||
| (void**) &buf2, &dwsize2, 0); | (void**) &buf2, &dwsize2, 0); | ||||
| @@ -753,9 +753,9 @@ public: | |||||
| String open (const BigInteger& inputChannels, | String open (const BigInteger& inputChannels, | ||||
| const BigInteger& outputChannels, | const BigInteger& outputChannels, | ||||
| double sampleRate, int bufferSizeSamples) override | |||||
| double newSampleRate, int newBufferSize) override | |||||
| { | { | ||||
| lastError = openDevice (inputChannels, outputChannels, sampleRate, bufferSizeSamples); | |||||
| lastError = openDevice (inputChannels, outputChannels, newSampleRate, newBufferSize); | |||||
| isOpen_ = lastError.isEmpty(); | isOpen_ = lastError.isEmpty(); | ||||
| return lastError; | return lastError; | ||||
| @@ -2,7 +2,7 @@ | |||||
| ============================================================================== | ============================================================================== | ||||
| This file is part of the JUCE library. | This file is part of the JUCE library. | ||||
| Copyright (c) 2013 - Raw Material Software Ltd. | |||||
| Copyright (c) 2015 - ROLI Ltd. | |||||
| Permission is granted to use this software under the terms of either: | Permission is granted to use this software under the terms of either: | ||||
| a) the GPL v2 (or any later version) | a) the GPL v2 (or any later version) | ||||
| @@ -143,37 +143,37 @@ private: | |||||
| public: | public: | ||||
| MidiHeader() {} | MidiHeader() {} | ||||
| void prepare (HMIDIIN deviceHandle) | |||||
| void prepare (HMIDIIN device) | |||||
| { | { | ||||
| zerostruct (hdr); | zerostruct (hdr); | ||||
| hdr.lpData = data; | hdr.lpData = data; | ||||
| hdr.dwBufferLength = (DWORD) numElementsInArray (data); | hdr.dwBufferLength = (DWORD) numElementsInArray (data); | ||||
| midiInPrepareHeader (deviceHandle, &hdr, sizeof (hdr)); | |||||
| midiInPrepareHeader (device, &hdr, sizeof (hdr)); | |||||
| } | } | ||||
| void unprepare (HMIDIIN deviceHandle) | |||||
| void unprepare (HMIDIIN device) | |||||
| { | { | ||||
| if ((hdr.dwFlags & WHDR_DONE) != 0) | if ((hdr.dwFlags & WHDR_DONE) != 0) | ||||
| { | { | ||||
| int c = 10; | int c = 10; | ||||
| while (--c >= 0 && midiInUnprepareHeader (deviceHandle, &hdr, sizeof (hdr)) == MIDIERR_STILLPLAYING) | |||||
| while (--c >= 0 && midiInUnprepareHeader (device, &hdr, sizeof (hdr)) == MIDIERR_STILLPLAYING) | |||||
| Thread::sleep (20); | Thread::sleep (20); | ||||
| jassert (c >= 0); | jassert (c >= 0); | ||||
| } | } | ||||
| } | } | ||||
| void write (HMIDIIN deviceHandle) | |||||
| void write (HMIDIIN device) | |||||
| { | { | ||||
| hdr.dwBytesRecorded = 0; | hdr.dwBytesRecorded = 0; | ||||
| midiInAddBuffer (deviceHandle, &hdr, sizeof (hdr)); | |||||
| midiInAddBuffer (device, &hdr, sizeof (hdr)); | |||||
| } | } | ||||
| void writeIfFinished (HMIDIIN deviceHandle) | |||||
| void writeIfFinished (HMIDIIN device) | |||||
| { | { | ||||
| if ((hdr.dwFlags & WHDR_DONE) != 0) | if ((hdr.dwFlags & WHDR_DONE) != 0) | ||||
| write (deviceHandle); | |||||
| write (device); | |||||
| } | } | ||||
| private: | private: | ||||
| @@ -362,6 +362,7 @@ MidiOutput* MidiOutput::openDevice (int index) | |||||
| UINT deviceId = MIDI_MAPPER; | UINT deviceId = MIDI_MAPPER; | ||||
| const UINT num = midiOutGetNumDevs(); | const UINT num = midiOutGetNumDevs(); | ||||
| int n = 0; | int n = 0; | ||||
| String deviceName; | |||||
| for (UINT i = 0; i < num; ++i) | for (UINT i = 0; i < num; ++i) | ||||
| { | { | ||||
| @@ -369,13 +370,16 @@ MidiOutput* MidiOutput::openDevice (int index) | |||||
| if (midiOutGetDevCaps (i, &mc, sizeof (mc)) == MMSYSERR_NOERROR) | if (midiOutGetDevCaps (i, &mc, sizeof (mc)) == MMSYSERR_NOERROR) | ||||
| { | { | ||||
| String name = String (mc.szPname, sizeof (mc.szPname)); | |||||
| // use the microsoft sw synth as a default - best not to allow deviceId | // use the microsoft sw synth as a default - best not to allow deviceId | ||||
| // to be MIDI_MAPPER, or else device sharing breaks | // to be MIDI_MAPPER, or else device sharing breaks | ||||
| if (String (mc.szPname, sizeof (mc.szPname)).containsIgnoreCase ("microsoft")) | |||||
| if (name.containsIgnoreCase ("microsoft")) | |||||
| deviceId = i; | deviceId = i; | ||||
| if (index == n) | if (index == n) | ||||
| { | { | ||||
| deviceName = name; | |||||
| deviceId = i; | deviceId = i; | ||||
| break; | break; | ||||
| } | } | ||||
| @@ -392,7 +396,7 @@ MidiOutput* MidiOutput::openDevice (int index) | |||||
| { | { | ||||
| han->refCount++; | han->refCount++; | ||||
| MidiOutput* const out = new MidiOutput(); | |||||
| MidiOutput* const out = new MidiOutput (deviceName); | |||||
| out->internal = han; | out->internal = han; | ||||
| return out; | return out; | ||||
| } | } | ||||
| @@ -411,7 +415,7 @@ MidiOutput* MidiOutput::openDevice (int index) | |||||
| han->handle = h; | han->handle = h; | ||||
| MidiOutHandle::activeHandles.add (han); | MidiOutHandle::activeHandles.add (han); | ||||
| MidiOutput* const out = new MidiOutput(); | |||||
| MidiOutput* const out = new MidiOutput (deviceName); | |||||
| out->internal = han; | out->internal = han; | ||||
| return out; | return out; | ||||
| } | } | ||||
| @@ -2,7 +2,7 @@ | |||||
| ============================================================================== | ============================================================================== | ||||
| This file is part of the JUCE library. | This file is part of the JUCE library. | ||||
| Copyright (c) 2013 - Raw Material Software Ltd. | |||||
| Copyright (c) 2015 - ROLI Ltd. | |||||
| Permission is granted to use this software under the terms of either: | Permission is granted to use this software under the terms of either: | ||||
| a) the GPL v2 (or any later version) | a) the GPL v2 (or any later version) | ||||
| @@ -547,13 +547,13 @@ private: | |||||
| //============================================================================== | //============================================================================== | ||||
| ComSmartPtr<IAudioClient> createClient() | ComSmartPtr<IAudioClient> createClient() | ||||
| { | { | ||||
| ComSmartPtr<IAudioClient> client; | |||||
| ComSmartPtr<IAudioClient> newClient; | |||||
| if (device != nullptr) | if (device != nullptr) | ||||
| logFailure (device->Activate (__uuidof (IAudioClient), CLSCTX_INPROC_SERVER, | logFailure (device->Activate (__uuidof (IAudioClient), CLSCTX_INPROC_SERVER, | ||||
| nullptr, (void**) client.resetAndGetPointerAddress())); | |||||
| nullptr, (void**) newClient.resetAndGetPointerAddress())); | |||||
| return client; | |||||
| return newClient; | |||||
| } | } | ||||
| struct AudioSampleFormat | struct AudioSampleFormat | ||||
| @@ -563,8 +563,8 @@ private: | |||||
| int bytesPerSampleContainer; | int bytesPerSampleContainer; | ||||
| }; | }; | ||||
| bool tryFormat (const AudioSampleFormat sampleFormat, IAudioClient* clientToUse, double sampleRate, | |||||
| DWORD mixFormatChannelMask, WAVEFORMATEXTENSIBLE& format) const | |||||
| bool tryFormat (const AudioSampleFormat sampleFormat, IAudioClient* clientToUse, double newSampleRate, | |||||
| DWORD newMixFormatChannelMask, WAVEFORMATEXTENSIBLE& format) const | |||||
| { | { | ||||
| zerostruct (format); | zerostruct (format); | ||||
| @@ -578,14 +578,14 @@ private: | |||||
| format.Format.cbSize = sizeof (WAVEFORMATEXTENSIBLE) - sizeof (WAVEFORMATEX); | format.Format.cbSize = sizeof (WAVEFORMATEXTENSIBLE) - sizeof (WAVEFORMATEX); | ||||
| } | } | ||||
| format.Format.nSamplesPerSec = (DWORD) sampleRate; | |||||
| format.Format.nSamplesPerSec = (DWORD) newSampleRate; | |||||
| format.Format.nChannels = (WORD) numChannels; | format.Format.nChannels = (WORD) numChannels; | ||||
| format.Format.wBitsPerSample = (WORD) (8 * sampleFormat.bytesPerSampleContainer); | format.Format.wBitsPerSample = (WORD) (8 * sampleFormat.bytesPerSampleContainer); | ||||
| format.Samples.wValidBitsPerSample = (WORD) (sampleFormat.bitsPerSampleToTry); | format.Samples.wValidBitsPerSample = (WORD) (sampleFormat.bitsPerSampleToTry); | ||||
| format.Format.nBlockAlign = (WORD) (format.Format.nChannels * format.Format.wBitsPerSample / 8); | format.Format.nBlockAlign = (WORD) (format.Format.nChannels * format.Format.wBitsPerSample / 8); | ||||
| format.Format.nAvgBytesPerSec = (DWORD) (format.Format.nSamplesPerSec * format.Format.nBlockAlign); | format.Format.nAvgBytesPerSec = (DWORD) (format.Format.nSamplesPerSec * format.Format.nBlockAlign); | ||||
| format.SubFormat = sampleFormat.useFloat ? KSDATAFORMAT_SUBTYPE_IEEE_FLOAT : KSDATAFORMAT_SUBTYPE_PCM; | format.SubFormat = sampleFormat.useFloat ? KSDATAFORMAT_SUBTYPE_IEEE_FLOAT : KSDATAFORMAT_SUBTYPE_PCM; | ||||
| format.dwChannelMask = mixFormatChannelMask; | |||||
| format.dwChannelMask = newMixFormatChannelMask; | |||||
| WAVEFORMATEXTENSIBLE* nearestFormat = nullptr; | WAVEFORMATEXTENSIBLE* nearestFormat = nullptr; | ||||
| @@ -605,8 +605,8 @@ private: | |||||
| return check (hr); | return check (hr); | ||||
| } | } | ||||
| bool findSupportedFormat (IAudioClient* clientToUse, double sampleRate, | |||||
| DWORD mixFormatChannelMask, WAVEFORMATEXTENSIBLE& format) const | |||||
| bool findSupportedFormat (IAudioClient* clientToUse, double newSampleRate, | |||||
| DWORD newMixFormatChannelMask, WAVEFORMATEXTENSIBLE& format) const | |||||
| { | { | ||||
| static const AudioSampleFormat formats[] = | static const AudioSampleFormat formats[] = | ||||
| { | { | ||||
| @@ -620,7 +620,7 @@ private: | |||||
| }; | }; | ||||
| for (int i = 0; i < numElementsInArray (formats); ++i) | for (int i = 0; i < numElementsInArray (formats); ++i) | ||||
| if (tryFormat (formats[i], clientToUse, sampleRate, mixFormatChannelMask, format)) | |||||
| if (tryFormat (formats[i], clientToUse, newSampleRate, newMixFormatChannelMask, format)) | |||||
| return true; | return true; | ||||
| return false; | return false; | ||||
| @@ -1523,10 +1523,10 @@ private: | |||||
| } | } | ||||
| //============================================================================== | //============================================================================== | ||||
| void scan (StringArray& outputDeviceNames, | |||||
| StringArray& inputDeviceNames, | |||||
| StringArray& outputDeviceIds, | |||||
| StringArray& inputDeviceIds) | |||||
| void scan (StringArray& outDeviceNames, | |||||
| StringArray& inDeviceNames, | |||||
| StringArray& outDeviceIds, | |||||
| StringArray& inDeviceIds) | |||||
| { | { | ||||
| if (enumerator == nullptr) | if (enumerator == nullptr) | ||||
| { | { | ||||
| @@ -1582,19 +1582,19 @@ private: | |||||
| if (flow == eRender) | if (flow == eRender) | ||||
| { | { | ||||
| const int index = (deviceId == defaultRenderer) ? 0 : -1; | const int index = (deviceId == defaultRenderer) ? 0 : -1; | ||||
| outputDeviceIds.insert (index, deviceId); | |||||
| outputDeviceNames.insert (index, name); | |||||
| outDeviceIds.insert (index, deviceId); | |||||
| outDeviceNames.insert (index, name); | |||||
| } | } | ||||
| else if (flow == eCapture) | else if (flow == eCapture) | ||||
| { | { | ||||
| const int index = (deviceId == defaultCapture) ? 0 : -1; | const int index = (deviceId == defaultCapture) ? 0 : -1; | ||||
| inputDeviceIds.insert (index, deviceId); | |||||
| inputDeviceNames.insert (index, name); | |||||
| inDeviceIds.insert (index, deviceId); | |||||
| inDeviceNames.insert (index, name); | |||||
| } | } | ||||
| } | } | ||||
| inputDeviceNames.appendNumbersToDuplicates (false, false); | |||||
| outputDeviceNames.appendNumbersToDuplicates (false, false); | |||||
| inDeviceNames.appendNumbersToDuplicates (false, false); | |||||
| outDeviceNames.appendNumbersToDuplicates (false, false); | |||||
| } | } | ||||
| //============================================================================== | //============================================================================== | ||||
| @@ -2,7 +2,7 @@ | |||||
| ============================================================================== | ============================================================================== | ||||
| This file is part of the JUCE library. | This file is part of the JUCE library. | ||||
| Copyright (c) 2013 - Raw Material Software Ltd. | |||||
| Copyright (c) 2015 - ROLI Ltd. | |||||
| Permission is granted to use this software under the terms of either: | Permission is granted to use this software under the terms of either: | ||||
| a) the GPL v2 (or any later version) | a) the GPL v2 (or any later version) | ||||
| @@ -2,7 +2,7 @@ | |||||
| ============================================================================== | ============================================================================== | ||||
| This file is part of the JUCE library. | This file is part of the JUCE library. | ||||
| Copyright (c) 2013 - Raw Material Software Ltd. | |||||
| Copyright (c) 2015 - ROLI Ltd. | |||||
| Permission is granted to use this software under the terms of either: | Permission is granted to use this software under the terms of either: | ||||
| a) the GPL v2 (or any later version) | a) the GPL v2 (or any later version) | ||||
| @@ -2,7 +2,7 @@ | |||||
| ============================================================================== | ============================================================================== | ||||
| This file is part of the JUCE library. | This file is part of the JUCE library. | ||||
| Copyright (c) 2013 - Raw Material Software Ltd. | |||||
| Copyright (c) 2015 - ROLI Ltd. | |||||
| Permission is granted to use this software under the terms of either: | Permission is granted to use this software under the terms of either: | ||||
| a) the GPL v2 (or any later version) | a) the GPL v2 (or any later version) | ||||
| @@ -2,7 +2,7 @@ | |||||
| ============================================================================== | ============================================================================== | ||||
| This file is part of the JUCE library. | This file is part of the JUCE library. | ||||
| Copyright (c) 2013 - Raw Material Software Ltd. | |||||
| Copyright (c) 2015 - ROLI Ltd. | |||||
| Permission is granted to use this software under the terms of either: | Permission is granted to use this software under the terms of either: | ||||
| a) the GPL v2 (or any later version) | a) the GPL v2 (or any later version) | ||||
| @@ -244,7 +244,11 @@ void FLAC__cpu_info(FLAC__CPUInfo *info) | |||||
| struct sigaction sigill_save; | struct sigaction sigill_save; | ||||
| struct sigaction sigill_sse; | struct sigaction sigill_sse; | ||||
| sigill_sse.sa_sigaction = sigill_handler_sse_os; | sigill_sse.sa_sigaction = sigill_handler_sse_os; | ||||
| #ifdef __ANDROID__ | |||||
| sigemptyset (&sigill_sse.sa_mask); | |||||
| #else | |||||
| __sigemptyset(&sigill_sse.sa_mask); | __sigemptyset(&sigill_sse.sa_mask); | ||||
| #endif | |||||
| sigill_sse.sa_flags = SA_SIGINFO | SA_RESETHAND; /* SA_RESETHAND just in case our SIGILL return jump breaks, so we don't get stuck in a loop */ | sigill_sse.sa_flags = SA_SIGINFO | SA_RESETHAND; /* SA_RESETHAND just in case our SIGILL return jump breaks, so we don't get stuck in a loop */ | ||||
| if(0 == sigaction(SIGILL, &sigill_sse, &sigill_save)) | if(0 == sigaction(SIGILL, &sigill_sse, &sigill_save)) | ||||
| { | { | ||||
| @@ -2,7 +2,7 @@ | |||||
| ============================================================================== | ============================================================================== | ||||
| This file is part of the JUCE library. | This file is part of the JUCE library. | ||||
| Copyright (c) 2013 - Raw Material Software Ltd. | |||||
| Copyright (c) 2015 - ROLI Ltd. | |||||
| Permission is granted to use this software under the terms of either: | Permission is granted to use this software under the terms of either: | ||||
| a) the GPL v2 (or any later version) | a) the GPL v2 (or any later version) | ||||
| @@ -2,7 +2,7 @@ | |||||
| ============================================================================== | ============================================================================== | ||||
| This file is part of the JUCE library. | This file is part of the JUCE library. | ||||
| Copyright (c) 2013 - Raw Material Software Ltd. | |||||
| Copyright (c) 2015 - ROLI Ltd. | |||||
| Permission is granted to use this software under the terms of either: | Permission is granted to use this software under the terms of either: | ||||
| a) the GPL v2 (or any later version) | a) the GPL v2 (or any later version) | ||||
| @@ -2,7 +2,7 @@ | |||||
| ============================================================================== | ============================================================================== | ||||
| This file is part of the JUCE library. | This file is part of the JUCE library. | ||||
| Copyright (c) 2013 - Raw Material Software Ltd. | |||||
| Copyright (c) 2015 - ROLI Ltd. | |||||
| Permission is granted to use this software under the terms of either: | Permission is granted to use this software under the terms of either: | ||||
| a) the GPL v2 (or any later version) | a) the GPL v2 (or any later version) | ||||
| @@ -2,7 +2,7 @@ | |||||
| ============================================================================== | ============================================================================== | ||||
| This file is part of the JUCE library. | This file is part of the JUCE library. | ||||
| Copyright (c) 2013 - Raw Material Software Ltd. | |||||
| Copyright (c) 2015 - ROLI Ltd. | |||||
| Permission is granted to use this software under the terms of either: | Permission is granted to use this software under the terms of either: | ||||
| a) the GPL v2 (or any later version) | a) the GPL v2 (or any later version) | ||||
| @@ -2,7 +2,7 @@ | |||||
| ============================================================================== | ============================================================================== | ||||
| This file is part of the JUCE library. | This file is part of the JUCE library. | ||||
| Copyright (c) 2013 - Raw Material Software Ltd. | |||||
| Copyright (c) 2015 - ROLI Ltd. | |||||
| Permission is granted to use this software under the terms of either: | Permission is granted to use this software under the terms of either: | ||||
| a) the GPL v2 (or any later version) | a) the GPL v2 (or any later version) | ||||
| @@ -2,7 +2,7 @@ | |||||
| ============================================================================== | ============================================================================== | ||||
| This file is part of the JUCE library. | This file is part of the JUCE library. | ||||
| Copyright (c) 2013 - Raw Material Software Ltd. | |||||
| Copyright (c) 2015 - ROLI Ltd. | |||||
| Permission is granted to use this software under the terms of either: | Permission is granted to use this software under the terms of either: | ||||
| a) the GPL v2 (or any later version) | a) the GPL v2 (or any later version) | ||||
| @@ -2,7 +2,7 @@ | |||||
| ============================================================================== | ============================================================================== | ||||
| This file is part of the JUCE library. | This file is part of the JUCE library. | ||||
| Copyright (c) 2013 - Raw Material Software Ltd. | |||||
| Copyright (c) 2015 - ROLI Ltd. | |||||
| Permission is granted to use this software under the terms of either: | Permission is granted to use this software under the terms of either: | ||||
| a) the GPL v2 (or any later version) | a) the GPL v2 (or any later version) | ||||
| @@ -2,7 +2,7 @@ | |||||
| ============================================================================== | ============================================================================== | ||||
| This file is part of the JUCE library. | This file is part of the JUCE library. | ||||
| Copyright (c) 2013 - Raw Material Software Ltd. | |||||
| Copyright (c) 2015 - ROLI Ltd. | |||||
| Permission is granted to use this software under the terms of either: | Permission is granted to use this software under the terms of either: | ||||
| a) the GPL v2 (or any later version) | a) the GPL v2 (or any later version) | ||||
| @@ -2,7 +2,7 @@ | |||||
| ============================================================================== | ============================================================================== | ||||
| This file is part of the JUCE library. | This file is part of the JUCE library. | ||||
| Copyright (c) 2013 - Raw Material Software Ltd. | |||||
| Copyright (c) 2015 - ROLI Ltd. | |||||
| Permission is granted to use this software under the terms of either: | Permission is granted to use this software under the terms of either: | ||||
| a) the GPL v2 (or any later version) | a) the GPL v2 (or any later version) | ||||
| @@ -25,8 +25,8 @@ | |||||
| /* | /* | ||||
| IMPORTANT DISCLAIMER: By choosing to enable the JUCE_USE_MP3AUDIOFORMAT flag and | IMPORTANT DISCLAIMER: By choosing to enable the JUCE_USE_MP3AUDIOFORMAT flag and | ||||
| to compile this MP3 code into your software, you do so AT YOUR OWN RISK! By doing so, | to compile this MP3 code into your software, you do so AT YOUR OWN RISK! By doing so, | ||||
| you are agreeing that Raw Material Software is in no way responsible for any patent, | |||||
| copyright, or other legal issues that you may suffer as a result. | |||||
| you are agreeing that ROLI Ltd. is in no way responsible for any patent, copyright, | |||||
| or other legal issues that you may suffer as a result. | |||||
| The code in juce_MP3AudioFormat.cpp is NOT guaranteed to be free from infringements of 3rd-party | The code in juce_MP3AudioFormat.cpp is NOT guaranteed to be free from infringements of 3rd-party | ||||
| intellectual property. If you wish to use it, please seek your own independent advice about the | intellectual property. If you wish to use it, please seek your own independent advice about the | ||||
| @@ -2,7 +2,7 @@ | |||||
| ============================================================================== | ============================================================================== | ||||
| This file is part of the JUCE library. | This file is part of the JUCE library. | ||||
| Copyright (c) 2013 - Raw Material Software Ltd. | |||||
| Copyright (c) 2015 - ROLI Ltd. | |||||
| Permission is granted to use this software under the terms of either: | Permission is granted to use this software under the terms of either: | ||||
| a) the GPL v2 (or any later version) | a) the GPL v2 (or any later version) | ||||
| @@ -30,8 +30,8 @@ | |||||
| IMPORTANT DISCLAIMER: By choosing to enable the JUCE_USE_MP3AUDIOFORMAT flag and | IMPORTANT DISCLAIMER: By choosing to enable the JUCE_USE_MP3AUDIOFORMAT flag and | ||||
| to compile the MP3 code into your software, you do so AT YOUR OWN RISK! By doing so, | to compile the MP3 code into your software, you do so AT YOUR OWN RISK! By doing so, | ||||
| you are agreeing that Raw Material Software is in no way responsible for any patent, | |||||
| copyright, or other legal issues that you may suffer as a result. | |||||
| you are agreeing that ROLI Ltd. is in no way responsible for any patent, copyright, | |||||
| or other legal issues that you may suffer as a result. | |||||
| The code in juce_MP3AudioFormat.cpp is NOT guaranteed to be free from infringements of 3rd-party | The code in juce_MP3AudioFormat.cpp is NOT guaranteed to be free from infringements of 3rd-party | ||||
| intellectual property. If you wish to use it, please seek your own independent advice about the | intellectual property. If you wish to use it, please seek your own independent advice about the | ||||
| @@ -2,7 +2,7 @@ | |||||
| ============================================================================== | ============================================================================== | ||||
| This file is part of the JUCE library. | This file is part of the JUCE library. | ||||
| Copyright (c) 2013 - Raw Material Software Ltd. | |||||
| Copyright (c) 2015 - ROLI Ltd. | |||||
| Permission is granted to use this software under the terms of either: | Permission is granted to use this software under the terms of either: | ||||
| a) the GPL v2 (or any later version) | a) the GPL v2 (or any later version) | ||||
| @@ -33,7 +33,7 @@ namespace OggVorbisNamespace | |||||
| #if JUCE_INCLUDE_OGGVORBIS_CODE || ! defined (JUCE_INCLUDE_OGGVORBIS_CODE) | #if JUCE_INCLUDE_OGGVORBIS_CODE || ! defined (JUCE_INCLUDE_OGGVORBIS_CODE) | ||||
| #if JUCE_MSVC | #if JUCE_MSVC | ||||
| #pragma warning (push) | #pragma warning (push) | ||||
| #pragma warning (disable: 4267 4127 4244 4996 4100 4701 4702 4013 4133 4206 4305 4189 4706 4995 4365) | |||||
| #pragma warning (disable: 4267 4127 4244 4996 4100 4701 4702 4013 4133 4206 4305 4189 4706 4995 4365 4456 4457 4459) | |||||
| #endif | #endif | ||||
| #if JUCE_CLANG | #if JUCE_CLANG | ||||
| @@ -2,7 +2,7 @@ | |||||
| ============================================================================== | ============================================================================== | ||||
| This file is part of the JUCE library. | This file is part of the JUCE library. | ||||
| Copyright (c) 2013 - Raw Material Software Ltd. | |||||
| Copyright (c) 2015 - ROLI Ltd. | |||||
| Permission is granted to use this software under the terms of either: | Permission is granted to use this software under the terms of either: | ||||
| a) the GPL v2 (or any later version) | a) the GPL v2 (or any later version) | ||||
| @@ -2,7 +2,7 @@ | |||||
| ============================================================================== | ============================================================================== | ||||
| This file is part of the JUCE library. | This file is part of the JUCE library. | ||||
| Copyright (c) 2013 - Raw Material Software Ltd. | |||||
| Copyright (c) 2015 - ROLI Ltd. | |||||
| Permission is granted to use this software under the terms of either: | Permission is granted to use this software under the terms of either: | ||||
| a) the GPL v2 (or any later version) | a) the GPL v2 (or any later version) | ||||
| @@ -2,7 +2,7 @@ | |||||
| ============================================================================== | ============================================================================== | ||||
| This file is part of the JUCE library. | This file is part of the JUCE library. | ||||
| Copyright (c) 2013 - Raw Material Software Ltd. | |||||
| Copyright (c) 2015 - ROLI Ltd. | |||||
| Permission is granted to use this software under the terms of either: | Permission is granted to use this software under the terms of either: | ||||
| a) the GPL v2 (or any later version) | a) the GPL v2 (or any later version) | ||||
| @@ -2,7 +2,7 @@ | |||||
| ============================================================================== | ============================================================================== | ||||
| This file is part of the JUCE library. | This file is part of the JUCE library. | ||||
| Copyright (c) 2013 - Raw Material Software Ltd. | |||||
| Copyright (c) 2015 - ROLI Ltd. | |||||
| Permission is granted to use this software under the terms of either: | Permission is granted to use this software under the terms of either: | ||||
| a) the GPL v2 (or any later version) | a) the GPL v2 (or any later version) | ||||