Browse Source

Fixes for ZipFile, QuickTimeAudioFormat.

tags/2021-05-28
Julian Storer 15 years ago
parent
commit
098f0af3ed
15 changed files with 366 additions and 286 deletions
  1. +58
    -38
      extras/audio plugins/wrapper/juce_PluginHostType.h
  2. +110
    -83
      juce_amalgamated.cpp
  3. +46
    -43
      juce_amalgamated.h
  4. +49
    -40
      src/audio/audio_file_formats/juce_QuickTimeAudioFormat.cpp
  5. +1
    -1
      src/audio/plugins/formats/juce_VSTPluginFormat.cpp
  6. +2
    -2
      src/containers/juce_AbstractFifo.cpp
  7. +13
    -11
      src/containers/juce_AbstractFifo.h
  8. +1
    -1
      src/core/juce_StandardHeader.h
  9. +1
    -1
      src/gui/components/controls/juce_TextEditor.cpp
  10. +43
    -29
      src/gui/graphics/fonts/juce_Font.cpp
  11. +31
    -30
      src/gui/graphics/fonts/juce_Font.h
  12. +1
    -1
      src/io/files/juce_ZipFile.cpp
  13. +4
    -4
      src/native/common/juce_posix_SharedCode.h
  14. +5
    -1
      src/text/juce_String.cpp
  15. +1
    -1
      src/text/juce_String.h

+ 58
- 38
extras/audio plugins/wrapper/juce_PluginHostType.h View File

@@ -29,7 +29,7 @@ class PluginHostType
{ {
public: public:
//============================================================================== //==============================================================================
PluginHostType() throw() : type (getHostType())
PluginHostType() : type (getHostType())
{ {
} }
@@ -41,11 +41,12 @@ public:
AbletonLive7, AbletonLive7,
AbletonLive8, AbletonLive8,
AbletonLiveGeneric, AbletonLiveGeneric,
AdobePremierePro,
AppleLogic, AppleLogic,
EmagicLogic,
DigidesignProTools,
CakewalkSonar8, CakewalkSonar8,
CakewalkSonarGeneric, CakewalkSonarGeneric,
DigidesignProTools,
EmagicLogic,
Reaper, Reaper,
MackieTracktion3, MackieTracktion3,
MackieTracktionGeneric, MackieTracktionGeneric,
@@ -88,14 +89,24 @@ public:
return type == CakewalkSonar8 || type == CakewalkSonarGeneric; return type == CakewalkSonar8 || type == CakewalkSonarGeneric;
} }
bool isLogic() const throw()
bool isWavelab() const throw()
{ {
return type == AppleLogic || type == EmagicLogic;
return type == SteinbergWavelab5 || type == SteinbergWavelab6 || type == SteinbergWavelab7 || type == SteinbergWavelabGeneric;
} }
bool isWavelab() const throw()
bool isWavelabLegacy() const throw()
{
return type == SteinbergWavelab5 || type == SteinbergWavelab6;
}
bool isPremiere() const throw()
{
return type == AdobePremierePro;
}
bool isLogic() const throw()
{ {
return type == SteinbergWavelabGeneric || type == SteinbergWavelab5 || type == SteinbergWavelab6 || type == SteinbergWavelab7;
return type == AppleLogic || type == EmagicLogic;
} }
bool isReceptor() const throw() bool isReceptor() const throw()
@@ -103,46 +114,55 @@ public:
return type == MuseReceptorGeneric; return type == MuseReceptorGeneric;
} }
//==============================================================================
static String getHostPath()
{
return File::getSpecialLocation (File::hostApplicationPath).getFullPathName();
}
//============================================================================== //==============================================================================
private: private:
static HostType getHostType() static HostType getHostType()
{ {
const String hostPath (File::getSpecialLocation (File::hostApplicationPath).getFullPathName());
const String hostPath (getHostPath());
const String hostFilename (File (hostPath).getFileName()); const String hostFilename (File (hostPath).getFileName());
#if JUCE_MAC #if JUCE_MAC
if (hostPath.containsIgnoreCase ("Live 6.")) return AbletonLive6;
if (hostPath.containsIgnoreCase ("Live 7.")) return AbletonLive7;
if (hostPath.containsIgnoreCase ("Live 8.")) return AbletonLive8;
if (hostFilename.containsIgnoreCase ("Live")) return AbletonLiveGeneric;
if (hostFilename.containsIgnoreCase ("Pro Tools")) return DigidesignProTools;
if (hostFilename.containsIgnoreCase ("Cubase 4")) return SteinbergCubase4;
if (hostFilename.containsIgnoreCase ("Cubase 5")) return SteinbergCubase5;
if (hostFilename.containsIgnoreCase ("Wavelab 7" )) return SteinbergWavelab7;
if (hostFilename.containsIgnoreCase ("Wavelab")) return SteinbergWavelabGeneric;
if (hostFilename.contains ("Logic")) return AppleLogic;
if (hostPath.containsIgnoreCase ("Live 6.")) return AbletonLive6;
if (hostPath.containsIgnoreCase ("Live 7.")) return AbletonLive7;
if (hostPath.containsIgnoreCase ("Live 8.")) return AbletonLive8;
if (hostFilename.containsIgnoreCase ("Live")) return AbletonLiveGeneric;
if (hostFilename.containsIgnoreCase ("Adobe Premiere")) return AdobePremierePro;
if (hostFilename.contains ("Logic")) return AppleLogic;
if (hostFilename.containsIgnoreCase ("Pro Tools")) return DigidesignProTools;
if (hostFilename.containsIgnoreCase ("Cubase 4")) return SteinbergCubase4;
if (hostFilename.containsIgnoreCase ("Cubase 5")) return SteinbergCubase5;
if (hostPath.containsIgnoreCase ("Wavelab 7")) return SteinbergWavelab7;
if (hostFilename.containsIgnoreCase ("Wavelab")) return SteinbergWavelabGeneric;
#elif JUCE_WINDOWS #elif JUCE_WINDOWS
if (hostFilename.containsIgnoreCase ("Live 6.")) return AbletonLive6;
if (hostFilename.containsIgnoreCase ("Live 7.")) return AbletonLive7;
if (hostFilename.containsIgnoreCase ("Live 8.")) return AbletonLive8;
if (hostFilename.containsIgnoreCase ("Live ")) return AbletonLiveGeneric;
if (hostFilename.containsIgnoreCase ("ProTools")) return DigidesignProTools;
if (hostPath.containsIgnoreCase ("SONAR 8")) return CakewalkSonar8;
if (hostFilename.containsIgnoreCase ("SONAR")) return CakewalkSonarGeneric;
if (hostPath.containsIgnoreCase ("Tracktion 3")) return MackieTracktion3;
if (hostFilename.containsIgnoreCase ("Tracktion")) return MackieTracktionGeneric;
if (hostFilename.containsIgnoreCase ("Cubase4")) return SteinbergCubase4;
if (hostFilename.containsIgnoreCase ("Cubase5")) return SteinbergCubase5;
if (hostFilename.containsIgnoreCase ("VSTBridgeApp")) return SteinbergCubase5Bridged;
if (hostFilename.containsIgnoreCase ("Cubase")) return SteinbergCubaseGeneric;
if (hostFilename.containsIgnoreCase ("Wavelab 5")) return SteinbergWavelab5;
if (hostFilename.containsIgnoreCase ("Wavelab 6" )) return SteinbergWavelab6;
if (hostFilename.containsIgnoreCase ("Wavelab 7" )) return SteinbergWavelab7;
if (hostFilename.containsIgnoreCase ("Wavelab")) return SteinbergWavelabGeneric;
if (hostFilename.containsIgnoreCase ("reaper")) return Reaper;
if (hostFilename.containsIgnoreCase ("Logic")) return EmagicLogic;
if (hostFilename.containsIgnoreCase ("rm-host")) return MuseReceptorGeneric;
if (hostFilename.containsIgnoreCase ("Live 6.")) return AbletonLive6;
if (hostFilename.containsIgnoreCase ("Live 7.")) return AbletonLive7;
if (hostFilename.containsIgnoreCase ("Live 8.")) return AbletonLive8;
if (hostFilename.containsIgnoreCase ("Live ")) return AbletonLiveGeneric;
if (hostFilename.containsIgnoreCase ("Adobe Premiere")) return AdobePremierePro;
if (hostFilename.containsIgnoreCase ("ProTools")) return DigidesignProTools;
if (hostPath.containsIgnoreCase ("SONAR 8")) return CakewalkSonar8;
if (hostFilename.containsIgnoreCase ("SONAR")) return CakewalkSonarGeneric;
if (hostFilename.containsIgnoreCase ("Logic")) return EmagicLogic;
if (hostPath.containsIgnoreCase ("Tracktion 3")) return MackieTracktion3;
if (hostFilename.containsIgnoreCase ("Tracktion")) return MackieTracktionGeneric;
if (hostFilename.containsIgnoreCase ("reaper")) return Reaper;
if (hostFilename.containsIgnoreCase ("Cubase4")) return SteinbergCubase4;
if (hostFilename.containsIgnoreCase ("Cubase5")) return SteinbergCubase5;
if (hostFilename.containsIgnoreCase ("Cubase")) return SteinbergCubaseGeneric;
if (hostFilename.containsIgnoreCase ("VSTBridgeApp")) return SteinbergCubase5Bridged;
if (hostPath.containsIgnoreCase ("Wavelab 5")) return SteinbergWavelab5;
if (hostPath.containsIgnoreCase ("Wavelab 6")) return SteinbergWavelab6;
if (hostPath.containsIgnoreCase ("Wavelab 7")) return SteinbergWavelab7;
if (hostFilename.containsIgnoreCase ("Wavelab")) return SteinbergWavelabGeneric;
if (hostFilename.containsIgnoreCase ("reaper")) return Reaper;
if (hostFilename.containsIgnoreCase ("rm-host")) return MuseReceptorGeneric;
#elif JUCE_LINUX #elif JUCE_LINUX


+ 110
- 83
juce_amalgamated.cpp View File

@@ -2435,7 +2435,7 @@ void AbstractFifo::setTotalSize (int newSize) throw()
bufferSize = newSize; bufferSize = newSize;
} }


void AbstractFifo::prepareToWrite (int numToWrite, int& startIndex1, int& blockSize1, int& startIndex2, int& blockSize2) throw()
void AbstractFifo::prepareToWrite (int numToWrite, int& startIndex1, int& blockSize1, int& startIndex2, int& blockSize2) const throw()
{ {
const int vs = validStart.get(); const int vs = validStart.get();
const int ve = validEnd.get(); const int ve = validEnd.get();
@@ -2466,7 +2466,7 @@ void AbstractFifo::finishedWrite (int numWritten) throw()
validEnd += numWritten; validEnd += numWritten;
} }


