mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-09 23:34:20 +00:00
Formatting: Remove double-dots from comments and other strings
This commit is contained in:
parent
82dc6d1c7e
commit
83e5264c86
209 changed files with 508 additions and 509 deletions
|
|
@ -199,7 +199,7 @@ int main (int argc, char* argv[])
|
||||||
{
|
{
|
||||||
const File file (files[i]);
|
const File file (files[i]);
|
||||||
|
|
||||||
// (avoid source control files and hidden files..)
|
// avoid source control files and hidden files
|
||||||
if (! isHiddenFile (file, sourceDirectory))
|
if (! isHiddenFile (file, sourceDirectory))
|
||||||
{
|
{
|
||||||
if (file.getParentDirectory() != sourceDirectory)
|
if (file.getParentDirectory() != sourceDirectory)
|
||||||
|
|
|
||||||
|
|
@ -508,12 +508,12 @@ public:
|
||||||
unitTest.expect (! clippingFailed);
|
unitTest.expect (! clippingFailed);
|
||||||
}
|
}
|
||||||
|
|
||||||
// convert data from the source to dest format..
|
// convert data from the source to dest format...
|
||||||
std::unique_ptr<AudioData::Converter> conv (new AudioData::ConverterInstance<AudioData::Pointer<F1, E1, AudioData::NonInterleaved, AudioData::Const>,
|
std::unique_ptr<AudioData::Converter> conv (new AudioData::ConverterInstance<AudioData::Pointer<F1, E1, AudioData::NonInterleaved, AudioData::Const>,
|
||||||
AudioData::Pointer<F2, E2, AudioData::NonInterleaved, AudioData::NonConst>>());
|
AudioData::Pointer<F2, E2, AudioData::NonInterleaved, AudioData::NonConst>>());
|
||||||
conv->convertSamples (inPlace ? reversed : converted, original, numSamples);
|
conv->convertSamples (inPlace ? reversed : converted, original, numSamples);
|
||||||
|
|
||||||
// ..and back again..
|
// ...and back again
|
||||||
conv.reset (new AudioData::ConverterInstance<AudioData::Pointer<F2, E2, AudioData::NonInterleaved, AudioData::Const>,
|
conv.reset (new AudioData::ConverterInstance<AudioData::Pointer<F2, E2, AudioData::NonInterleaved, AudioData::Const>,
|
||||||
AudioData::Pointer<F1, E1, AudioData::NonInterleaved, AudioData::NonConst>>());
|
AudioData::Pointer<F1, E1, AudioData::NonInterleaved, AudioData::NonConst>>());
|
||||||
if (! inPlace)
|
if (! inPlace)
|
||||||
|
|
|
||||||
|
|
@ -74,7 +74,7 @@ public:
|
||||||
// These types can be used as the Constness template parameter for the AudioData::Pointer class.
|
// These types can be used as the Constness template parameter for the AudioData::Pointer class.
|
||||||
|
|
||||||
class NonConst; /**< Used as a template parameter for AudioData::Pointer. Indicates that the pointer can be used for non-const data. */
|
class NonConst; /**< Used as a template parameter for AudioData::Pointer. Indicates that the pointer can be used for non-const data. */
|
||||||
class Const; /**< Used as a template parameter for AudioData::Pointer. Indicates that the samples can only be used for const data.. */
|
class Const; /**< Used as a template parameter for AudioData::Pointer. Indicates that the samples can only be used for const data. */
|
||||||
|
|
||||||
|
|
||||||
//==============================================================================
|
//==============================================================================
|
||||||
|
|
@ -342,17 +342,17 @@ public:
|
||||||
This object can be used to read and write from blocks of encoded audio samples. To create one, you specify
|
This object can be used to read and write from blocks of encoded audio samples. To create one, you specify
|
||||||
the audio format as a series of template parameters, e.g.
|
the audio format as a series of template parameters, e.g.
|
||||||
@code
|
@code
|
||||||
// this creates a pointer for reading from a const array of 16-bit little-endian packed samples.
|
// this creates a pointer for reading from a const array of 16-bit little-endian packed samples
|
||||||
AudioData::Pointer <AudioData::Int16,
|
AudioData::Pointer <AudioData::Int16,
|
||||||
AudioData::LittleEndian,
|
AudioData::LittleEndian,
|
||||||
AudioData::NonInterleaved,
|
AudioData::NonInterleaved,
|
||||||
AudioData::Const> pointer (someRawAudioData);
|
AudioData::Const> pointer (someRawAudioData);
|
||||||
|
|
||||||
// These methods read the sample that is being pointed to
|
// these methods read the sample that is being pointed to
|
||||||
float firstSampleAsFloat = pointer.getAsFloat();
|
float firstSampleAsFloat = pointer.getAsFloat();
|
||||||
int32 firstSampleAsInt = pointer.getAsInt32();
|
int32 firstSampleAsInt = pointer.getAsInt32();
|
||||||
++pointer; // moves the pointer to the next sample.
|
++pointer; // moves the pointer to the next sample
|
||||||
pointer += 3; // skips the next 3 samples.
|
pointer += 3; // skips the next 3 samples
|
||||||
@endcode
|
@endcode
|
||||||
|
|
||||||
The convertSamples() method lets you copy a range of samples from one format to another, automatically
|
The convertSamples() method lets you copy a range of samples from one format to another, automatically
|
||||||
|
|
@ -488,7 +488,7 @@ public:
|
||||||
++source;
|
++source;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else // copy backwards if we're increasing the sample width..
|
else // copy backwards if we're increasing the sample width
|
||||||
{
|
{
|
||||||
dest += numSamples;
|
dest += numSamples;
|
||||||
source += numSamples;
|
source += numSamples;
|
||||||
|
|
|
||||||
|
|
@ -145,7 +145,7 @@ MidiMessage::MidiMessage (const void* const d, const int dataSize, const double
|
||||||
: timeStamp (t), size (dataSize)
|
: timeStamp (t), size (dataSize)
|
||||||
{
|
{
|
||||||
jassert (dataSize > 0);
|
jassert (dataSize > 0);
|
||||||
// this checks that the length matches the data..
|
// this checks that the length matches the data
|
||||||
jassert (dataSize > 3 || *(uint8*)d >= 0xf0 || getMessageLengthFromFirstByte (*(uint8*)d) == size);
|
jassert (dataSize > 3 || *(uint8*)d >= 0xf0 || getMessageLengthFromFirstByte (*(uint8*)d) == size);
|
||||||
|
|
||||||
memcpy (allocateSpace (dataSize), d, (size_t) dataSize);
|
memcpy (allocateSpace (dataSize), d, (size_t) dataSize);
|
||||||
|
|
@ -156,7 +156,7 @@ MidiMessage::MidiMessage (const int byte1, const double t) noexcept
|
||||||
{
|
{
|
||||||
packedData.asBytes[0] = (uint8) byte1;
|
packedData.asBytes[0] = (uint8) byte1;
|
||||||
|
|
||||||
// check that the length matches the data..
|
// check that the length matches the data
|
||||||
jassert (byte1 >= 0xf0 || getMessageLengthFromFirstByte ((uint8) byte1) == 1);
|
jassert (byte1 >= 0xf0 || getMessageLengthFromFirstByte ((uint8) byte1) == 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -166,7 +166,7 @@ MidiMessage::MidiMessage (const int byte1, const int byte2, const double t) noex
|
||||||
packedData.asBytes[0] = (uint8) byte1;
|
packedData.asBytes[0] = (uint8) byte1;
|
||||||
packedData.asBytes[1] = (uint8) byte2;
|
packedData.asBytes[1] = (uint8) byte2;
|
||||||
|
|
||||||
// check that the length matches the data..
|
// check that the length matches the data
|
||||||
jassert (byte1 >= 0xf0 || getMessageLengthFromFirstByte ((uint8) byte1) == 2);
|
jassert (byte1 >= 0xf0 || getMessageLengthFromFirstByte ((uint8) byte1) == 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -177,7 +177,7 @@ MidiMessage::MidiMessage (const int byte1, const int byte2, const int byte3, con
|
||||||
packedData.asBytes[1] = (uint8) byte2;
|
packedData.asBytes[1] = (uint8) byte2;
|
||||||
packedData.asBytes[2] = (uint8) byte3;
|
packedData.asBytes[2] = (uint8) byte3;
|
||||||
|
|
||||||
// check that the length matches the data..
|
// check that the length matches the data
|
||||||
jassert (byte1 >= 0xf0 || getMessageLengthFromFirstByte ((uint8) byte1) == 3);
|
jassert (byte1 >= 0xf0 || getMessageLengthFromFirstByte ((uint8) byte1) == 3);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -78,7 +78,7 @@ public:
|
||||||
template <typename... Data>
|
template <typename... Data>
|
||||||
MidiMessage (int byte1, int byte2, int byte3, Data... otherBytes) : size (3 + sizeof... (otherBytes))
|
MidiMessage (int byte1, int byte2, int byte3, Data... otherBytes) : size (3 + sizeof... (otherBytes))
|
||||||
{
|
{
|
||||||
// this checks that the length matches the data..
|
// this checks that the length matches the data
|
||||||
jassert (size > 3 || byte1 >= 0xf0 || getMessageLengthFromFirstByte ((uint8) byte1) == size);
|
jassert (size > 3 || byte1 >= 0xf0 || getMessageLengthFromFirstByte ((uint8) byte1) == size);
|
||||||
|
|
||||||
const uint8 data[] = { (uint8) byte1, (uint8) byte2, (uint8) byte3, static_cast<uint8> (otherBytes)... };
|
const uint8 data[] = { (uint8) byte1, (uint8) byte2, (uint8) byte3, static_cast<uint8> (otherBytes)... };
|
||||||
|
|
|
||||||
|
|
@ -991,7 +991,7 @@ public:
|
||||||
expectNote (test.getNote (3, 2), 100, 0, 8192, 64, MPENote::keyDown);
|
expectNote (test.getNote (3, 2), 100, 0, 8192, 64, MPENote::keyDown);
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
// pathological case: second note-on for same note should retrigger it.
|
// pathological case: second note-on for same note should retrigger it
|
||||||
UnitTestInstrument test;
|
UnitTestInstrument test;
|
||||||
test.setZoneLayout (testLayout);
|
test.setZoneLayout (testLayout);
|
||||||
test.noteOn (3, 0, MPEValue::from7BitInt (100));
|
test.noteOn (3, 0, MPEValue::from7BitInt (100));
|
||||||
|
|
@ -1037,7 +1037,7 @@ public:
|
||||||
test.noteOn (3, 60, MPEValue::from7BitInt (100)); // note in lower zone
|
test.noteOn (3, 60, MPEValue::from7BitInt (100)); // note in lower zone
|
||||||
test.noteOn (10, 60, MPEValue::from7BitInt (100)); // note in upper zone
|
test.noteOn (10, 60, MPEValue::from7BitInt (100)); // note in upper zone
|
||||||
|
|
||||||
// sustain pedal on per-note channel shouldn't do anything.
|
// sustain pedal on per-note channel shouldn't do anything
|
||||||
test.sustainPedal (3, true);
|
test.sustainPedal (3, true);
|
||||||
expectNote (test.getNote (3, 60), 100, 0, 8192, 64, MPENote::keyDown);
|
expectNote (test.getNote (3, 60), 100, 0, 8192, 64, MPENote::keyDown);
|
||||||
|
|
||||||
|
|
@ -1045,13 +1045,13 @@ public:
|
||||||
expectNote (test.getNote (10, 60), 100, 0, 8192, 64, MPENote::keyDown);
|
expectNote (test.getNote (10, 60), 100, 0, 8192, 64, MPENote::keyDown);
|
||||||
expectEquals (test.noteKeyStateChangedCallCounter, 0);
|
expectEquals (test.noteKeyStateChangedCallCounter, 0);
|
||||||
|
|
||||||
// sustain pedal on non-zone channel shouldn't do anything either.
|
// sustain pedal on non-zone channel shouldn't do anything either
|
||||||
test.sustainPedal (7, true);
|
test.sustainPedal (7, true);
|
||||||
expectNote (test.getNote (3, 60), 100, 0, 8192, 64, MPENote::keyDown);
|
expectNote (test.getNote (3, 60), 100, 0, 8192, 64, MPENote::keyDown);
|
||||||
expectNote (test.getNote (10, 60), 100, 0, 8192, 64, MPENote::keyDown);
|
expectNote (test.getNote (10, 60), 100, 0, 8192, 64, MPENote::keyDown);
|
||||||
expectEquals (test.noteKeyStateChangedCallCounter, 0);
|
expectEquals (test.noteKeyStateChangedCallCounter, 0);
|
||||||
|
|
||||||
// sustain pedal on master channel should sustain notes on _that_ zone.
|
// sustain pedal on master channel should sustain notes on _that_ zone
|
||||||
test.sustainPedal (1, true);
|
test.sustainPedal (1, true);
|
||||||
expectNote (test.getNote (3, 60), 100, 0, 8192, 64, MPENote::keyDownAndSustained);
|
expectNote (test.getNote (3, 60), 100, 0, 8192, 64, MPENote::keyDownAndSustained);
|
||||||
expectNote (test.getNote (10, 60), 100, 0, 8192, 64, MPENote::keyDown);
|
expectNote (test.getNote (10, 60), 100, 0, 8192, 64, MPENote::keyDown);
|
||||||
|
|
@ -1100,19 +1100,19 @@ public:
|
||||||
test.noteOn (3, 60, MPEValue::from7BitInt (100)); // note in lower zone
|
test.noteOn (3, 60, MPEValue::from7BitInt (100)); // note in lower zone
|
||||||
test.noteOn (10, 60, MPEValue::from7BitInt (100)); // note in upper zone
|
test.noteOn (10, 60, MPEValue::from7BitInt (100)); // note in upper zone
|
||||||
|
|
||||||
// sostenuto pedal on per-note channel shouldn't do anything.
|
// sostenuto pedal on per-note channel shouldn't do anything
|
||||||
test.sostenutoPedal (3, true);
|
test.sostenutoPedal (3, true);
|
||||||
expectNote (test.getNote (3, 60), 100, 0, 8192, 64, MPENote::keyDown);
|
expectNote (test.getNote (3, 60), 100, 0, 8192, 64, MPENote::keyDown);
|
||||||
expectNote (test.getNote (10, 60), 100, 0, 8192, 64, MPENote::keyDown);
|
expectNote (test.getNote (10, 60), 100, 0, 8192, 64, MPENote::keyDown);
|
||||||
expectEquals (test.noteKeyStateChangedCallCounter, 0);
|
expectEquals (test.noteKeyStateChangedCallCounter, 0);
|
||||||
|
|
||||||
// sostenuto pedal on non-zone channel shouldn't do anything either.
|
// sostenuto pedal on non-zone channel shouldn't do anything either
|
||||||
test.sostenutoPedal (9, true);
|
test.sostenutoPedal (9, true);
|
||||||
expectNote (test.getNote (3, 60), 100, 0, 8192, 64, MPENote::keyDown);
|
expectNote (test.getNote (3, 60), 100, 0, 8192, 64, MPENote::keyDown);
|
||||||
expectNote (test.getNote (10, 60), 100, 0, 8192, 64, MPENote::keyDown);
|
expectNote (test.getNote (10, 60), 100, 0, 8192, 64, MPENote::keyDown);
|
||||||
expectEquals (test.noteKeyStateChangedCallCounter, 0);
|
expectEquals (test.noteKeyStateChangedCallCounter, 0);
|
||||||
|
|
||||||
// sostenuto pedal on master channel should sustain notes on *that* zone.
|
// sostenuto pedal on master channel should sustain notes on *that* zone
|
||||||
test.sostenutoPedal (1, true);
|
test.sostenutoPedal (1, true);
|
||||||
expectNote (test.getNote (3, 60), 100, 0, 8192, 64, MPENote::keyDownAndSustained);
|
expectNote (test.getNote (3, 60), 100, 0, 8192, 64, MPENote::keyDownAndSustained);
|
||||||
expectNote (test.getNote (10, 60), 100, 0, 8192, 64, MPENote::keyDown);
|
expectNote (test.getNote (10, 60), 100, 0, 8192, 64, MPENote::keyDown);
|
||||||
|
|
@ -1195,7 +1195,7 @@ public:
|
||||||
MPEValue::centreValue(), MPEValue::centreValue());
|
MPEValue::centreValue(), MPEValue::centreValue());
|
||||||
|
|
||||||
{
|
{
|
||||||
// case 1: the note to exclude is not the most recent one.
|
// case 1: the note to exclude is not the most recent one
|
||||||
|
|
||||||
MPEInstrument test;
|
MPEInstrument test;
|
||||||
test.setZoneLayout (testLayout);
|
test.setZoneLayout (testLayout);
|
||||||
|
|
@ -1210,7 +1210,7 @@ public:
|
||||||
expect (test.getMostRecentNoteOtherThan (testNote).initialNote == 61);
|
expect (test.getMostRecentNoteOtherThan (testNote).initialNote == 61);
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
// case 2: the note to exclude is the most recent one.
|
// case 2: the note to exclude is the most recent one
|
||||||
|
|
||||||
MPEInstrument test;
|
MPEInstrument test;
|
||||||
test.setZoneLayout (testLayout);
|
test.setZoneLayout (testLayout);
|
||||||
|
|
@ -1373,7 +1373,7 @@ public:
|
||||||
expectNote (test.getNote (10, 60), 100, 0, 8192, 64, MPENote::keyDown);
|
expectNote (test.getNote (10, 60), 100, 0, 8192, 64, MPENote::keyDown);
|
||||||
expectEquals (test.notePitchbendChangedCallCounter, 3);
|
expectEquals (test.notePitchbendChangedCallCounter, 3);
|
||||||
|
|
||||||
// applying pitchbend on an unrelated channel should do nothing.
|
// applying pitchbend on an unrelated channel should do nothing
|
||||||
test.pitchbend (8, MPEValue::from14BitInt (3333));
|
test.pitchbend (8, MPEValue::from14BitInt (3333));
|
||||||
expectNote (test.getNote (3, 60), 100, 0, 1111, 64, MPENote::keyDown);
|
expectNote (test.getNote (3, 60), 100, 0, 1111, 64, MPENote::keyDown);
|
||||||
expectNote (test.getNote (4, 60), 100, 0, 8192, 64, MPENote::keyDown);
|
expectNote (test.getNote (4, 60), 100, 0, 8192, 64, MPENote::keyDown);
|
||||||
|
|
@ -1442,7 +1442,7 @@ public:
|
||||||
// - release the note
|
// - release the note
|
||||||
// - press same note again without sending a pitchbend or timbre message before the note-on
|
// - press same note again without sending a pitchbend or timbre message before the note-on
|
||||||
// - the note should be turned on with a default value for pitchbend/timbre,
|
// - the note should be turned on with a default value for pitchbend/timbre,
|
||||||
// and *not* the last value received on channel.
|
// and *not* the last value received on channel
|
||||||
|
|
||||||
test.noteOn (3, 60, MPEValue::from7BitInt (100));
|
test.noteOn (3, 60, MPEValue::from7BitInt (100));
|
||||||
test.pitchbend (3, MPEValue::from14BitInt (5555));
|
test.pitchbend (3, MPEValue::from14BitInt (5555));
|
||||||
|
|
@ -1938,15 +1938,15 @@ public:
|
||||||
test.noteOn (15, 63, MPEValue::from7BitInt (100));
|
test.noteOn (15, 63, MPEValue::from7BitInt (100));
|
||||||
expectEquals (test.getNumPlayingNotes(), 4);
|
expectEquals (test.getNumPlayingNotes(), 4);
|
||||||
|
|
||||||
// on note channel: ignore.
|
// on note channel: ignore
|
||||||
test.processNextMidiEvent (MidiMessage::allControllersOff (3));
|
test.processNextMidiEvent (MidiMessage::allControllersOff (3));
|
||||||
expectEquals (test.getNumPlayingNotes(), 4);
|
expectEquals (test.getNumPlayingNotes(), 4);
|
||||||
|
|
||||||
// on unused channel: ignore.
|
// on unused channel: ignore
|
||||||
test.processNextMidiEvent (MidiMessage::allControllersOff (9));
|
test.processNextMidiEvent (MidiMessage::allControllersOff (9));
|
||||||
expectEquals (test.getNumPlayingNotes(), 4);
|
expectEquals (test.getNumPlayingNotes(), 4);
|
||||||
|
|
||||||
// on master channel: release notes in that zone only.
|
// on master channel: release notes in that zone only
|
||||||
test.processNextMidiEvent (MidiMessage::allControllersOff (1));
|
test.processNextMidiEvent (MidiMessage::allControllersOff (1));
|
||||||
expectEquals (test.getNumPlayingNotes(), 2);
|
expectEquals (test.getNumPlayingNotes(), 2);
|
||||||
test.processNextMidiEvent (MidiMessage::allControllersOff (16));
|
test.processNextMidiEvent (MidiMessage::allControllersOff (16));
|
||||||
|
|
@ -2136,7 +2136,7 @@ public:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
// custom pitchbend range in legacy mode.
|
// custom pitchbend range in legacy mode
|
||||||
UnitTestInstrument test;
|
UnitTestInstrument test;
|
||||||
test.enableLegacyMode (11);
|
test.enableLegacyMode (11);
|
||||||
|
|
||||||
|
|
@ -2145,7 +2145,7 @@ public:
|
||||||
expectDoubleWithinRelativeError (test.getMostRecentNote (1).totalPitchbendInSemitones, -5.5, 0.01);
|
expectDoubleWithinRelativeError (test.getMostRecentNote (1).totalPitchbendInSemitones, -5.5, 0.01);
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
// sustain pedal should be per channel in legacy mode.
|
// sustain pedal should be per channel in legacy mode
|
||||||
UnitTestInstrument test;
|
UnitTestInstrument test;
|
||||||
test.enableLegacyMode();
|
test.enableLegacyMode();
|
||||||
|
|
||||||
|
|
@ -2168,7 +2168,7 @@ public:
|
||||||
|
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
// sostenuto pedal should be per channel in legacy mode.
|
// sostenuto pedal should be per channel in legacy mode
|
||||||
UnitTestInstrument test;
|
UnitTestInstrument test;
|
||||||
test.enableLegacyMode();
|
test.enableLegacyMode();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -211,7 +211,7 @@ MPESynthesiserVoice* MPESynthesiser::findVoiceToSteal (MPENote noteToStealVoiceF
|
||||||
usableVoicesToStealArray.add (voice);
|
usableVoicesToStealArray.add (voice);
|
||||||
|
|
||||||
// NB: Using a functor rather than a lambda here due to scare-stories about
|
// NB: Using a functor rather than a lambda here due to scare-stories about
|
||||||
// compilers generating code containing heap allocations..
|
// compilers generating code containing heap allocations.
|
||||||
struct Sorter
|
struct Sorter
|
||||||
{
|
{
|
||||||
bool operator() (const MPESynthesiserVoice* a, const MPESynthesiserVoice* b) const noexcept { return a->noteOnTime < b->noteOnTime; }
|
bool operator() (const MPESynthesiserVoice* a, const MPESynthesiserVoice* b) const noexcept { return a->noteOnTime < b->noteOnTime; }
|
||||||
|
|
@ -334,7 +334,7 @@ void MPESynthesiser::turnOffAllVoices (bool allowTailOff)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// finally make sure the MPE Instrument also doesn't have any notes anymore.
|
// finally make sure the MPE Instrument also doesn't have any notes anymore
|
||||||
instrument.releaseAllNotes();
|
instrument.releaseAllNotes();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -50,7 +50,7 @@ BufferingAudioSource::BufferingAudioSource (PositionableAudioSource* s,
|
||||||
jassert (source != nullptr);
|
jassert (source != nullptr);
|
||||||
|
|
||||||
jassert (numberOfSamplesToBuffer > 1024); // not much point using this class if you're
|
jassert (numberOfSamplesToBuffer > 1024); // not much point using this class if you're
|
||||||
// not using a larger buffer..
|
// not using a larger buffer
|
||||||
}
|
}
|
||||||
|
|
||||||
BufferingAudioSource::~BufferingAudioSource()
|
BufferingAudioSource::~BufferingAudioSource()
|
||||||
|
|
|
||||||
|
|
@ -134,7 +134,7 @@ void ResamplingAudioSource::getNextAudioBlock (const AudioSourceChannelInfo& inf
|
||||||
|
|
||||||
if (localRatio > 1.0001)
|
if (localRatio > 1.0001)
|
||||||
{
|
{
|
||||||
// for down-sampling, pre-apply the filter..
|
// for down-sampling, pre-apply the filter
|
||||||
|
|
||||||
for (int i = channelsToProcess; --i >= 0;)
|
for (int i = channelsToProcess; --i >= 0;)
|
||||||
applyFilter (buffer.getWritePointer (i, endOfBufferPos), numToDo, filterStates[i]);
|
applyFilter (buffer.getWritePointer (i, endOfBufferPos), numToDo, filterStates[i]);
|
||||||
|
|
@ -178,7 +178,7 @@ void ResamplingAudioSource::getNextAudioBlock (const AudioSourceChannelInfo& inf
|
||||||
|
|
||||||
if (localRatio < 0.9999)
|
if (localRatio < 0.9999)
|
||||||
{
|
{
|
||||||
// for up-sampling, apply the filter after transposing..
|
// for up-sampling, apply the filter after transposing
|
||||||
for (int i = channelsToProcess; --i >= 0;)
|
for (int i = channelsToProcess; --i >= 0;)
|
||||||
applyFilter (info.buffer->getWritePointer (i, info.startSample), info.numSamples, filterStates[i]);
|
applyFilter (info.buffer->getWritePointer (i, info.startSample), info.numSamples, filterStates[i]);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -553,7 +553,7 @@ SynthesiserVoice* Synthesiser::findVoiceToSteal (SynthesiserSound* soundToPlay,
|
||||||
usableVoicesToStealArray.add (voice);
|
usableVoicesToStealArray.add (voice);
|
||||||
|
|
||||||
// NB: Using a functor rather than a lambda here due to scare-stories about
|
// NB: Using a functor rather than a lambda here due to scare-stories about
|
||||||
// compilers generating code containing heap allocations..
|
// compilers generating code containing heap allocations.
|
||||||
struct Sorter
|
struct Sorter
|
||||||
{
|
{
|
||||||
bool operator() (const SynthesiserVoice* a, const SynthesiserVoice* b) const noexcept { return a->wasStartedBefore (*b); }
|
bool operator() (const SynthesiserVoice* a, const SynthesiserVoice* b) const noexcept { return a->wasStartedBefore (*b); }
|
||||||
|
|
@ -578,7 +578,7 @@ SynthesiserVoice* Synthesiser::findVoiceToSteal (SynthesiserSound* soundToPlay,
|
||||||
if (top == low)
|
if (top == low)
|
||||||
top = nullptr;
|
top = nullptr;
|
||||||
|
|
||||||
// The oldest note that's playing with the target pitch is ideal..
|
// The oldest note that's playing with the target pitch is ideal.
|
||||||
for (auto* voice : usableVoicesToStealArray)
|
for (auto* voice : usableVoicesToStealArray)
|
||||||
if (voice->getCurrentlyPlayingNote() == midiNoteNumber)
|
if (voice->getCurrentlyPlayingNote() == midiNoteNumber)
|
||||||
return voice;
|
return voice;
|
||||||
|
|
|
||||||
|
|
@ -132,7 +132,7 @@ private:
|
||||||
//==============================================================================
|
//==============================================================================
|
||||||
enum { defaultMinusInfinitydB = -100 };
|
enum { defaultMinusInfinitydB = -100 };
|
||||||
|
|
||||||
Decibels() = delete; // This class can't be instantiated, it's just a holder for static methods..
|
Decibels() = delete; // This class can't be instantiated, it's just a holder for static methods.
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace juce
|
} // namespace juce
|
||||||
|
|
|
||||||
|
|
@ -1350,7 +1350,7 @@ double AudioDeviceManager::LevelMeter::getCurrentLevel() const noexcept
|
||||||
|
|
||||||
void AudioDeviceManager::playTestSound()
|
void AudioDeviceManager::playTestSound()
|
||||||
{
|
{
|
||||||
{ // cunningly nested to swap, unlock and delete in that order.
|
{ // cunningly nested to swap, unlock and delete in that order
|
||||||
std::unique_ptr<AudioBuffer<float>> oldSound;
|
std::unique_ptr<AudioBuffer<float>> oldSound;
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -105,7 +105,7 @@ void MidiMessageCollector::removeNextBlockOfMessages (MidiBuffer& destBuffer,
|
||||||
if (numSourceSamples > numSamples)
|
if (numSourceSamples > numSamples)
|
||||||
{
|
{
|
||||||
// if our list of events is longer than the buffer we're being
|
// if our list of events is longer than the buffer we're being
|
||||||
// asked for, scale them down to squeeze them all in..
|
// asked for, scale them down to squeeze them all in
|
||||||
const int maxBlockLengthToUse = numSamples << 5;
|
const int maxBlockLengthToUse = numSamples << 5;
|
||||||
|
|
||||||
auto iter = incomingMessages.cbegin();
|
auto iter = incomingMessages.cbegin();
|
||||||
|
|
|
||||||
|
|
@ -220,7 +220,7 @@ public:
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (snd_pcm_hw_params_set_access (handle, hwParams, SND_PCM_ACCESS_RW_INTERLEAVED) >= 0) // works better for plughw..
|
if (snd_pcm_hw_params_set_access (handle, hwParams, SND_PCM_ACCESS_RW_INTERLEAVED) >= 0) // works better for plughw
|
||||||
isInterleaved = true;
|
isInterleaved = true;
|
||||||
else if (snd_pcm_hw_params_set_access (handle, hwParams, SND_PCM_ACCESS_RW_NONINTERLEAVED) >= 0)
|
else if (snd_pcm_hw_params_set_access (handle, hwParams, SND_PCM_ACCESS_RW_NONINTERLEAVED) >= 0)
|
||||||
isInterleaved = false;
|
isInterleaved = false;
|
||||||
|
|
@ -286,7 +286,7 @@ public:
|
||||||
|| JUCE_ALSA_FAILED (snd_pcm_hw_params_get_periods (hwParams, &periods, &dir)))
|
|| JUCE_ALSA_FAILED (snd_pcm_hw_params_get_periods (hwParams, &periods, &dir)))
|
||||||
latency = 0;
|
latency = 0;
|
||||||
else
|
else
|
||||||
latency = (int) frames * ((int) periods - 1); // (this is the method JACK uses to guess the latency..)
|
latency = (int) frames * ((int) periods - 1); // (this is the method JACK uses to guess the latency)
|
||||||
|
|
||||||
JUCE_ALSA_LOG ("frames: " << (int) frames << ", periods: " << (int) periods
|
JUCE_ALSA_LOG ("frames: " << (int) frames << ", periods: " << (int) periods
|
||||||
<< ", samplesPerPeriod: " << (int) samplesPerPeriod);
|
<< ", samplesPerPeriod: " << (int) samplesPerPeriod);
|
||||||
|
|
@ -551,7 +551,7 @@ public:
|
||||||
currentOutputChans.clear();
|
currentOutputChans.clear();
|
||||||
|
|
||||||
// Note that the input device is opened before an output, because we've heard
|
// Note that the input device is opened before an output, because we've heard
|
||||||
// of drivers where doing it in the reverse order mysteriously fails.. If this
|
// of drivers where doing it in the reverse order mysteriously fails. If this
|
||||||
// order also causes problems, let us know and we'll see if we can find a compromise!
|
// order also causes problems, let us know and we'll see if we can find a compromise!
|
||||||
|
|
||||||
if (inputChannelDataForCallback.size() > 0 && inputId.isNotEmpty())
|
if (inputChannelDataForCallback.size() > 0 && inputId.isNotEmpty())
|
||||||
|
|
@ -660,7 +660,7 @@ public:
|
||||||
|
|
||||||
if ((! waitForThreadToExit (400)) && audioIoInProgress && numCallbacks == callbacksToStop)
|
if ((! waitForThreadToExit (400)) && audioIoInProgress && numCallbacks == callbacksToStop)
|
||||||
{
|
{
|
||||||
JUCE_ALSA_LOG ("Thread is stuck in i/o.. Is pulseaudio suspended?");
|
JUCE_ALSA_LOG ("Thread is stuck in i/o. Is pulseaudio suspended?");
|
||||||
|
|
||||||
if (outputDevice != nullptr) outputDevice->closeNow();
|
if (outputDevice != nullptr) outputDevice->closeNow();
|
||||||
if (inputDevice != nullptr) inputDevice->closeNow();
|
if (inputDevice != nullptr) inputDevice->closeNow();
|
||||||
|
|
@ -1240,7 +1240,7 @@ private:
|
||||||
bool isInput = (ioid != "Output");
|
bool isInput = (ioid != "Output");
|
||||||
|
|
||||||
// alsa is stupid here, it advertises dmix and dsnoop as input/output devices, but
|
// alsa is stupid here, it advertises dmix and dsnoop as input/output devices, but
|
||||||
// opening dmix as input, or dsnoop as output will trigger errors..
|
// opening dmix as input, or dsnoop as output will trigger errors
|
||||||
isInput = isInput && ! id.startsWith ("dmix");
|
isInput = isInput && ! id.startsWith ("dmix");
|
||||||
isOutput = isOutput && ! id.startsWith ("dsnoop");
|
isOutput = isOutput && ! id.startsWith ("dsnoop");
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -119,7 +119,7 @@ struct ASIOSampleFormat
|
||||||
case ASIOSTDSDInt8NER8: break; // (unhandled)
|
case ASIOSTDSDInt8NER8: break; // (unhandled)
|
||||||
|
|
||||||
default:
|
default:
|
||||||
jassertfalse; // (not a valid format code..)
|
jassertfalse; // (not a valid format code)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -357,7 +357,7 @@ public:
|
||||||
|
|
||||||
void updateSampleRates()
|
void updateSampleRates()
|
||||||
{
|
{
|
||||||
// find a list of sample rates..
|
// find a list of sample rates
|
||||||
Array<double> newRates;
|
Array<double> newRates;
|
||||||
|
|
||||||
if (asioObject != nullptr)
|
if (asioObject != nullptr)
|
||||||
|
|
@ -586,7 +586,7 @@ public:
|
||||||
if (! calledback)
|
if (! calledback)
|
||||||
{
|
{
|
||||||
error = "Device didn't start correctly";
|
error = "Device didn't start correctly";
|
||||||
JUCE_ASIO_LOG ("no callbacks - stopping..");
|
JUCE_ASIO_LOG ("no callbacks - stopping");
|
||||||
asioObject->stop();
|
asioObject->stop();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -862,7 +862,7 @@ private:
|
||||||
|
|
||||||
if (shouldUsePreferredSize)
|
if (shouldUsePreferredSize)
|
||||||
{
|
{
|
||||||
JUCE_ASIO_LOG ("Using preferred size for buffer..");
|
JUCE_ASIO_LOG ("using preferred size for buffer");
|
||||||
auto err = refreshBufferSizes();
|
auto err = refreshBufferSizes();
|
||||||
|
|
||||||
if (err == ASE_OK)
|
if (err == ASE_OK)
|
||||||
|
|
@ -919,7 +919,7 @@ private:
|
||||||
|
|
||||||
void addBufferSizes (long minSize, long maxSize, long preferredSize, long granularity)
|
void addBufferSizes (long minSize, long maxSize, long preferredSize, long granularity)
|
||||||
{
|
{
|
||||||
// find a list of buffer sizes..
|
// find a list of buffer sizes
|
||||||
JUCE_ASIO_LOG (String ((int) minSize) + "->" + String ((int) maxSize) + ", "
|
JUCE_ASIO_LOG (String ((int) minSize) + "->" + String ((int) maxSize) + ", "
|
||||||
+ String ((int) preferredSize) + ", " + String ((int) granularity));
|
+ String ((int) preferredSize) + ", " + String ((int) granularity));
|
||||||
|
|
||||||
|
|
@ -964,7 +964,7 @@ private:
|
||||||
|
|
||||||
if (err == ASE_NoClock && numClockSources > 0)
|
if (err == ASE_NoClock && numClockSources > 0)
|
||||||
{
|
{
|
||||||
JUCE_ASIO_LOG ("trying to set a clock source..");
|
JUCE_ASIO_LOG ("trying to set a clock source");
|
||||||
err = asioObject->setClockSource (clocks[0].index);
|
err = asioObject->setClockSource (clocks[0].index);
|
||||||
JUCE_ASIO_LOG_ERROR ("setClockSource2", err);
|
JUCE_ASIO_LOG_ERROR ("setClockSource2", err);
|
||||||
Thread::sleep (10);
|
Thread::sleep (10);
|
||||||
|
|
@ -976,7 +976,7 @@ private:
|
||||||
if (err == 0)
|
if (err == 0)
|
||||||
currentSampleRate = newRate;
|
currentSampleRate = newRate;
|
||||||
|
|
||||||
// on fail, ignore the attempt to change rate, and run with the current one..
|
// on fail, ignore the attempt to change rate, and run with the current one
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1170,7 +1170,7 @@ private:
|
||||||
if (driverError.isEmpty())
|
if (driverError.isEmpty())
|
||||||
{
|
{
|
||||||
char buffer[512] = {};
|
char buffer[512] = {};
|
||||||
asioObject->getDriverName (buffer); // just in case any flimsy drivers expect this to be called..
|
asioObject->getDriverName (buffer); // just in case any flimsy drivers expect this to be called
|
||||||
}
|
}
|
||||||
|
|
||||||
return driverError;
|
return driverError;
|
||||||
|
|
@ -1178,7 +1178,7 @@ private:
|
||||||
|
|
||||||
String openDevice()
|
String openDevice()
|
||||||
{
|
{
|
||||||
// open the device and get its info..
|
// open the device and get its info
|
||||||
JUCE_ASIO_LOG ("opening device: " + getName());
|
JUCE_ASIO_LOG ("opening device: " + getName());
|
||||||
|
|
||||||
needToReset = false;
|
needToReset = false;
|
||||||
|
|
@ -1241,11 +1241,11 @@ private:
|
||||||
JUCE_ASIO_LOG ("outputReady true");
|
JUCE_ASIO_LOG ("outputReady true");
|
||||||
|
|
||||||
updateSampleRates();
|
updateSampleRates();
|
||||||
readLatencies(); // ..doing these steps because cubase does so at this stage
|
readLatencies(); // doing these steps because cubase does so at this stage
|
||||||
createDummyBuffers (preferredBufferSize); // in initialisation, and some devices fail if we don't.
|
createDummyBuffers (preferredBufferSize); // in initialisation, and some devices fail if we don't
|
||||||
readLatencies();
|
readLatencies();
|
||||||
|
|
||||||
// start and stop because cubase does it..
|
// start and stop because cubase does it
|
||||||
err = asioObject->start();
|
err = asioObject->start();
|
||||||
// ignore an error here, as it might start later after setting other stuff up
|
// ignore an error here, as it might start later after setting other stuff up
|
||||||
JUCE_ASIO_LOG_ERROR ("start", err);
|
JUCE_ASIO_LOG_ERROR ("start", err);
|
||||||
|
|
@ -1485,7 +1485,7 @@ public:
|
||||||
|
|
||||||
for (int i = deviceNames.size(); --i >= 0;)
|
for (int i = deviceNames.size(); --i >= 0;)
|
||||||
if (deviceNames[i].containsIgnoreCase ("asio4all"))
|
if (deviceNames[i].containsIgnoreCase ("asio4all"))
|
||||||
return i; // asio4all is a safe choice for a default..
|
return i; // asio4all is a safe choice for a default
|
||||||
|
|
||||||
#if JUCE_DEBUG
|
#if JUCE_DEBUG
|
||||||
if (deviceNames.size() > 1 && deviceNames[0].containsIgnoreCase ("digidesign"))
|
if (deviceNames.size() > 1 && deviceNames[0].containsIgnoreCase ("digidesign"))
|
||||||
|
|
@ -1503,7 +1503,7 @@ public:
|
||||||
return i;
|
return i;
|
||||||
|
|
||||||
jassertfalse; // unfortunately you can only have a finite number
|
jassertfalse; // unfortunately you can only have a finite number
|
||||||
// of ASIO devices open at the same time..
|
// of ASIO devices open at the same time
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1579,7 +1579,7 @@ private:
|
||||||
|
|
||||||
if (RegQueryValueEx (pathKey, 0, 0, &dtype, (LPBYTE) pathName, &dsize) == ERROR_SUCCESS)
|
if (RegQueryValueEx (pathKey, 0, 0, &dtype, (LPBYTE) pathName, &dsize) == ERROR_SUCCESS)
|
||||||
// In older code, this used to check for the existence of the file, but there are situations
|
// In older code, this used to check for the existence of the file, but there are situations
|
||||||
// where our process doesn't have access to it, but where the driver still loads ok..
|
// where our process doesn't have access to it, but where the driver still loads ok.
|
||||||
ok = (pathName[0] != 0);
|
ok = (pathName[0] != 0);
|
||||||
|
|
||||||
RegCloseKey (pathKey);
|
RegCloseKey (pathKey);
|
||||||
|
|
|
||||||
|
|
@ -671,7 +671,7 @@ public:
|
||||||
// Annoyingly, after changing the rate and buffer size, some devices fail to
|
// Annoyingly, after changing the rate and buffer size, some devices fail to
|
||||||
// correctly report their new settings until some random time in the future, so
|
// correctly report their new settings until some random time in the future, so
|
||||||
// after calling updateDetailsFromDevice, we need to manually bodge these values
|
// after calling updateDetailsFromDevice, we need to manually bodge these values
|
||||||
// to make sure we're using the correct numbers..
|
// to make sure we're using the correct numbers.
|
||||||
updateDetailsFromDevice (ins, outs);
|
updateDetailsFromDevice (ins, outs);
|
||||||
sampleRate = newSampleRate;
|
sampleRate = newSampleRate;
|
||||||
bufferSize = bufferSizeSamples;
|
bufferSize = bufferSizeSamples;
|
||||||
|
|
@ -2298,7 +2298,7 @@ public:
|
||||||
jassert (hasScanned); // need to call scanForDevices() before doing this
|
jassert (hasScanned); // need to call scanForDevices() before doing this
|
||||||
|
|
||||||
// if they're asking for any input channels at all, use the default input, so we
|
// if they're asking for any input channels at all, use the default input, so we
|
||||||
// get the built-in mic rather than the built-in output with no inputs..
|
// get the built-in mic rather than the built-in output with no inputs
|
||||||
|
|
||||||
AudioObjectPropertyAddress pa;
|
AudioObjectPropertyAddress pa;
|
||||||
auto selector = forInput ? kAudioHardwarePropertyDefaultInputDevice
|
auto selector = forInput ? kAudioHardwarePropertyDefaultInputDevice
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,7 @@
|
||||||
|
|
||||||
extern "C"
|
extern "C"
|
||||||
{
|
{
|
||||||
// Declare just the minimum number of interfaces for the DSound objects that we need..
|
// Declare just the minimum number of interfaces for the DSound objects that we need.
|
||||||
struct DSBUFFERDESC
|
struct DSBUFFERDESC
|
||||||
{
|
{
|
||||||
DWORD dwSize;
|
DWORD dwSize;
|
||||||
|
|
@ -857,7 +857,7 @@ public:
|
||||||
{
|
{
|
||||||
if (! isThreadRunning())
|
if (! isThreadRunning())
|
||||||
{
|
{
|
||||||
// something gone wrong and the thread's stopped..
|
// something gone wrong and the thread's stopped
|
||||||
isOpen_ = false;
|
isOpen_ = false;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -1119,7 +1119,7 @@ String DSoundAudioIODevice::openDevice (const BigInteger& inputChannels,
|
||||||
sampleRate = sampleRate_ > 0.0 ? sampleRate_ : 44100.0;
|
sampleRate = sampleRate_ > 0.0 ? sampleRate_ : 44100.0;
|
||||||
|
|
||||||
if (bufferSizeSamples_ <= 0)
|
if (bufferSizeSamples_ <= 0)
|
||||||
bufferSizeSamples_ = 960; // use as a default size if none is set.
|
bufferSizeSamples_ = 960; // use as a default size if none is set
|
||||||
|
|
||||||
bufferSizeSamples = bufferSizeSamples_ & ~7;
|
bufferSizeSamples = bufferSizeSamples_ & ~7;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -800,11 +800,11 @@ public:
|
||||||
OpenSLAudioIODevice (const String& deviceName) : AudioIODevice (deviceName, openSLTypeName)
|
OpenSLAudioIODevice (const String& deviceName) : AudioIODevice (deviceName, openSLTypeName)
|
||||||
{
|
{
|
||||||
// OpenSL has piss-poor support for determining latency, so the only way I can find to
|
// OpenSL has piss-poor support for determining latency, so the only way I can find to
|
||||||
// get a number for this is by asking the AudioTrack/AudioRecord classes..
|
// get a number for this is by asking the AudioTrack/AudioRecord classes.
|
||||||
AndroidAudioIODevice javaDevice (deviceName);
|
AndroidAudioIODevice javaDevice (deviceName);
|
||||||
|
|
||||||
// this is a total guess about how to calculate the latency, but seems to vaguely agree
|
// this is a total guess about how to calculate the latency, but seems to vaguely agree
|
||||||
// with the devices I've tested.. YMMV
|
// with the devices I've tested. YMMV
|
||||||
inputLatency = (javaDevice.minBufferSizeIn * 2) / 3;
|
inputLatency = (javaDevice.minBufferSizeIn * 2) / 3;
|
||||||
outputLatency = (javaDevice.minBufferSizeOut * 2) / 3;
|
outputLatency = (javaDevice.minBufferSizeOut * 2) / 3;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1474,7 +1474,7 @@ public:
|
||||||
|
|
||||||
if (! isThreadRunning())
|
if (! isThreadRunning())
|
||||||
{
|
{
|
||||||
// something's gone wrong and the thread's stopped..
|
// something's gone wrong and the thread's stopped
|
||||||
flags &= ~flagOpen;
|
flags &= ~flagOpen;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -85,7 +85,7 @@ void AudioSourcePlayer::audioDeviceIOCallbackWithContext (const float* const* in
|
||||||
int numActiveChans = 0, numInputs = 0, numOutputs = 0;
|
int numActiveChans = 0, numInputs = 0, numOutputs = 0;
|
||||||
|
|
||||||
// messy stuff needed to compact the channels down into an array
|
// messy stuff needed to compact the channels down into an array
|
||||||
// of non-zero pointers..
|
// of non-zero pointers
|
||||||
for (int i = 0; i < totalNumInputChannels; ++i)
|
for (int i = 0; i < totalNumInputChannels; ++i)
|
||||||
{
|
{
|
||||||
if (inputChannelData[i] != nullptr)
|
if (inputChannelData[i] != nullptr)
|
||||||
|
|
|
||||||
|
|
@ -269,7 +269,7 @@ void AudioTransportSource::getNextAudioBlock (const AudioSourceChannelInfo& info
|
||||||
|
|
||||||
if (! playing)
|
if (! playing)
|
||||||
{
|
{
|
||||||
// just stopped playing, so fade out the last block..
|
// just stopped playing, so fade out the last block
|
||||||
for (int i = info.buffer->getNumChannels(); --i >= 0;)
|
for (int i = info.buffer->getNumChannels(); --i >= 0;)
|
||||||
info.buffer->applyGainRamp (i, info.startSample, jmin (256, info.numSamples), 1.0f, 0.0f);
|
info.buffer->applyGainRamp (i, info.startSample, jmin (256, info.numSamples), 1.0f, 0.0f);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -707,9 +707,9 @@ public:
|
||||||
if (bytesWritten + bytes >= (size_t) 0xfff00000
|
if (bytesWritten + bytes >= (size_t) 0xfff00000
|
||||||
|| ! output->write (tempBlock.getData(), bytes))
|
|| ! output->write (tempBlock.getData(), bytes))
|
||||||
{
|
{
|
||||||
// failed to write to disk, so let's try writing the header.
|
// Failed to write to disk, so let's try writing the header.
|
||||||
// If it's just run out of disk space, then if it does manage
|
// If it's just run out of disk space, then if it does manage
|
||||||
// to write the header, we'll still have a useable file..
|
// to write the header, we'll still have a useable file.
|
||||||
writeHeader();
|
writeHeader();
|
||||||
writeFailed = true;
|
writeFailed = true;
|
||||||
return false;
|
return false;
|
||||||
|
|
@ -848,7 +848,7 @@ public:
|
||||||
|
|
||||||
if (map == nullptr || ! mappedSection.contains (Range<int64> (startSampleInFile, startSampleInFile + numSamples)))
|
if (map == nullptr || ! mappedSection.contains (Range<int64> (startSampleInFile, startSampleInFile + numSamples)))
|
||||||
{
|
{
|
||||||
jassertfalse; // you must make sure that the window contains all the samples you're going to attempt to read.
|
jassertfalse; // you must make sure that the window contains all the samples you're going to attempt to read
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -870,7 +870,7 @@ public:
|
||||||
|
|
||||||
if (map == nullptr || ! mappedSection.contains (sample))
|
if (map == nullptr || ! mappedSection.contains (sample))
|
||||||
{
|
{
|
||||||
jassertfalse; // you must make sure that the window contains all the samples you're going to attempt to read.
|
jassertfalse; // you must make sure that the window contains all the samples you're going to attempt to read
|
||||||
|
|
||||||
zeromem (result, (size_t) num * sizeof (float));
|
zeromem (result, (size_t) num * sizeof (float));
|
||||||
return;
|
return;
|
||||||
|
|
@ -913,7 +913,7 @@ public:
|
||||||
|
|
||||||
if (map == nullptr || numSamples <= 0 || ! mappedSection.contains (Range<int64> (startSampleInFile, startSampleInFile + numSamples)))
|
if (map == nullptr || numSamples <= 0 || ! mappedSection.contains (Range<int64> (startSampleInFile, startSampleInFile + numSamples)))
|
||||||
{
|
{
|
||||||
jassert (numSamples <= 0); // you must make sure that the window contains all the samples you're going to attempt to read.
|
jassert (numSamples <= 0); // you must make sure that the window contains all the samples you're going to attempt to read
|
||||||
|
|
||||||
for (int i = 0; i < numChannelsToRead; ++i)
|
for (int i = 0; i < numChannelsToRead; ++i)
|
||||||
results[i] = Range<float>();
|
results[i] = Range<float>();
|
||||||
|
|
|
||||||
|
|
@ -222,7 +222,7 @@ public:
|
||||||
if (lengthInSamples == 0 && sampleRate > 0)
|
if (lengthInSamples == 0 && sampleRate > 0)
|
||||||
{
|
{
|
||||||
// the length hasn't been stored in the metadata, so we'll need to
|
// the length hasn't been stored in the metadata, so we'll need to
|
||||||
// work it out the length the hard way, by scanning the whole file..
|
// work it out the length the hard way, by scanning the whole file
|
||||||
scanningForLength = true;
|
scanningForLength = true;
|
||||||
FLAC__stream_decoder_process_until_end_of_stream (decoder);
|
FLAC__stream_decoder_process_until_end_of_stream (decoder);
|
||||||
scanningForLength = false;
|
scanningForLength = false;
|
||||||
|
|
|
||||||
|
|
@ -327,7 +327,7 @@ public:
|
||||||
{
|
{
|
||||||
if (ok)
|
if (ok)
|
||||||
{
|
{
|
||||||
// write a zero-length packet to show ogg that we're finished..
|
// write a zero-length packet to show ogg that we're finished
|
||||||
writeSamples (0);
|
writeSamples (0);
|
||||||
|
|
||||||
ogg_stream_clear (&os);
|
ogg_stream_clear (&os);
|
||||||
|
|
|
||||||
|
|
@ -1651,9 +1651,9 @@ public:
|
||||||
|
|
||||||
if (! output->write (tempBlock.getData(), bytes))
|
if (! output->write (tempBlock.getData(), bytes))
|
||||||
{
|
{
|
||||||
// failed to write to disk, so let's try writing the header.
|
// Failed to write to disk, so let's try writing the header.
|
||||||
// If it's just run out of disk space, then if it does manage
|
// If it's just run out of disk space, then if it does manage
|
||||||
// to write the header, we'll still have a usable file..
|
// to write the header, we'll still have a usable file.
|
||||||
writeHeader();
|
writeHeader();
|
||||||
writeFailed = true;
|
writeFailed = true;
|
||||||
return false;
|
return false;
|
||||||
|
|
@ -1890,7 +1890,7 @@ public:
|
||||||
|
|
||||||
if (map == nullptr || ! mappedSection.contains (sample))
|
if (map == nullptr || ! mappedSection.contains (sample))
|
||||||
{
|
{
|
||||||
jassertfalse; // you must make sure that the window contains all the samples you're going to attempt to read.
|
jassertfalse; // you must make sure that the window contains all the samples you're going to attempt to read
|
||||||
|
|
||||||
zeromem (result, (size_t) num * sizeof (float));
|
zeromem (result, (size_t) num * sizeof (float));
|
||||||
return;
|
return;
|
||||||
|
|
@ -1917,7 +1917,7 @@ public:
|
||||||
|
|
||||||
if (map == nullptr || numSamples <= 0 || ! mappedSection.contains (Range<int64> (startSampleInFile, startSampleInFile + numSamples)))
|
if (map == nullptr || numSamples <= 0 || ! mappedSection.contains (Range<int64> (startSampleInFile, startSampleInFile + numSamples)))
|
||||||
{
|
{
|
||||||
jassert (numSamples <= 0); // you must make sure that the window contains all the samples you're going to attempt to read.
|
jassert (numSamples <= 0); // you must make sure that the window contains all the samples you're going to attempt to read
|
||||||
|
|
||||||
for (int i = 0; i < numChannelsToRead; ++i)
|
for (int i = 0; i < numChannelsToRead; ++i)
|
||||||
results[i] = {};
|
results[i] = {};
|
||||||
|
|
@ -2090,7 +2090,7 @@ bool WavAudioFormat::replaceMetadataInFile (const File& wavFile, const StringPai
|
||||||
|
|
||||||
if (chunk.getSize() <= (size_t) bwavSize)
|
if (chunk.getSize() <= (size_t) bwavSize)
|
||||||
{
|
{
|
||||||
// the new one will fit in the space available, so write it directly..
|
// the new one will fit in the space available, so write it directly
|
||||||
auto oldSize = wavFile.getSize();
|
auto oldSize = wavFile.getSize();
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -67,7 +67,7 @@ public:
|
||||||
This is the number of samples from the start of an edit that the
|
This is the number of samples from the start of an edit that the
|
||||||
file is supposed to begin at. Seems like an obvious mistake to
|
file is supposed to begin at. Seems like an obvious mistake to
|
||||||
only allow a file to occur in an edit once, but that's the way
|
only allow a file to occur in an edit once, but that's the way
|
||||||
it is..
|
it is.
|
||||||
|
|
||||||
@see AudioFormatReader::metadataValues, createWriterFor
|
@see AudioFormatReader::metadataValues, createWriterFor
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -188,7 +188,7 @@ bool AudioFormatReader::read (AudioBuffer<float>* buffer,
|
||||||
if (! read (chans, 2, readerStartSample, numSamples, true))
|
if (! read (chans, 2, readerStartSample, numSamples, true))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// if the target's stereo and the source is mono, dupe the first channel..
|
// if the target's stereo and the source is mono, dupe the first channel
|
||||||
if (numTargetChannels > 1
|
if (numTargetChannels > 1
|
||||||
&& (chans[0] == nullptr || chans[1] == nullptr)
|
&& (chans[0] == nullptr || chans[1] == nullptr)
|
||||||
&& (dests[0] != nullptr && dests[1] != nullptr))
|
&& (dests[0] != nullptr && dests[1] != nullptr))
|
||||||
|
|
@ -439,7 +439,7 @@ void MemoryMappedAudioFormatReader::touchSample (int64 sample) const noexcept
|
||||||
if (map != nullptr && mappedSection.contains (sample))
|
if (map != nullptr && mappedSection.contains (sample))
|
||||||
memoryReadDummyVariable += *(char*) sampleToPointer (sample);
|
memoryReadDummyVariable += *(char*) sampleToPointer (sample);
|
||||||
else
|
else
|
||||||
jassertfalse; // you must make sure that the window contains all the samples you're going to attempt to read.
|
jassertfalse; // you must make sure that the window contains all the samples you're going to attempt to read
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace juce
|
} // namespace juce
|
||||||
|
|
|
||||||
|
|
@ -140,7 +140,7 @@ void SamplerVoice::renderNextBlock (AudioBuffer<float>& outputBuffer, int startS
|
||||||
auto alpha = (float) (sourceSamplePosition - pos);
|
auto alpha = (float) (sourceSamplePosition - pos);
|
||||||
auto invAlpha = 1.0f - alpha;
|
auto invAlpha = 1.0f - alpha;
|
||||||
|
|
||||||
// just using a very simple linear interpolation here..
|
// just using a very simple linear interpolation here
|
||||||
float l = (inL[pos] * invAlpha + inL[pos + 1] * alpha);
|
float l = (inL[pos] * invAlpha + inL[pos + 1] * alpha);
|
||||||
float r = (inR != nullptr) ? (inR[pos] * invAlpha + inR[pos + 1] * alpha)
|
float r = (inR != nullptr) ? (inR[pos] * invAlpha + inR[pos + 1] * alpha)
|
||||||
: l;
|
: l;
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// The following checks should cause a compile error if you've forgotten to
|
// The following checks should cause a compile error if you've forgotten to
|
||||||
// define all your plugin settings properly..
|
// define all your plugin settings properly.
|
||||||
|
|
||||||
#if ! (JucePlugin_Build_VST || JucePlugin_Build_VST3 \
|
#if ! (JucePlugin_Build_VST || JucePlugin_Build_VST3 \
|
||||||
|| JucePlugin_Build_AU || JucePlugin_Build_AUv3 \
|
|| JucePlugin_Build_AU || JucePlugin_Build_AUv3 \
|
||||||
|
|
|
||||||
|
|
@ -58,7 +58,7 @@ struct VSTWindowUtilities
|
||||||
: ComponentPeer::windowIgnoresKeyPresses;
|
: ComponentPeer::windowIgnoresKeyPresses;
|
||||||
comp->addToDesktop (desktopFlags | defaultFlags, parentView);
|
comp->addToDesktop (desktopFlags | defaultFlags, parentView);
|
||||||
|
|
||||||
// (this workaround is because Wavelab provides a zero-size parent view..)
|
// this workaround is because Wavelab provides a zero-size parent view
|
||||||
if (approximatelyEqual ([parentView frame].size.height, 0.0))
|
if (approximatelyEqual ([parentView frame].size.height, 0.0))
|
||||||
[((NSView*) comp->getWindowHandle()) setFrameOrigin: NSZeroPoint];
|
[((NSView*) comp->getWindowHandle()) setFrameOrigin: NSZeroPoint];
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -931,7 +931,7 @@ namespace AAXClasses
|
||||||
auto numObjects = dataSize / sizeof (PluginInstanceInfo);
|
auto numObjects = dataSize / sizeof (PluginInstanceInfo);
|
||||||
auto* objects = static_cast<PluginInstanceInfo*> (data);
|
auto* objects = static_cast<PluginInstanceInfo*> (data);
|
||||||
|
|
||||||
jassert (numObjects == 1); // not sure how to handle more than one..
|
jassert (numObjects == 1); // not sure how to handle more than one
|
||||||
|
|
||||||
for (size_t i = 0; i < numObjects; ++i)
|
for (size_t i = 0; i < numObjects; ++i)
|
||||||
new (objects + i) PluginInstanceInfo (const_cast<JuceAAX_Processor&> (*this));
|
new (objects + i) PluginInstanceInfo (const_cast<JuceAAX_Processor&> (*this));
|
||||||
|
|
|
||||||
|
|
@ -1892,7 +1892,7 @@ public:
|
||||||
if (activePlugins.size() + activeUIs.size() == 0)
|
if (activePlugins.size() + activeUIs.size() == 0)
|
||||||
{
|
{
|
||||||
// there's some kind of component currently modal, but the host
|
// there's some kind of component currently modal, but the host
|
||||||
// is trying to delete our plugin..
|
// is trying to delete our plugin
|
||||||
jassert (ModalComponentManager::getInstanceWithoutCreating() == nullptr
|
jassert (ModalComponentManager::getInstanceWithoutCreating() == nullptr
|
||||||
|| Component::getCurrentlyModalComponent() == nullptr);
|
|| Component::getCurrentlyModalComponent() == nullptr);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1281,7 +1281,7 @@ private:
|
||||||
|
|
||||||
// In the event that the plugin decides to send all of its parameters in one go,
|
// In the event that the plugin decides to send all of its parameters in one go,
|
||||||
// we should ensure that the output buffer is large enough to accommodate, with some
|
// we should ensure that the output buffer is large enough to accommodate, with some
|
||||||
// extra room for the sequence header, MIDI messages etc..
|
// extra room for the sequence header, MIDI messages etc.
|
||||||
const auto patchSetSizeBytes = 72;
|
const auto patchSetSizeBytes = 72;
|
||||||
const auto additionalSize = 8192;
|
const auto additionalSize = 8192;
|
||||||
const auto atomPortMinSize = proc.getParameters().size() * patchSetSizeBytes + additionalSize;
|
const auto atomPortMinSize = proc.getParameters().size() * patchSetSizeBytes + additionalSize;
|
||||||
|
|
|
||||||
|
|
@ -454,10 +454,10 @@ public:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// if some output channels are disabled, some hosts supply the same buffer
|
// If some output channels are disabled, some hosts supply the same buffer
|
||||||
// for multiple channels or supply a nullptr - this buggers up our method
|
// for multiple channels or supply a nullptr - this buggers up our method
|
||||||
// of copying the inputs over the outputs, so we need to create unique temp
|
// of copying the inputs over the outputs, so we need to create unique temp
|
||||||
// buffers in this case..
|
// buffers in this case.
|
||||||
if (bufferPointerReusedForOtherChannels || chan == nullptr)
|
if (bufferPointerReusedForOtherChannels || chan == nullptr)
|
||||||
{
|
{
|
||||||
chan = new FloatType [(size_t) blockSize * 2];
|
chan = new FloatType [(size_t) blockSize * 2];
|
||||||
|
|
@ -491,7 +491,7 @@ public:
|
||||||
processor->processBlock (chans, midiEvents);
|
processor->processBlock (chans, midiEvents);
|
||||||
}
|
}
|
||||||
|
|
||||||
// copy back any temp channels that may have been used..
|
// copy back any temp channels that may have been used
|
||||||
for (i = 0; i < numOut; ++i)
|
for (i = 0; i < numOut; ++i)
|
||||||
if (auto* chan = tmpBuffers.tempChannels.getUnchecked (i))
|
if (auto* chan = tmpBuffers.tempChannels.getUnchecked (i))
|
||||||
if (auto* dest = outputs[i])
|
if (auto* dest = outputs[i])
|
||||||
|
|
@ -863,8 +863,8 @@ public:
|
||||||
|
|
||||||
editorComp = nullptr;
|
editorComp = nullptr;
|
||||||
|
|
||||||
// there's some kind of component currently modal, but the host
|
// There's some kind of component currently modal, but the host
|
||||||
// is trying to delete our plugin. You should try to avoid this happening..
|
// is trying to delete our plugin. You should try to avoid this happening.
|
||||||
jassert (Component::getCurrentlyModalComponent() == nullptr);
|
jassert (Component::getCurrentlyModalComponent() == nullptr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1084,7 +1084,7 @@ public:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// some hosts don't support the sizeWindow call, so do it manually..
|
// some hosts don't support the sizeWindow call, so do it manually
|
||||||
if (! sizeWasSuccessful)
|
if (! sizeWasSuccessful)
|
||||||
{
|
{
|
||||||
const ScopedValueSetter<bool> resizingParentSetter (resizingParent, true);
|
const ScopedValueSetter<bool> resizingParentSetter (resizingParent, true);
|
||||||
|
|
@ -1354,7 +1354,7 @@ private:
|
||||||
|
|
||||||
//==============================================================================
|
//==============================================================================
|
||||||
#if JUCE_WINDOWS
|
#if JUCE_WINDOWS
|
||||||
// Workarounds for hosts which attempt to open editor windows on a non-GUI thread.. (Grrrr...)
|
// Workarounds for hosts which attempt to open editor windows on a non-GUI thread. (Grrrr...)
|
||||||
static void checkWhetherMessageThreadIsCorrect()
|
static void checkWhetherMessageThreadIsCorrect()
|
||||||
{
|
{
|
||||||
auto host = detail::PluginUtilities::getHostType();
|
auto host = detail::PluginUtilities::getHostType();
|
||||||
|
|
@ -1498,7 +1498,7 @@ private:
|
||||||
{
|
{
|
||||||
if (auto* param = juceParameters.getParamForIndex (args.index))
|
if (auto* param = juceParameters.getParamForIndex (args.index))
|
||||||
{
|
{
|
||||||
// length should technically be kVstMaxParamStrLen, which is 8, but hosts will normally allow a bit more.
|
// length should technically be kVstMaxParamStrLen, which is 8, but hosts will normally allow a bit more
|
||||||
param->getLabel().copyToUTF8 ((char*) args.ptr, 24 + 1);
|
param->getLabel().copyToUTF8 ((char*) args.ptr, 24 + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1509,7 +1509,7 @@ private:
|
||||||
{
|
{
|
||||||
if (auto* param = juceParameters.getParamForIndex (args.index))
|
if (auto* param = juceParameters.getParamForIndex (args.index))
|
||||||
{
|
{
|
||||||
// length should technically be kVstMaxParamStrLen, which is 8, but hosts will normally allow a bit more.
|
// length should technically be kVstMaxParamStrLen, which is 8, but hosts will normally allow a bit more
|
||||||
param->getCurrentValueAsText().copyToUTF8 ((char*) args.ptr, 24 + 1);
|
param->getCurrentValueAsText().copyToUTF8 ((char*) args.ptr, 24 + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1520,7 +1520,7 @@ private:
|
||||||
{
|
{
|
||||||
if (auto* param = juceParameters.getParamForIndex (args.index))
|
if (auto* param = juceParameters.getParamForIndex (args.index))
|
||||||
{
|
{
|
||||||
// length should technically be kVstMaxParamStrLen, which is 8, but hosts will normally allow a bit more.
|
// length should technically be kVstMaxParamStrLen, which is 8, but hosts will normally allow a bit more
|
||||||
param->getName (32).copyToUTF8 ((char*) args.ptr, 32 + 1);
|
param->getName (32).copyToUTF8 ((char*) args.ptr, 32 + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -2189,7 +2189,7 @@ namespace
|
||||||
JUCE_BEGIN_IGNORE_WARNINGS_GCC_LIKE ("-Wmissing-prototypes")
|
JUCE_BEGIN_IGNORE_WARNINGS_GCC_LIKE ("-Wmissing-prototypes")
|
||||||
|
|
||||||
//==============================================================================
|
//==============================================================================
|
||||||
// Mac startup code..
|
// Mac startup code
|
||||||
#if JUCE_MAC
|
#if JUCE_MAC
|
||||||
|
|
||||||
JUCE_EXPORTED_FUNCTION Vst2::AEffect* VSTPluginMain (Vst2::audioMasterCallback audioMaster);
|
JUCE_EXPORTED_FUNCTION Vst2::AEffect* VSTPluginMain (Vst2::audioMasterCallback audioMaster);
|
||||||
|
|
@ -2205,7 +2205,7 @@ JUCE_BEGIN_IGNORE_WARNINGS_GCC_LIKE ("-Wmissing-prototypes")
|
||||||
}
|
}
|
||||||
|
|
||||||
//==============================================================================
|
//==============================================================================
|
||||||
// Linux startup code..
|
// Linux startup code
|
||||||
#elif JUCE_LINUX || JUCE_BSD
|
#elif JUCE_LINUX || JUCE_BSD
|
||||||
|
|
||||||
JUCE_EXPORTED_FUNCTION Vst2::AEffect* VSTPluginMain (Vst2::audioMasterCallback audioMaster);
|
JUCE_EXPORTED_FUNCTION Vst2::AEffect* VSTPluginMain (Vst2::audioMasterCallback audioMaster);
|
||||||
|
|
@ -2225,7 +2225,7 @@ JUCE_BEGIN_IGNORE_WARNINGS_GCC_LIKE ("-Wmissing-prototypes")
|
||||||
__attribute__ ((destructor)) void myPluginFini() {}
|
__attribute__ ((destructor)) void myPluginFini() {}
|
||||||
|
|
||||||
//==============================================================================
|
//==============================================================================
|
||||||
// Win32 startup code..
|
// Win32 startup code
|
||||||
#else
|
#else
|
||||||
|
|
||||||
extern "C" __declspec (dllexport) Vst2::AEffect* VSTPluginMain (Vst2::audioMasterCallback audioMaster)
|
extern "C" __declspec (dllexport) Vst2::AEffect* VSTPluginMain (Vst2::audioMasterCallback audioMaster)
|
||||||
|
|
|
||||||
|
|
@ -177,7 +177,7 @@ private:
|
||||||
}
|
}
|
||||||
|
|
||||||
#if JUCE_MODAL_LOOPS_PERMITTED
|
#if JUCE_MODAL_LOOPS_PERMITTED
|
||||||
// Unfortunately, Steinberg's docs explicitly say this should be modal..
|
// Unfortunately, Steinberg's docs explicitly say this should be modal.
|
||||||
handleResult (topLevelMenu->showMenu (options));
|
handleResult (topLevelMenu->showMenu (options));
|
||||||
#else
|
#else
|
||||||
topLevelMenu->showMenuAsync (options,
|
topLevelMenu->showMenuAsync (options,
|
||||||
|
|
|
||||||
|
|
@ -479,7 +479,7 @@ private:
|
||||||
if ((rw > 50 && rh > 50 && rw < 2000 && rh < 2000 && (! isWithin (w, rw, 2) || ! isWithin (h, rh, 2)))
|
if ((rw > 50 && rh > 50 && rw < 2000 && rh < 2000 && (! isWithin (w, rw, 2) || ! isWithin (h, rh, 2)))
|
||||||
|| ((w == 0 && rw > 0) || (h == 0 && rh > 0)))
|
|| ((w == 0 && rw > 0) || (h == 0 && rh > 0)))
|
||||||
{
|
{
|
||||||
// very dodgy logic to decide which size is right.
|
// very dodgy logic to decide which size is right
|
||||||
if (std::abs (rw - w) > 350 || std::abs (rh - h) > 350)
|
if (std::abs (rw - w) > 350 || std::abs (rh - h) > 350)
|
||||||
{
|
{
|
||||||
ScopedThreadDPIAwarenessSetter threadDpiAwarenessSetter { pluginHWND };
|
ScopedThreadDPIAwarenessSetter threadDpiAwarenessSetter { pluginHWND };
|
||||||
|
|
@ -604,7 +604,7 @@ private:
|
||||||
resizeToFit();
|
resizeToFit();
|
||||||
}
|
}
|
||||||
|
|
||||||
// hooks to get keyboard events from VST windows.
|
// hooks to get keyboard events from VST windows
|
||||||
static LRESULT CALLBACK vstHookWndProc (HWND hW, UINT message, WPARAM wParam, LPARAM lParam)
|
static LRESULT CALLBACK vstHookWndProc (HWND hW, UINT message, WPARAM wParam, LPARAM lParam)
|
||||||
{
|
{
|
||||||
for (int i = activeVSTWindows.size(); --i >= 0;)
|
for (int i = activeVSTWindows.size(); --i >= 0;)
|
||||||
|
|
|
||||||
|
|
@ -42,7 +42,7 @@ AudioProcessorEditor::AudioProcessorEditor (AudioProcessor& p) noexcept : proce
|
||||||
|
|
||||||
AudioProcessorEditor::AudioProcessorEditor (AudioProcessor* p) noexcept : processor (*p)
|
AudioProcessorEditor::AudioProcessorEditor (AudioProcessor* p) noexcept : processor (*p)
|
||||||
{
|
{
|
||||||
// the filter must be valid..
|
// the filter must be valid
|
||||||
jassert (p != nullptr);
|
jassert (p != nullptr);
|
||||||
initialise();
|
initialise();
|
||||||
}
|
}
|
||||||
|
|
@ -50,7 +50,7 @@ AudioProcessorEditor::AudioProcessorEditor (AudioProcessor* p) noexcept : proce
|
||||||
AudioProcessorEditor::~AudioProcessorEditor()
|
AudioProcessorEditor::~AudioProcessorEditor()
|
||||||
{
|
{
|
||||||
// if this fails, then the wrapper hasn't called editorBeingDeleted() on the
|
// if this fails, then the wrapper hasn't called editorBeingDeleted() on the
|
||||||
// filter for some reason..
|
// filter for some reason
|
||||||
jassert (processor.getActiveEditor() != this);
|
jassert (processor.getActiveEditor() != this);
|
||||||
removeComponentListener (resizeListener.get());
|
removeComponentListener (resizeListener.get());
|
||||||
}
|
}
|
||||||
|
|
@ -91,7 +91,7 @@ void AudioProcessorEditor::setResizeLimits (int newMinimumWidth,
|
||||||
{
|
{
|
||||||
if (constrainer != nullptr && constrainer != &defaultConstrainer)
|
if (constrainer != nullptr && constrainer != &defaultConstrainer)
|
||||||
{
|
{
|
||||||
// if you've set up a custom constrainer then these settings won't have any effect..
|
// if you've set up a custom constrainer then these settings won't have any effect
|
||||||
jassertfalse;
|
jassertfalse;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -103,7 +103,7 @@ bool KnownPluginList::addType (const PluginDescription& type)
|
||||||
{
|
{
|
||||||
if (desc.isDuplicateOf (type))
|
if (desc.isDuplicateOf (type))
|
||||||
{
|
{
|
||||||
// strange - found a duplicate plugin with different info..
|
// strange - found a duplicate plugin with different info
|
||||||
jassert (desc.name == type.name);
|
jassert (desc.name == type.name);
|
||||||
jassert (desc.isInstrument == type.isInstrument);
|
jassert (desc.isInstrument == type.isInstrument);
|
||||||
|
|
||||||
|
|
@ -489,7 +489,7 @@ struct PluginTreeUtils
|
||||||
{
|
{
|
||||||
#if JUCE_MAC
|
#if JUCE_MAC
|
||||||
if (path.containsChar (':'))
|
if (path.containsChar (':'))
|
||||||
path = path.fromFirstOccurrenceOf (":", false, false); // avoid the special AU formatting nonsense on Mac..
|
path = path.fromFirstOccurrenceOf (":", false, false); // avoid the special AU formatting nonsense on Mac
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (path.isEmpty())
|
if (path.isEmpty())
|
||||||
|
|
|
||||||
|
|
@ -69,7 +69,7 @@ void PluginDirectoryScanner::setFilesOrIdentifiersToScan (const StringArray& fil
|
||||||
filesOrIdentifiersToScan = filesOrIdentifiers;
|
filesOrIdentifiersToScan = filesOrIdentifiers;
|
||||||
|
|
||||||
// If any plugins have crashed recently when being loaded, move them to the
|
// If any plugins have crashed recently when being loaded, move them to the
|
||||||
// end of the list to give the others a chance to load correctly..
|
// end of the list to give the others a chance to load correctly.
|
||||||
for (auto& crashed : readDeadMansPedalFile (deadMansPedalFile))
|
for (auto& crashed : readDeadMansPedalFile (deadMansPedalFile))
|
||||||
for (int j = filesOrIdentifiersToScan.size(); --j >= 0;)
|
for (int j = filesOrIdentifiersToScan.size(); --j >= 0;)
|
||||||
if (crashed == filesOrIdentifiersToScan[j])
|
if (crashed == filesOrIdentifiersToScan[j])
|
||||||
|
|
@ -112,7 +112,7 @@ bool PluginDirectoryScanner::scanNextFile (bool dontRescanIfAlreadyInList,
|
||||||
|
|
||||||
list.scanAndAddFile (file, dontRescanIfAlreadyInList, typesFound, format);
|
list.scanAndAddFile (file, dontRescanIfAlreadyInList, typesFound, format);
|
||||||
|
|
||||||
// Managed to load without crashing, so remove it from the dead-man's-pedal..
|
// Managed to load without crashing, so remove it from the dead-man's-pedal.
|
||||||
crashedPlugins.removeString (file);
|
crashedPlugins.removeString (file);
|
||||||
setDeadMansPedalFile (crashedPlugins);
|
setDeadMansPedalFile (crashedPlugins);
|
||||||
|
|
||||||
|
|
@ -140,7 +140,7 @@ void PluginDirectoryScanner::setDeadMansPedalFile (const StringArray& newContent
|
||||||
void PluginDirectoryScanner::applyBlacklistingsFromDeadMansPedal (KnownPluginList& list, const File& file)
|
void PluginDirectoryScanner::applyBlacklistingsFromDeadMansPedal (KnownPluginList& list, const File& file)
|
||||||
{
|
{
|
||||||
// If any plugins have crashed recently when being loaded, move them to the
|
// If any plugins have crashed recently when being loaded, move them to the
|
||||||
// end of the list to give the others a chance to load correctly..
|
// end of the list to give the others a chance to load correctly.
|
||||||
for (auto& crashedPlugin : readDeadMansPedalFile (file))
|
for (auto& crashedPlugin : readDeadMansPedalFile (file))
|
||||||
list.addToBlacklist (crashedPlugin);
|
list.addToBlacklist (crashedPlugin);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,7 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
/** @cond */
|
/** @cond */
|
||||||
// This macro can be set if you need to override this internal name for some reason..
|
// This macro can be set if you need to override this internal name for some reason.
|
||||||
#ifndef JUCE_STATE_DICTIONARY_KEY
|
#ifndef JUCE_STATE_DICTIONARY_KEY
|
||||||
#define JUCE_STATE_DICTIONARY_KEY "jucePluginState"
|
#define JUCE_STATE_DICTIONARY_KEY "jucePluginState"
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -1428,7 +1428,7 @@ public:
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Plugin not working correctly, so just bypass..
|
// Plugin not working correctly, so just bypass.
|
||||||
for (int i = getTotalNumOutputChannels(); --i >= 0;)
|
for (int i = getTotalNumOutputChannels(); --i >= 0;)
|
||||||
buffer.clear (i, 0, buffer.getNumSamples());
|
buffer.clear (i, 0, buffer.getNumSamples());
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -278,7 +278,7 @@ public:
|
||||||
{
|
{
|
||||||
tempBuffer.setSize (jmax (1, outputs.size()), samplesPerBlockExpected);
|
tempBuffer.setSize (jmax (1, outputs.size()), samplesPerBlockExpected);
|
||||||
|
|
||||||
// dodgy hack to force some plugins to initialise the sample rate..
|
// dodgy hack to force some plugins to initialise the sample rate
|
||||||
if (auto* firstParam = getParameters()[0])
|
if (auto* firstParam = getParameters()[0])
|
||||||
{
|
{
|
||||||
const auto old = firstParam->getValue();
|
const auto old = firstParam->getValue();
|
||||||
|
|
|
||||||
|
|
@ -1387,7 +1387,7 @@ struct VSTPluginInstanceHeadless : public AudioPluginInstance
|
||||||
if (! isPowerOn)
|
if (! isPowerOn)
|
||||||
setPower (true);
|
setPower (true);
|
||||||
|
|
||||||
// dodgy hack to force some plugins to initialise the sample rate.
|
// dodgy hack to force some plugins to initialise the sample rate
|
||||||
if (! hasEditor())
|
if (! hasEditor())
|
||||||
{
|
{
|
||||||
if (auto* firstParam = getParameters()[0])
|
if (auto* firstParam = getParameters()[0])
|
||||||
|
|
@ -1670,7 +1670,7 @@ struct VSTPluginInstanceHeadless : public AudioPluginInstance
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// handles non plugin-specific callbacks.
|
// handles non plugin-specific callbacks
|
||||||
static pointer_sized_int handleGeneralCallback (int32 opcode, int32 /*index*/, pointer_sized_int /*value*/, void* ptr, float /*opt*/)
|
static pointer_sized_int handleGeneralCallback (int32 opcode, int32 /*index*/, pointer_sized_int /*value*/, void* ptr, float /*opt*/)
|
||||||
{
|
{
|
||||||
switch (opcode)
|
switch (opcode)
|
||||||
|
|
@ -2442,7 +2442,7 @@ private:
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
// copy any incoming midi.
|
// Copy any incoming midi.
|
||||||
const ScopedLock sl (midiInLock);
|
const ScopedLock sl (midiInLock);
|
||||||
|
|
||||||
midiMessages.swapWith (incomingMidi);
|
midiMessages.swapWith (incomingMidi);
|
||||||
|
|
@ -2557,7 +2557,7 @@ private:
|
||||||
{
|
{
|
||||||
char nm[256] = { 0 };
|
char nm[256] = { 0 };
|
||||||
|
|
||||||
// only do this if the plugin can't use indexed names.
|
// only do this if the plugin can't use indexed names
|
||||||
if (dispatch (Vst2::effGetProgramNameIndexed, 0, -1, nm, 0) == 0)
|
if (dispatch (Vst2::effGetProgramNameIndexed, 0, -1, nm, 0) == 0)
|
||||||
{
|
{
|
||||||
auto oldProgram = getCurrentProgram();
|
auto oldProgram = getCurrentProgram();
|
||||||
|
|
|
||||||
|
|
@ -54,7 +54,7 @@ String AudioPluginInstance::getParameterID (int parameterIndex)
|
||||||
// AudioProcessorParameter class, and the previous behaviour of JUCE's
|
// AudioProcessorParameter class, and the previous behaviour of JUCE's
|
||||||
// plug-in hosting code simply returns a string version of the index; to
|
// plug-in hosting code simply returns a string version of the index; to
|
||||||
// maintain backwards compatibility you should perform the operation below
|
// maintain backwards compatibility you should perform the operation below
|
||||||
// this comment. However the caveat is that for plug-ins which change their
|
// this comment. However, the caveat is that for plug-ins which change their
|
||||||
// number of parameters dynamically at runtime you cannot rely upon the
|
// number of parameters dynamically at runtime you cannot rely upon the
|
||||||
// returned parameter ID mapping to the correct parameter. A comprehensive
|
// returned parameter ID mapping to the correct parameter. A comprehensive
|
||||||
// solution to this problem requires some additional work in JUCE's hosting
|
// solution to this problem requires some additional work in JUCE's hosting
|
||||||
|
|
|
||||||
|
|
@ -62,7 +62,7 @@ AudioProcessor::~AudioProcessor()
|
||||||
{
|
{
|
||||||
const ScopedLock sl (activeEditorLock);
|
const ScopedLock sl (activeEditorLock);
|
||||||
|
|
||||||
// ooh, nasty - the editor should have been deleted before its AudioProcessor.
|
// ooh, nasty - the editor should have been deleted before its AudioProcessor
|
||||||
jassert (activeEditor == nullptr);
|
jassert (activeEditor == nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -955,7 +955,7 @@ void AudioProcessor::copyXmlToBinary (const XmlElement& xml, juce::MemoryBlock&
|
||||||
out.writeByte (0);
|
out.writeByte (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
// go back and write the string length..
|
// go back and write the string length
|
||||||
static_cast<uint32*> (destData.getData())[1]
|
static_cast<uint32*> (destData.getData())[1]
|
||||||
= ByteOrder::swapIfBigEndian ((uint32) destData.getSize() - 9);
|
= ByteOrder::swapIfBigEndian ((uint32) destData.getSize() - 9);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -912,7 +912,7 @@ public:
|
||||||
{
|
{
|
||||||
suspendProcessing (true);
|
suspendProcessing (true);
|
||||||
|
|
||||||
..do something that takes ages..
|
...do something that takes ages...
|
||||||
|
|
||||||
suspendProcessing (false);
|
suspendProcessing (false);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1178,10 +1178,10 @@ private:
|
||||||
return index;
|
return index;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Handle an input from a single source..
|
// Handle an input from a single source.
|
||||||
if (sources.size() == 1)
|
if (sources.size() == 1)
|
||||||
{
|
{
|
||||||
// channel with a straightforward single input..
|
// channel with a straightforward single input
|
||||||
auto src = *sources.begin();
|
auto src = *sources.begin();
|
||||||
|
|
||||||
int bufIndex = getBufferContaining (src);
|
int bufIndex = getBufferContaining (src);
|
||||||
|
|
@ -1217,7 +1217,7 @@ private:
|
||||||
return bufIndex;
|
return bufIndex;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Handle a mix of several outputs coming into this input..
|
// Handle a mix of several outputs coming into this input.
|
||||||
int reusableInputIndex = -1;
|
int reusableInputIndex = -1;
|
||||||
int bufIndex = -1;
|
int bufIndex = -1;
|
||||||
|
|
||||||
|
|
@ -1229,7 +1229,7 @@ private:
|
||||||
|
|
||||||
if (sourceBufIndex >= 0 && ! isBufferNeededLater (reversed, ourRenderingIndex, inputChan, src))
|
if (sourceBufIndex >= 0 && ! isBufferNeededLater (reversed, ourRenderingIndex, inputChan, src))
|
||||||
{
|
{
|
||||||
// we've found one of our input chans that can be re-used..
|
// we've found one of our input chans that can be re-used
|
||||||
reusableInputIndex = i;
|
reusableInputIndex = i;
|
||||||
bufIndex = sourceBufIndex;
|
bufIndex = sourceBufIndex;
|
||||||
|
|
||||||
|
|
@ -1247,7 +1247,7 @@ private:
|
||||||
|
|
||||||
if (reusableInputIndex < 0)
|
if (reusableInputIndex < 0)
|
||||||
{
|
{
|
||||||
// can't re-use any of our input chans, so get a new one and copy everything into it..
|
// can't re-use any of our input chans, so get a new one and copy everything into it
|
||||||
bufIndex = getFreeBuffer (audioBuffers);
|
bufIndex = getFreeBuffer (audioBuffers);
|
||||||
jassert (bufIndex != 0);
|
jassert (bufIndex != 0);
|
||||||
|
|
||||||
|
|
@ -1315,7 +1315,7 @@ private:
|
||||||
auto& processor = *node.getProcessor();
|
auto& processor = *node.getProcessor();
|
||||||
auto sources = c.getSourcesForDestination ({ node.nodeID, midiChannelIndex });
|
auto sources = c.getSourcesForDestination ({ node.nodeID, midiChannelIndex });
|
||||||
|
|
||||||
// No midi inputs..
|
// no midi inputs
|
||||||
if (sources.empty())
|
if (sources.empty())
|
||||||
{
|
{
|
||||||
auto midiBufferToUse = getFreeBuffer (midiBuffers); // need to pick a buffer even if the processor doesn't use midi
|
auto midiBufferToUse = getFreeBuffer (midiBuffers); // need to pick a buffer even if the processor doesn't use midi
|
||||||
|
|
@ -1326,7 +1326,7 @@ private:
|
||||||
return midiBufferToUse;
|
return midiBufferToUse;
|
||||||
}
|
}
|
||||||
|
|
||||||
// One midi input..
|
// one midi input
|
||||||
if (sources.size() == 1)
|
if (sources.size() == 1)
|
||||||
{
|
{
|
||||||
auto src = *sources.begin();
|
auto src = *sources.begin();
|
||||||
|
|
@ -1337,7 +1337,7 @@ private:
|
||||||
if (isBufferNeededLater (reversed, ourRenderingIndex, midiChannelIndex, src))
|
if (isBufferNeededLater (reversed, ourRenderingIndex, midiChannelIndex, src))
|
||||||
{
|
{
|
||||||
// can't mess up this channel because it's needed later by another node, so we
|
// can't mess up this channel because it's needed later by another node, so we
|
||||||
// need to use a copy of it..
|
// need to use a copy of it
|
||||||
auto newFreeBuffer = getFreeBuffer (midiBuffers);
|
auto newFreeBuffer = getFreeBuffer (midiBuffers);
|
||||||
sequence.addCopyMidiBufferOp (midiBufferToUse, newFreeBuffer);
|
sequence.addCopyMidiBufferOp (midiBufferToUse, newFreeBuffer);
|
||||||
midiBufferToUse = newFreeBuffer;
|
midiBufferToUse = newFreeBuffer;
|
||||||
|
|
@ -1345,14 +1345,14 @@ private:
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// probably a feedback loop, so just use an empty one..
|
// probably a feedback loop, so just use an empty one
|
||||||
midiBufferToUse = getFreeBuffer (midiBuffers); // need to pick a buffer even if the processor doesn't use midi
|
midiBufferToUse = getFreeBuffer (midiBuffers); // need to pick a buffer even if the processor doesn't use midi
|
||||||
}
|
}
|
||||||
|
|
||||||
return midiBufferToUse;
|
return midiBufferToUse;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Multiple midi inputs..
|
// multiple midi inputs
|
||||||
int midiBufferToUse = -1;
|
int midiBufferToUse = -1;
|
||||||
int reusableInputIndex = -1;
|
int reusableInputIndex = -1;
|
||||||
|
|
||||||
|
|
@ -1365,7 +1365,7 @@ private:
|
||||||
if (sourceBufIndex >= 0
|
if (sourceBufIndex >= 0
|
||||||
&& ! isBufferNeededLater (reversed, ourRenderingIndex, midiChannelIndex, src))
|
&& ! isBufferNeededLater (reversed, ourRenderingIndex, midiChannelIndex, src))
|
||||||
{
|
{
|
||||||
// we've found one of our input buffers that can be re-used..
|
// we've found one of our input buffers that can be re-used
|
||||||
reusableInputIndex = i;
|
reusableInputIndex = i;
|
||||||
midiBufferToUse = sourceBufIndex;
|
midiBufferToUse = sourceBufIndex;
|
||||||
break;
|
break;
|
||||||
|
|
@ -1377,7 +1377,7 @@ private:
|
||||||
|
|
||||||
if (reusableInputIndex < 0)
|
if (reusableInputIndex < 0)
|
||||||
{
|
{
|
||||||
// can't re-use any of our input buffers, so get a new one and copy everything into it..
|
// can't re-use any of our input buffers, so get a new one and copy everything into it
|
||||||
midiBufferToUse = getFreeBuffer (midiBuffers);
|
midiBufferToUse = getFreeBuffer (midiBuffers);
|
||||||
jassert (midiBufferToUse >= 0);
|
jassert (midiBufferToUse >= 0);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -41,7 +41,7 @@ MidiKeyboardComponent::MidiKeyboardComponent (MidiKeyboardState& stateToUse, Ori
|
||||||
{
|
{
|
||||||
state.addListener (this);
|
state.addListener (this);
|
||||||
|
|
||||||
// initialise with a default set of qwerty key-mappings.
|
// initialise with a default set of qwerty key-mappings
|
||||||
const std::string_view keys { "awsedftgyhujkolp;" };
|
const std::string_view keys { "awsedftgyhujkolp;" };
|
||||||
|
|
||||||
for (const char& c : keys)
|
for (const char& c : keys)
|
||||||
|
|
|
||||||
|
|
@ -427,7 +427,7 @@ DWORD performScsiPassThroughCommand (SRB_ExecSCSICmd* const srb, const char driv
|
||||||
|
|
||||||
|
|
||||||
//==============================================================================
|
//==============================================================================
|
||||||
// Controller types..
|
// controller types
|
||||||
|
|
||||||
class ControllerType1 final : public CDController
|
class ControllerType1 final : public CDController
|
||||||
{
|
{
|
||||||
|
|
@ -1130,7 +1130,7 @@ bool AudioCDReader::readSamples (int* const* destSamples, int numDestChannels, i
|
||||||
}
|
}
|
||||||
|
|
||||||
// sometimes the read fails for just the very last couple of blocks, so
|
// sometimes the read fails for just the very last couple of blocks, so
|
||||||
// we'll ignore and errors in the last half-second of the disk..
|
// we'll ignore and errors in the last half-second of the disk
|
||||||
ok = startSampleInFile > (trackStartSamples [getNumTracks()] - 20000);
|
ok = startSampleInFile > (trackStartSamples [getNumTracks()] - 20000);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
@ -1241,7 +1241,7 @@ Array<int> AudioCDReader::findIndexesInTrack (const int trackNumber)
|
||||||
|
|
||||||
if (index == 0)
|
if (index == 0)
|
||||||
{
|
{
|
||||||
// lead-out, so skip back a bit if we've not found any indexes yet..
|
// lead-out, so skip back a bit if we've not found any indexes yet
|
||||||
if (seenAnIndex)
|
if (seenAnIndex)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1074,7 +1074,7 @@ public:
|
||||||
int compareElements (ElementType first, ElementType second);
|
int compareElements (ElementType first, ElementType second);
|
||||||
@endcode
|
@endcode
|
||||||
|
|
||||||
..and this method must return:
|
...and this method must return:
|
||||||
- a value of < 0 if the first comes before the second
|
- a value of < 0 if the first comes before the second
|
||||||
- a value of 0 if the two objects are equivalent
|
- a value of 0 if the two objects are equivalent
|
||||||
- a value of > 0 if the second comes before the first
|
- a value of > 0 if the second comes before the first
|
||||||
|
|
|
||||||
|
|
@ -69,7 +69,7 @@ private:
|
||||||
int compareElements (ElementType first, ElementType second);
|
int compareElements (ElementType first, ElementType second);
|
||||||
@endcode
|
@endcode
|
||||||
|
|
||||||
..and this method must return:
|
...and this method must return:
|
||||||
- a value of < 0 if the first comes before the second
|
- a value of < 0 if the first comes before the second
|
||||||
- a value of 0 if the two objects are equivalent
|
- a value of 0 if the two objects are equivalent
|
||||||
- a value of > 0 if the second comes before the first
|
- a value of > 0 if the second comes before the first
|
||||||
|
|
@ -119,7 +119,7 @@ static void sortArray (ElementComparator& comparator,
|
||||||
int compareElements (ElementType first, ElementType second);
|
int compareElements (ElementType first, ElementType second);
|
||||||
@endcode
|
@endcode
|
||||||
|
|
||||||
..and this method must return:
|
...and this method must return:
|
||||||
- a value of < 0 if the first comes before the second
|
- a value of < 0 if the first comes before the second
|
||||||
- a value of 0 if the two objects are equivalent
|
- a value of 0 if the two objects are equivalent
|
||||||
- a value of > 0 if the second comes before the first
|
- a value of > 0 if the second comes before the first
|
||||||
|
|
|
||||||
|
|
@ -98,7 +98,7 @@ struct DefaultHashFunctions
|
||||||
DBG (hash [1]); // prints "item1"
|
DBG (hash [1]); // prints "item1"
|
||||||
DBG (hash [2]); // prints "item2"
|
DBG (hash [2]); // prints "item2"
|
||||||
|
|
||||||
// This iterates the map, printing all of its key -> value pairs..
|
// This iterates the map, printing all of its key -> value pairs.
|
||||||
for (HashMap<int, String>::Iterator i (hash); i.next();)
|
for (HashMap<int, String>::Iterator i (hash); i.next();)
|
||||||
DBG (i.getKey() << " -> " << i.getValue());
|
DBG (i.getKey() << " -> " << i.getValue());
|
||||||
@endcode
|
@endcode
|
||||||
|
|
|
||||||
|
|
@ -115,7 +115,7 @@ bool NamedValueSet::operator== (const NamedValueSet& other) const noexcept
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// if we encounter keys that are in a different order, search remaining items by brute force..
|
// if we encounter keys that are in a different order, search remaining items by brute force
|
||||||
for (int j = i; j < num; ++j)
|
for (int j = i; j < num; ++j)
|
||||||
{
|
{
|
||||||
if (auto* otherVal = other.getVarPointer (values.getReference (j).name))
|
if (auto* otherVal = other.getVarPointer (values.getReference (j).name))
|
||||||
|
|
|
||||||
|
|
@ -44,7 +44,7 @@ namespace juce
|
||||||
|
|
||||||
Declare it in the form: OwnedArray<MyObjectClass>
|
Declare it in the form: OwnedArray<MyObjectClass>
|
||||||
|
|
||||||
..and then add new objects, e.g. myOwnedArray.add (new MyObjectClass());
|
...and then add new objects, e.g. myOwnedArray.add (new MyObjectClass());
|
||||||
|
|
||||||
After adding objects, they are 'owned' by the array and will be deleted when
|
After adding objects, they are 'owned' by the array and will be deleted when
|
||||||
removed or replaced.
|
removed or replaced.
|
||||||
|
|
@ -440,7 +440,7 @@ public:
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
jassertfalse; // you're trying to set an object at a negative index, which doesn't have
|
jassertfalse; // you're trying to set an object at a negative index, which doesn't have
|
||||||
// any effect - but since the object is not being added, it may be leaking..
|
// any effect - but since the object is not being added, it may be leaking
|
||||||
}
|
}
|
||||||
|
|
||||||
return newObject;
|
return newObject;
|
||||||
|
|
@ -775,7 +775,7 @@ public:
|
||||||
int compareElements (ElementType* first, ElementType* second);
|
int compareElements (ElementType* first, ElementType* second);
|
||||||
@endcode
|
@endcode
|
||||||
|
|
||||||
..and this method must return:
|
...and this method must return:
|
||||||
- a value of < 0 if the first comes before the second
|
- a value of < 0 if the first comes before the second
|
||||||
- a value of 0 if the two objects are equivalent
|
- a value of 0 if the two objects are equivalent
|
||||||
- a value of > 0 if the second comes before the first
|
- a value of > 0 if the second comes before the first
|
||||||
|
|
|
||||||
|
|
@ -797,7 +797,7 @@ public:
|
||||||
int compareElements (ElementType first, ElementType second);
|
int compareElements (ElementType first, ElementType second);
|
||||||
@endcode
|
@endcode
|
||||||
|
|
||||||
..and this method must return:
|
...and this method must return:
|
||||||
- a value of < 0 if the first comes before the second
|
- a value of < 0 if the first comes before the second
|
||||||
- a value of 0 if the two objects are equivalent
|
- a value of 0 if the two objects are equivalent
|
||||||
- a value of > 0 if the second comes before the first
|
- a value of > 0 if the second comes before the first
|
||||||
|
|
|
||||||
|
|
@ -293,7 +293,7 @@ public:
|
||||||
|
|
||||||
if (newElement == elem)
|
if (newElement == elem)
|
||||||
{
|
{
|
||||||
elem = newElement; // force an update in case operator== permits differences.
|
elem = newElement; // force an update in case operator== permits differences
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -114,7 +114,7 @@ bool DirectoryIterator::next (bool* isDirResult, bool* isHiddenResult, int64* fi
|
||||||
matches = (whatToLookFor & File::findFiles) != 0;
|
matches = (whatToLookFor & File::findFiles) != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// if we're not relying on the OS iterator to do the wildcard match, do it now..
|
// if we're not relying on the OS iterator to do the wildcard match, do it now
|
||||||
if (matches && (isRecursive || wildCards.size() > 1))
|
if (matches && (isRecursive || wildCards.size() > 1))
|
||||||
matches = fileMatches (wildCards, filename);
|
matches = fileMatches (wildCards, filename);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -145,7 +145,7 @@ String File::parseAbsolutePath (const String& p)
|
||||||
return {};
|
return {};
|
||||||
|
|
||||||
#if JUCE_WINDOWS
|
#if JUCE_WINDOWS
|
||||||
// Windows..
|
// Windows
|
||||||
auto path = normaliseSeparators (removeEllipsis (p.replaceCharacter ('/', '\\')));
|
auto path = normaliseSeparators (removeEllipsis (p.replaceCharacter ('/', '\\')));
|
||||||
|
|
||||||
if (path.startsWithChar (getSeparatorChar()))
|
if (path.startsWithChar (getSeparatorChar()))
|
||||||
|
|
@ -178,7 +178,7 @@ String File::parseAbsolutePath (const String& p)
|
||||||
return File::getCurrentWorkingDirectory().getChildFile (path).getFullPathName();
|
return File::getCurrentWorkingDirectory().getChildFile (path).getFullPathName();
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
// Mac or Linux..
|
// Mac or Linux
|
||||||
|
|
||||||
// Yes, I know it's legal for a unix pathname to contain a backslash, but this assertion is here
|
// Yes, I know it's legal for a unix pathname to contain a backslash, but this assertion is here
|
||||||
// to catch anyone who's trying to run code that was written on Windows with hard-coded path names.
|
// to catch anyone who's trying to run code that was written on Windows with hard-coded path names.
|
||||||
|
|
@ -228,7 +228,7 @@ String File::parseAbsolutePath (const String& p)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
while (path.endsWithChar (getSeparatorChar()) && path != getSeparatorString()) // careful not to turn a single "/" into an empty string.
|
while (path.endsWithChar (getSeparatorChar()) && path != getSeparatorString()) // careful not to turn a single "/" into an empty string
|
||||||
path = path.dropLastCharacters (1);
|
path = path.dropLastCharacters (1);
|
||||||
|
|
||||||
return path;
|
return path;
|
||||||
|
|
@ -629,7 +629,7 @@ File File::getNonexistentChildFile (const String& suggestedPrefix,
|
||||||
int number = 1;
|
int number = 1;
|
||||||
auto prefix = suggestedPrefix;
|
auto prefix = suggestedPrefix;
|
||||||
|
|
||||||
// remove any bracketed numbers that may already be on the end..
|
// remove any bracketed numbers that may already be on the end
|
||||||
if (prefix.trim().endsWithChar (')'))
|
if (prefix.trim().endsWithChar (')'))
|
||||||
{
|
{
|
||||||
putNumbersInBrackets = true;
|
putNumbersInBrackets = true;
|
||||||
|
|
@ -941,7 +941,7 @@ String File::getRelativePathFrom (const File& dir) const
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// if the only common bit is the root, then just return the full path..
|
// if the only common bit is the root, then just return the full path
|
||||||
if (commonBitLength == 0 || (commonBitLength == 1 && thisPath[1] == getSeparatorChar()))
|
if (commonBitLength == 0 || (commonBitLength == 1 && thisPath[1] == getSeparatorChar()))
|
||||||
return fullPath;
|
return fullPath;
|
||||||
|
|
||||||
|
|
@ -1118,7 +1118,7 @@ public:
|
||||||
if (roots[i].exists())
|
if (roots[i].exists())
|
||||||
++numRootsExisting;
|
++numRootsExisting;
|
||||||
|
|
||||||
// (on windows, some of the drives may not contain media, so as long as at least one is ok..)
|
// on windows, some of the drives may not contain media, so as long as at least one is ok
|
||||||
expect (numRootsExisting > 0);
|
expect (numRootsExisting > 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -756,7 +756,7 @@ public:
|
||||||
the file first and then re-writing it, it creates a new temporary file,
|
the file first and then re-writing it, it creates a new temporary file,
|
||||||
writes the data to that, and then moves the new file to replace the existing
|
writes the data to that, and then moves the new file to replace the existing
|
||||||
file. This means that if the power gets pulled out or something crashes,
|
file. This means that if the power gets pulled out or something crashes,
|
||||||
you're a lot less likely to end up with a corrupted or unfinished file..
|
you're a lot less likely to end up with a corrupted or unfinished file.
|
||||||
|
|
||||||
Returns true if the operation succeeds, or false if it fails.
|
Returns true if the operation succeeds, or false if it fails.
|
||||||
|
|
||||||
|
|
@ -791,7 +791,7 @@ public:
|
||||||
the file first and then re-writing it, it creates a new temporary file,
|
the file first and then re-writing it, it creates a new temporary file,
|
||||||
writes the text to that, and then moves the new file to replace the existing
|
writes the text to that, and then moves the new file to replace the existing
|
||||||
file. This means that if the power gets pulled out or something crashes,
|
file. This means that if the power gets pulled out or something crashes,
|
||||||
you're a lot less likely to end up with an empty file..
|
you're a lot less likely to end up with an empty file.
|
||||||
|
|
||||||
For an explanation of the parameters here, see the appendText() method.
|
For an explanation of the parameters here, see the appendText() method.
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -99,7 +99,7 @@ bool TemporaryFile::overwriteTargetFileWithTemporary() const
|
||||||
|
|
||||||
if (temporaryFile.exists())
|
if (temporaryFile.exists())
|
||||||
{
|
{
|
||||||
// Have a few attempts at overwriting the file before giving up..
|
// Have a few attempts at overwriting the file before giving up.
|
||||||
for (int i = 5; --i >= 0;)
|
for (int i = 5; --i >= 0;)
|
||||||
{
|
{
|
||||||
if (temporaryFile.replaceFileIn (targetFile))
|
if (temporaryFile.replaceFileIn (targetFile))
|
||||||
|
|
@ -120,7 +120,7 @@ bool TemporaryFile::overwriteTargetFileWithTemporary() const
|
||||||
|
|
||||||
bool TemporaryFile::deleteTemporaryFile() const
|
bool TemporaryFile::deleteTemporaryFile() const
|
||||||
{
|
{
|
||||||
// Have a few attempts at deleting the file before giving up..
|
// Have a few attempts at deleting the file before giving up.
|
||||||
for (int i = 5; --i >= 0;)
|
for (int i = 5; --i >= 0;)
|
||||||
{
|
{
|
||||||
if (temporaryFile.isDirectory() ? temporaryFile.deleteRecursively() : temporaryFile.deleteFile())
|
if (temporaryFile.isDirectory() ? temporaryFile.deleteRecursively() : temporaryFile.deleteFile())
|
||||||
|
|
|
||||||
|
|
@ -58,12 +58,12 @@ namespace juce
|
||||||
out->write ( ...etc )
|
out->write ( ...etc )
|
||||||
out.reset(); // (deletes the stream)
|
out.reset(); // (deletes the stream)
|
||||||
|
|
||||||
// ..now we've finished writing, this will rename the temp file to
|
// ...now we've finished writing, this will rename the temp file to
|
||||||
// make it replace the target file we specified above.
|
// make it replace the target file we specified above
|
||||||
bool succeeded = temp.overwriteTargetFileWithTemporary();
|
bool succeeded = temp.overwriteTargetFileWithTemporary();
|
||||||
}
|
}
|
||||||
|
|
||||||
// ..and even if something went wrong and our overwrite failed,
|
// ...and even if something went wrong and our overwrite failed,
|
||||||
// as the TemporaryFile object goes out of scope here, it'll make sure
|
// as the TemporaryFile object goes out of scope here, it'll make sure
|
||||||
// that the temp file gets deleted.
|
// that the temp file gets deleted.
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -250,7 +250,7 @@ uint32 BigInteger::getBitRangeAsInt (const int startBit, int numBits) const noex
|
||||||
{
|
{
|
||||||
if (numBits > 32)
|
if (numBits > 32)
|
||||||
{
|
{
|
||||||
jassertfalse; // use getBitRange() if you need more than 32 bits..
|
jassertfalse; // use getBitRange() if you need more than 32 bits
|
||||||
numBits = 32;
|
numBits = 32;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -646,7 +646,7 @@ BigInteger& BigInteger::operator|= (const BigInteger& other)
|
||||||
if (this == &other)
|
if (this == &other)
|
||||||
return *this;
|
return *this;
|
||||||
|
|
||||||
// this operation doesn't take into account negative values..
|
// this operation doesn't take into account negative values
|
||||||
jassert (isNegative() == other.isNegative());
|
jassert (isNegative() == other.isNegative());
|
||||||
|
|
||||||
if (other.highestBit >= 0)
|
if (other.highestBit >= 0)
|
||||||
|
|
@ -673,7 +673,7 @@ BigInteger& BigInteger::operator&= (const BigInteger& other)
|
||||||
if (this == &other)
|
if (this == &other)
|
||||||
return *this;
|
return *this;
|
||||||
|
|
||||||
// this operation doesn't take into account negative values..
|
// this operation doesn't take into account negative values
|
||||||
jassert (isNegative() == other.isNegative());
|
jassert (isNegative() == other.isNegative());
|
||||||
|
|
||||||
auto* values = getValues();
|
auto* values = getValues();
|
||||||
|
|
|
||||||
|
|
@ -909,7 +909,7 @@ struct Expression::Helpers
|
||||||
return *new DotOperator (new SymbolTerm (identifier), rhs);
|
return *new DotOperator (new SymbolTerm (identifier), rhs);
|
||||||
}
|
}
|
||||||
|
|
||||||
// just a symbol..
|
// just a symbol
|
||||||
jassert (identifier.trim() == identifier);
|
jassert (identifier.trim() == identifier);
|
||||||
return *new SymbolTerm (identifier);
|
return *new SymbolTerm (identifier);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -521,7 +521,7 @@ Type jlimit (Type lowerLimit,
|
||||||
Type upperLimit,
|
Type upperLimit,
|
||||||
Type valueToConstrain) noexcept
|
Type valueToConstrain) noexcept
|
||||||
{
|
{
|
||||||
jassert (lowerLimit <= upperLimit); // if these are in the wrong order, results are unpredictable..
|
jassert (lowerLimit <= upperLimit); // if these are in the wrong order, results are unpredictable
|
||||||
|
|
||||||
return valueToConstrain < lowerLimit ? lowerLimit
|
return valueToConstrain < lowerLimit ? lowerLimit
|
||||||
: (upperLimit < valueToConstrain ? upperLimit
|
: (upperLimit < valueToConstrain ? upperLimit
|
||||||
|
|
@ -536,14 +536,14 @@ Type jlimit (Type lowerLimit,
|
||||||
template <typename Type1, typename Type2>
|
template <typename Type1, typename Type2>
|
||||||
bool isPositiveAndBelow (Type1 valueToTest, Type2 upperLimit) noexcept
|
bool isPositiveAndBelow (Type1 valueToTest, Type2 upperLimit) noexcept
|
||||||
{
|
{
|
||||||
jassert (Type1() <= static_cast<Type1> (upperLimit)); // makes no sense to call this if the upper limit is itself below zero..
|
jassert (Type1() <= static_cast<Type1> (upperLimit)); // makes no sense to call this if the upper limit is itself below zero
|
||||||
return Type1() <= valueToTest && valueToTest < static_cast<Type1> (upperLimit);
|
return Type1() <= valueToTest && valueToTest < static_cast<Type1> (upperLimit);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename Type>
|
template <typename Type>
|
||||||
bool isPositiveAndBelow (int valueToTest, Type upperLimit) noexcept
|
bool isPositiveAndBelow (int valueToTest, Type upperLimit) noexcept
|
||||||
{
|
{
|
||||||
jassert (upperLimit >= 0); // makes no sense to call this if the upper limit is itself below zero..
|
jassert (upperLimit >= 0); // makes no sense to call this if the upper limit is itself below zero
|
||||||
return static_cast<unsigned int> (valueToTest) < static_cast<unsigned int> (upperLimit);
|
return static_cast<unsigned int> (valueToTest) < static_cast<unsigned int> (upperLimit);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -555,14 +555,14 @@ bool isPositiveAndBelow (int valueToTest, Type upperLimit) noexcept
|
||||||
template <typename Type1, typename Type2>
|
template <typename Type1, typename Type2>
|
||||||
bool isPositiveAndNotGreaterThan (Type1 valueToTest, Type2 upperLimit) noexcept
|
bool isPositiveAndNotGreaterThan (Type1 valueToTest, Type2 upperLimit) noexcept
|
||||||
{
|
{
|
||||||
jassert (Type1() <= static_cast<Type1> (upperLimit)); // makes no sense to call this if the upper limit is itself below zero..
|
jassert (Type1() <= static_cast<Type1> (upperLimit)); // makes no sense to call this if the upper limit is itself below zero
|
||||||
return Type1() <= valueToTest && valueToTest <= static_cast<Type1> (upperLimit);
|
return Type1() <= valueToTest && valueToTest <= static_cast<Type1> (upperLimit);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename Type>
|
template <typename Type>
|
||||||
bool isPositiveAndNotGreaterThan (int valueToTest, Type upperLimit) noexcept
|
bool isPositiveAndNotGreaterThan (int valueToTest, Type upperLimit) noexcept
|
||||||
{
|
{
|
||||||
jassert (upperLimit >= 0); // makes no sense to call this if the upper limit is itself below zero..
|
jassert (upperLimit >= 0); // makes no sense to call this if the upper limit is itself below zero
|
||||||
return static_cast<unsigned int> (valueToTest) <= static_cast<unsigned int> (upperLimit);
|
return static_cast<unsigned int> (valueToTest) <= static_cast<unsigned int> (upperLimit);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -73,7 +73,7 @@ namespace HeapBlockHelper
|
||||||
free (temp);
|
free (temp);
|
||||||
@endcode
|
@endcode
|
||||||
|
|
||||||
..you could just write this:
|
...you could just write this:
|
||||||
@code
|
@code
|
||||||
HeapBlock<int> temp (1024);
|
HeapBlock<int> temp (1024);
|
||||||
memcpy (temp, xyz, 1024 * sizeof (int));
|
memcpy (temp, xyz, 1024 * sizeof (int));
|
||||||
|
|
@ -343,7 +343,7 @@ private:
|
||||||
auto* memory = static_cast<ElementType*> (f());
|
auto* memory = static_cast<ElementType*> (f());
|
||||||
|
|
||||||
#if JUCE_EXCEPTIONS_DISABLED
|
#if JUCE_EXCEPTIONS_DISABLED
|
||||||
jassert (memory != nullptr); // without exceptions, you'll need to find a better way to handle this failure case.
|
jassert (memory != nullptr); // without exceptions, you'll need to find a better way to handle this failure case
|
||||||
#else
|
#else
|
||||||
HeapBlockHelper::ThrowOnFail<throwOnFailure>::checkPointer (memory);
|
HeapBlockHelper::ThrowOnFail<throwOnFailure>::checkPointer (memory);
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -67,7 +67,7 @@ public:
|
||||||
DBG ("*** Dangling pointer deletion! Class: " << getLeakedObjectClassName());
|
DBG ("*** Dangling pointer deletion! Class: " << getLeakedObjectClassName());
|
||||||
|
|
||||||
/** If you hit this, then you've managed to delete more instances of this class than you've
|
/** If you hit this, then you've managed to delete more instances of this class than you've
|
||||||
created.. That indicates that you're deleting some dangling pointers.
|
created. That indicates that you're deleting some dangling pointers.
|
||||||
|
|
||||||
Note that although this assertion will have been triggered during a destructor, it might
|
Note that although this assertion will have been triggered during a destructor, it might
|
||||||
not be this particular deletion that's at fault - the incorrect one may have happened
|
not be this particular deletion that's at fault - the incorrect one may have happened
|
||||||
|
|
|
||||||
|
|
@ -369,7 +369,7 @@ String MemoryBlock::toBase64Encoding() const
|
||||||
{
|
{
|
||||||
auto numChars = ((size << 3) + 5) / 6;
|
auto numChars = ((size << 3) + 5) / 6;
|
||||||
|
|
||||||
String destString ((unsigned int) size); // store the length, followed by a '.', and then the data.
|
String destString ((unsigned int) size); // store the length, followed by a '.', and then the data
|
||||||
auto initialLen = destString.length();
|
auto initialLen = destString.length();
|
||||||
destString.preallocateBytes ((size_t) initialLen * sizeof (String::CharPointerType::CharType) + 2 + numChars);
|
destString.preallocateBytes ((size_t) initialLen * sizeof (String::CharPointerType::CharType) + 2 + numChars);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -48,7 +48,7 @@ namespace juce
|
||||||
void foo();
|
void foo();
|
||||||
|
|
||||||
// This is a neat way of declaring a typedef for a pointer class,
|
// This is a neat way of declaring a typedef for a pointer class,
|
||||||
// rather than typing out the full templated name each time..
|
// rather than typing out the full templated name each time.
|
||||||
using Ptr = ReferenceCountedObjectPtr<MyClass>;
|
using Ptr = ReferenceCountedObjectPtr<MyClass>;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -178,7 +178,7 @@ struct SingletonHolder : private MutexType // (inherited so we can use the empt
|
||||||
JUCE_DECLARE_SINGLETON (MySingleton, false)
|
JUCE_DECLARE_SINGLETON (MySingleton, false)
|
||||||
};
|
};
|
||||||
|
|
||||||
// ..and this goes in a suitable .cpp file:
|
// ...and this goes in a suitable .cpp file:
|
||||||
JUCE_IMPLEMENT_SINGLETON (MySingleton)
|
JUCE_IMPLEMENT_SINGLETON (MySingleton)
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -187,7 +187,7 @@ struct SingletonHolder : private MutexType // (inherited so we can use the empt
|
||||||
|
|
||||||
...
|
...
|
||||||
|
|
||||||
MySingleton::deleteInstance(); // safely deletes the singleton (if it's been created).
|
MySingleton::deleteInstance(); // safely deletes the singleton (if it's been created)
|
||||||
|
|
||||||
@endcode
|
@endcode
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -71,7 +71,7 @@ namespace juce
|
||||||
|
|
||||||
OR: just use the handy JUCE_DECLARE_WEAK_REFERENCEABLE macro to do all this for you.
|
OR: just use the handy JUCE_DECLARE_WEAK_REFERENCEABLE macro to do all this for you.
|
||||||
|
|
||||||
// Here's an example of using a pointer..
|
// Here's an example of using a pointer.
|
||||||
|
|
||||||
auto* n = new MyObject();
|
auto* n = new MyObject();
|
||||||
WeakReference<MyObject> myObjectRef = n;
|
WeakReference<MyObject> myObjectRef = n;
|
||||||
|
|
|
||||||
|
|
@ -276,7 +276,7 @@
|
||||||
#include <cpu-features.h>
|
#include <cpu-features.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Need to clear various moronic redefinitions made by system headers..
|
// Need to clear various moronic redefinitions made by system headers.
|
||||||
#undef max
|
#undef max
|
||||||
#undef min
|
#undef min
|
||||||
#undef direct
|
#undef direct
|
||||||
|
|
|
||||||
|
|
@ -477,7 +477,7 @@ OSType File::getMacOSType() const
|
||||||
bool File::isBundle() const
|
bool File::isBundle() const
|
||||||
{
|
{
|
||||||
#if JUCE_IOS
|
#if JUCE_IOS
|
||||||
return false; // xxx can't find a sensible way to do this without trying to open the bundle..
|
return false; // xxx can't find a sensible way to do this without trying to open the bundle
|
||||||
#else
|
#else
|
||||||
JUCE_AUTORELEASEPOOL
|
JUCE_AUTORELEASEPOOL
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -342,7 +342,7 @@ bool File::moveToTrash() const
|
||||||
if (! exists())
|
if (! exists())
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
// The string we pass in must be double null terminated..
|
// The string we pass in must be double null terminated.
|
||||||
const size_t numBytes = CharPointer_UTF16::getBytesRequiredFor (fullPath.getCharPointer()) + 8;
|
const size_t numBytes = CharPointer_UTF16::getBytesRequiredFor (fullPath.getCharPointer()) + 8;
|
||||||
HeapBlock<WCHAR> doubleNullTermPath;
|
HeapBlock<WCHAR> doubleNullTermPath;
|
||||||
doubleNullTermPath.calloc (numBytes, 1);
|
doubleNullTermPath.calloc (numBytes, 1);
|
||||||
|
|
|
||||||
|
|
@ -401,7 +401,7 @@ public:
|
||||||
LocalRef<jobject> responseHeaderBuffer (env->NewObject (StringBuffer, StringBuffer.constructor));
|
LocalRef<jobject> responseHeaderBuffer (env->NewObject (StringBuffer, StringBuffer.constructor));
|
||||||
|
|
||||||
// Annoyingly, the android HTTP functions will choke on this call if you try to do it on the message
|
// Annoyingly, the android HTTP functions will choke on this call if you try to do it on the message
|
||||||
// thread. You'll need to move your networking code to a background thread to keep it happy..
|
// thread. You'll need to move your networking code to a background thread to keep it happy.
|
||||||
jassert (Thread::getCurrentThread() != nullptr);
|
jassert (Thread::getCurrentThread() != nullptr);
|
||||||
|
|
||||||
jintArray statusCodeArray = env->NewIntArray (1);
|
jintArray statusCodeArray = env->NewIntArray (1);
|
||||||
|
|
|
||||||
|
|
@ -292,7 +292,7 @@ private:
|
||||||
|
|
||||||
if (sessionHandle != nullptr)
|
if (sessionHandle != nullptr)
|
||||||
{
|
{
|
||||||
// break up the url..
|
// break up the url
|
||||||
const int fileNumChars = 65536;
|
const int fileNumChars = 65536;
|
||||||
const int serverNumChars = 2048;
|
const int serverNumChars = 2048;
|
||||||
const int usernameNumChars = 1024;
|
const int usernameNumChars = 1024;
|
||||||
|
|
|
||||||
|
|
@ -190,7 +190,7 @@ namespace
|
||||||
}
|
}
|
||||||
|
|
||||||
#if ! JUCE_WASM
|
#if ! JUCE_WASM
|
||||||
// if this file doesn't exist, find a parent of it that does..
|
// if this file doesn't exist, find a parent of it that does
|
||||||
bool juce_doStatFS (File f, struct statfs& result)
|
bool juce_doStatFS (File f, struct statfs& result)
|
||||||
{
|
{
|
||||||
for (int i = 5; --i >= 0;)
|
for (int i = 5; --i >= 0;)
|
||||||
|
|
@ -318,7 +318,7 @@ static bool setFileModeFlags (const String& fullPath, mode_t flags, bool shouldS
|
||||||
|
|
||||||
bool File::setFileReadOnlyInternal (bool shouldBeReadOnly) const
|
bool File::setFileReadOnlyInternal (bool shouldBeReadOnly) const
|
||||||
{
|
{
|
||||||
// Hmm.. should we give global write permission or just the current user?
|
// Should we give global write permission or just the current user?
|
||||||
return setFileModeFlags (fullPath, S_IWUSR | S_IWGRP | S_IWOTH, ! shouldBeReadOnly);
|
return setFileModeFlags (fullPath, S_IWUSR | S_IWGRP | S_IWOTH, ! shouldBeReadOnly);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -707,7 +707,7 @@ void juce_runSystemCommand (const String& command)
|
||||||
String juce_getOutputFromCommand (const String&);
|
String juce_getOutputFromCommand (const String&);
|
||||||
String juce_getOutputFromCommand (const String& command)
|
String juce_getOutputFromCommand (const String& command)
|
||||||
{
|
{
|
||||||
// slight bodge here, as we just pipe the output into a temp file and read it...
|
// slight bodge here, as we just pipe the output into a temp file and read it
|
||||||
auto tempFile = File::getSpecialLocation (File::tempDirectory)
|
auto tempFile = File::getSpecialLocation (File::tempDirectory)
|
||||||
.getNonexistentChildFile (String::toHexString (Random::getSystemRandom().nextInt()), ".tmp", false);
|
.getNonexistentChildFile (String::toHexString (Random::getSystemRandom().nextInt()), ".tmp", false);
|
||||||
|
|
||||||
|
|
@ -726,7 +726,7 @@ class InterProcessLock::Pimpl
|
||||||
public:
|
public:
|
||||||
Pimpl (const String&, int) {}
|
Pimpl (const String&, int) {}
|
||||||
|
|
||||||
int handle = 1, refCount = 1; // On iOS just fake success..
|
int handle = 1, refCount = 1; // on iOS just fake success
|
||||||
};
|
};
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
@ -738,7 +738,7 @@ public:
|
||||||
{
|
{
|
||||||
#if JUCE_MAC
|
#if JUCE_MAC
|
||||||
if (! createLockFile (File ("~/Library/Caches/com.juce.locks").getChildFile (lockName), timeOutMillisecs))
|
if (! createLockFile (File ("~/Library/Caches/com.juce.locks").getChildFile (lockName), timeOutMillisecs))
|
||||||
// Fallback if the user's home folder is on a network drive with no ability to lock..
|
// fallback if the user's home folder is on a network drive with no ability to lock
|
||||||
createLockFile (File ("/tmp/com.juce.locks").getChildFile (lockName), timeOutMillisecs);
|
createLockFile (File ("/tmp/com.juce.locks").getChildFile (lockName), timeOutMillisecs);
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
@ -795,7 +795,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
closeFile();
|
closeFile();
|
||||||
return true; // only false if there's a file system error. Failure to lock still returns true.
|
return true; // only false if there's a file system error. Failure to lock still returns true
|
||||||
}
|
}
|
||||||
|
|
||||||
void closeFile()
|
void closeFile()
|
||||||
|
|
@ -1127,7 +1127,7 @@ public:
|
||||||
}
|
}
|
||||||
else if (result == 0)
|
else if (result == 0)
|
||||||
{
|
{
|
||||||
// we're the child process..
|
// we're the child process
|
||||||
close (pipeHandles[0]); // close the read handle
|
close (pipeHandles[0]); // close the read handle
|
||||||
|
|
||||||
if ((streamFlags & wantStdOut) != 0)
|
if ((streamFlags & wantStdOut) != 0)
|
||||||
|
|
@ -1155,7 +1155,7 @@ public:
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// we're the parent process..
|
// we're the parent process
|
||||||
childPID = result;
|
childPID = result;
|
||||||
pipeHandle = pipeHandles[0];
|
pipeHandle = pipeHandles[0];
|
||||||
close (pipeHandles[1]); // close the write handle
|
close (pipeHandles[1]); // close the write handle
|
||||||
|
|
|
||||||
|
|
@ -73,7 +73,6 @@ bool SystemStats::isOperatingSystem64Bit()
|
||||||
#if JUCE_64BIT
|
#if JUCE_64BIT
|
||||||
return true;
|
return true;
|
||||||
#else
|
#else
|
||||||
//xxx not sure how to find this out?..
|
|
||||||
return false;
|
return false;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -233,7 +233,7 @@ static int lastProcessPriority = -1;
|
||||||
void juce_repeatLastProcessPriority();
|
void juce_repeatLastProcessPriority();
|
||||||
void juce_repeatLastProcessPriority()
|
void juce_repeatLastProcessPriority()
|
||||||
{
|
{
|
||||||
if (lastProcessPriority >= 0) // (avoid changing this if it's not been explicitly set by the app..)
|
if (lastProcessPriority >= 0) // avoid changing this if it's not been explicitly set by the app
|
||||||
{
|
{
|
||||||
DWORD p;
|
DWORD p;
|
||||||
|
|
||||||
|
|
@ -295,7 +295,7 @@ void JUCE_CALLTYPE Process::terminate()
|
||||||
_CrtDumpMemoryLeaks();
|
_CrtDumpMemoryLeaks();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// bullet in the head in case there's a problem shutting down..
|
// bullet in the head in case there's a problem shutting down
|
||||||
ExitProcess (1);
|
ExitProcess (1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -153,7 +153,7 @@ namespace SocketHelpers
|
||||||
|
|
||||||
if (isListener)
|
if (isListener)
|
||||||
{
|
{
|
||||||
// need to do this to interrupt the accept() function..
|
// need to do this to interrupt the accept() function
|
||||||
StreamingSocket temp;
|
StreamingSocket temp;
|
||||||
temp.connect (IPAddress::local().toString(), portNumber, 1000);
|
temp.connect (IPAddress::local().toString(), portNumber, 1000);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -507,7 +507,7 @@ void URL::createHeadersAndPostData (String& headers,
|
||||||
|
|
||||||
if (filesToUpload.size() > 0)
|
if (filesToUpload.size() > 0)
|
||||||
{
|
{
|
||||||
// (this doesn't currently support mixing custom post-data with uploads..)
|
// this doesn't currently support mixing custom post-data with uploads
|
||||||
jassert (postData.isEmpty());
|
jassert (postData.isEmpty());
|
||||||
|
|
||||||
auto boundary = String::toHexString (Random::getSystemRandom().nextInt64());
|
auto boundary = String::toHexString (Random::getSystemRandom().nextInt64());
|
||||||
|
|
@ -550,7 +550,7 @@ void URL::createHeadersAndPostData (String& headers,
|
||||||
|
|
||||||
data << postData;
|
data << postData;
|
||||||
|
|
||||||
// if the user-supplied headers didn't contain a content-type, add one now..
|
// if the user-supplied headers didn't contain a content-type, add one now
|
||||||
if (! headers.containsIgnoreCase ("Content-Type"))
|
if (! headers.containsIgnoreCase ("Content-Type"))
|
||||||
headers << "Content-Type: application/x-www-form-urlencoded\r\n";
|
headers << "Content-Type: application/x-www-form-urlencoded\r\n";
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -177,13 +177,13 @@ bool MemoryOutputStream::setPosition (int64 newPosition)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// can't move beyond the end of the stream..
|
// can't move beyond the end of the stream
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
int64 MemoryOutputStream::writeFromInputStream (InputStream& source, int64 maxNumBytesToWrite)
|
int64 MemoryOutputStream::writeFromInputStream (InputStream& source, int64 maxNumBytesToWrite)
|
||||||
{
|
{
|
||||||
// before writing from an input, see if we can preallocate to make it more efficient..
|
// before writing from an input, see if we can preallocate to make it more efficient
|
||||||
const auto availableData = source.getTotalLength() - source.getPosition();
|
const auto availableData = source.getTotalLength() - source.getPosition();
|
||||||
|
|
||||||
if (availableData > 0)
|
if (availableData > 0)
|
||||||
|
|
|
||||||
|
|
@ -48,7 +48,7 @@ struct DanglingStreamChecker
|
||||||
It's always a bad idea to leak any object, but if you're leaking output
|
It's always a bad idea to leak any object, but if you're leaking output
|
||||||
streams, then there's a good chance that you're failing to flush a file
|
streams, then there's a good chance that you're failing to flush a file
|
||||||
to disk properly, which could result in corrupted data and other similar
|
to disk properly, which could result in corrupted data and other similar
|
||||||
nastiness..
|
nastiness.
|
||||||
*/
|
*/
|
||||||
jassert (activeStreams.size() == 0);
|
jassert (activeStreams.size() == 0);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -187,7 +187,7 @@ namespace juce
|
||||||
|
|
||||||
#else
|
#else
|
||||||
//==============================================================================
|
//==============================================================================
|
||||||
// If debugging is disabled, these dummy debug and assertion macros are used..
|
// If debugging is disabled, these dummy debug and assertion macros are used.
|
||||||
|
|
||||||
#define DBG(textToWrite)
|
#define DBG(textToWrite)
|
||||||
#define jassertfalse JUCE_BLOCK_WITH_FORCED_SEMICOLON (JUCE_LOG_CURRENT_ASSERTION;)
|
#define jassertfalse JUCE_BLOCK_WITH_FORCED_SEMICOLON (JUCE_LOG_CURRENT_ASSERTION;)
|
||||||
|
|
@ -228,19 +228,19 @@ namespace juce
|
||||||
@code
|
@code
|
||||||
class MyClass
|
class MyClass
|
||||||
{
|
{
|
||||||
etc..
|
etc.
|
||||||
|
|
||||||
private:
|
private:
|
||||||
MyClass (const MyClass&);
|
MyClass (const MyClass&);
|
||||||
MyClass& operator= (const MyClass&);
|
MyClass& operator= (const MyClass&);
|
||||||
};@endcode
|
};@endcode
|
||||||
|
|
||||||
..you can just write:
|
...you can just write:
|
||||||
|
|
||||||
@code
|
@code
|
||||||
class MyClass
|
class MyClass
|
||||||
{
|
{
|
||||||
etc..
|
etc.
|
||||||
|
|
||||||
private:
|
private:
|
||||||
JUCE_DECLARE_NON_COPYABLE (MyClass)
|
JUCE_DECLARE_NON_COPYABLE (MyClass)
|
||||||
|
|
|
||||||
|
|
@ -95,7 +95,7 @@
|
||||||
#include "juce_PlatformDefs.h"
|
#include "juce_PlatformDefs.h"
|
||||||
|
|
||||||
//==============================================================================
|
//==============================================================================
|
||||||
// Now we'll include some common OS headers..
|
// Now we'll include some common OS headers.
|
||||||
JUCE_BEGIN_IGNORE_WARNINGS_MSVC (4514 4245 4100)
|
JUCE_BEGIN_IGNORE_WARNINGS_MSVC (4514 4245 4100)
|
||||||
|
|
||||||
#if JUCE_MSVC
|
#if JUCE_MSVC
|
||||||
|
|
@ -134,7 +134,7 @@ JUCE_END_IGNORE_WARNINGS_MSVC
|
||||||
#include <byteswap.h>
|
#include <byteswap.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// undef symbols that are sometimes set by misguided 3rd-party headers..
|
// undef symbols that are sometimes set by misguided 3rd-party headers
|
||||||
#undef TYPE_BOOL
|
#undef TYPE_BOOL
|
||||||
#undef max
|
#undef max
|
||||||
#undef min
|
#undef min
|
||||||
|
|
|
||||||
|
|
@ -204,7 +204,7 @@ public:
|
||||||
static StringArray getMachineIdentifiers (MachineIdFlags flags);
|
static StringArray getMachineIdentifiers (MachineIdFlags flags);
|
||||||
|
|
||||||
//==============================================================================
|
//==============================================================================
|
||||||
// CPU and memory information..
|
// CPU and memory information
|
||||||
|
|
||||||
/** Returns the number of logical CPU cores. */
|
/** Returns the number of logical CPU cores. */
|
||||||
static int getNumCpus() noexcept;
|
static int getNumCpus() noexcept;
|
||||||
|
|
|
||||||
|
|
@ -84,7 +84,7 @@ namespace
|
||||||
// before the currentMappings object, we can force the static order-of-destruction to
|
// before the currentMappings object, we can force the static order-of-destruction to
|
||||||
// delete the currentMappings object first, which avoids a bogus leak warning.
|
// delete the currentMappings object first, which avoids a bogus leak warning.
|
||||||
// (Oddly, just creating a LocalisedStrings on the stack doesn't work in gcc, it
|
// (Oddly, just creating a LocalisedStrings on the stack doesn't work in gcc, it
|
||||||
// has to be created with 'new' for this to work..)
|
// has to be created with 'new' for this to work.)
|
||||||
struct LeakAvoidanceTrick
|
struct LeakAvoidanceTrick
|
||||||
{
|
{
|
||||||
LeakAvoidanceTrick()
|
LeakAvoidanceTrick()
|
||||||
|
|
|
||||||
|
|
@ -314,7 +314,7 @@ String::String (const char* const t)
|
||||||
|
|
||||||
To get around this problem, you must be more explicit when you pass an ambiguous 8-bit
|
To get around this problem, you must be more explicit when you pass an ambiguous 8-bit
|
||||||
string to the String class - so for example if your source data is actually UTF-8,
|
string to the String class - so for example if your source data is actually UTF-8,
|
||||||
you'd call String (CharPointer_UTF8 ("my utf8 string..")), and it would be able to
|
you'd call String (CharPointer_UTF8 ("my utf8 string.")), and it would be able to
|
||||||
correctly convert the multi-byte characters to unicode. It's *highly* recommended that
|
correctly convert the multi-byte characters to unicode. It's *highly* recommended that
|
||||||
you use UTF-8 with escape characters in your source code to represent extended characters,
|
you use UTF-8 with escape characters in your source code to represent extended characters,
|
||||||
because there's no other way to represent these strings in a way that isn't dependent on
|
because there's no other way to represent these strings in a way that isn't dependent on
|
||||||
|
|
@ -337,7 +337,7 @@ String::String (const char* const t, const size_t maxChars)
|
||||||
|
|
||||||
To get around this problem, you must be more explicit when you pass an ambiguous 8-bit
|
To get around this problem, you must be more explicit when you pass an ambiguous 8-bit
|
||||||
string to the String class - so for example if your source data is actually UTF-8,
|
string to the String class - so for example if your source data is actually UTF-8,
|
||||||
you'd call String (CharPointer_UTF8 ("my utf8 string..")), and it would be able to
|
you'd call String (CharPointer_UTF8 ("my utf8 string.")), and it would be able to
|
||||||
correctly convert the multi-byte characters to unicode. It's *highly* recommended that
|
correctly convert the multi-byte characters to unicode. It's *highly* recommended that
|
||||||
you use UTF-8 with escape characters in your source code to represent extended characters,
|
you use UTF-8 with escape characters in your source code to represent extended characters,
|
||||||
because there's no other way to represent these strings in a way that isn't dependent on
|
because there's no other way to represent these strings in a way that isn't dependent on
|
||||||
|
|
@ -419,7 +419,7 @@ namespace NumberToStringConverters
|
||||||
return t;
|
return t;
|
||||||
}
|
}
|
||||||
|
|
||||||
// pass in a pointer to the END of a buffer..
|
// pass in a pointer to the END of a buffer
|
||||||
static char* numberToString (char* t, int64 n) noexcept
|
static char* numberToString (char* t, int64 n) noexcept
|
||||||
{
|
{
|
||||||
if (n >= 0)
|
if (n >= 0)
|
||||||
|
|
@ -2058,7 +2058,7 @@ struct StringEncodingConverter
|
||||||
void* const newSpace = addBytesToPointer (text.getAddress(), (int) endOffset);
|
void* const newSpace = addBytesToPointer (text.getAddress(), (int) endOffset);
|
||||||
const CharPointerType_Dest extraSpace (static_cast<DestChar*> (newSpace));
|
const CharPointerType_Dest extraSpace (static_cast<DestChar*> (newSpace));
|
||||||
|
|
||||||
#if JUCE_DEBUG // (This just avoids spurious warnings from valgrind about the uninitialised bytes at the end of the buffer..)
|
#if JUCE_DEBUG // This just avoids spurious warnings from valgrind about the uninitialised bytes at the end of the buffer.
|
||||||
auto bytesToClear = (size_t) jmin ((int) extraBytesNeeded, 4);
|
auto bytesToClear = (size_t) jmin ((int) extraBytesNeeded, 4);
|
||||||
zeromem (addBytesToPointer (newSpace, extraBytesNeeded - bytesToClear), bytesToClear);
|
zeromem (addBytesToPointer (newSpace, extraBytesNeeded - bytesToClear), bytesToClear);
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -2191,7 +2191,7 @@ StringRef::StringRef (const char* stringLiteral) noexcept
|
||||||
|
|
||||||
To get around this problem, you must be more explicit when you pass an ambiguous 8-bit
|
To get around this problem, you must be more explicit when you pass an ambiguous 8-bit
|
||||||
string to the StringRef class - so for example if your source data is actually UTF-8,
|
string to the StringRef class - so for example if your source data is actually UTF-8,
|
||||||
you'd call StringRef (CharPointer_UTF8 ("my utf8 string..")), and it would be able to
|
you'd call StringRef (CharPointer_UTF8 ("my utf8 string.")), and it would be able to
|
||||||
correctly convert the multi-byte characters to unicode. It's *highly* recommended that
|
correctly convert the multi-byte characters to unicode. It's *highly* recommended that
|
||||||
you use UTF-8 with escape characters in your source code to represent extended characters,
|
you use UTF-8 with escape characters in your source code to represent extended characters,
|
||||||
because there's no other way to represent these strings in a way that isn't dependent on
|
because there's no other way to represent these strings in a way that isn't dependent on
|
||||||
|
|
|
||||||
|
|
@ -86,7 +86,7 @@ public:
|
||||||
assertion.
|
assertion.
|
||||||
|
|
||||||
To create strings with extended characters from UTF-8, you should explicitly call
|
To create strings with extended characters from UTF-8, you should explicitly call
|
||||||
String (CharPointer_UTF8 ("my utf8 string..")). It's *highly* recommended that you
|
String (CharPointer_UTF8 ("my utf8 string.")). It's *highly* recommended that you
|
||||||
use UTF-8 with escape characters in your source code to represent extended characters,
|
use UTF-8 with escape characters in your source code to represent extended characters,
|
||||||
because there's no other way to represent unicode strings in a way that isn't dependent
|
because there's no other way to represent unicode strings in a way that isn't dependent
|
||||||
on the compiler, source code editor and platform.
|
on the compiler, source code editor and platform.
|
||||||
|
|
@ -101,7 +101,7 @@ public:
|
||||||
assertion.
|
assertion.
|
||||||
|
|
||||||
To create strings with extended characters from UTF-8, you should explicitly call
|
To create strings with extended characters from UTF-8, you should explicitly call
|
||||||
String (CharPointer_UTF8 ("my utf8 string..")). In C++20 or later, you may alternatively
|
String (CharPointer_UTF8 ("my utf8 string.")). In C++20 or later, you may alternatively
|
||||||
pass a char8_t string to indicate a UTF-8 encoding. It's *highly* recommended that you
|
pass a char8_t string to indicate a UTF-8 encoding. It's *highly* recommended that you
|
||||||
use UTF-8 with escape characters in your source code to represent extended characters,
|
use UTF-8 with escape characters in your source code to represent extended characters,
|
||||||
because there's no other way to represent unicode strings in a way that isn't dependent
|
because there's no other way to represent unicode strings in a way that isn't dependent
|
||||||
|
|
@ -217,7 +217,7 @@ public:
|
||||||
int length() const noexcept;
|
int length() const noexcept;
|
||||||
|
|
||||||
//==============================================================================
|
//==============================================================================
|
||||||
// Assignment and concatenation operators..
|
// Assignment and concatenation operators
|
||||||
|
|
||||||
/** Replaces this string's contents with another string. */
|
/** Replaces this string's contents with another string. */
|
||||||
String& operator= (const String& other) noexcept;
|
String& operator= (const String& other) noexcept;
|
||||||
|
|
@ -328,7 +328,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
//==============================================================================
|
//==============================================================================
|
||||||
// Comparison methods..
|
// Comparison methods
|
||||||
|
|
||||||
/** Returns true if the string contains no characters.
|
/** Returns true if the string contains no characters.
|
||||||
Note that there's also an isNotEmpty() method to help write readable code.
|
Note that there's also an isNotEmpty() method to help write readable code.
|
||||||
|
|
@ -513,7 +513,7 @@ public:
|
||||||
bool matchesWildcard (StringRef wildcard, bool ignoreCase) const noexcept;
|
bool matchesWildcard (StringRef wildcard, bool ignoreCase) const noexcept;
|
||||||
|
|
||||||
//==============================================================================
|
//==============================================================================
|
||||||
// Substring location methods..
|
// Substring location methods
|
||||||
|
|
||||||
/** Searches for a character inside this string.
|
/** Searches for a character inside this string.
|
||||||
Uses a case-sensitive comparison.
|
Uses a case-sensitive comparison.
|
||||||
|
|
@ -616,7 +616,7 @@ public:
|
||||||
|
|
||||||
|
|
||||||
//==============================================================================
|
//==============================================================================
|
||||||
// Substring extraction and manipulation methods..
|
// Substring extraction and manipulation methods
|
||||||
|
|
||||||
/** Returns the character at this index in the string.
|
/** Returns the character at this index in the string.
|
||||||
In a release build, no checks are made to see if the index is within a valid range, so be
|
In a release build, no checks are made to see if the index is within a valid range, so be
|
||||||
|
|
@ -976,7 +976,7 @@ public:
|
||||||
CharPointerType end() const { return begin().findTerminatingNull(); }
|
CharPointerType end() const { return begin().findTerminatingNull(); }
|
||||||
|
|
||||||
//==============================================================================
|
//==============================================================================
|
||||||
// Numeric conversions..
|
// Numeric conversions
|
||||||
|
|
||||||
/** Creates a string containing this signed 32-bit integer as a decimal number.
|
/** Creates a string containing this signed 32-bit integer as a decimal number.
|
||||||
@see getIntValue, getFloatValue, getDoubleValue, toHexString
|
@see getIntValue, getFloatValue, getDoubleValue, toHexString
|
||||||
|
|
|
||||||
|
|
@ -69,7 +69,7 @@ bool StringPairArray::operator== (const StringPairArray& other) const
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// if we encounter keys that are in a different order, search remaining items by brute force..
|
// if we encounter keys that are in a different order, search remaining items by brute force
|
||||||
for (int j = i; j < num; ++j)
|
for (int j = i; j < num; ++j)
|
||||||
{
|
{
|
||||||
auto otherIndex = other.keys.indexOf (keys[j], other.ignoreCase);
|
auto otherIndex = other.keys.indexOf (keys[j], other.ignoreCase);
|
||||||
|
|
|
||||||
|
|
@ -183,11 +183,11 @@ private:
|
||||||
{
|
{
|
||||||
const ScopedLock myScopedLock (objectLock);
|
const ScopedLock myScopedLock (objectLock);
|
||||||
|
|
||||||
// objectLock is now locked..
|
// objectLock is now locked...
|
||||||
|
|
||||||
...do some thread-safe work here...
|
...do some thread-safe work here...
|
||||||
|
|
||||||
// ..and objectLock gets unlocked here, as myScopedLock goes out of
|
// ...and objectLock gets unlocked here, as myScopedLock goes out of
|
||||||
// scope at the end of the block
|
// scope at the end of the block
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
@ -217,18 +217,18 @@ using ScopedLock = CriticalSection::ScopedLockType;
|
||||||
{
|
{
|
||||||
const ScopedLock myScopedLock (objectLock);
|
const ScopedLock myScopedLock (objectLock);
|
||||||
|
|
||||||
// objectLock is now locked..
|
// objectLock is now locked...
|
||||||
|
|
||||||
{
|
{
|
||||||
ScopedUnlock myUnlocker (objectLock);
|
ScopedUnlock myUnlocker (objectLock);
|
||||||
|
|
||||||
// ..and now unlocked..
|
// ...and now unlocked...
|
||||||
}
|
}
|
||||||
|
|
||||||
// ..and now locked again..
|
// ...and now locked again...
|
||||||
}
|
}
|
||||||
|
|
||||||
// ..and finally unlocked.
|
// ...and finally unlocked.
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@endcode
|
@endcode
|
||||||
|
|
@ -254,14 +254,14 @@ using ScopedUnlock = CriticalSection::ScopedUnlockType;
|
||||||
const ScopedTryLock myScopedTryLock (objectLock);
|
const ScopedTryLock myScopedTryLock (objectLock);
|
||||||
|
|
||||||
// Unlike using a ScopedLock, this may fail to actually get the lock, so you
|
// Unlike using a ScopedLock, this may fail to actually get the lock, so you
|
||||||
// must call the isLocked() method before making any assumptions..
|
// must call the isLocked() method before making any assumptions.
|
||||||
if (myScopedTryLock.isLocked())
|
if (myScopedTryLock.isLocked())
|
||||||
{
|
{
|
||||||
...safely do some work...
|
...safely do some work...
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// If we get here, then our attempt at locking failed because another thread had already locked it..
|
// If we get here, then our attempt at locking failed because another thread had already locked it.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -101,7 +101,7 @@ void ReadWriteLock::exitRead() const noexcept
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
jassertfalse; // unlocking a lock that wasn't locked..
|
jassertfalse; // unlocking a lock that wasn't locked
|
||||||
}
|
}
|
||||||
|
|
||||||
//==============================================================================
|
//==============================================================================
|
||||||
|
|
@ -144,7 +144,7 @@ void ReadWriteLock::exitWrite() const noexcept
|
||||||
{
|
{
|
||||||
const SpinLock::ScopedLockType sl (accessLock);
|
const SpinLock::ScopedLockType sl (accessLock);
|
||||||
|
|
||||||
// check this thread actually had the lock..
|
// check this thread actually had the lock
|
||||||
jassert (numWriters > 0 && writerThreadId == Thread::getCurrentThreadId());
|
jassert (numWriters > 0 && writerThreadId == Thread::getCurrentThreadId());
|
||||||
|
|
||||||
if (--numWriters == 0)
|
if (--numWriters == 0)
|
||||||
|
|
|
||||||
|
|
@ -54,7 +54,7 @@ namespace juce
|
||||||
|
|
||||||
...do some stuff...
|
...do some stuff...
|
||||||
|
|
||||||
// myCriticalSection gets unlocked here.
|
// myCriticalSection gets unlocked here
|
||||||
}
|
}
|
||||||
@endcode
|
@endcode
|
||||||
|
|
||||||
|
|
@ -111,11 +111,11 @@ private:
|
||||||
const GenericScopedLock<CriticalSection> myScopedLock (myCriticalSection);
|
const GenericScopedLock<CriticalSection> myScopedLock (myCriticalSection);
|
||||||
// myCriticalSection is now locked
|
// myCriticalSection is now locked
|
||||||
|
|
||||||
... do some stuff with it locked ..
|
... do some stuff with it locked...
|
||||||
|
|
||||||
while (xyz)
|
while (xyz)
|
||||||
{
|
{
|
||||||
... do some stuff with it locked ..
|
... do some stuff with it locked...
|
||||||
|
|
||||||
const GenericScopedUnlock<CriticalSection> unlocker (myCriticalSection);
|
const GenericScopedUnlock<CriticalSection> unlocker (myCriticalSection);
|
||||||
|
|
||||||
|
|
@ -125,7 +125,7 @@ private:
|
||||||
...do some stuff with it unlocked ...
|
...do some stuff with it unlocked ...
|
||||||
}
|
}
|
||||||
|
|
||||||
// myCriticalSection gets unlocked here.
|
// myCriticalSection gets unlocked here
|
||||||
}
|
}
|
||||||
@endcode
|
@endcode
|
||||||
|
|
||||||
|
|
@ -187,14 +187,14 @@ private:
|
||||||
|
|
||||||
// Unlike using a ScopedLock, this may fail to actually get the lock, so you
|
// Unlike using a ScopedLock, this may fail to actually get the lock, so you
|
||||||
// should test this with the isLocked() method before doing your thread-unsafe
|
// should test this with the isLocked() method before doing your thread-unsafe
|
||||||
// action..
|
// action.
|
||||||
if (myScopedTryLock.isLocked())
|
if (myScopedTryLock.isLocked())
|
||||||
{
|
{
|
||||||
...do some stuff...
|
...do some stuff...
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
..our attempt at locking failed because another thread had already locked it..
|
...our attempt at locking failed because another thread had already locked it...
|
||||||
}
|
}
|
||||||
|
|
||||||
// myCriticalSection gets unlocked here (if it was locked)
|
// myCriticalSection gets unlocked here (if it was locked)
|
||||||
|
|
|
||||||
|
|
@ -52,7 +52,7 @@ namespace juce
|
||||||
|
|
||||||
...do some stuff...
|
...do some stuff...
|
||||||
|
|
||||||
// myLock gets unlocked here.
|
// myLock gets unlocked here
|
||||||
}
|
}
|
||||||
@endcode
|
@endcode
|
||||||
|
|
||||||
|
|
@ -117,10 +117,10 @@ private:
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
..our attempt at locking failed because a write lock has already been issued..
|
...our attempt at locking failed because a write lock has already been issued...
|
||||||
}
|
}
|
||||||
|
|
||||||
// myLock gets unlocked here (if it was locked).
|
// myLock gets unlocked here (if it was locked)
|
||||||
}
|
}
|
||||||
@endcode
|
@endcode
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -52,7 +52,7 @@ namespace juce
|
||||||
|
|
||||||
...do some stuff...
|
...do some stuff...
|
||||||
|
|
||||||
// myLock gets unlocked here.
|
// myLock gets unlocked here
|
||||||
}
|
}
|
||||||
@endcode
|
@endcode
|
||||||
|
|
||||||
|
|
@ -117,10 +117,10 @@ private:
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
..our attempt at locking failed because some other thread has already locked the object..
|
...our attempt at locking failed because some other thread has already locked the object...
|
||||||
}
|
}
|
||||||
|
|
||||||
// myLock gets unlocked here (if it was locked).
|
// myLock gets unlocked here (if it was locked)
|
||||||
}
|
}
|
||||||
@endcode
|
@endcode
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -261,7 +261,7 @@ bool Thread::stopThread (const int timeOutMilliseconds)
|
||||||
if (isThreadRunning())
|
if (isThreadRunning())
|
||||||
{
|
{
|
||||||
// very bad karma if this point is reached, as there are bound to be
|
// very bad karma if this point is reached, as there are bound to be
|
||||||
// locks and events left in silly states when a thread is killed by force..
|
// locks and events left in silly states when a thread is killed by force
|
||||||
jassertfalse;
|
jassertfalse;
|
||||||
Logger::writeToLog ("!! killing thread by force !!");
|
Logger::writeToLog ("!! killing thread by force !!");
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -82,10 +82,10 @@ public:
|
||||||
enum JobStatus
|
enum JobStatus
|
||||||
{
|
{
|
||||||
jobHasFinished = 0, /**< indicates that the job has finished and can be
|
jobHasFinished = 0, /**< indicates that the job has finished and can be
|
||||||
removed from the pool. */
|
removed from the pool */
|
||||||
|
|
||||||
jobNeedsRunningAgain /**< indicates that the job would like to be called
|
jobNeedsRunningAgain /**< indicates that the job would like to be called
|
||||||
again when a thread is free. */
|
again when a thread is free */
|
||||||
};
|
};
|
||||||
|
|
||||||
/** Performs the actual work that this job needs to do.
|
/** Performs the actual work that this job needs to do.
|
||||||
|
|
|
||||||
|
|
@ -61,10 +61,10 @@ void TimeSliceThread::removeTimeSliceClient (TimeSliceClient* const client)
|
||||||
const ScopedLock sl1 (listLock);
|
const ScopedLock sl1 (listLock);
|
||||||
|
|
||||||
// if there's a chance we're in the middle of calling this client, we need to
|
// if there's a chance we're in the middle of calling this client, we need to
|
||||||
// also lock the outer lock..
|
// also lock the outer lock
|
||||||
if (clientBeingCalled == client)
|
if (clientBeingCalled == client)
|
||||||
{
|
{
|
||||||
const ScopedUnlock ul (listLock); // unlock first to get the order right..
|
const ScopedUnlock ul (listLock); // unlock first to get the order right
|
||||||
|
|
||||||
const ScopedLock sl2 (callbackLock);
|
const ScopedLock sl2 (callbackLock);
|
||||||
const ScopedLock sl3 (listLock);
|
const ScopedLock sl3 (listLock);
|
||||||
|
|
|
||||||
|
|
@ -142,7 +142,7 @@ namespace TimeHelpers
|
||||||
}
|
}
|
||||||
|
|
||||||
// There's no posix function that does a UTC version of mktime,
|
// There's no posix function that does a UTC version of mktime,
|
||||||
// so annoyingly we need to implement this manually..
|
// so annoyingly we need to implement this manually.
|
||||||
static int64 mktime_utc (const std::tm& t) noexcept
|
static int64 mktime_utc (const std::tm& t) noexcept
|
||||||
{
|
{
|
||||||
return 24 * 3600 * (daysFrom1970 (t.tm_year + 1900, t.tm_mon) + (t.tm_mday - 1))
|
return 24 * 3600 * (daysFrom1970 (t.tm_year + 1900, t.tm_mon) + (t.tm_mday - 1))
|
||||||
|
|
@ -244,9 +244,9 @@ uint32 Time::getMillisecondCounter() noexcept
|
||||||
|
|
||||||
if (now < TimeHelpers::lastMSCounterValue.get())
|
if (now < TimeHelpers::lastMSCounterValue.get())
|
||||||
{
|
{
|
||||||
// in multi-threaded apps this might be called concurrently, so
|
// In multi-threaded apps this might be called concurrently, so
|
||||||
// make sure that our last counter value only increases and doesn't
|
// make sure that our last counter value only increases and doesn't
|
||||||
// go backwards..
|
// go backwards.
|
||||||
if (now < TimeHelpers::lastMSCounterValue.get() - (uint32) 1000)
|
if (now < TimeHelpers::lastMSCounterValue.get() - (uint32) 1000)
|
||||||
TimeHelpers::lastMSCounterValue = now;
|
TimeHelpers::lastMSCounterValue = now;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -293,7 +293,7 @@ public:
|
||||||
static String getMonthName (int monthNumber, bool threeLetterVersion);
|
static String getMonthName (int monthNumber, bool threeLetterVersion);
|
||||||
|
|
||||||
//==============================================================================
|
//==============================================================================
|
||||||
// Static methods for getting system timers directly..
|
// Static methods for getting system timers directly
|
||||||
|
|
||||||
/** Returns the current system time.
|
/** Returns the current system time.
|
||||||
|
|
||||||
|
|
@ -345,7 +345,7 @@ public:
|
||||||
static uint32 getApproximateMillisecondCounter() noexcept;
|
static uint32 getApproximateMillisecondCounter() noexcept;
|
||||||
|
|
||||||
//==============================================================================
|
//==============================================================================
|
||||||
// High-resolution timers..
|
// High-resolution timers
|
||||||
|
|
||||||
/** Returns the current high-resolution counter's tick-count.
|
/** Returns the current high-resolution counter's tick-count.
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -62,7 +62,7 @@ class UnitTestRunner;
|
||||||
expect (myOtherFoobar.doesSomething());
|
expect (myOtherFoobar.doesSomething());
|
||||||
expect (myOtherFoobar.doesSomethingElse());
|
expect (myOtherFoobar.doesSomethingElse());
|
||||||
|
|
||||||
...etc..
|
...etc...
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue