Browse Source

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.

tags/2021-05-28
jules 16 years ago
parent
commit
7d2a7af8a5
6 changed files with 71 additions and 29 deletions
  1. +17
    -5
      build/macosx/platform_specific_code/juce_mac_CoreMidi.cpp
  2. +8
    -1
      build/macosx/platform_specific_code/juce_mac_NSViewComponentPeer.mm
  3. +10
    -0
      extras/audio plugins/wrapper/AU/juce_AU_Wrapper.mm
  4. +31
    -15
      juce_amalgamated.cpp
  5. +2
    -5
      src/juce_appframework/audio/audio_sources/juce_AudioTransportSource.cpp
  6. +3
    -3
      src/juce_appframework/gui/components/special/juce_PreferencesPanel.cpp

+ 17
- 5
build/macosx/platform_specific_code/juce_mac_CoreMidi.cpp View File

@@ -304,11 +304,23 @@ void MidiOutput::sendMessageNow (const MidiMessage& message)
if (message.isSysEx()) 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); MIDISend (mpe->port, mpe->endPoint, packets);
juce_free (packets); juce_free (packets);


+ 8
- 1
build/macosx/platform_specific_code/juce_mac_NSViewComponentPeer.mm View File

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


+ 10
- 0
extras/audio plugins/wrapper/AU/juce_AU_Wrapper.mm View File

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


+ 31
- 15
juce_amalgamated.cpp View File

@@ -21314,11 +21314,8 @@ void AudioTransportSource::setSource (PositionableAudioSource* const newSource,
if (oldMasterSource != 0) if (oldMasterSource != 0)
oldMasterSource->releaseResources(); oldMasterSource->releaseResources();


if (oldResamplerSource != 0)
delete oldResamplerSource;

if (oldBufferingSource != 0)
delete oldBufferingSource;
delete oldResamplerSource;
delete oldBufferingSource;
} }


void AudioTransportSource::start() void AudioTransportSource::start()
@@ -32849,7 +32846,7 @@ const String VSTPluginInstance::getVersion() const throw()
if (v != 0) if (v != 0)
{ {
int versionBits[4]; int versionBits[4];
unsigned int n = 0;
int n = 0;


while (v != 0) while (v != 0)
{ {
@@ -71808,6 +71805,9 @@ void PreferencesPanel::addSettingsPage (const String& title,
addAndMakeVisible (button); addAndMakeVisible (button);


resized(); resized();

if (currentPage == 0)
setCurrentPage (title);
} }


void PreferencesPanel::addSettingsPage (const String& title, void PreferencesPanel::addSettingsPage (const String& title,
@@ -71824,9 +71824,6 @@ void PreferencesPanel::addSettingsPage (const String& title,
iconDown.setOverlayColour (Colours::black.withAlpha (0.25f)); iconDown.setOverlayColour (Colours::black.withAlpha (0.25f));


addSettingsPage (title, &icon, &iconOver, &iconDown); addSettingsPage (title, &icon, &iconOver, &iconDown);

if (currentPage == 0)
setCurrentPage (title);
} }


class PrefsDialogWindow : public DialogWindow class PrefsDialogWindow : public DialogWindow
@@ -266964,6 +266961,7 @@ END_JUCE_NAMESPACE


- (BOOL) becomeFirstResponder; - (BOOL) becomeFirstResponder;
- (BOOL) resignFirstResponder; - (BOOL) resignFirstResponder;
- (BOOL) acceptsFirstResponder;


- (NSArray*) getSupportedDragTypes; - (NSArray*) getSupportedDragTypes;
- (BOOL) sendDragCallback: (int) type sender: (id <NSDraggingInfo>) sender; - (BOOL) sendDragCallback: (int) type sender: (id <NSDraggingInfo>) sender;
@@ -267269,6 +267267,11 @@ END_JUCE_NAMESPACE
return true; return true;
} }


- (BOOL) acceptsFirstResponder
{
return owner != 0 && owner->canBecomeKeyWindow();
}

- (NSArray*) getSupportedDragTypes - (NSArray*) getSupportedDragTypes
{ {
return [NSArray arrayWithObjects: NSFilenamesPboardType, /*NSFilesPromisePboardType, NSStringPboardType,*/ nil]; return [NSArray arrayWithObjects: NSFilenamesPboardType, /*NSFilesPromisePboardType, NSStringPboardType,*/ nil];
@@ -268024,7 +268027,8 @@ void juce_HandleProcessFocusChange()


bool NSViewComponentPeer::isFocused() const bool NSViewComponentPeer::isFocused() const
{ {
return window != 0 && [window isKeyWindow];
return isSharedWindow ? this == currentlyFocusedPeer
: (window != 0 && [window isKeyWindow]);
} }


void NSViewComponentPeer::grabFocus() void NSViewComponentPeer::grabFocus()
@@ -273031,11 +273035,23 @@ void MidiOutput::sendMessageNow (const MidiMessage& message)


if (message.isSysEx()) 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); MIDISend (mpe->port, mpe->endPoint, packets);
juce_free (packets); juce_free (packets);


+ 2
- 5
src/juce_appframework/audio/audio_sources/juce_AudioTransportSource.cpp View File

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


+ 3
- 3
src/juce_appframework/gui/components/special/juce_PreferencesPanel.cpp View File

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


Loading…
Cancel
Save