1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-02-07 04:10:08 +00:00

Added an alertwindow font setting to the lookandfeel class. Made sure the ComponentListener::componentChildrenChanged is called when component z-order changes. Fix for CoreMidi output timestamps.

This commit is contained in:
Julian Storer 2011-01-06 15:32:11 +00:00
parent 7478c7f9ab
commit e2ef26e91c
14 changed files with 124 additions and 105 deletions

View file

@ -24896,15 +24896,20 @@ void ResamplingAudioSource::releaseResources()
void ResamplingAudioSource::getNextAudioBlock (const AudioSourceChannelInfo& info)
{
const ScopedLock sl (ratioLock);
float localRatio;
if (lastRatio != ratio)
{
createLowPass (ratio);
lastRatio = ratio;
const ScopedLock sl (ratioLock);
localRatio = ratio;
}
const int sampsNeeded = roundToInt (info.numSamples * ratio) + 2;
if (lastRatio != localRatio)
{
createLowPass (localRatio);
lastRatio = localRatio;
}
const int sampsNeeded = roundToInt (info.numSamples * localRatio) + 2;
int bufferSize = buffer.getNumSamples();
@ -24934,7 +24939,7 @@ void ResamplingAudioSource::getNextAudioBlock (const AudioSourceChannelInfo& inf
input->getNextAudioBlock (readInfo);
if (ratio > 1.0001)
if (localRatio > 1.0001)
{
// for down-sampling, pre-apply the filter..
@ -24961,7 +24966,7 @@ void ResamplingAudioSource::getNextAudioBlock (const AudioSourceChannelInfo& inf
for (int channel = 0; channel < channelsToProcess; ++channel)
*destBuffers[channel]++ = srcBuffers[channel][bufferPos] * invAlpha + srcBuffers[channel][nextPos] * alpha;
subSampleOffset += ratio;
subSampleOffset += localRatio;
jassert (sampsInBuffer > 0);
@ -24977,13 +24982,13 @@ void ResamplingAudioSource::getNextAudioBlock (const AudioSourceChannelInfo& inf
}
}
if (ratio < 0.9999)
if (localRatio < 0.9999)
{
// for up-sampling, apply the filter after transposing..
for (int i = channelsToProcess; --i >= 0;)
applyFilter (info.buffer->getSampleData (i, info.startSample), info.numSamples, filterStates[i]);
}
else if (ratio <= 1.0001)
else if (localRatio <= 1.0001)
{
// if the filter's not currently being applied, keep it stoked with the last couple of samples to avoid discontinuities
for (int i = channelsToProcess; --i >= 0;)
@ -40241,6 +40246,21 @@ void Component::setBufferedToImage (const bool shouldBeBuffered)
}
}
void Component::moveChildInternal (const int sourceIndex, const int destIndex)
{
if (sourceIndex != destIndex)
{
Component* const c = childComponentList.getUnchecked (sourceIndex);
jassert (c != 0);
c->repaintParent();
childComponentList.move (sourceIndex, destIndex);
sendFakeMouseMove();
internalChildrenChanged();
}
}
void Component::toFront (const bool setAsForeground)
{
// if component methods are being called from threads other than the message
@ -40261,7 +40281,7 @@ void Component::toFront (const bool setAsForeground)
}
else if (parentComponent != 0)
{
Array<Component*>& childList = parentComponent->childComponentList;
const Array<Component*>& childList = parentComponent->childComponentList;
if (childList.getLast() != this)
{
@ -40279,13 +40299,7 @@ void Component::toFront (const bool setAsForeground)
--insertIndex;
}
if (index != insertIndex)
{
childList.move (index, insertIndex);
sendFakeMouseMove();
repaintParent();
}
parentComponent->moveChildInternal (index, insertIndex);
}
}
@ -40306,8 +40320,7 @@ void Component::toBehind (Component* const other)
if (parentComponent != 0)
{
Array<Component*>& childList = parentComponent->childComponentList;
const Array<Component*>& childList = parentComponent->childComponentList;
const int index = childList.indexOf (this);
if (index >= 0 && childList [index + 1] != other)
@ -40319,10 +40332,7 @@ void Component::toBehind (Component* const other)
if (index < otherIndex)
--otherIndex;
childList.move (index, otherIndex);
sendFakeMouseMove();
repaintParent();
parentComponent->moveChildInternal (index, otherIndex);
}
}
}
@ -40345,35 +40355,27 @@ void Component::toBehind (Component* const other)
void Component::toBack()
{
Array<Component*>& childList = parentComponent->childComponentList;
if (isOnDesktop())
{
jassertfalse; //xxx need to add this to native window
}
else if (parentComponent != 0 && childList.getFirst() != this)
else if (parentComponent != 0)
{
const int index = childList.indexOf (this);
const Array<Component*>& childList = parentComponent->childComponentList;
if (index > 0)
if (childList.getFirst() != this)
{
int insertIndex = 0;
const int index = childList.indexOf (this);
if (flags.alwaysOnTopFlag)
if (index > 0)
{
while (insertIndex < childList.size()
&& ! childList.getUnchecked (insertIndex)->isAlwaysOnTop())
{
++insertIndex;
}
}
int insertIndex = 0;
if (index != insertIndex)
{
childList.move (index, insertIndex);
if (flags.alwaysOnTopFlag)
while (insertIndex < childList.size() && ! childList.getUnchecked (insertIndex)->isAlwaysOnTop())
++insertIndex;
sendFakeMouseMove();
repaintParent();
parentComponent->moveChildInternal (index, insertIndex);
}
}
}
@ -65444,6 +65446,11 @@ int LookAndFeel::getAlertWindowButtonHeight()
return 28;
}
const Font LookAndFeel::getAlertWindowMessageFont()
{
return Font (15.0f);
}
const Font LookAndFeel::getAlertWindowFont()
{
return Font (12.0f);
@ -76484,7 +76491,7 @@ void AlertWindow::setMessage (const String& message)
{
text = newMessage;
font.setHeight (15.0f);
font = getLookAndFeel().getAlertWindowMessageFont();
Font titleFont (font.getHeight() * 1.1f, Font::bold);
textLayout.setText (getName() + "\n\n", titleFont);
@ -270305,7 +270312,7 @@ void MidiOutput::sendMessageNow (const MidiMessage& message)
for (int i = 0; i < numPackets; ++i)
{
p->timeStamp = 0;
p->timeStamp = AudioGetCurrentHostTime();
p->length = jmin (maxPacketSize, bytesLeft);
memcpy (p->data, message.getRawData() + pos, p->length);
pos += p->length;
@ -270319,7 +270326,7 @@ void MidiOutput::sendMessageNow (const MidiMessage& message)
{
MIDIPacketList packets;
packets.numPackets = 1;
packets.packet[0].timeStamp = 0;
packets.packet[0].timeStamp = AudioGetCurrentHostTime();
packets.packet[0].length = message.getRawDataSize();
*(int*) (packets.packet[0].data) = *(const int*) message.getRawData();
@ -278808,7 +278815,7 @@ void MidiOutput::sendMessageNow (const MidiMessage& message)
for (int i = 0; i < numPackets; ++i)
{
p->timeStamp = 0;
p->timeStamp = AudioGetCurrentHostTime();
p->length = jmin (maxPacketSize, bytesLeft);
memcpy (p->data, message.getRawData() + pos, p->length);
pos += p->length;
@ -278822,7 +278829,7 @@ void MidiOutput::sendMessageNow (const MidiMessage& message)
{
MIDIPacketList packets;
packets.numPackets = 1;
packets.packet[0].timeStamp = 0;
packets.packet[0].timeStamp = AudioGetCurrentHostTime();
packets.packet[0].length = message.getRawDataSize();
*(int*) (packets.packet[0].data) = *(const int*) message.getRawData();