void AbstractFifo::prepareToRead (int numWanted, int& startIndex1, int& blockSize1, int& startIndex2, int& blockSize2) throw()
void AbstractFifo::prepareToRead (int numWanted, int& startIndex1, int& blockSize1, int& startIndex2, int& blockSize2) const throw()
{ {
const int vs = validStart.get(); const int vs = validStart.get();
const int ve = validEnd.get(); const int ve = validEnd.get();
@@ -10731,7 +10731,7 @@ bool ZipFile::uncompressEntry (const int index,


if (zei->entry.filename.endsWithChar ('/')) if (zei->entry.filename.endsWithChar ('/'))
{ {
targetFile.createDirectory(); // (entry is a directory, not a file)
return targetFile.createDirectory(); // (entry is a directory, not a file)
} }
else else
{ {
@@ -11774,6 +11774,7 @@ public:


static void copyChars (juce_wchar* const dest, const juce_wchar* const src, const size_t numChars) throw() static void copyChars (juce_wchar* const dest, const juce_wchar* const src, const size_t numChars) throw()
{ {
jassert (src != 0 & dest != 0);
memcpy (dest, src, numChars * sizeof (juce_wchar)); memcpy (dest, src, numChars * sizeof (juce_wchar));
dest [numChars] = 0; dest [numChars] = 0;
} }
@@ -13771,7 +13772,10 @@ int String::copyToCString (char* destBuffer, const int maxBufferSizeBytes) const


void String::copyToUnicode (juce_wchar* const destBuffer, const int maxCharsToCopy) const throw() void String::copyToUnicode (juce_wchar* const destBuffer, const int maxCharsToCopy) const throw()
{ {
StringHolder::copyChars (destBuffer, text, jmin (maxCharsToCopy, length()));
jassert (destBuffer != 0 && maxCharsToCopy >= 0);

if (destBuffer != 0 && maxCharsToCopy >= 0)
StringHolder::copyChars (destBuffer, text, jmin (maxCharsToCopy, length()));
} }


String::Concatenator::Concatenator (String& stringToAppendTo) String::Concatenator::Concatenator (String& stringToAppendTo)
@@ -22710,7 +22714,7 @@ public:


bufferList->mNumberBuffers = 1; bufferList->mNumberBuffers = 1;
bufferList->mBuffers[0].mNumberChannels = inputStreamDesc.mChannelsPerFrame; bufferList->mBuffers[0].mNumberChannels = inputStreamDesc.mChannelsPerFrame;
bufferList->mBuffers[0].mDataByteSize = (UInt32) (samplesPerFrame * inputStreamDesc.mBytesPerFrame) + 16;
bufferList->mBuffers[0].mDataByteSize = jmax ((UInt32) 4096, (UInt32) (samplesPerFrame * inputStreamDesc.mBytesPerFrame) + 16);


dataBuffer.malloc (bufferList->mBuffers[0].mDataByteSize); dataBuffer.malloc (bufferList->mBuffers[0].mDataByteSize);
bufferList->mBuffers[0].mData = dataBuffer; bufferList->mBuffers[0].mData = dataBuffer;
@@ -22746,13 +22750,44 @@ public:
int64 startSampleInFile, int numSamples) int64 startSampleInFile, int numSamples)
{ {
checkThreadIsAttached(); checkThreadIsAttached();
bool ok = true;


while (numSamples > 0) while (numSamples > 0)
{ {
if (! loadFrame ((int) startSampleInFile))
return false;
if (lastSampleRead != startSampleInFile)
{
TimeRecord time;
time.scale = (TimeScale) inputStreamDesc.mSampleRate;
time.base = 0;
time.value.hi = 0;
time.value.lo = (UInt32) startSampleInFile;

OSStatus err = MovieAudioExtractionSetProperty (extractor,
kQTPropertyClass_MovieAudioExtraction_Movie,
kQTMovieAudioExtractionMoviePropertyID_CurrentTime,
sizeof (time), &time);


const int numToDo = jmin (numSamples, samplesPerFrame);
if (err != noErr)
{
ok = false;
break;
}
}

int framesToDo = bufferList->mBuffers[0].mDataByteSize / inputStreamDesc.mBytesPerFrame;
bufferList->mBuffers[0].mDataByteSize = inputStreamDesc.mBytesPerFrame * framesToDo;

UInt32 outFlags = 0;
UInt32 actualNumFrames = framesToDo;
OSStatus err = MovieAudioExtractionFillBuffer (extractor, &actualNumFrames, bufferList, &outFlags);
if (err != noErr)
{
ok = false;
break;
}

lastSampleRead = startSampleInFile + actualNumFrames * samplesPerFrame;
const int samplesReceived = actualNumFrames * samplesPerFrame;


for (int j = numDestChannels; --j >= 0;) for (int j = numDestChannels; --j >= 0;)
{ {
@@ -22760,49 +22795,27 @@ public:
{ {
const short* const src = ((const short*) bufferList->mBuffers[0].mData) + j; const short* const src = ((const short*) bufferList->mBuffers[0].mData) + j;


for (int i = 0; i < numToDo; ++i)
for (int i = 0; i < samplesReceived; ++i)
destSamples[j][startOffsetInDestBuffer + i] = src [i << 1] << 16; destSamples[j][startOffsetInDestBuffer + i] = src [i << 1] << 16;
} }
} }


startOffsetInDestBuffer += numToDo;
startSampleInFile += numToDo;
numSamples -= numToDo;
}

detachThread();
return true;
}

bool loadFrame (const int sampleNum)
{
if (lastSampleRead != sampleNum)
{
TimeRecord time;
time.scale = (TimeScale) inputStreamDesc.mSampleRate;
time.base = 0;
time.value.hi = 0;
time.value.lo = (UInt32) sampleNum;
startOffsetInDestBuffer += samplesReceived;
startSampleInFile += samplesReceived;
numSamples -= samplesReceived;


OSStatus err = MovieAudioExtractionSetProperty (extractor,
kQTPropertyClass_MovieAudioExtraction_Movie,
kQTMovieAudioExtractionMoviePropertyID_CurrentTime,
sizeof (time), &time);
if ((outFlags & kQTMovieAudioExtractionComplete) != 0 && numSamples > 0)
{
for (int j = numDestChannels; --j >= 0;)
if (destSamples[j] != 0)
zeromem (destSamples[j] + startOffsetInDestBuffer, sizeof (int) * numSamples);


if (err != noErr)
return false;
break;
}
} }


bufferList->mBuffers[0].mDataByteSize = inputStreamDesc.mBytesPerFrame * samplesPerFrame;

UInt32 outFlags = 0;
UInt32 actualNumSamples = samplesPerFrame;
OSStatus err = MovieAudioExtractionFillBuffer (extractor, &actualNumSamples,
bufferList, &outFlags);

lastSampleRead = sampleNum + samplesPerFrame;

return err == noErr;
detachThread();
return ok;
} }


juce_UseDebuggingNewOperator juce_UseDebuggingNewOperator
@@ -22816,7 +22829,7 @@ private:
const int trackNum; const int trackNum;
double trackUnitsPerFrame; double trackUnitsPerFrame;
int samplesPerFrame; int samplesPerFrame;
int lastSampleRead;
int64 lastSampleRead;
Thread::ThreadID lastThreadId; Thread::ThreadID lastThreadId;
MovieAudioExtractionRef extractor; MovieAudioExtractionRef extractor;
AudioStreamBasicDescription inputStreamDesc; AudioStreamBasicDescription inputStreamDesc;
@@ -34118,7 +34131,7 @@ private:
#pragma warning (push) #pragma warning (push)
#pragma warning (disable: 4244) #pragma warning (disable: 4244)


originalWndProc = (void*) GetWindowLongPtr (pluginHWND, GWL_WNDPROC);
originalWndProc = (void*) GetWindowLongPtr (pluginHWND, GWLP_WNDPROC);


if (! pluginWantsKeys) if (! pluginWantsKeys)
SetWindowLongPtr (pluginHWND, GWLP_WNDPROC, (LONG_PTR) vstHookWndProc); SetWindowLongPtr (pluginHWND, GWLP_WNDPROC, (LONG_PTR) vstHookWndProc);
@@ -52364,7 +52377,7 @@ struct TextAtom


String atomText; String atomText;
float width; float width;
uint16 numChars;
int numChars;


bool isWhitespace() const { return CharacterFunctions::isWhitespace (atomText[0]); } bool isWhitespace() const { return CharacterFunctions::isWhitespace (atomText[0]); }
bool isNewLine() const { return atomText[0] == '\r' || atomText[0] == '\n'; } bool isNewLine() const { return atomText[0] == '\r' || atomText[0] == '\n'; }
@@ -89398,13 +89411,13 @@ Font::SharedFontInternal::SharedFontInternal (const SharedFontInternal& other) t
{ {
} }


Font::Font() throw()
Font::Font()
: font (new SharedFontInternal (getDefaultSansSerifFontName(), FontValues::defaultFontHeight, : font (new SharedFontInternal (getDefaultSansSerifFontName(), FontValues::defaultFontHeight,
1.0f, 0, 0, Font::plain, 0)) 1.0f, 0, 0, Font::plain, 0))
{ {
} }


Font::Font (const float fontHeight, const int styleFlags_) throw()
Font::Font (const float fontHeight, const int styleFlags_)
: font (new SharedFontInternal (getDefaultSansSerifFontName(), FontValues::limitFontHeight (fontHeight), : font (new SharedFontInternal (getDefaultSansSerifFontName(), FontValues::limitFontHeight (fontHeight),
1.0f, 0, 0, styleFlags_, 0)) 1.0f, 0, 0, styleFlags_, 0))
{ {
@@ -89412,7 +89425,7 @@ Font::Font (const float fontHeight, const int styleFlags_) throw()


Font::Font (const String& typefaceName_, Font::Font (const String& typefaceName_,
const float fontHeight, const float fontHeight,
const int styleFlags_) throw()
const int styleFlags_)
: font (new SharedFontInternal (typefaceName_, FontValues::limitFontHeight (fontHeight), : font (new SharedFontInternal (typefaceName_, FontValues::limitFontHeight (fontHeight),
1.0f, 0, 0, styleFlags_, 0)) 1.0f, 0, 0, styleFlags_, 0))
{ {
@@ -89433,7 +89446,7 @@ Font::~Font() throw()
{ {
} }


Font::Font (const Typeface::Ptr& typeface) throw()
Font::Font (const Typeface::Ptr& typeface)
: font (new SharedFontInternal (typeface->getName(), FontValues::defaultFontHeight, : font (new SharedFontInternal (typeface->getName(), FontValues::defaultFontHeight,
1.0f, 0, 0, Font::plain, typeface)) 1.0f, 0, 0, Font::plain, typeface))
{ {
@@ -89454,31 +89467,31 @@ bool Font::operator!= (const Font& other) const throw()
return ! operator== (other); return ! operator== (other);
} }


void Font::dupeInternalIfShared() throw()
void Font::dupeInternalIfShared()
{ {
if (font->getReferenceCount() > 1) if (font->getReferenceCount() > 1)
font = new SharedFontInternal (*font); font = new SharedFontInternal (*font);
} }


const String Font::getDefaultSansSerifFontName() throw()
const String Font::getDefaultSansSerifFontName()
{ {
static const String name ("<Sans-Serif>"); static const String name ("<Sans-Serif>");
return name; return name;
} }


const String Font::getDefaultSerifFontName() throw()
const String Font::getDefaultSerifFontName()
{ {
static const String name ("<Serif>"); static const String name ("<Serif>");
return name; return name;
} }


const String Font::getDefaultMonospacedFontName() throw()
const String Font::getDefaultMonospacedFontName()
{ {
static const String name ("<Monospaced>"); static const String name ("<Monospaced>");
return name; return name;
} }


void Font::setTypefaceName (const String& faceName) throw()
void Font::setTypefaceName (const String& faceName)
{ {
if (faceName != font->typefaceName) if (faceName != font->typefaceName)
{ {
@@ -89489,17 +89502,17 @@ void Font::setTypefaceName (const String& faceName) throw()
} }
} }


const String Font::getFallbackFontName() throw()
const String Font::getFallbackFontName()
{ {
return FontValues::fallbackFont; return FontValues::fallbackFont;
} }


void Font::setFallbackFontName (const String& name) throw()
void Font::setFallbackFontName (const String& name)
{ {
FontValues::fallbackFont = name; FontValues::fallbackFont = name;
} }


void Font::setHeight (float newHeight) throw()
void Font::setHeight (float newHeight)
{ {
newHeight = FontValues::limitFontHeight (newHeight); newHeight = FontValues::limitFontHeight (newHeight);


@@ -89510,7 +89523,7 @@ void Font::setHeight (float newHeight) throw()
} }
} }


void Font::setHeightWithoutChangingWidth (float newHeight) throw()
void Font::setHeightWithoutChangingWidth (float newHeight)
{ {
newHeight = FontValues::limitFontHeight (newHeight); newHeight = FontValues::limitFontHeight (newHeight);


@@ -89522,7 +89535,7 @@ void Font::setHeightWithoutChangingWidth (float newHeight) throw()
} }
} }


void Font::setStyleFlags (const int newFlags) throw()
void Font::setStyleFlags (const int newFlags)
{ {
if (font->styleFlags != newFlags) if (font->styleFlags != newFlags)
{ {
@@ -89536,7 +89549,7 @@ void Font::setStyleFlags (const int newFlags) throw()
void Font::setSizeAndStyle (float newHeight, void Font::setSizeAndStyle (float newHeight,
const int newStyleFlags, const int newStyleFlags,
const float newHorizontalScale, const float newHorizontalScale,
const float newKerningAmount) throw()
const float newKerningAmount)
{ {
newHeight = FontValues::limitFontHeight (newHeight); newHeight = FontValues::limitFontHeight (newHeight);


@@ -89553,41 +89566,55 @@ void Font::setSizeAndStyle (float newHeight,
setStyleFlags (newStyleFlags); setStyleFlags (newStyleFlags);
} }


void Font::setHorizontalScale (const float scaleFactor) throw()
void Font::setHorizontalScale (const float scaleFactor)
{ {
dupeInternalIfShared(); dupeInternalIfShared();
font->horizontalScale = scaleFactor; font->horizontalScale = scaleFactor;
} }


void Font::setExtraKerningFactor (const float extraKerning) throw()
void Font::setExtraKerningFactor (const float extraKerning)
{ {
dupeInternalIfShared(); dupeInternalIfShared();
font->kerning = extraKerning; font->kerning = extraKerning;
} }


void Font::setBold (const bool shouldBeBold) throw()
void Font::setBold (const bool shouldBeBold)
{ {
setStyleFlags (shouldBeBold ? (font->styleFlags | bold) setStyleFlags (shouldBeBold ? (font->styleFlags | bold)
: (font->styleFlags & ~bold)); : (font->styleFlags & ~bold));
} }


const Font Font::boldened() const
{
Font f (*this);
f.setBold (true);
return f;
}

bool Font::isBold() const throw() bool Font::isBold() const throw()
{ {
return (font->styleFlags & bold) != 0; return (font->styleFlags & bold) != 0;
} }


void Font::setItalic (const bool shouldBeItalic) throw()
void Font::setItalic (const bool shouldBeItalic)
{ {
setStyleFlags (shouldBeItalic ? (font->styleFlags | italic) setStyleFlags (shouldBeItalic ? (font->styleFlags | italic)
: (font->styleFlags & ~italic)); : (font->styleFlags & ~italic));
} }


const Font Font::italicised() const
{
Font f (*this);
f.setItalic (true);
return f;
}

bool Font::isItalic() const throw() bool Font::isItalic() const throw()
{ {
return (font->styleFlags & italic) != 0; return (font->styleFlags & italic) != 0;
} }


void Font::setUnderline (const bool shouldBeUnderlined) throw()
void Font::setUnderline (const bool shouldBeUnderlined)
{ {
setStyleFlags (shouldBeUnderlined ? (font->styleFlags | underlined) setStyleFlags (shouldBeUnderlined ? (font->styleFlags | underlined)
: (font->styleFlags & ~underlined)); : (font->styleFlags & ~underlined));
@@ -89598,7 +89625,7 @@ bool Font::isUnderlined() const throw()
return (font->styleFlags & underlined) != 0; return (font->styleFlags & underlined) != 0;
} }


float Font::getAscent() const throw()
float Font::getAscent() const
{ {
if (font->ascent == 0) if (font->ascent == 0)
font->ascent = getTypeface()->getAscent(); font->ascent = getTypeface()->getAscent();
@@ -89606,17 +89633,17 @@ float Font::getAscent() const throw()
return font->height * font->ascent; return font->height * font->ascent;
} }


float Font::getDescent() const throw()
float Font::getDescent() const
{ {
return font->height - getAscent(); return font->height - getAscent();
} }


int Font::getStringWidth (const String& text) const throw()
int Font::getStringWidth (const String& text) const
{ {
return roundToInt (getStringWidthFloat (text)); return roundToInt (getStringWidthFloat (text));
} }


float Font::getStringWidthFloat (const String& text) const throw()
float Font::getStringWidthFloat (const String& text) const
{ {
float w = getTypeface()->getStringWidth (text); float w = getTypeface()->getStringWidth (text);


@@ -89626,7 +89653,7 @@ float Font::getStringWidthFloat (const String& text) const throw()
return w * font->height * font->horizontalScale; return w * font->height * font->horizontalScale;
} }


void Font::getGlyphPositions (const String& text, Array <int>& glyphs, Array <float>& xOffsets) const throw()
void Font::getGlyphPositions (const String& text, Array <int>& glyphs, Array <float>& xOffsets) const
{ {
getTypeface()->getGlyphPositions (text, glyphs, xOffsets); getTypeface()->getGlyphPositions (text, glyphs, xOffsets);


@@ -89650,7 +89677,7 @@ void Font::getGlyphPositions (const String& text, Array <int>& glyphs, Array <fl
} }
} }


void Font::findFonts (Array<Font>& destArray) throw()
void Font::findFonts (Array<Font>& destArray)
{ {
const StringArray names (findAllTypefaceNames()); const StringArray names (findAllTypefaceNames());


@@ -89708,7 +89735,7 @@ const Font Font::fromString (const String& fontDescription)
class TypefaceCache : public DeletedAtShutdown class TypefaceCache : public DeletedAtShutdown
{ {
public: public:
TypefaceCache (int numToCache = 10) throw()
TypefaceCache (int numToCache = 10)
: counter (1) : counter (1)
{ {
while (--numToCache >= 0) while (--numToCache >= 0)
@@ -89722,7 +89749,7 @@ public:


juce_DeclareSingleton_SingleThreaded_Minimal (TypefaceCache) juce_DeclareSingleton_SingleThreaded_Minimal (TypefaceCache)


const Typeface::Ptr findTypefaceFor (const Font& font) throw()
const Typeface::Ptr findTypefaceFor (const Font& font)
{ {
const int flags = font.getStyleFlags() & (Font::bold | Font::italic); const int flags = font.getStyleFlags() & (Font::bold | Font::italic);
const String faceName (font.getTypefaceName()); const String faceName (font.getTypefaceName());
@@ -89789,7 +89816,7 @@ private:


juce_ImplementSingleton_SingleThreaded (TypefaceCache) juce_ImplementSingleton_SingleThreaded (TypefaceCache)


Typeface* Font::getTypeface() const throw()
Typeface* Font::getTypeface() const
{ {
if (font->typeface == 0) if (font->typeface == 0)
font->typeface = TypefaceCache::getInstance()->findTypefaceFor (*this); font->typeface = TypefaceCache::getInstance()->findTypefaceFor (*this);
@@ -254571,7 +254598,7 @@ bool File::setAsCurrentWorkingDirectory() const
return chdir (getFullPathName().toUTF8()) == 0; return chdir (getFullPathName().toUTF8()) == 0;
} }


#if JUCE_IOS
#if JUCE_IOS && ! __DARWIN_ONLY_64_BIT_INO_T
typedef struct stat64 juce_statStruct; // (need to use the 64-bit version to work around a simulator bug) typedef struct stat64 juce_statStruct; // (need to use the 64-bit version to work around a simulator bug)
#else #else
typedef struct stat juce_statStruct; typedef struct stat juce_statStruct;
@@ -254580,11 +254607,11 @@ bool File::setAsCurrentWorkingDirectory() const
static bool juce_stat (const String& fileName, juce_statStruct& info) static bool juce_stat (const String& fileName, juce_statStruct& info)
{ {
return fileName.isNotEmpty() return fileName.isNotEmpty()
#if JUCE_IOS
#if JUCE_IOS && ! __DARWIN_ONLY_64_BIT_INO_T
&& (stat64 (fileName.toUTF8(), &info) == 0); && (stat64 (fileName.toUTF8(), &info) == 0);
#else
#else
&& (stat (fileName.toUTF8(), &info) == 0); && (stat (fileName.toUTF8(), &info) == 0);
#endif
#endif
} }


bool File::isDirectory() const bool File::isDirectory() const
@@ -264408,7 +264435,7 @@ bool File::setAsCurrentWorkingDirectory() const
return chdir (getFullPathName().toUTF8()) == 0; return chdir (getFullPathName().toUTF8()) == 0;
} }


#if JUCE_IOS
#if JUCE_IOS && ! __DARWIN_ONLY_64_BIT_INO_T
typedef struct stat64 juce_statStruct; // (need to use the 64-bit version to work around a simulator bug) typedef struct stat64 juce_statStruct; // (need to use the 64-bit version to work around a simulator bug)
#else #else
typedef struct stat juce_statStruct; typedef struct stat juce_statStruct;
@@ -264417,11 +264444,11 @@ bool File::setAsCurrentWorkingDirectory() const
static bool juce_stat (const String& fileName, juce_statStruct& info) static bool juce_stat (const String& fileName, juce_statStruct& info)
{ {
return fileName.isNotEmpty() return fileName.isNotEmpty()
#if JUCE_IOS
#if JUCE_IOS && ! __DARWIN_ONLY_64_BIT_INO_T
&& (stat64 (fileName.toUTF8(), &info) == 0); && (stat64 (fileName.toUTF8(), &info) == 0);
#else
#else
&& (stat (fileName.toUTF8(), &info) == 0); && (stat (fileName.toUTF8(), &info) == 0);
#endif
#endif
} }


bool File::isDirectory() const bool File::isDirectory() const


+ 46
- 43
juce_amalgamated.h View File

@@ -64,7 +64,7 @@
*/ */
#define JUCE_MAJOR_VERSION 1 #define JUCE_MAJOR_VERSION 1
#define JUCE_MINOR_VERSION 52 #define JUCE_MINOR_VERSION 52
#define JUCE_BUILDNUMBER 71
#define JUCE_BUILDNUMBER 72


/** Current Juce version number. /** Current Juce version number.


@@ -2531,7 +2531,7 @@ public:


@param destBuffer the place to copy it to @param destBuffer the place to copy it to
@param maxCharsToCopy the maximum number of characters to copy to the buffer, @param maxCharsToCopy the maximum number of characters to copy to the buffer,
not including the tailing zero, so this shouldn't be
NOT including the trailing zero, so this shouldn't be
larger than the size of your destination buffer - 1 larger than the size of your destination buffer - 1
*/ */
void copyToUnicode (juce_wchar* destBuffer, int maxCharsToCopy) const throw(); void copyToUnicode (juce_wchar* destBuffer, int maxCharsToCopy) const throw();
@@ -3193,10 +3193,11 @@ public:
the second. the second.


If the number of items you ask for is too large to fit within the buffer's free space, then If the number of items you ask for is too large to fit within the buffer's free space, then
blockSize1 + blockSize2 may add up to a lower value than numToWrite.
blockSize1 + blockSize2 may add up to a lower value than numToWrite. If this happens, you
may decide to keep waiting and re-trying the method until there's enough space available.


After calling this method, and writing your data, you must call finishedWrite() to tell the
FIFO how much data you actually added.
After calling this method, if you choose to write your data into the blocks returned, you
must call finishedWrite() to tell the FIFO how much data you actually added.


e.g. e.g.
@code @code
@@ -3220,10 +3221,10 @@ public:
@param blockSize1 on exit, this indicates how many items can be written to the block starting at startIndex1 @param blockSize1 on exit, this indicates how many items can be written to the block starting at startIndex1
@param startIndex2 on exit, this will contain the start index in your buffer at which any data that didn't fit into @param startIndex2 on exit, this will contain the start index in your buffer at which any data that didn't fit into
the first block should be written the first block should be written
@param blockSize1 on exit, this indicates how many items can be written to the block starting at startIndex2
@param blockSize2 on exit, this indicates how many items can be written to the block starting at startIndex2
@see finishedWrite @see finishedWrite
*/ */
void prepareToWrite (int numToWrite, int& startIndex1, int& blockSize1, int& startIndex2, int& blockSize2) throw();
void prepareToWrite (int numToWrite, int& startIndex1, int& blockSize1, int& startIndex2, int& blockSize2) const throw();


/** Called after reading from the FIFO, to indicate that this many items have been added. /** Called after reading from the FIFO, to indicate that this many items have been added.
@see prepareToWrite @see prepareToWrite
@@ -3237,10 +3238,11 @@ public:
should read from both of them. should read from both of them.


If the number of items you ask for is greater than the amount of data available, then If the number of items you ask for is greater than the amount of data available, then
blockSize1 + blockSize2 may add up to a lower value than numWanted.
blockSize1 + blockSize2 may add up to a lower value than numWanted. If this happens, you
may decide to keep waiting and re-trying the method until there's enough data available.


After calling this method, and reading the data, you must call finishedRead() to tell the
FIFO how much data you have consumed.
After calling this method, if you choose to read the data, you must call finishedRead() to
tell the FIFO how much data you have consumed.


e.g. e.g.
@code @code
@@ -3259,15 +3261,15 @@ public:
} }
@endcode @endcode


@param numToWrite indicates how many items you'd like to add to the buffer
@param numWanted indicates how many items you'd like to add to the buffer
@param startIndex1 on exit, this will contain the start index in your buffer at which your data should be written @param startIndex1 on exit, this will contain the start index in your buffer at which your data should be written
@param blockSize1 on exit, this indicates how many items can be written to the block starting at startIndex1 @param blockSize1 on exit, this indicates how many items can be written to the block starting at startIndex1
@param startIndex2 on exit, this will contain the start index in your buffer at which any data that didn't fit into @param startIndex2 on exit, this will contain the start index in your buffer at which any data that didn't fit into
the first block should be written the first block should be written
@param blockSize1 on exit, this indicates how many items can be written to the block starting at startIndex2
@param blockSize2 on exit, this indicates how many items can be written to the block starting at startIndex2
@see finishedRead @see finishedRead
*/ */
void prepareToRead (int numWanted, int& startIndex1, int& blockSize1, int& startIndex2, int& blockSize2) throw();
void prepareToRead (int numWanted, int& startIndex1, int& blockSize1, int& startIndex2, int& blockSize2) const throw();


/** Called after reading from the FIFO, to indicate that this many items have now been consumed. /** Called after reading from the FIFO, to indicate that this many items have now been consumed.
@see prepareToRead @see prepareToRead
@@ -22703,8 +22705,7 @@ public:
just Font::plain for the normal style. just Font::plain for the normal style.
@see FontStyleFlags, getDefaultSansSerifFontName @see FontStyleFlags, getDefaultSansSerifFontName
*/ */
Font (float fontHeight,
int styleFlags = plain) throw();
Font (float fontHeight, int styleFlags = plain);


/** Creates a font with a given typeface and parameters. /** Creates a font with a given typeface and parameters.


@@ -22715,15 +22716,13 @@ public:
just Font::plain for the normal style. just Font::plain for the normal style.
@see FontStyleFlags, getDefaultSansSerifFontName @see FontStyleFlags, getDefaultSansSerifFontName
*/ */
Font (const String& typefaceName,
float fontHeight,
int styleFlags) throw();
Font (const String& typefaceName, float fontHeight, int styleFlags);


/** Creates a copy of another Font object. */ /** Creates a copy of another Font object. */
Font (const Font& other) throw(); Font (const Font& other) throw();


/** Creates a font for a typeface. */ /** Creates a font for a typeface. */
Font (const Typeface::Ptr& typeface) throw();
Font (const Typeface::Ptr& typeface);


/** Creates a basic sans-serif font at a default height. /** Creates a basic sans-serif font at a default height.


@@ -22731,7 +22730,7 @@ public:
on drawing with - this constructor is here to help initialise objects before changing on drawing with - this constructor is here to help initialise objects before changing
the font's settings later. the font's settings later.
*/ */
Font() throw();
Font();


/** Copies this font from another one. */ /** Copies this font from another one. */
Font& operator= (const Font& other) throw(); Font& operator= (const Font& other) throw();
@@ -22754,7 +22753,7 @@ public:


If a suitable font isn't found on the machine, it'll just use a default instead. If a suitable font isn't found on the machine, it'll just use a default instead.
*/ */
void setTypefaceName (const String& faceName) throw();
void setTypefaceName (const String& faceName);


/** Returns the name of the typeface family that this font uses. /** Returns the name of the typeface family that this font uses.


@@ -22780,7 +22779,7 @@ public:


@see setTypefaceName, getDefaultSerifFontName, getDefaultMonospacedFontName @see setTypefaceName, getDefaultSerifFontName, getDefaultMonospacedFontName
*/ */
static const String getDefaultSansSerifFontName() throw();
static const String getDefaultSansSerifFontName();


/** Returns a typeface name that represents the default sans-serif font. /** Returns a typeface name that represents the default sans-serif font.


@@ -22790,7 +22789,7 @@ public:


@see setTypefaceName, getDefaultSansSerifFontName, getDefaultMonospacedFontName @see setTypefaceName, getDefaultSansSerifFontName, getDefaultMonospacedFontName
*/ */
static const String getDefaultSerifFontName() throw();
static const String getDefaultSerifFontName();


/** Returns a typeface name that represents the default sans-serif font. /** Returns a typeface name that represents the default sans-serif font.


@@ -22800,7 +22799,7 @@ public:


@see setTypefaceName, getDefaultSansSerifFontName, getDefaultSerifFontName @see setTypefaceName, getDefaultSansSerifFontName, getDefaultSerifFontName
*/ */
static const String getDefaultMonospacedFontName() throw();
static const String getDefaultMonospacedFontName();


/** Returns the typeface names of the default fonts on the current platform. */ /** Returns the typeface names of the default fonts on the current platform. */
static void getPlatformDefaultFontNames (String& defaultSans, String& defaultSerif, String& defaultFixed); static void getPlatformDefaultFontNames (String& defaultSans, String& defaultSerif, String& defaultFixed);
@@ -22818,13 +22817,13 @@ public:


@see getHeight, setHeightWithoutChangingWidth @see getHeight, setHeightWithoutChangingWidth
*/ */
void setHeight (float newHeight) throw();
void setHeight (float newHeight);


/** Changes the font's height without changing its width. /** Changes the font's height without changing its width.


This alters the horizontal scale to compensate for the change in height. This alters the horizontal scale to compensate for the change in height.
*/ */
void setHeightWithoutChangingWidth (float newHeight) throw();
void setHeightWithoutChangingWidth (float newHeight);


/** Returns the height of the font above its baseline. /** Returns the height of the font above its baseline.


@@ -22832,7 +22831,7 @@ public:


@see getHeight, getDescent @see getHeight, getDescent
*/ */
float getAscent() const throw();
float getAscent() const;


/** Returns the amount that the font descends below its baseline. /** Returns the amount that the font descends below its baseline.


@@ -22840,7 +22839,7 @@ public:


@see getAscent, getHeight @see getAscent, getHeight
*/ */
float getDescent() const throw();
float getDescent() const;


/** Returns the font's style flags. /** Returns the font's style flags.


@@ -22857,20 +22856,24 @@ public:
enum, to set the font's properties enum, to set the font's properties
@see FontStyleFlags @see FontStyleFlags
*/ */
void setStyleFlags (int newFlags) throw();
void setStyleFlags (int newFlags);


/** Makes the font bold or non-bold. */ /** Makes the font bold or non-bold. */
void setBold (bool shouldBeBold) throw();
void setBold (bool shouldBeBold);
/** Returns a copy of this font with the bold attribute set. */
const Font boldened() const;
/** Returns true if the font is bold. */ /** Returns true if the font is bold. */
bool isBold() const throw(); bool isBold() const throw();


/** Makes the font italic or non-italic. */ /** Makes the font italic or non-italic. */
void setItalic (bool shouldBeItalic) throw();
void setItalic (bool shouldBeItalic);
/** Returns a copy of this font with the italic attribute set. */
const Font italicised() const;
/** Returns true if the font is italic. */ /** Returns true if the font is italic. */
bool isItalic() const throw(); bool isItalic() const throw();


/** Makes the font underlined or non-underlined. */ /** Makes the font underlined or non-underlined. */
void setUnderline (bool shouldBeUnderlined) throw();
void setUnderline (bool shouldBeUnderlined);
/** Returns true if the font is underlined. */ /** Returns true if the font is underlined. */
bool isUnderlined() const throw(); bool isUnderlined() const throw();


@@ -22879,7 +22882,7 @@ public:
@param scaleFactor a value of 1.0 is the normal scale, less than this will be @param scaleFactor a value of 1.0 is the normal scale, less than this will be
narrower, greater than 1.0 will be stretched out. narrower, greater than 1.0 will be stretched out.
*/ */
void setHorizontalScale (float scaleFactor) throw();
void setHorizontalScale (float scaleFactor);


/** Returns the font's horizontal scale. /** Returns the font's horizontal scale.


@@ -22897,7 +22900,7 @@ public:
normal spacing, positive values spread the letters out, normal spacing, positive values spread the letters out,
negative values make them closer together. negative values make them closer together.
*/ */
void setExtraKerningFactor (float extraKerning) throw();
void setExtraKerningFactor (float extraKerning);


/** Returns the font's kerning. /** Returns the font's kerning.


@@ -22913,33 +22916,33 @@ public:
void setSizeAndStyle (float newHeight, void setSizeAndStyle (float newHeight,
int newStyleFlags, int newStyleFlags,
float newHorizontalScale, float newHorizontalScale,
float newKerningAmount) throw();
float newKerningAmount);


/** Returns the total width of a string as it would be drawn using this font. /** Returns the total width of a string as it would be drawn using this font.


For a more accurate floating-point result, use getStringWidthFloat(). For a more accurate floating-point result, use getStringWidthFloat().
*/ */
int getStringWidth (const String& text) const throw();
int getStringWidth (const String& text) const;


/** Returns the total width of a string as it would be drawn using this font. /** Returns the total width of a string as it would be drawn using this font.


@see getStringWidth @see getStringWidth
*/ */
float getStringWidthFloat (const String& text) const throw();
float getStringWidthFloat (const String& text) const;


/** Returns the series of glyph numbers and their x offsets needed to represent a string. /** Returns the series of glyph numbers and their x offsets needed to represent a string.


An extra x offset is added at the end of the run, to indicate where the right hand An extra x offset is added at the end of the run, to indicate where the right hand
edge of the last character is. edge of the last character is.
*/ */
void getGlyphPositions (const String& text, Array <int>& glyphs, Array <float>& xOffsets) const throw();
void getGlyphPositions (const String& text, Array <int>& glyphs, Array <float>& xOffsets) const;


/** Returns the typeface used by this font. /** Returns the typeface used by this font.


Note that the object returned may go out of scope if this font is deleted Note that the object returned may go out of scope if this font is deleted
or has its style changed. or has its style changed.
*/ */
Typeface* getTypeface() const throw();
Typeface* getTypeface() const;


/** Creates an array of Font objects to represent all the fonts on the system. /** Creates an array of Font objects to represent all the fonts on the system.


@@ -22948,7 +22951,7 @@ public:


@param results the array to which new Font objects will be added. @param results the array to which new Font objects will be added.
*/ */
static void findFonts (Array<Font>& results) throw();
static void findFonts (Array<Font>& results);


/** Returns a list of all the available typeface names. /** Returns a list of all the available typeface names.


@@ -22962,12 +22965,12 @@ public:
/** Returns the name of the typeface to be used for rendering glyphs that aren't found /** Returns the name of the typeface to be used for rendering glyphs that aren't found
in the requested typeface. in the requested typeface.
*/ */
static const String getFallbackFontName() throw();
static const String getFallbackFontName();


/** Sets the (platform-specific) name of the typeface to use to find glyphs that aren't /** Sets the (platform-specific) name of the typeface to use to find glyphs that aren't
available in whatever font you're trying to use. available in whatever font you're trying to use.
*/ */
static void setFallbackFontName (const String& name) throw();
static void setFallbackFontName (const String& name);


/** Creates a string to describe this font. /** Creates a string to describe this font.
The string will contain information to describe the font's typeface, size, and The string will contain information to describe the font's typeface, size, and
@@ -23003,7 +23006,7 @@ private:
}; };


ReferenceCountedObjectPtr <SharedFontInternal> font; ReferenceCountedObjectPtr <SharedFontInternal> font;
void dupeInternalIfShared() throw();
void dupeInternalIfShared();
}; };


#endif // __JUCE_FONT_JUCEHEADER__ #endif // __JUCE_FONT_JUCEHEADER__


+ 49
- 40
src/audio/audio_file_formats/juce_QuickTimeAudioFormat.cpp View File

@@ -196,7 +196,7 @@ public:
bufferList->mNumberBuffers = 1; bufferList->mNumberBuffers = 1;
bufferList->mBuffers[0].mNumberChannels = inputStreamDesc.mChannelsPerFrame; bufferList->mBuffers[0].mNumberChannels = inputStreamDesc.mChannelsPerFrame;
bufferList->mBuffers[0].mDataByteSize = (UInt32) (samplesPerFrame * inputStreamDesc.mBytesPerFrame) + 16;
bufferList->mBuffers[0].mDataByteSize = jmax ((UInt32) 4096, (UInt32) (samplesPerFrame * inputStreamDesc.mBytesPerFrame) + 16);
dataBuffer.malloc (bufferList->mBuffers[0].mDataByteSize); dataBuffer.malloc (bufferList->mBuffers[0].mDataByteSize);
bufferList->mBuffers[0].mData = dataBuffer; bufferList->mBuffers[0].mData = dataBuffer;
@@ -232,13 +232,44 @@ public:
int64 startSampleInFile, int numSamples) int64 startSampleInFile, int numSamples)
{ {
checkThreadIsAttached(); checkThreadIsAttached();
bool ok = true;
while (numSamples > 0) while (numSamples > 0)
{ {
if (! loadFrame ((int) startSampleInFile))
return false;
if (lastSampleRead != startSampleInFile)
{
TimeRecord time;
time.scale = (TimeScale) inputStreamDesc.mSampleRate;
time.base = 0;
time.value.hi = 0;
time.value.lo = (UInt32) startSampleInFile;
OSStatus err = MovieAudioExtractionSetProperty (extractor,
kQTPropertyClass_MovieAudioExtraction_Movie,
kQTMovieAudioExtractionMoviePropertyID_CurrentTime,
sizeof (time), &time);
if (err != noErr)
{
ok = false;
break;
}
}
int framesToDo = bufferList->mBuffers[0].mDataByteSize / inputStreamDesc.mBytesPerFrame;
bufferList->mBuffers[0].mDataByteSize = inputStreamDesc.mBytesPerFrame * framesToDo;
const int numToDo = jmin (numSamples, samplesPerFrame);
UInt32 outFlags = 0;
UInt32 actualNumFrames = framesToDo;
OSStatus err = MovieAudioExtractionFillBuffer (extractor, &actualNumFrames, bufferList, &outFlags);
if (err != noErr)
{
ok = false;
break;
}
lastSampleRead = startSampleInFile + actualNumFrames * samplesPerFrame;
const int samplesReceived = actualNumFrames * samplesPerFrame;
for (int j = numDestChannels; --j >= 0;) for (int j = numDestChannels; --j >= 0;)
{ {
@@ -246,49 +277,27 @@ public:
{ {
const short* const src = ((const short*) bufferList->mBuffers[0].mData) + j; const short* const src = ((const short*) bufferList->mBuffers[0].mData) + j;
for (int i = 0; i < numToDo; ++i)
for (int i = 0; i < samplesReceived; ++i)
destSamples[j][startOffsetInDestBuffer + i] = src [i << 1] << 16; destSamples[j][startOffsetInDestBuffer + i] = src [i << 1] << 16;
} }
} }
startOffsetInDestBuffer += numToDo;
startSampleInFile += numToDo;
numSamples -= numToDo;
}
detachThread();
return true;
}
bool loadFrame (const int sampleNum)
{
if (lastSampleRead != sampleNum)
{
TimeRecord time;
time.scale = (TimeScale) inputStreamDesc.mSampleRate;
time.base = 0;
time.value.hi = 0;
time.value.lo = (UInt32) sampleNum;
startOffsetInDestBuffer += samplesReceived;
startSampleInFile += samplesReceived;
numSamples -= samplesReceived;
OSStatus err = MovieAudioExtractionSetProperty (extractor,
kQTPropertyClass_MovieAudioExtraction_Movie,
kQTMovieAudioExtractionMoviePropertyID_CurrentTime,
sizeof (time), &time);
if ((outFlags & kQTMovieAudioExtractionComplete) != 0 && numSamples > 0)
{
for (int j = numDestChannels; --j >= 0;)
if (destSamples[j] != 0)
zeromem (destSamples[j] + startOffsetInDestBuffer, sizeof (int) * numSamples);
if (err != noErr)
return false;
break;
}
} }
bufferList->mBuffers[0].mDataByteSize = inputStreamDesc.mBytesPerFrame * samplesPerFrame;
UInt32 outFlags = 0;
UInt32 actualNumSamples = samplesPerFrame;
OSStatus err = MovieAudioExtractionFillBuffer (extractor, &actualNumSamples,
bufferList, &outFlags);
lastSampleRead = sampleNum + samplesPerFrame;
return err == noErr;
detachThread();
return ok;
} }
juce_UseDebuggingNewOperator juce_UseDebuggingNewOperator
@@ -302,7 +311,7 @@ private:
const int trackNum; const int trackNum;
double trackUnitsPerFrame; double trackUnitsPerFrame;
int samplesPerFrame; int samplesPerFrame;
int lastSampleRead;
int64 lastSampleRead;
Thread::ThreadID lastThreadId; Thread::ThreadID lastThreadId;
MovieAudioExtractionRef extractor; MovieAudioExtractionRef extractor;
AudioStreamBasicDescription inputStreamDesc; AudioStreamBasicDescription inputStreamDesc;


+ 1
- 1
src/audio/plugins/formats/juce_VSTPluginFormat.cpp View File

@@ -1456,7 +1456,7 @@ private:
#pragma warning (push) #pragma warning (push)
#pragma warning (disable: 4244) #pragma warning (disable: 4244)
originalWndProc = (void*) GetWindowLongPtr (pluginHWND, GWL_WNDPROC);
originalWndProc = (void*) GetWindowLongPtr (pluginHWND, GWLP_WNDPROC);
if (! pluginWantsKeys) if (! pluginWantsKeys)
SetWindowLongPtr (pluginHWND, GWLP_WNDPROC, (LONG_PTR) vstHookWndProc); SetWindowLongPtr (pluginHWND, GWLP_WNDPROC, (LONG_PTR) vstHookWndProc);


+ 2
- 2
src/containers/juce_AbstractFifo.cpp View File

@@ -57,7 +57,7 @@ void AbstractFifo::setTotalSize (int newSize) throw()
} }
//============================================================================== //==============================================================================
void AbstractFifo::prepareToWrite (int numToWrite, int& startIndex1, int& blockSize1, int& startIndex2, int& blockSize2) throw()
void AbstractFifo::prepareToWrite (int numToWrite, int& startIndex1, int& blockSize1, int& startIndex2, int& blockSize2) const throw()
{ {
const int vs = validStart.get(); const int vs = validStart.get();
const int ve = validEnd.get(); const int ve = validEnd.get();
@@ -88,7 +88,7 @@ void AbstractFifo::finishedWrite (int numWritten) throw()
validEnd += numWritten; validEnd += numWritten;
} }
void AbstractFifo::prepareToRead (int numWanted, int& startIndex1, int& blockSize1, int& startIndex2, int& blockSize2) throw()
void AbstractFifo::prepareToRead (int numWanted, int& startIndex1, int& blockSize1, int& startIndex2, int& blockSize2) const throw()
{ {
const int vs = validStart.get(); const int vs = validStart.get();
const int ve = validEnd.get(); const int ve = validEnd.get();


+ 13
- 11
src/containers/juce_AbstractFifo.h View File

@@ -123,10 +123,11 @@ public:
the second. the second.
If the number of items you ask for is too large to fit within the buffer's free space, then If the number of items you ask for is too large to fit within the buffer's free space, then
blockSize1 + blockSize2 may add up to a lower value than numToWrite.
blockSize1 + blockSize2 may add up to a lower value than numToWrite. If this happens, you
may decide to keep waiting and re-trying the method until there's enough space available.
After calling this method, and writing your data, you must call finishedWrite() to tell the
FIFO how much data you actually added.
After calling this method, if you choose to write your data into the blocks returned, you
must call finishedWrite() to tell the FIFO how much data you actually added.
e.g. e.g.
@code @code
@@ -150,10 +151,10 @@ public:
@param blockSize1 on exit, this indicates how many items can be written to the block starting at startIndex1 @param blockSize1 on exit, this indicates how many items can be written to the block starting at startIndex1
@param startIndex2 on exit, this will contain the start index in your buffer at which any data that didn't fit into @param startIndex2 on exit, this will contain the start index in your buffer at which any data that didn't fit into
the first block should be written the first block should be written
@param blockSize1 on exit, this indicates how many items can be written to the block starting at startIndex2
@param blockSize2 on exit, this indicates how many items can be written to the block starting at startIndex2
@see finishedWrite @see finishedWrite
*/ */
void prepareToWrite (int numToWrite, int& startIndex1, int& blockSize1, int& startIndex2, int& blockSize2) throw();
void prepareToWrite (int numToWrite, int& startIndex1, int& blockSize1, int& startIndex2, int& blockSize2) const throw();
/** Called after reading from the FIFO, to indicate that this many items have been added. /** Called after reading from the FIFO, to indicate that this many items have been added.
@see prepareToWrite @see prepareToWrite
@@ -167,10 +168,11 @@ public:
should read from both of them. should read from both of them.
If the number of items you ask for is greater than the amount of data available, then If the number of items you ask for is greater than the amount of data available, then
blockSize1 + blockSize2 may add up to a lower value than numWanted.
blockSize1 + blockSize2 may add up to a lower value than numWanted. If this happens, you
may decide to keep waiting and re-trying the method until there's enough data available.
After calling this method, and reading the data, you must call finishedRead() to tell the
FIFO how much data you have consumed.
After calling this method, if you choose to read the data, you must call finishedRead() to
tell the FIFO how much data you have consumed.
e.g. e.g.
@code @code
@@ -189,15 +191,15 @@ public:
} }
@endcode @endcode
@param numToWrite indicates how many items you'd like to add to the buffer
@param numWanted indicates how many items you'd like to add to the buffer
@param startIndex1 on exit, this will contain the start index in your buffer at which your data should be written @param startIndex1 on exit, this will contain the start index in your buffer at which your data should be written
@param blockSize1 on exit, this indicates how many items can be written to the block starting at startIndex1 @param blockSize1 on exit, this indicates how many items can be written to the block starting at startIndex1
@param startIndex2 on exit, this will contain the start index in your buffer at which any data that didn't fit into @param startIndex2 on exit, this will contain the start index in your buffer at which any data that didn't fit into
the first block should be written the first block should be written
@param blockSize1 on exit, this indicates how many items can be written to the block starting at startIndex2
@param blockSize2 on exit, this indicates how many items can be written to the block starting at startIndex2
@see finishedRead @see finishedRead
*/ */
void prepareToRead (int numWanted, int& startIndex1, int& blockSize1, int& startIndex2, int& blockSize2) throw();
void prepareToRead (int numWanted, int& startIndex1, int& blockSize1, int& startIndex2, int& blockSize2) const throw();
/** Called after reading from the FIFO, to indicate that this many items have now been consumed. /** Called after reading from the FIFO, to indicate that this many items have now been consumed.
@see prepareToRead @see prepareToRead


+ 1
- 1
src/core/juce_StandardHeader.h View File

@@ -33,7 +33,7 @@
*/ */
#define JUCE_MAJOR_VERSION 1 #define JUCE_MAJOR_VERSION 1
#define JUCE_MINOR_VERSION 52 #define JUCE_MINOR_VERSION 52
#define JUCE_BUILDNUMBER 71
#define JUCE_BUILDNUMBER 72
/** Current Juce version number. /** Current Juce version number.


+ 1
- 1
src/gui/components/controls/juce_TextEditor.cpp View File

@@ -43,7 +43,7 @@ struct TextAtom
//============================================================================== //==============================================================================
String atomText; String atomText;
float width; float width;
uint16 numChars;
int numChars;
//============================================================================== //==============================================================================
bool isWhitespace() const { return CharacterFunctions::isWhitespace (atomText[0]); } bool isWhitespace() const { return CharacterFunctions::isWhitespace (atomText[0]); }


+ 43
- 29
src/gui/graphics/fonts/juce_Font.cpp View File

@@ -75,13 +75,13 @@ Font::SharedFontInternal::SharedFontInternal (const SharedFontInternal& other) t
//============================================================================== //==============================================================================
Font::Font() throw()
Font::Font()
: font (new SharedFontInternal (getDefaultSansSerifFontName(), FontValues::defaultFontHeight, : font (new SharedFontInternal (getDefaultSansSerifFontName(), FontValues::defaultFontHeight,
1.0f, 0, 0, Font::plain, 0)) 1.0f, 0, 0, Font::plain, 0))
{ {
} }
Font::Font (const float fontHeight, const int styleFlags_) throw()
Font::Font (const float fontHeight, const int styleFlags_)
: font (new SharedFontInternal (getDefaultSansSerifFontName(), FontValues::limitFontHeight (fontHeight), : font (new SharedFontInternal (getDefaultSansSerifFontName(), FontValues::limitFontHeight (fontHeight),
1.0f, 0, 0, styleFlags_, 0)) 1.0f, 0, 0, styleFlags_, 0))
{ {
@@ -89,7 +89,7 @@ Font::Font (const float fontHeight, const int styleFlags_) throw()
Font::Font (const String& typefaceName_, Font::Font (const String& typefaceName_,
const float fontHeight, const float fontHeight,
const int styleFlags_) throw()
const int styleFlags_)
: font (new SharedFontInternal (typefaceName_, FontValues::limitFontHeight (fontHeight), : font (new SharedFontInternal (typefaceName_, FontValues::limitFontHeight (fontHeight),
1.0f, 0, 0, styleFlags_, 0)) 1.0f, 0, 0, styleFlags_, 0))
{ {
@@ -110,7 +110,7 @@ Font::~Font() throw()
{ {
} }
Font::Font (const Typeface::Ptr& typeface) throw()
Font::Font (const Typeface::Ptr& typeface)
: font (new SharedFontInternal (typeface->getName(), FontValues::defaultFontHeight, : font (new SharedFontInternal (typeface->getName(), FontValues::defaultFontHeight,
1.0f, 0, 0, Font::plain, typeface)) 1.0f, 0, 0, Font::plain, typeface))
{ {
@@ -131,32 +131,32 @@ bool Font::operator!= (const Font& other) const throw()
return ! operator== (other); return ! operator== (other);
} }
void Font::dupeInternalIfShared() throw()
void Font::dupeInternalIfShared()
{ {
if (font->getReferenceCount() > 1) if (font->getReferenceCount() > 1)
font = new SharedFontInternal (*font); font = new SharedFontInternal (*font);
} }
//============================================================================== //==============================================================================
const String Font::getDefaultSansSerifFontName() throw()
const String Font::getDefaultSansSerifFontName()
{ {
static const String name ("<Sans-Serif>"); static const String name ("<Sans-Serif>");
return name; return name;
} }
const String Font::getDefaultSerifFontName() throw()
const String Font::getDefaultSerifFontName()
{ {
static const String name ("<Serif>"); static const String name ("<Serif>");
return name; return name;
} }
const String Font::getDefaultMonospacedFontName() throw()
const String Font::getDefaultMonospacedFontName()
{ {
static const String name ("<Monospaced>"); static const String name ("<Monospaced>");
return name; return name;
} }
void Font::setTypefaceName (const String& faceName) throw()
void Font::setTypefaceName (const String& faceName)
{ {
if (faceName != font->typefaceName) if (faceName != font->typefaceName)
{ {
@@ -168,18 +168,18 @@ void Font::setTypefaceName (const String& faceName) throw()
} }
//============================================================================== //==============================================================================
const String Font::getFallbackFontName() throw()
const String Font::getFallbackFontName()
{ {
return FontValues::fallbackFont; return FontValues::fallbackFont;
} }
void Font::setFallbackFontName (const String& name) throw()
void Font::setFallbackFontName (const String& name)
{ {
FontValues::fallbackFont = name; FontValues::fallbackFont = name;
} }
//============================================================================== //==============================================================================
void Font::setHeight (float newHeight) throw()
void Font::setHeight (float newHeight)
{ {
newHeight = FontValues::limitFontHeight (newHeight); newHeight = FontValues::limitFontHeight (newHeight);
@@ -190,7 +190,7 @@ void Font::setHeight (float newHeight) throw()
} }
} }
void Font::setHeightWithoutChangingWidth (float newHeight) throw()
void Font::setHeightWithoutChangingWidth (float newHeight)
{ {
newHeight = FontValues::limitFontHeight (newHeight); newHeight = FontValues::limitFontHeight (newHeight);
@@ -202,7 +202,7 @@ void Font::setHeightWithoutChangingWidth (float newHeight) throw()
} }
} }
void Font::setStyleFlags (const int newFlags) throw()
void Font::setStyleFlags (const int newFlags)
{ {
if (font->styleFlags != newFlags) if (font->styleFlags != newFlags)
{ {
@@ -216,7 +216,7 @@ void Font::setStyleFlags (const int newFlags) throw()
void Font::setSizeAndStyle (float newHeight, void Font::setSizeAndStyle (float newHeight,
const int newStyleFlags, const int newStyleFlags,
const float newHorizontalScale, const float newHorizontalScale,
const float newKerningAmount) throw()
const float newKerningAmount)
{ {
newHeight = FontValues::limitFontHeight (newHeight); newHeight = FontValues::limitFontHeight (newHeight);
@@ -233,41 +233,55 @@ void Font::setSizeAndStyle (float newHeight,
setStyleFlags (newStyleFlags); setStyleFlags (newStyleFlags);
} }
void Font::setHorizontalScale (const float scaleFactor) throw()
void Font::setHorizontalScale (const float scaleFactor)
{ {
dupeInternalIfShared(); dupeInternalIfShared();
font->horizontalScale = scaleFactor; font->horizontalScale = scaleFactor;
} }
void Font::setExtraKerningFactor (const float extraKerning) throw()
void Font::setExtraKerningFactor (const float extraKerning)
{ {
dupeInternalIfShared(); dupeInternalIfShared();
font->kerning = extraKerning; font->kerning = extraKerning;
} }
void Font::setBold (const bool shouldBeBold) throw()
void Font::setBold (const bool shouldBeBold)
{ {
setStyleFlags (shouldBeBold ? (font->styleFlags | bold) setStyleFlags (shouldBeBold ? (font->styleFlags | bold)
: (font->styleFlags & ~bold)); : (font->styleFlags & ~bold));
} }
const Font Font::boldened() const
{
Font f (*this);
f.setBold (true);
return f;
}
bool Font::isBold() const throw() bool Font::isBold() const throw()
{ {
return (font->styleFlags & bold) != 0; return (font->styleFlags & bold) != 0;
} }
void Font::setItalic (const bool shouldBeItalic) throw()
void Font::setItalic (const bool shouldBeItalic)
{ {
setStyleFlags (shouldBeItalic ? (font->styleFlags | italic) setStyleFlags (shouldBeItalic ? (font->styleFlags | italic)
: (font->styleFlags & ~italic)); : (font->styleFlags & ~italic));
} }
const Font Font::italicised() const
{
Font f (*this);
f.setItalic (true);
return f;
}
bool Font::isItalic() const throw() bool Font::isItalic() const throw()
{ {
return (font->styleFlags & italic) != 0; return (font->styleFlags & italic) != 0;
} }
void Font::setUnderline (const bool shouldBeUnderlined) throw()
void Font::setUnderline (const bool shouldBeUnderlined)
{ {
setStyleFlags (shouldBeUnderlined ? (font->styleFlags | underlined) setStyleFlags (shouldBeUnderlined ? (font->styleFlags | underlined)
: (font->styleFlags & ~underlined)); : (font->styleFlags & ~underlined));
@@ -278,7 +292,7 @@ bool Font::isUnderlined() const throw()
return (font->styleFlags & underlined) != 0; return (font->styleFlags & underlined) != 0;
} }
float Font::getAscent() const throw()
float Font::getAscent() const
{ {
if (font->ascent == 0) if (font->ascent == 0)
font->ascent = getTypeface()->getAscent(); font->ascent = getTypeface()->getAscent();
@@ -286,17 +300,17 @@ float Font::getAscent() const throw()
return font->height * font->ascent; return font->height * font->ascent;
} }
float Font::getDescent() const throw()
float Font::getDescent() const
{ {
return font->height - getAscent(); return font->height - getAscent();
} }
int Font::getStringWidth (const String& text) const throw()
int Font::getStringWidth (const String& text) const
{ {
return roundToInt (getStringWidthFloat (text)); return roundToInt (getStringWidthFloat (text));
} }
float Font::getStringWidthFloat (const String& text) const throw()
float Font::getStringWidthFloat (const String& text) const
{ {
float w = getTypeface()->getStringWidth (text); float w = getTypeface()->getStringWidth (text);
@@ -306,7 +320,7 @@ float Font::getStringWidthFloat (const String& text) const throw()
return w * font->height * font->horizontalScale; return w * font->height * font->horizontalScale;
} }
void Font::getGlyphPositions (const String& text, Array <int>& glyphs, Array <float>& xOffsets) const throw()
void Font::getGlyphPositions (const String& text, Array <int>& glyphs, Array <float>& xOffsets) const
{ {
getTypeface()->getGlyphPositions (text, glyphs, xOffsets); getTypeface()->getGlyphPositions (text, glyphs, xOffsets);
@@ -330,7 +344,7 @@ void Font::getGlyphPositions (const String& text, Array <int>& glyphs, Array <fl
} }
} }
void Font::findFonts (Array<Font>& destArray) throw()
void Font::findFonts (Array<Font>& destArray)
{ {
const StringArray names (findAllTypefaceNames()); const StringArray names (findAllTypefaceNames());
@@ -390,7 +404,7 @@ const Font Font::fromString (const String& fontDescription)
class TypefaceCache : public DeletedAtShutdown class TypefaceCache : public DeletedAtShutdown
{ {
public: public:
TypefaceCache (int numToCache = 10) throw()
TypefaceCache (int numToCache = 10)
: counter (1) : counter (1)
{ {
while (--numToCache >= 0) while (--numToCache >= 0)
@@ -404,7 +418,7 @@ public:
juce_DeclareSingleton_SingleThreaded_Minimal (TypefaceCache) juce_DeclareSingleton_SingleThreaded_Minimal (TypefaceCache)
const Typeface::Ptr findTypefaceFor (const Font& font) throw()
const Typeface::Ptr findTypefaceFor (const Font& font)
{ {
const int flags = font.getStyleFlags() & (Font::bold | Font::italic); const int flags = font.getStyleFlags() & (Font::bold | Font::italic);
const String faceName (font.getTypefaceName()); const String faceName (font.getTypefaceName());
@@ -472,7 +486,7 @@ private:
juce_ImplementSingleton_SingleThreaded (TypefaceCache) juce_ImplementSingleton_SingleThreaded (TypefaceCache)
Typeface* Font::getTypeface() const throw()
Typeface* Font::getTypeface() const
{ {
if (font->typeface == 0) if (font->typeface == 0)
font->typeface = TypefaceCache::getInstance()->findTypefaceFor (*this); font->typeface = TypefaceCache::getInstance()->findTypefaceFor (*this);


+ 31
- 30
src/gui/graphics/fonts/juce_Font.h View File

@@ -67,8 +67,7 @@ public:
just Font::plain for the normal style. just Font::plain for the normal style.
@see FontStyleFlags, getDefaultSansSerifFontName @see FontStyleFlags, getDefaultSansSerifFontName
*/ */
Font (float fontHeight,
int styleFlags = plain) throw();
Font (float fontHeight, int styleFlags = plain);
/** Creates a font with a given typeface and parameters. /** Creates a font with a given typeface and parameters.
@@ -79,15 +78,13 @@ public:
just Font::plain for the normal style. just Font::plain for the normal style.
@see FontStyleFlags, getDefaultSansSerifFontName @see FontStyleFlags, getDefaultSansSerifFontName
*/ */
Font (const String& typefaceName,
float fontHeight,
int styleFlags) throw();
Font (const String& typefaceName, float fontHeight, int styleFlags);
/** Creates a copy of another Font object. */ /** Creates a copy of another Font object. */
Font (const Font& other) throw(); Font (const Font& other) throw();
/** Creates a font for a typeface. */ /** Creates a font for a typeface. */
Font (const Typeface::Ptr& typeface) throw();
Font (const Typeface::Ptr& typeface);
/** Creates a basic sans-serif font at a default height. /** Creates a basic sans-serif font at a default height.
@@ -95,7 +92,7 @@ public:
on drawing with - this constructor is here to help initialise objects before changing on drawing with - this constructor is here to help initialise objects before changing
the font's settings later. the font's settings later.
*/ */
Font() throw();
Font();
/** Copies this font from another one. */ /** Copies this font from another one. */
Font& operator= (const Font& other) throw(); Font& operator= (const Font& other) throw();
@@ -119,7 +116,7 @@ public:
If a suitable font isn't found on the machine, it'll just use a default instead. If a suitable font isn't found on the machine, it'll just use a default instead.
*/ */
void setTypefaceName (const String& faceName) throw();
void setTypefaceName (const String& faceName);
/** Returns the name of the typeface family that this font uses. /** Returns the name of the typeface family that this font uses.
@@ -146,7 +143,7 @@ public:
@see setTypefaceName, getDefaultSerifFontName, getDefaultMonospacedFontName @see setTypefaceName, getDefaultSerifFontName, getDefaultMonospacedFontName
*/ */
static const String getDefaultSansSerifFontName() throw();
static const String getDefaultSansSerifFontName();
/** Returns a typeface name that represents the default sans-serif font. /** Returns a typeface name that represents the default sans-serif font.
@@ -156,7 +153,7 @@ public:
@see setTypefaceName, getDefaultSansSerifFontName, getDefaultMonospacedFontName @see setTypefaceName, getDefaultSansSerifFontName, getDefaultMonospacedFontName
*/ */
static const String getDefaultSerifFontName() throw();
static const String getDefaultSerifFontName();
/** Returns a typeface name that represents the default sans-serif font. /** Returns a typeface name that represents the default sans-serif font.
@@ -166,7 +163,7 @@ public:
@see setTypefaceName, getDefaultSansSerifFontName, getDefaultSerifFontName @see setTypefaceName, getDefaultSansSerifFontName, getDefaultSerifFontName
*/ */
static const String getDefaultMonospacedFontName() throw();
static const String getDefaultMonospacedFontName();
/** Returns the typeface names of the default fonts on the current platform. */ /** Returns the typeface names of the default fonts on the current platform. */
static void getPlatformDefaultFontNames (String& defaultSans, String& defaultSerif, String& defaultFixed); static void getPlatformDefaultFontNames (String& defaultSans, String& defaultSerif, String& defaultFixed);
@@ -185,13 +182,13 @@ public:
@see getHeight, setHeightWithoutChangingWidth @see getHeight, setHeightWithoutChangingWidth
*/ */
void setHeight (float newHeight) throw();
void setHeight (float newHeight);
/** Changes the font's height without changing its width. /** Changes the font's height without changing its width.
This alters the horizontal scale to compensate for the change in height. This alters the horizontal scale to compensate for the change in height.
*/ */
void setHeightWithoutChangingWidth (float newHeight) throw();
void setHeightWithoutChangingWidth (float newHeight);
/** Returns the height of the font above its baseline. /** Returns the height of the font above its baseline.
@@ -199,7 +196,7 @@ public:
@see getHeight, getDescent @see getHeight, getDescent
*/ */
float getAscent() const throw();
float getAscent() const;
/** Returns the amount that the font descends below its baseline. /** Returns the amount that the font descends below its baseline.
@@ -207,7 +204,7 @@ public:
@see getAscent, getHeight @see getAscent, getHeight
*/ */
float getDescent() const throw();
float getDescent() const;
//============================================================================== //==============================================================================
/** Returns the font's style flags. /** Returns the font's style flags.
@@ -225,21 +222,25 @@ public:
enum, to set the font's properties enum, to set the font's properties
@see FontStyleFlags @see FontStyleFlags
*/ */
void setStyleFlags (int newFlags) throw();
void setStyleFlags (int newFlags);
//============================================================================== //==============================================================================
/** Makes the font bold or non-bold. */ /** Makes the font bold or non-bold. */
void setBold (bool shouldBeBold) throw();
void setBold (bool shouldBeBold);
/** Returns a copy of this font with the bold attribute set. */
const Font boldened() const;
/** Returns true if the font is bold. */ /** Returns true if the font is bold. */
bool isBold() const throw(); bool isBold() const throw();
/** Makes the font italic or non-italic. */ /** Makes the font italic or non-italic. */
void setItalic (bool shouldBeItalic) throw();
void setItalic (bool shouldBeItalic);
/** Returns a copy of this font with the italic attribute set. */
const Font italicised() const;
/** Returns true if the font is italic. */ /** Returns true if the font is italic. */
bool isItalic() const throw(); bool isItalic() const throw();
/** Makes the font underlined or non-underlined. */ /** Makes the font underlined or non-underlined. */
void setUnderline (bool shouldBeUnderlined) throw();
void setUnderline (bool shouldBeUnderlined);
/** Returns true if the font is underlined. */ /** Returns true if the font is underlined. */
bool isUnderlined() const throw(); bool isUnderlined() const throw();
@@ -249,7 +250,7 @@ public:
@param scaleFactor a value of 1.0 is the normal scale, less than this will be @param scaleFactor a value of 1.0 is the normal scale, less than this will be
narrower, greater than 1.0 will be stretched out. narrower, greater than 1.0 will be stretched out.
*/ */
void setHorizontalScale (float scaleFactor) throw();
void setHorizontalScale (float scaleFactor);
/** Returns the font's horizontal scale. /** Returns the font's horizontal scale.
@@ -267,7 +268,7 @@ public:
normal spacing, positive values spread the letters out, normal spacing, positive values spread the letters out,
negative values make them closer together. negative values make them closer together.
*/ */
void setExtraKerningFactor (float extraKerning) throw();
void setExtraKerningFactor (float extraKerning);
/** Returns the font's kerning. /** Returns the font's kerning.
@@ -285,27 +286,27 @@ public:
void setSizeAndStyle (float newHeight, void setSizeAndStyle (float newHeight,
int newStyleFlags, int newStyleFlags,
float newHorizontalScale, float newHorizontalScale,
float newKerningAmount) throw();
float newKerningAmount);
//============================================================================== //==============================================================================
/** Returns the total width of a string as it would be drawn using this font. /** Returns the total width of a string as it would be drawn using this font.
For a more accurate floating-point result, use getStringWidthFloat(). For a more accurate floating-point result, use getStringWidthFloat().
*/ */
int getStringWidth (const String& text) const throw();
int getStringWidth (const String& text) const;
/** Returns the total width of a string as it would be drawn using this font. /** Returns the total width of a string as it would be drawn using this font.
@see getStringWidth @see getStringWidth
*/ */
float getStringWidthFloat (const String& text) const throw();
float getStringWidthFloat (const String& text) const;
/** Returns the series of glyph numbers and their x offsets needed to represent a string. /** Returns the series of glyph numbers and their x offsets needed to represent a string.
An extra x offset is added at the end of the run, to indicate where the right hand An extra x offset is added at the end of the run, to indicate where the right hand
edge of the last character is. edge of the last character is.
*/ */
void getGlyphPositions (const String& text, Array <int>& glyphs, Array <float>& xOffsets) const throw();
void getGlyphPositions (const String& text, Array <int>& glyphs, Array <float>& xOffsets) const;
//============================================================================== //==============================================================================
/** Returns the typeface used by this font. /** Returns the typeface used by this font.
@@ -313,7 +314,7 @@ public:
Note that the object returned may go out of scope if this font is deleted Note that the object returned may go out of scope if this font is deleted
or has its style changed. or has its style changed.
*/ */
Typeface* getTypeface() const throw();
Typeface* getTypeface() const;
/** Creates an array of Font objects to represent all the fonts on the system. /** Creates an array of Font objects to represent all the fonts on the system.
@@ -322,7 +323,7 @@ public:
@param results the array to which new Font objects will be added. @param results the array to which new Font objects will be added.
*/ */
static void findFonts (Array<Font>& results) throw();
static void findFonts (Array<Font>& results);
/** Returns a list of all the available typeface names. /** Returns a list of all the available typeface names.
@@ -337,12 +338,12 @@ public:
/** Returns the name of the typeface to be used for rendering glyphs that aren't found /** Returns the name of the typeface to be used for rendering glyphs that aren't found
in the requested typeface. in the requested typeface.
*/ */
static const String getFallbackFontName() throw();
static const String getFallbackFontName();
/** Sets the (platform-specific) name of the typeface to use to find glyphs that aren't /** Sets the (platform-specific) name of the typeface to use to find glyphs that aren't
available in whatever font you're trying to use. available in whatever font you're trying to use.
*/ */
static void setFallbackFontName (const String& name) throw();
static void setFallbackFontName (const String& name);
//============================================================================== //==============================================================================
/** Creates a string to describe this font. /** Creates a string to describe this font.
@@ -380,7 +381,7 @@ private:
}; };
ReferenceCountedObjectPtr <SharedFontInternal> font; ReferenceCountedObjectPtr <SharedFontInternal> font;
void dupeInternalIfShared() throw();
void dupeInternalIfShared();
}; };
#endif // __JUCE_FONT_JUCEHEADER__ #endif // __JUCE_FONT_JUCEHEADER__

+ 1
- 1
src/io/files/juce_ZipFile.cpp View File

@@ -396,7 +396,7 @@ bool ZipFile::uncompressEntry (const int index,
if (zei->entry.filename.endsWithChar ('/')) if (zei->entry.filename.endsWithChar ('/'))
{ {
targetFile.createDirectory(); // (entry is a directory, not a file)
return targetFile.createDirectory(); // (entry is a directory, not a file)
} }
else else
{ {


+ 4
- 4
src/native/common/juce_posix_SharedCode.h View File

@@ -220,7 +220,7 @@ bool File::setAsCurrentWorkingDirectory() const
} }
//============================================================================== //==============================================================================
#if JUCE_IOS
#if JUCE_IOS && ! __DARWIN_ONLY_64_BIT_INO_T
typedef struct stat64 juce_statStruct; // (need to use the 64-bit version to work around a simulator bug) typedef struct stat64 juce_statStruct; // (need to use the 64-bit version to work around a simulator bug)
#else #else
typedef struct stat juce_statStruct; typedef struct stat juce_statStruct;
@@ -229,11 +229,11 @@ bool File::setAsCurrentWorkingDirectory() const
static bool juce_stat (const String& fileName, juce_statStruct& info) static bool juce_stat (const String& fileName, juce_statStruct& info)
{ {
return fileName.isNotEmpty() return fileName.isNotEmpty()
#if JUCE_IOS
#if JUCE_IOS && ! __DARWIN_ONLY_64_BIT_INO_T
&& (stat64 (fileName.toUTF8(), &info) == 0); && (stat64 (fileName.toUTF8(), &info) == 0);
#else
#else
&& (stat (fileName.toUTF8(), &info) == 0); && (stat (fileName.toUTF8(), &info) == 0);
#endif
#endif
} }
bool File::isDirectory() const bool File::isDirectory() const


+ 5
- 1
src/text/juce_String.cpp View File

@@ -137,6 +137,7 @@ public:
static void copyChars (juce_wchar* const dest, const juce_wchar* const src, const size_t numChars) throw() static void copyChars (juce_wchar* const dest, const juce_wchar* const src, const size_t numChars) throw()
{ {
jassert (src != 0 & dest != 0);
memcpy (dest, src, numChars * sizeof (juce_wchar)); memcpy (dest, src, numChars * sizeof (juce_wchar));
dest [numChars] = 0; dest [numChars] = 0;
} }
@@ -2157,7 +2158,10 @@ int String::copyToCString (char* destBuffer, const int maxBufferSizeBytes) const
//============================================================================== //==============================================================================
void String::copyToUnicode (juce_wchar* const destBuffer, const int maxCharsToCopy) const throw() void String::copyToUnicode (juce_wchar* const destBuffer, const int maxCharsToCopy) const throw()
{ {
StringHolder::copyChars (destBuffer, text, jmin (maxCharsToCopy, length()));
jassert (destBuffer != 0 && maxCharsToCopy >= 0);
if (destBuffer != 0 && maxCharsToCopy >= 0)
StringHolder::copyChars (destBuffer, text, jmin (maxCharsToCopy, length()));
} }


+ 1
- 1
src/text/juce_String.h View File

@@ -984,7 +984,7 @@ public:
@param destBuffer the place to copy it to @param destBuffer the place to copy it to
@param maxCharsToCopy the maximum number of characters to copy to the buffer, @param maxCharsToCopy the maximum number of characters to copy to the buffer,
not including the tailing zero, so this shouldn't be
NOT including the trailing zero, so this shouldn't be
larger than the size of your destination buffer - 1 larger than the size of your destination buffer - 1
*/ */
void copyToUnicode (juce_wchar* destBuffer, int maxCharsToCopy) const throw(); void copyToUnicode (juce_wchar* destBuffer, int maxCharsToCopy) const throw();


Loading…
Cancel
Save