1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-10 23:44:24 +00:00

Fixed bugs in the audio demo page, TextLayout, and AudioUnitPluginFormat.

This commit is contained in:
jules 2011-11-29 14:18:53 +00:00
parent a9fbfad8c1
commit d38057b304
3 changed files with 18 additions and 23 deletions

View file

@ -76,7 +76,7 @@ public:
if (thumbnail.getTotalLength() > 0)
{
double newStart = startTime - wheelIncrementX * (endTime - startTime) / 10.0;
newStart = jlimit (0.0, thumbnail.getTotalLength() - (endTime - startTime), newStart);
newStart = jlimit (0.0, jmax (0.0, thumbnail.getTotalLength() - (endTime - startTime)), newStart);
endTime = newStart + (endTime - startTime);
startTime = newStart;
@ -124,6 +124,11 @@ public:
demoPage->showFile (File (files[0]));
}
void mouseDown (const MouseEvent& e)
{
mouseDrag (e);
}
void mouseDrag (const MouseEvent& e)
{
transportSource.setPosition (jmax (0.0, xToTime ((float) e.x)));
@ -219,7 +224,7 @@ AudioDemoPlaybackPage::AudioDemoPlaybackPage (AudioDeviceManager& deviceManager_
//[Constructor] You can add your own custom stuff here..
formatManager.registerBasicFormats();
directoryList.setDirectory (File ("/Users/jules/Music/iTunes/iTunes Music/"), true, true);
directoryList.setDirectory (File::getSpecialLocation (File::userHomeDirectory), true, true);
thread.startThread (3);
fileTreeComp->setColour (FileTreeComponent::backgroundColourId, Colours::white);

View file

@ -598,10 +598,8 @@ public:
AudioUnitParameterInfo info;
UInt32 sz = sizeof (info);
if (AudioUnitGetProperty (audioUnit,
kAudioUnitProperty_ParameterInfo,
kAudioUnitScope_Global,
parameterIds [index], &info, &sz) == noErr)
if (AudioUnitGetProperty (audioUnit, kAudioUnitProperty_ParameterInfo,
kAudioUnitScope_Global, parameterIds [index], &info, &sz) == noErr)
{
return (info.flags & kAudioUnitParameterFlag_NonRealTime) == 0;
}
@ -616,10 +614,8 @@ public:
UInt32 sz = sizeof (CFArrayRef);
int num = 0;
if (AudioUnitGetProperty (audioUnit,
kAudioUnitProperty_FactoryPresets,
kAudioUnitScope_Global,
0, &presets, &sz) == noErr)
if (AudioUnitGetProperty (audioUnit, kAudioUnitProperty_FactoryPresets,
kAudioUnitScope_Global, 0, &presets, &sz) == noErr)
{
num = (int) CFArrayGetCount (presets);
CFRelease (presets);
@ -634,10 +630,8 @@ public:
current.presetNumber = 0;
UInt32 sz = sizeof (AUPreset);
AudioUnitGetProperty (audioUnit,
kAudioUnitProperty_FactoryPresets,
kAudioUnitScope_Global,
0, &current, &sz);
AudioUnitGetProperty (audioUnit, kAudioUnitProperty_PresentPreset,
kAudioUnitScope_Global, 0, &current, &sz);
return current.presetNumber;
}
@ -648,10 +642,8 @@ public:
current.presetNumber = newIndex;
current.presetName = 0;
AudioUnitSetProperty (audioUnit,
kAudioUnitProperty_PresentPreset,
kAudioUnitScope_Global,
0, &current, sizeof (AUPreset));
AudioUnitSetProperty (audioUnit, kAudioUnitProperty_PresentPreset,
kAudioUnitScope_Global, 0, &current, sizeof (AUPreset));
}
const String getProgramName (int index)
@ -660,10 +652,8 @@ public:
CFArrayRef presets;
UInt32 sz = sizeof (CFArrayRef);
if (AudioUnitGetProperty (audioUnit,
kAudioUnitProperty_FactoryPresets,
kAudioUnitScope_Global,
0, &presets, &sz) == noErr)
if (AudioUnitGetProperty (audioUnit, kAudioUnitProperty_FactoryPresets,
kAudioUnitScope_Global, 0, &presets, &sz) == noErr)
{
for (CFIndex i = 0; i < CFArrayGetCount (presets); ++i)
{

View file

@ -365,7 +365,7 @@ namespace TextLayoutHelpers
{
const int totalW = (int) layout.getWidth();
for (int i = 0; i < totalLines; ++i)
for (int i = 0; i < layout.getNumLines(); ++i)
{
const int lineW = getLineWidth (i);
float dx = 0;