mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-02-05 03:50:07 +00:00
Fix for mono files in QuicktimeAudioFormat. Avoided some floating-point comparison warnings. Added some iOS options in the new jucer plist. Fix for audio host startup. Changes to allow backslashes in unix filenames.
This commit is contained in:
parent
2a86002b31
commit
3fe85fd17a
24 changed files with 150 additions and 85 deletions
|
|
@ -404,7 +404,7 @@ AudioFormatReader* AiffAudioFormat::createReaderFor (InputStream* sourceStream,
|
|||
{
|
||||
ScopedPointer <AiffAudioFormatReader> w (new AiffAudioFormatReader (sourceStream));
|
||||
|
||||
if (w->sampleRate != 0)
|
||||
if (w->sampleRate > 0)
|
||||
return w.release();
|
||||
|
||||
if (! deleteStreamIfOpeningFails)
|
||||
|
|
|
|||
|
|
@ -507,7 +507,7 @@ AudioFormatReader* FlacAudioFormat::createReaderFor (InputStream* in,
|
|||
{
|
||||
ScopedPointer<FlacReader> r (new FlacReader (in));
|
||||
|
||||
if (r->sampleRate != 0)
|
||||
if (r->sampleRate > 0)
|
||||
return r.release();
|
||||
|
||||
if (! deleteStreamIfOpeningFails)
|
||||
|
|
|
|||
|
|
@ -426,7 +426,7 @@ AudioFormatReader* OggVorbisAudioFormat::createReaderFor (InputStream* in,
|
|||
{
|
||||
ScopedPointer <OggReader> r (new OggReader (in));
|
||||
|
||||
if (r->sampleRate != 0)
|
||||
if (r->sampleRate > 0)
|
||||
return r.release();
|
||||
|
||||
if (! deleteStreamIfOpeningFails)
|
||||
|
|
|
|||
|
|
@ -280,10 +280,13 @@ public:
|
|||
{
|
||||
if (destSamples[j] != 0)
|
||||
{
|
||||
const short* const src = ((const short*) bufferList->mBuffers[0].mData) + j;
|
||||
const short* src = ((const short*) bufferList->mBuffers[0].mData) + j;
|
||||
|
||||
for (int i = 0; i < samplesReceived; ++i)
|
||||
destSamples[j][startOffsetInDestBuffer + i] = src [i << 1] << 16;
|
||||
{
|
||||
destSamples[j][startOffsetInDestBuffer + i] = (*src << 16);
|
||||
src += numChannels;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -718,7 +718,7 @@ AudioFormatReader* WavAudioFormat::createReaderFor (InputStream* sourceStream,
|
|||
{
|
||||
ScopedPointer <WavAudioFormatReader> r (new WavAudioFormatReader (sourceStream));
|
||||
|
||||
if (r->sampleRate != 0)
|
||||
if (r->sampleRate > 0)
|
||||
return r.release();
|
||||
|
||||
if (! deleteStreamIfOpeningFails)
|
||||
|
|
|
|||
|
|
@ -94,7 +94,7 @@ void AudioTransportSource::setSource (PositionableAudioSource* const newSource,
|
|||
|
||||
newPositionableSource->setNextReadPosition (0);
|
||||
|
||||
if (sourceSampleRateToCorrectFor != 0)
|
||||
if (sourceSampleRateToCorrectFor > 0)
|
||||
newMasterSource = newResamplerSource
|
||||
= new ResamplingAudioSource (newPositionableSource, false, maxNumChannels);
|
||||
else
|
||||
|
|
@ -237,7 +237,7 @@ void AudioTransportSource::prepareToPlay (int samplesPerBlockExpected,
|
|||
if (masterSource != 0)
|
||||
masterSource->prepareToPlay (samplesPerBlockExpected, sampleRate);
|
||||
|
||||
if (resamplerSource != 0 && sourceSampleRate != 0)
|
||||
if (resamplerSource != 0 && sourceSampleRate > 0)
|
||||
resamplerSource->setResamplingRatio (sourceSampleRate / sampleRate);
|
||||
|
||||
isPrepared = true;
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@ void MixerAudioSource::addInputSource (AudioSource* input, const bool deleteWhen
|
|||
localBufferSize = bufferSizeExpected;
|
||||
}
|
||||
|
||||
if (localRate != 0.0)
|
||||
if (localRate > 0.0)
|
||||
input->prepareToPlay (localBufferSize, localRate);
|
||||
|
||||
const ScopedLock sl (lock);
|
||||
|
|
|
|||
|
|
@ -468,7 +468,7 @@ double AudioDeviceManager::chooseBestSampleRate (double rate) const
|
|||
{
|
||||
const double sr = currentAudioDevice->getSampleRate (i);
|
||||
|
||||
if (sr >= 44100.0 && (lowestAbove44 == 0 || sr < lowestAbove44))
|
||||
if (sr >= 44100.0 && (lowestAbove44 < 1.0 || sr < lowestAbove44))
|
||||
lowestAbove44 = sr;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -150,7 +150,6 @@ namespace MidiFileHelpers
|
|||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return correctedTempoTime + (time - tempoTime) * secsPerTick;
|
||||
|
|
@ -169,19 +168,16 @@ namespace MidiFileHelpers
|
|||
{
|
||||
const double diff = (first->message.getTimeStamp() - second->message.getTimeStamp());
|
||||
|
||||
if (diff == 0)
|
||||
{
|
||||
if (first->message.isNoteOff() && second->message.isNoteOn())
|
||||
return -1;
|
||||
else if (first->message.isNoteOn() && second->message.isNoteOff())
|
||||
return 1;
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
return (diff > 0) ? 1 : -1;
|
||||
}
|
||||
if (diff > 0)
|
||||
return 1;
|
||||
else if (diff < 0)
|
||||
return -1;
|
||||
else if (first->message.isNoteOff() && second->message.isNoteOn())
|
||||
return -1;
|
||||
else if (first->message.isNoteOn() && second->message.isNoteOff())
|
||||
return 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -60,7 +60,7 @@ void ResizableEdgeComponent::paint (Graphics& g)
|
|||
isMouseOver(), isMouseButtonDown());
|
||||
}
|
||||
|
||||
void ResizableEdgeComponent::mouseDown (const MouseEvent& e)
|
||||
void ResizableEdgeComponent::mouseDown (const MouseEvent&)
|
||||
{
|
||||
if (component == 0)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -339,7 +339,7 @@ void Colour::getHSB (float& h, float& s, float& v) const throw()
|
|||
{
|
||||
s = (hi - lo) / (float) hi;
|
||||
|
||||
if (s != 0)
|
||||
if (s > 0)
|
||||
{
|
||||
const float invDiff = 1.0f / (hi - lo);
|
||||
|
||||
|
|
|
|||
|
|
@ -219,5 +219,15 @@ bool ColourGradient::isInvisible() const throw()
|
|||
return true;
|
||||
}
|
||||
|
||||
bool ColourGradient::ColourPoint::operator== (const ColourPoint& other) const throw()
|
||||
{
|
||||
return position == other.position && colour == other.colour;
|
||||
}
|
||||
|
||||
bool ColourGradient::ColourPoint::operator!= (const ColourPoint& other) const throw()
|
||||
{
|
||||
return position != other.position || colour != other.colour;
|
||||
}
|
||||
|
||||
|
||||
END_JUCE_NAMESPACE
|
||||
|
|
|
|||
|
|
@ -163,8 +163,8 @@ private:
|
|||
: position (position_), colour (colour_)
|
||||
{}
|
||||
|
||||
bool operator== (const ColourPoint& other) const throw() { return position == other.position && colour == other.colour; }
|
||||
bool operator!= (const ColourPoint& other) const throw() { return position != other.position || colour != other.colour; }
|
||||
bool operator== (const ColourPoint& other) const throw();
|
||||
bool operator!= (const ColourPoint& other) const throw();
|
||||
|
||||
double position;
|
||||
Colour colour;
|
||||
|
|
|
|||
|
|
@ -123,7 +123,7 @@ public:
|
|||
owner.applyRelativePath (*owner.relativePath, &scope);
|
||||
}
|
||||
|
||||
void applyNewBounds (const Rectangle<int>& newBounds)
|
||||
void applyNewBounds (const Rectangle<int>&)
|
||||
{
|
||||
jassertfalse; // drawables can't be resized directly!
|
||||
}
|
||||
|
|
|
|||
|
|
@ -77,7 +77,7 @@ public:
|
|||
owner.repaint();
|
||||
}
|
||||
|
||||
void applyNewBounds (const Rectangle<int>& newBounds)
|
||||
void applyNewBounds (const Rectangle<int>&)
|
||||
{
|
||||
jassertfalse; // drawables can't be resized directly!
|
||||
}
|
||||
|
|
|
|||
|
|
@ -211,7 +211,7 @@ public:
|
|||
const Point<ValueType> delta (end - start);
|
||||
const double length = juce_hypot ((double) delta.getX(),
|
||||
(double) delta.getY());
|
||||
if (length == 0)
|
||||
if (length <= 0)
|
||||
return start;
|
||||
|
||||
return Point<ValueType> (start.getX() + (ValueType) ((delta.getX() * distanceFromStart - delta.getY() * perpendicularDistance) / length),
|
||||
|
|
|
|||
|
|
@ -63,6 +63,12 @@ PathFlatteningIterator::~PathFlatteningIterator()
|
|||
{
|
||||
}
|
||||
|
||||
bool PathFlatteningIterator::isLastInSubpath() const throw()
|
||||
{
|
||||
return stackPos == stackBase.getData()
|
||||
&& (index >= path.numElements || points [index] == Path::moveMarker);
|
||||
}
|
||||
|
||||
bool PathFlatteningIterator::next()
|
||||
{
|
||||
x1 = x2;
|
||||
|
|
|
|||
|
|
@ -91,9 +91,7 @@ public:
|
|||
int subPathIndex;
|
||||
|
||||
/** Returns true if the current segment is the last in the current sub-path. */
|
||||
bool isLastInSubpath() const throw() { return stackPos == stackBase.getData()
|
||||
&& (index >= path.numElements || points [index] == Path::moveMarker); }
|
||||
|
||||
bool isLastInSubpath() const throw();
|
||||
|
||||
/** This is the default value that should be used for the tolerance value (see the constructor parameters). */
|
||||
static const float defaultTolerance;
|
||||
|
|
|
|||
|
|
@ -118,7 +118,13 @@ const String File::parseAbsolutePath (const String& p)
|
|||
}
|
||||
#else
|
||||
// Mac or Linux..
|
||||
String path (p.replaceCharacter ('\\', '/'));
|
||||
|
||||
// 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.
|
||||
// If that's why you've ended up here, use File::getChildFile() to build your paths instead.
|
||||
jassert ((! p.containsChar ('\\')) || (p.indexOfChar ('/') >= 0 && p.indexOfChar ('/') < p.indexOfChar ('\\')));
|
||||
|
||||
String path (p);
|
||||
|
||||
if (path.startsWithChar ('~'))
|
||||
{
|
||||
|
|
@ -364,11 +370,11 @@ bool File::isAChildOf (const File& potentialParent) const
|
|||
bool File::isAbsolutePath (const String& path)
|
||||
{
|
||||
return path.startsWithChar ('/') || path.startsWithChar ('\\')
|
||||
#if JUCE_WINDOWS
|
||||
#if JUCE_WINDOWS
|
||||
|| (path.isNotEmpty() && path[1] == ':');
|
||||
#else
|
||||
#else
|
||||
|| path.startsWithChar ('~');
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
const File File::getChildFile (String relativePath) const
|
||||
|
|
@ -385,11 +391,12 @@ const File File::getChildFile (String relativePath) const
|
|||
|
||||
if (relativePath[0] == '.')
|
||||
{
|
||||
#if JUCE_WINDOWS
|
||||
#if JUCE_WINDOWS
|
||||
relativePath = relativePath.replaceCharacter ('/', '\\').trimStart();
|
||||
#else
|
||||
relativePath = relativePath.replaceCharacter ('\\', '/').trimStart();
|
||||
#endif
|
||||
#else
|
||||
relativePath = relativePath.trimStart();
|
||||
#endif
|
||||
|
||||
while (relativePath[0] == '.')
|
||||
{
|
||||
if (relativePath[1] == '.')
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue