1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-19 01:04:20 +00:00

Added some packetising code to the Mac Midi sysex output; tweaked some key focus problems for the AU wrapper in AULab; fixed a small PreferencesPanel bug.

This commit is contained in:
jules 2009-05-29 12:04:30 +00:00
parent 829498e397
commit 7d2a7af8a5
6 changed files with 71 additions and 29 deletions

View file

@ -304,11 +304,23 @@ void MidiOutput::sendMessageNow (const MidiMessage& message)
if (message.isSysEx())
{
MIDIPacketList* const packets = (MIDIPacketList*) juce_malloc (32 + message.getRawDataSize());
packets->numPackets = 1;
packets->packet[0].timeStamp = 0;
packets->packet[0].length = message.getRawDataSize();
memcpy (packets->packet[0].data, message.getRawData(), message.getRawDataSize());
const int maxPacketSize = 256;
int pos = 0, bytesLeft = message.getRawDataSize();
const int numPackets = (bytesLeft + maxPacketSize - 1) / maxPacketSize;
MIDIPacketList* const packets = (MIDIPacketList*) juce_malloc (32 * numPackets + message.getRawDataSize());
packets->numPackets = numPackets;
MIDIPacket* p = packets->packet;
for (int i = 0; i < numPackets; ++i)
{
p->timeStamp = 0;
p->length = jmin (maxPacketSize, bytesLeft);
memcpy (p->data, message.getRawData() + pos, p->length);
pos += p->length;
bytesLeft -= p->length;
p = MIDIPacketNext (p);
}
MIDISend (mpe->port, mpe->endPoint, packets);
juce_free (packets);

View file

@ -77,6 +77,7 @@ END_JUCE_NAMESPACE
- (BOOL) becomeFirstResponder;
- (BOOL) resignFirstResponder;
- (BOOL) acceptsFirstResponder;
- (NSArray*) getSupportedDragTypes;
- (BOOL) sendDragCallback: (int) type sender: (id <NSDraggingInfo>) sender;
@ -392,6 +393,11 @@ END_JUCE_NAMESPACE
return true;
}
- (BOOL) acceptsFirstResponder
{
return owner != 0 && owner->canBecomeKeyWindow();
}
//==============================================================================
- (NSArray*) getSupportedDragTypes
{
@ -1156,7 +1162,8 @@ void juce_HandleProcessFocusChange()
bool NSViewComponentPeer::isFocused() const
{
return window != 0 && [window isKeyWindow];
return isSharedWindow ? this == currentlyFocusedPeer
: (window != 0 && [window isKeyWindow]);
}
void NSViewComponentPeer::grabFocus()

View file

@ -926,6 +926,12 @@ public:
setSize (editorComp->getWidth(), editorComp->getHeight());
addAndMakeVisible (editorComp);
editorComp->addComponentListener (this);
#if ! JucePlugin_EditorRequiresKeyboardFocus
setWantsKeyboardFocus (false);
#else
setWantsKeyboardFocus (true);
#endif
}
~EditorCompHolder()
@ -1196,6 +1202,7 @@ private:
setWantsKeyboardFocus (false);
#else
addToDesktop (ComponentPeer::windowIsTemporary);
setWantsKeyboardFocus (true);
#endif
setVisible (true);
@ -1203,6 +1210,9 @@ private:
addSubWindow();
NSWindow* pluginWindow = [((NSView*) getWindowHandle()) window];
[pluginWindow setNextResponder: hostWindow];
// Adds a callback bodge to work around some problems with wrapped
// carbon windows..
const EventTypeSpec eventsToCatch[] = {

View file

@ -21314,11 +21314,8 @@ void AudioTransportSource::setSource (PositionableAudioSource* const newSource,
if (oldMasterSource != 0)
oldMasterSource->releaseResources();
if (oldResamplerSource != 0)
delete oldResamplerSource;
if (oldBufferingSource != 0)
delete oldBufferingSource;
delete oldResamplerSource;
delete oldBufferingSource;
}
void AudioTransportSource::start()
@ -32849,7 +32846,7 @@ const String VSTPluginInstance::getVersion() const throw()
if (v != 0)
{
int versionBits[4];
unsigned int n = 0;
int n = 0;
while (v != 0)
{
@ -71808,6 +71805,9 @@ void PreferencesPanel::addSettingsPage (const String& title,
addAndMakeVisible (button);
resized();
if (currentPage == 0)
setCurrentPage (title);
}
void PreferencesPanel::addSettingsPage (const String& title,
@ -71824,9 +71824,6 @@ void PreferencesPanel::addSettingsPage (const String& title,
iconDown.setOverlayColour (Colours::black.withAlpha (0.25f));
addSettingsPage (title, &icon, &iconOver, &iconDown);
if (currentPage == 0)
setCurrentPage (title);
}
class PrefsDialogWindow : public DialogWindow
@ -266964,6 +266961,7 @@ END_JUCE_NAMESPACE
- (BOOL) becomeFirstResponder;
- (BOOL) resignFirstResponder;
- (BOOL) acceptsFirstResponder;
- (NSArray*) getSupportedDragTypes;
- (BOOL) sendDragCallback: (int) type sender: (id <NSDraggingInfo>) sender;
@ -267269,6 +267267,11 @@ END_JUCE_NAMESPACE
return true;
}
- (BOOL) acceptsFirstResponder
{
return owner != 0 && owner->canBecomeKeyWindow();
}
- (NSArray*) getSupportedDragTypes
{
return [NSArray arrayWithObjects: NSFilenamesPboardType, /*NSFilesPromisePboardType, NSStringPboardType,*/ nil];
@ -268024,7 +268027,8 @@ void juce_HandleProcessFocusChange()
bool NSViewComponentPeer::isFocused() const
{
return window != 0 && [window isKeyWindow];
return isSharedWindow ? this == currentlyFocusedPeer
: (window != 0 && [window isKeyWindow]);
}
void NSViewComponentPeer::grabFocus()
@ -273031,11 +273035,23 @@ void MidiOutput::sendMessageNow (const MidiMessage& message)
if (message.isSysEx())
{
MIDIPacketList* const packets = (MIDIPacketList*) juce_malloc (32 + message.getRawDataSize());
packets->numPackets = 1;
packets->packet[0].timeStamp = 0;
packets->packet[0].length = message.getRawDataSize();
memcpy (packets->packet[0].data, message.getRawData(), message.getRawDataSize());
const int maxPacketSize = 256;
int pos = 0, bytesLeft = message.getRawDataSize();
const int numPackets = (bytesLeft + maxPacketSize - 1) / maxPacketSize;
MIDIPacketList* const packets = (MIDIPacketList*) juce_malloc (32 * numPackets + message.getRawDataSize());
packets->numPackets = numPackets;
MIDIPacket* p = packets->packet;
for (int i = 0; i < numPackets; ++i)
{
p->timeStamp = 0;
p->length = jmin (maxPacketSize, bytesLeft);
memcpy (p->data, message.getRawData() + pos, p->length);
pos += p->length;
bytesLeft -= p->length;
p = MIDIPacketNext (p);
}
MIDISend (mpe->port, mpe->endPoint, packets);
juce_free (packets);

View file

@ -128,11 +128,8 @@ void AudioTransportSource::setSource (PositionableAudioSource* const newSource,
if (oldMasterSource != 0)
oldMasterSource->releaseResources();
if (oldResamplerSource != 0)
delete oldResamplerSource;
if (oldBufferingSource != 0)
delete oldBufferingSource;
delete oldResamplerSource;
delete oldBufferingSource;
}
void AudioTransportSource::start()

View file

@ -67,6 +67,9 @@ void PreferencesPanel::addSettingsPage (const String& title,
addAndMakeVisible (button);
resized();
if (currentPage == 0)
setCurrentPage (title);
}
void PreferencesPanel::addSettingsPage (const String& title,
@ -83,9 +86,6 @@ void PreferencesPanel::addSettingsPage (const String& title,
iconDown.setOverlayColour (Colours::black.withAlpha (0.25f));
addSettingsPage (title, &icon, &iconOver, &iconDown);
if (currentPage == 0)
setCurrentPage (title);
}
//==============================================================================