| @@ -224,12 +224,11 @@ void AudioTransportSource::setGain (const float newGain) noexcept | |||
| gain = newGain; | |||
| } | |||
| void AudioTransportSource::prepareToPlay (int samplesPerBlockExpected, | |||
| double sampleRate_) | |||
| void AudioTransportSource::prepareToPlay (int samplesPerBlockExpected, double newSampleRate) | |||
| { | |||
| const ScopedLock sl (callbackLock); | |||
| sampleRate = sampleRate_; | |||
| sampleRate = newSampleRate; | |||
| blockSize = samplesPerBlockExpected; | |||
| if (masterSource != nullptr) | |||
| @@ -76,15 +76,15 @@ private: | |||
| class AudioThumbnail::LevelDataSource : public TimeSliceClient | |||
| { | |||
| public: | |||
| LevelDataSource (AudioThumbnail& owner_, AudioFormatReader* newReader, int64 hash) | |||
| LevelDataSource (AudioThumbnail& thumb, AudioFormatReader* newReader, int64 hash) | |||
| : lengthInSamples (0), numSamplesFinished (0), sampleRate (0), numChannels (0), | |||
| hashCode (hash), owner (owner_), reader (newReader) | |||
| hashCode (hash), owner (thumb), reader (newReader) | |||
| { | |||
| } | |||
| LevelDataSource (AudioThumbnail& owner_, InputSource* source_) | |||
| LevelDataSource (AudioThumbnail& thumb, InputSource* src) | |||
| : lengthInSamples (0), numSamplesFinished (0), sampleRate (0), numChannels (0), | |||
| hashCode (source_->hashCode()), owner (owner_), source (source_) | |||
| hashCode (src->hashCode()), owner (thumb), source (src) | |||
| { | |||
| } | |||
| @@ -95,11 +95,11 @@ public: | |||
| enum { timeBeforeDeletingReader = 3000 }; | |||
| void initialise (int64 numSamplesFinished_) | |||
| void initialise (int64 samplesFinished) | |||
| { | |||
| const ScopedLock sl (readerLock); | |||
| numSamplesFinished = numSamplesFinished_; | |||
| numSamplesFinished = samplesFinished; | |||
| createReader(); | |||
| @@ -519,9 +519,9 @@ private: | |||
| //============================================================================== | |||
| AudioThumbnail::AudioThumbnail (const int originalSamplesPerThumbnailSample, | |||
| AudioFormatManager& formatManagerToUse_, | |||
| AudioFormatManager& formatManager, | |||
| AudioThumbnailCache& cacheToUse) | |||
| : formatManagerToUse (formatManagerToUse_), | |||
| : formatManagerToUse (formatManager), | |||
| cache (cacheToUse), | |||
| window (new CachedWindow()), | |||
| samplesPerThumbSample (originalSamplesPerThumbnailSample), | |||
| @@ -56,9 +56,9 @@ private: | |||
| }; | |||
| //============================================================================== | |||
| AudioThumbnailCache::AudioThumbnailCache (const int maxNumThumbsToStore_) | |||
| AudioThumbnailCache::AudioThumbnailCache (const int maxNumThumbs) | |||
| : thread ("thumb cache"), | |||
| maxNumThumbsToStore (maxNumThumbsToStore_) | |||
| maxNumThumbsToStore (maxNumThumbs) | |||
| { | |||
| jassert (maxNumThumbsToStore > 0); | |||
| thread.startThread (2); | |||
| @@ -31,8 +31,8 @@ TemporaryFile::TemporaryFile (const String& suffix, const int optionFlags) | |||
| optionFlags); | |||
| } | |||
| TemporaryFile::TemporaryFile (const File& targetFile_, const int optionFlags) | |||
| : targetFile (targetFile_) | |||
| TemporaryFile::TemporaryFile (const File& target, const int optionFlags) | |||
| : targetFile (target) | |||
| { | |||
| // If you use this constructor, you need to give it a valid target file! | |||
| jassert (targetFile != File::nonexistent); | |||
| @@ -87,8 +87,7 @@ bool BufferedInputStream::setPosition (int64 newPosition) | |||
| bool BufferedInputStream::isExhausted() | |||
| { | |||
| return (position >= lastReadPos) | |||
| && source->isExhausted(); | |||
| return position >= lastReadPos && source->isExhausted(); | |||
| } | |||
| void BufferedInputStream::ensureBuffered() | |||
| @@ -23,8 +23,8 @@ | |||
| ============================================================================== | |||
| */ | |||
| FileInputSource::FileInputSource (const File& file_, bool useFileTimeInHashGeneration_) | |||
| : file (file_), useFileTimeInHashGeneration (useFileTimeInHashGeneration_) | |||
| FileInputSource::FileInputSource (const File& f, bool useFileTimeInHash) | |||
| : file (f), useFileTimeInHashGeneration (useFileTimeInHash) | |||
| { | |||
| } | |||
| @@ -124,11 +124,9 @@ bool MemoryOutputStream::setPosition (int64 newPosition) | |||
| position = jlimit ((size_t) 0, size, (size_t) newPosition); | |||
| return true; | |||
| } | |||
| else | |||
| { | |||
| // trying to make it bigger isn't a good thing to do.. | |||
| return false; | |||
| } | |||
| // can't move beyond the end of the stream.. | |||
| return false; | |||
| } | |||
| int MemoryOutputStream::writeFromInputStream (InputStream& source, int64 maxNumBytesToWrite) | |||
| @@ -24,12 +24,11 @@ | |||
| */ | |||
| SubregionStream::SubregionStream (InputStream* const sourceStream, | |||
| const int64 startPositionInSourceStream_, | |||
| const int64 lengthOfSourceStream_, | |||
| const int64 start, const int64 length, | |||
| const bool deleteSourceWhenDestroyed) | |||
| : source (sourceStream, deleteSourceWhenDestroyed), | |||
| startPositionInSourceStream (startPositionInSourceStream_), | |||
| lengthOfSourceStream (lengthOfSourceStream_) | |||
| startPositionInSourceStream (start), | |||
| lengthOfSourceStream (length) | |||
| { | |||
| SubregionStream::setPosition (0); | |||
| } | |||
| @@ -42,8 +41,8 @@ int64 SubregionStream::getTotalLength() | |||
| { | |||
| const int64 srcLen = source->getTotalLength() - startPositionInSourceStream; | |||
| return (lengthOfSourceStream >= 0) ? jmin (lengthOfSourceStream, srcLen) | |||
| : srcLen; | |||
| return lengthOfSourceStream >= 0 ? jmin (lengthOfSourceStream, srcLen) | |||
| : srcLen; | |||
| } | |||
| int64 SubregionStream::getPosition() | |||
| @@ -61,18 +60,14 @@ int SubregionStream::read (void* destBuffer, int maxBytesToRead) | |||
| jassert (destBuffer != nullptr && maxBytesToRead >= 0); | |||
| if (lengthOfSourceStream < 0) | |||
| { | |||
| return source->read (destBuffer, maxBytesToRead); | |||
| } | |||
| else | |||
| { | |||
| maxBytesToRead = (int) jmin ((int64) maxBytesToRead, lengthOfSourceStream - getPosition()); | |||
| if (maxBytesToRead <= 0) | |||
| return 0; | |||
| maxBytesToRead = (int) jmin ((int64) maxBytesToRead, lengthOfSourceStream - getPosition()); | |||
| return source->read (destBuffer, maxBytesToRead); | |||
| } | |||
| if (maxBytesToRead <= 0) | |||
| return 0; | |||
| return source->read (destBuffer, maxBytesToRead); | |||
| } | |||
| bool SubregionStream::isExhausted() | |||
| @@ -23,6 +23,10 @@ | |||
| ============================================================================== | |||
| */ | |||
| ResizableBorderComponent::Zone::Zone() noexcept | |||
| : zone (0) | |||
| {} | |||
| ResizableBorderComponent::Zone::Zone (const int zoneFlags) noexcept | |||
| : zone (zoneFlags) | |||
| {} | |||
| @@ -40,9 +44,9 @@ ResizableBorderComponent::Zone& ResizableBorderComponent::Zone::operator= (const | |||
| bool ResizableBorderComponent::Zone::operator== (const ResizableBorderComponent::Zone& other) const noexcept { return zone == other.zone; } | |||
| bool ResizableBorderComponent::Zone::operator!= (const ResizableBorderComponent::Zone& other) const noexcept { return zone != other.zone; } | |||
| const ResizableBorderComponent::Zone ResizableBorderComponent::Zone::fromPositionOnBorder (const Rectangle<int>& totalSize, | |||
| const BorderSize<int>& border, | |||
| const Point<int>& position) | |||
| ResizableBorderComponent::Zone ResizableBorderComponent::Zone::fromPositionOnBorder (const Rectangle<int>& totalSize, | |||
| const BorderSize<int>& border, | |||
| const Point<int>& position) | |||
| { | |||
| int z = 0; | |||
| @@ -106,20 +106,22 @@ public: | |||
| //============================================================================== | |||
| /** Creates a Zone from a combination of the flags in \enum Zones. */ | |||
| explicit Zone (int zoneFlags = 0) noexcept; | |||
| Zone (const Zone& other) noexcept; | |||
| Zone& operator= (const Zone& other) noexcept; | |||
| explicit Zone (int zoneFlags) noexcept; | |||
| bool operator== (const Zone& other) const noexcept; | |||
| bool operator!= (const Zone& other) const noexcept; | |||
| Zone() noexcept; | |||
| Zone (const Zone&) noexcept; | |||
| Zone& operator= (const Zone&) noexcept; | |||
| bool operator== (const Zone&) const noexcept; | |||
| bool operator!= (const Zone&) const noexcept; | |||
| //============================================================================== | |||
| /** Given a point within a rectangle with a resizable border, this returns the | |||
| zone that the point lies within. | |||
| */ | |||
| static const Zone fromPositionOnBorder (const Rectangle<int>& totalSize, | |||
| const BorderSize<int>& border, | |||
| const Point<int>& position); | |||
| static Zone fromPositionOnBorder (const Rectangle<int>& totalSize, | |||
| const BorderSize<int>& border, | |||
| const Point<int>& position); | |||
| /** Returns an appropriate mouse-cursor for this resize zone. */ | |||
| MouseCursor getMouseCursor() const noexcept; | |||
| @@ -139,23 +141,16 @@ public: | |||
| applies to. | |||
| */ | |||
| template <typename ValueType> | |||
| const Rectangle<ValueType> resizeRectangleBy (Rectangle<ValueType> original, | |||
| const Point<ValueType>& distance) const noexcept | |||
| Rectangle<ValueType> resizeRectangleBy (Rectangle<ValueType> original, | |||
| const Point<ValueType>& distance) const noexcept | |||
| { | |||
| if (isDraggingWholeObject()) | |||
| return original + distance; | |||
| if (isDraggingLeftEdge()) | |||
| original.setLeft (jmin (original.getRight(), original.getX() + distance.x)); | |||
| if (isDraggingRightEdge()) | |||
| original.setWidth (jmax (ValueType(), original.getWidth() + distance.x)); | |||
| if (isDraggingTopEdge()) | |||
| original.setTop (jmin (original.getBottom(), original.getY() + distance.y)); | |||
| if (isDraggingBottomEdge()) | |||
| original.setHeight (jmax (ValueType(), original.getHeight() + distance.y)); | |||
| if (isDraggingLeftEdge()) original.setLeft (jmin (original.getRight(), original.getX() + distance.x)); | |||
| if (isDraggingRightEdge()) original.setWidth (jmax (ValueType(), original.getWidth() + distance.x)); | |||
| if (isDraggingTopEdge()) original.setTop (jmin (original.getBottom(), original.getY() + distance.y)); | |||
| if (isDraggingBottomEdge()) original.setHeight (jmax (ValueType(), original.getHeight() + distance.y)); | |||
| return original; | |||
| } | |||
| @@ -168,21 +163,22 @@ public: | |||
| int zone; | |||
| }; | |||
| /** Returns the zone in which the mouse was last seen. */ | |||
| Zone getCurrentZone() const noexcept { return mouseZone; } | |||
| protected: | |||
| //============================================================================== | |||
| /** @internal */ | |||
| void paint (Graphics& g); | |||
| void paint (Graphics&); | |||
| /** @internal */ | |||
| void mouseEnter (const MouseEvent& e); | |||
| void mouseEnter (const MouseEvent&); | |||
| /** @internal */ | |||
| void mouseMove (const MouseEvent& e); | |||
| void mouseMove (const MouseEvent&); | |||
| /** @internal */ | |||
| void mouseDown (const MouseEvent& e); | |||
| void mouseDown (const MouseEvent&); | |||
| /** @internal */ | |||
| void mouseDrag (const MouseEvent& e); | |||
| void mouseDrag (const MouseEvent&); | |||
| /** @internal */ | |||
| void mouseUp (const MouseEvent& e); | |||
| void mouseUp (const MouseEvent&); | |||
| /** @internal */ | |||
| bool hitTest (int x, int y); | |||
| @@ -193,7 +189,7 @@ private: | |||
| Rectangle<int> originalBounds; | |||
| Zone mouseZone; | |||
| void updateMouseZone (const MouseEvent& e); | |||
| void updateMouseZone (const MouseEvent&); | |||
| JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (ResizableBorderComponent) | |||
| }; | |||