Browse Source

Cleaned up some namespace issues, and tweaked the plugin host demo to avoid namespace clashes with juce plugins

tags/2021-05-28
Julian Storer 16 years ago
parent
commit
3e77725594
8 changed files with 52 additions and 44 deletions
  1. +3
    -3
      extras/audio plugin host/build/mac/PluginHost.xcodeproj/project.pbxproj
  2. +8
    -0
      extras/audio plugin host/src/juce_AppConfig.h
  3. +1
    -1
      extras/audio plugins/wrapper/RTAS/juce_RTAS_Wrapper.cpp
  4. +1
    -1
      extras/audio plugins/wrapper/juce_PluginHostType.h
  5. +3
    -3
      extras/browser plugins/wrapper/juce_NPAPI_GlueCode.cpp
  6. +31
    -31
      src/native/linux/juce_linux_JackAudio.cpp
  7. +1
    -1
      src/native/mac/juce_iphone_UIViewComponentPeer.mm
  8. +4
    -4
      src/native/mac/juce_mac_NSViewComponentPeer.mm

+ 3
- 3
extras/audio plugin host/build/mac/PluginHost.xcodeproj/project.pbxproj View File

@@ -233,20 +233,20 @@
}; };
C0E91ACA08A95435008D54AB /* Debug */ = { C0E91ACA08A95435008D54AB /* Debug */ = {
isa = XCBuildConfiguration; isa = XCBuildConfiguration;
baseConfigurationReference = 84FC4CD80CD8894600850651 /* juce.xcconfig */;
buildSettings = { buildSettings = {
GCC_ENABLE_FIX_AND_CONTINUE = YES; GCC_ENABLE_FIX_AND_CONTINUE = YES;
GCC_OPTIMIZATION_LEVEL = 0; GCC_OPTIMIZATION_LEVEL = 0;
MACOSX_DEPLOYMENT_TARGET = 10.4;
PRODUCT_NAME = PluginHost; PRODUCT_NAME = PluginHost;
SEPARATE_STRIP = YES;
USER_HEADER_SEARCH_PATHS = "~/SDKs/vstsdk2.4 $(inherited)"; USER_HEADER_SEARCH_PATHS = "~/SDKs/vstsdk2.4 $(inherited)";
ZERO_LINK = NO;
}; };
name = Debug; name = Debug;
}; };
C0E91ACB08A95435008D54AB /* Release */ = { C0E91ACB08A95435008D54AB /* Release */ = {
isa = XCBuildConfiguration; isa = XCBuildConfiguration;
baseConfigurationReference = 84FC4CD80CD8894600850651 /* juce.xcconfig */;
buildSettings = { buildSettings = {
MACOSX_DEPLOYMENT_TARGET = 10.4;
PRODUCT_NAME = PluginHost; PRODUCT_NAME = PluginHost;
SEPARATE_STRIP = YES; SEPARATE_STRIP = YES;
USER_HEADER_SEARCH_PATHS = "~/SDKs/vstsdk2.4 $(inherited)"; USER_HEADER_SEARCH_PATHS = "~/SDKs/vstsdk2.4 $(inherited)";


+ 8
- 0
extras/audio plugin host/src/juce_AppConfig.h View File

@@ -38,6 +38,14 @@
to an explicit 0 or 1 in here. to an explicit 0 or 1 in here.
*/ */
/* Because the host may be loading juce plugins that contain the same symbols as itself,
there's endless opportunity for the dynamic loader to bugger up . So, we'll make the host
use a different namespace and obj-C classnames, to try to avoid this as much as possible.
*/
#define JUCE_ObjCExtraSuffix JuceDemoHost
#define JUCE_NAMESPACE JuceDemoHost
#define JUCE_PLUGINHOST_VST 1 #define JUCE_PLUGINHOST_VST 1
#define JUCE_PLUGINHOST_AU 1 #define JUCE_PLUGINHOST_AU 1
#define JUCE_SUPPORT_CARBON 1 #define JUCE_SUPPORT_CARBON 1


+ 1
- 1
extras/audio plugins/wrapper/RTAS/juce_RTAS_Wrapper.cpp View File

@@ -605,7 +605,7 @@ protected:
if (! midiEvents.isEmpty()) if (! midiEvents.isEmpty())
{ {
#if JucePlugin_ProducesMidiOutput #if JucePlugin_ProducesMidiOutput
const juce::uint8* midiEventData;
const JUCE_NAMESPACE::uint8* midiEventData;
int midiEventSize, midiEventPosition; int midiEventSize, midiEventPosition;
MidiBuffer::Iterator i (midiEvents); MidiBuffer::Iterator i (midiEvents);


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

@@ -134,6 +134,6 @@ private:
#else #else
#error #error
#endif #endif
return String::fromUTF8 ((const juce::uint8*) buffer.getData(), size);
return String::fromUTF8 ((const JUCE_NAMESPACE::uint8*) buffer.getData(), size);
} }
}; };

+ 3
- 3
extras/browser plugins/wrapper/juce_NPAPI_GlueCode.cpp View File

@@ -85,7 +85,7 @@ static void log (const String& s)
//============================================================================== //==============================================================================
#if JUCE_MAC #if JUCE_MAC
static const String nsStringToJuce (NSString* s) { return String::fromUTF8 ((juce::uint8*) [s UTF8String]); }
static const String nsStringToJuce (NSString* s) { return String::fromUTF8 ((JUCE_NAMESPACE::uint8*) [s UTF8String]); }
static NSString* juceStringToNS (const String& s) { return [NSString stringWithUTF8String: (const char*) s.toUTF8()]; } static NSString* juceStringToNS (const String& s) { return [NSString stringWithUTF8String: (const char*) s.toUTF8()]; }
#pragma export on #pragma export on
@@ -845,10 +845,10 @@ static const var createValueFromNPVariant (NPP npp, const NPVariant& v)
return var (NPVARIANT_TO_DOUBLE (v)); return var (NPVARIANT_TO_DOUBLE (v));
else if (NPVARIANT_IS_STRING (v)) else if (NPVARIANT_IS_STRING (v))
#if JUCE_MAC #if JUCE_MAC
return var (String::fromUTF8 ((const juce::uint8*) (NPVARIANT_TO_STRING (v).UTF8Characters),
return var (String::fromUTF8 ((const JUCE_NAMESPACE::uint8*) (NPVARIANT_TO_STRING (v).UTF8Characters),
(int) NPVARIANT_TO_STRING (v).UTF8Length)); (int) NPVARIANT_TO_STRING (v).UTF8Length));
#else #else
return var (String::fromUTF8 ((const juce::uint8*) (NPVARIANT_TO_STRING (v).utf8characters),
return var (String::fromUTF8 ((const JUCE_NAMESPACE::uint8*) (NPVARIANT_TO_STRING (v).utf8characters),
(int) NPVARIANT_TO_STRING (v).utf8length)); (int) NPVARIANT_TO_STRING (v).utf8length));
#endif #endif
else if (NPVARIANT_IS_OBJECT (v)) else if (NPVARIANT_IS_OBJECT (v))


+ 31
- 31
src/native/linux/juce_linux_JackAudio.cpp View File

@@ -135,7 +135,7 @@ public:
jassert (deviceName.isNotEmpty()); jassert (deviceName.isNotEmpty());
jack_status_t status; jack_status_t status;
client = juce::jack_client_open (JUCE_JACK_CLIENT_NAME, JackNoStartServer, &status);
client = JUCE_NAMESPACE::jack_client_open (JUCE_JACK_CLIENT_NAME, JackNoStartServer, &status);
if (client == 0) if (client == 0)
{ {
@@ -143,7 +143,7 @@ public:
} }
else else
{ {
juce::jack_set_error_function (errorCallback);
JUCE_NAMESPACE::jack_set_error_function (errorCallback);
// open input ports // open input ports
const StringArray inputChannels (getInputChannelNames()); const StringArray inputChannels (getInputChannelNames());
@@ -152,8 +152,8 @@ public:
String inputName; String inputName;
inputName << "in_" << (++totalNumberOfInputChannels); inputName << "in_" << (++totalNumberOfInputChannels);
inputPorts.add (juce::jack_port_register (client, (const char*) inputName,
JACK_DEFAULT_AUDIO_TYPE, JackPortIsInput, 0));
inputPorts.add (JUCE_NAMESPACE::jack_port_register (client, (const char*) inputName,
JACK_DEFAULT_AUDIO_TYPE, JackPortIsInput, 0));
} }
// open output ports // open output ports
@@ -163,8 +163,8 @@ public:
String outputName; String outputName;
outputName << "out_" << (++totalNumberOfOutputChannels); outputName << "out_" << (++totalNumberOfOutputChannels);
outputPorts.add (juce::jack_port_register (client, (const char*) outputName,
JACK_DEFAULT_AUDIO_TYPE, JackPortIsOutput, 0));
outputPorts.add (JUCE_NAMESPACE::jack_port_register (client, (const char*) outputName,
JACK_DEFAULT_AUDIO_TYPE, JackPortIsOutput, 0));
} }
inChans = (float**) juce_calloc (sizeof (float*) * (totalNumberOfInputChannels + 2)); inChans = (float**) juce_calloc (sizeof (float*) * (totalNumberOfInputChannels + 2));
@@ -177,7 +177,7 @@ public:
close(); close();
if (client != 0) if (client != 0)
{ {
juce::jack_client_close (client);
JUCE_NAMESPACE::jack_client_close (client);
client = 0; client = 0;
} }
@@ -188,8 +188,8 @@ public:
const StringArray getChannelNames (bool forInput) const const StringArray getChannelNames (bool forInput) const
{ {
StringArray names; StringArray names;
const char** const ports = juce::jack_get_ports (client, 0, 0, /* JackPortIsPhysical | */
forInput ? JackPortIsInput : JackPortIsOutput);
const char** const ports = JUCE_NAMESPACE::jack_get_ports (client, 0, 0, /* JackPortIsPhysical | */
forInput ? JackPortIsInput : JackPortIsOutput);
if (ports != 0) if (ports != 0)
{ {
@@ -211,10 +211,10 @@ public:
const StringArray getOutputChannelNames() { return getChannelNames (false); } const StringArray getOutputChannelNames() { return getChannelNames (false); }
const StringArray getInputChannelNames() { return getChannelNames (true); } const StringArray getInputChannelNames() { return getChannelNames (true); }
int getNumSampleRates() { return client != 0 ? 1 : 0; } int getNumSampleRates() { return client != 0 ? 1 : 0; }
double getSampleRate (int index) { return client != 0 ? juce::jack_get_sample_rate (client) : 0; }
double getSampleRate (int index) { return client != 0 ? JUCE_NAMESPACE::jack_get_sample_rate (client) : 0; }
int getNumBufferSizesAvailable() { return client != 0 ? 1 : 0; } int getNumBufferSizesAvailable() { return client != 0 ? 1 : 0; }
int getBufferSizeSamples (int index) { return getDefaultBufferSize(); } int getBufferSizeSamples (int index) { return getDefaultBufferSize(); }
int getDefaultBufferSize() { return client != 0 ? juce::jack_get_buffer_size (client) : 0; }
int getDefaultBufferSize() { return client != 0 ? JUCE_NAMESPACE::jack_get_buffer_size (client) : 0; }
const String open (const BitArray& inputChannels, const BitArray& outputChannels, const String open (const BitArray& inputChannels, const BitArray& outputChannels,
double sampleRate, int bufferSizeSamples) double sampleRate, int bufferSizeSamples)
@@ -228,14 +228,14 @@ public:
lastError = String::empty; lastError = String::empty;
close(); close();
juce::jack_set_process_callback (client, processCallback, this);
juce::jack_on_shutdown (client, shutdownCallback, this);
juce::jack_activate (client);
JUCE_NAMESPACE::jack_set_process_callback (client, processCallback, this);
JUCE_NAMESPACE::jack_on_shutdown (client, shutdownCallback, this);
JUCE_NAMESPACE::jack_activate (client);
isOpen_ = true; isOpen_ = true;
if (! inputChannels.isEmpty()) if (! inputChannels.isEmpty())
{ {
const char** const ports = juce::jack_get_ports (client, 0, 0, /* JackPortIsPhysical | */ JackPortIsOutput);
const char** const ports = JUCE_NAMESPACE::jack_get_ports (client, 0, 0, /* JackPortIsPhysical | */ JackPortIsOutput);
if (ports != 0) if (ports != 0)
{ {
@@ -247,7 +247,7 @@ public:
if (inputChannels[i] && portName.upToFirstOccurrenceOf (T(":"), false, false) == getName()) if (inputChannels[i] && portName.upToFirstOccurrenceOf (T(":"), false, false) == getName())
{ {
int error = juce::jack_connect (client, ports[i], juce::jack_port_name ((jack_port_t*) inputPorts[i]));
int error = JUCE_NAMESPACE::jack_connect (client, ports[i], JUCE_NAMESPACE::jack_port_name ((jack_port_t*) inputPorts[i]));
if (error != 0) if (error != 0)
jack_Log ("Cannot connect input port " + String (i) + " (" + String (ports[i]) + "), error " + String (error)); jack_Log ("Cannot connect input port " + String (i) + " (" + String (ports[i]) + "), error " + String (error));
} }
@@ -259,7 +259,7 @@ public:
if (! outputChannels.isEmpty()) if (! outputChannels.isEmpty())
{ {
const char** const ports = juce::jack_get_ports (client, 0, 0, /* JackPortIsPhysical | */ JackPortIsInput);
const char** const ports = JUCE_NAMESPACE::jack_get_ports (client, 0, 0, /* JackPortIsPhysical | */ JackPortIsInput);
if (ports != 0) if (ports != 0)
{ {
@@ -271,7 +271,7 @@ public:
if (outputChannels[i] && portName.upToFirstOccurrenceOf (T(":"), false, false) == getName()) if (outputChannels[i] && portName.upToFirstOccurrenceOf (T(":"), false, false) == getName())
{ {
int error = juce::jack_connect (client, juce::jack_port_name ((jack_port_t*) outputPorts[i]), ports[i]);
int error = JUCE_NAMESPACE::jack_connect (client, JUCE_NAMESPACE::jack_port_name ((jack_port_t*) outputPorts[i]), ports[i]);
if (error != 0) if (error != 0)
jack_Log ("Cannot connect output port " + String (i) + " (" + String (ports[i]) + "), error " + String (error)); jack_Log ("Cannot connect output port " + String (i) + " (" + String (ports[i]) + "), error " + String (error));
} }
@@ -290,9 +290,9 @@ public:
if (client != 0) if (client != 0)
{ {
juce::jack_deactivate (client);
juce::jack_set_process_callback (client, processCallback, 0);
juce::jack_on_shutdown (client, shutdownCallback, 0);
JUCE_NAMESPACE::jack_deactivate (client);
JUCE_NAMESPACE::jack_set_process_callback (client, processCallback, 0);
JUCE_NAMESPACE::jack_on_shutdown (client, shutdownCallback, 0);
} }
isOpen_ = false; isOpen_ = false;
@@ -334,7 +334,7 @@ public:
BitArray outputBits; BitArray outputBits;
for (int i = 0; i < outputPorts.size(); i++) for (int i = 0; i < outputPorts.size(); i++)
if (juce::jack_port_connected ((jack_port_t*) outputPorts [i]))
if (JUCE_NAMESPACE::jack_port_connected ((jack_port_t*) outputPorts [i]))
outputBits.setBit (i); outputBits.setBit (i);
return outputBits; return outputBits;
@@ -345,7 +345,7 @@ public:
BitArray inputBits; BitArray inputBits;
for (int i = 0; i < inputPorts.size(); i++) for (int i = 0; i < inputPorts.size(); i++)
if (juce::jack_port_connected ((jack_port_t*) inputPorts [i]))
if (JUCE_NAMESPACE::jack_port_connected ((jack_port_t*) inputPorts [i]))
inputBits.setBit (i); inputBits.setBit (i);
return inputBits; return inputBits;
@@ -356,7 +356,7 @@ public:
int latency = 0; int latency = 0;
for (int i = 0; i < outputPorts.size(); i++) for (int i = 0; i < outputPorts.size(); i++)
latency = jmax (latency, (int) juce::jack_port_get_total_latency (client, (jack_port_t*) outputPorts [i]));
latency = jmax (latency, (int) JUCE_NAMESPACE::jack_port_get_total_latency (client, (jack_port_t*) outputPorts [i]));
return latency; return latency;
} }
@@ -366,7 +366,7 @@ public:
int latency = 0; int latency = 0;
for (int i = 0; i < inputPorts.size(); i++) for (int i = 0; i < inputPorts.size(); i++)
latency = jmax (latency, (int) juce::jack_port_get_total_latency (client, (jack_port_t*) inputPorts [i]));
latency = jmax (latency, (int) JUCE_NAMESPACE::jack_port_get_total_latency (client, (jack_port_t*) inputPorts [i]));
return latency; return latency;
} }
@@ -381,7 +381,7 @@ private:
for (i = 0; i < totalNumberOfInputChannels; ++i) for (i = 0; i < totalNumberOfInputChannels; ++i)
{ {
jack_default_audio_sample_t* in jack_default_audio_sample_t* in
= (jack_default_audio_sample_t*) juce::jack_port_get_buffer ((jack_port_t*) inputPorts.getUnchecked(i), numSamples);
= (jack_default_audio_sample_t*) JUCE_NAMESPACE::jack_port_get_buffer ((jack_port_t*) inputPorts.getUnchecked(i), numSamples);
if (in != 0) if (in != 0)
inChans [numActiveInChans++] = (float*) in; inChans [numActiveInChans++] = (float*) in;
@@ -390,7 +390,7 @@ private:
for (i = 0; i < totalNumberOfOutputChannels; ++i) for (i = 0; i < totalNumberOfOutputChannels; ++i)
{ {
jack_default_audio_sample_t* out jack_default_audio_sample_t* out
= (jack_default_audio_sample_t*) juce::jack_port_get_buffer ((jack_port_t*) outputPorts.getUnchecked(i), numSamples);
= (jack_default_audio_sample_t*) JUCE_NAMESPACE::jack_port_get_buffer ((jack_port_t*) outputPorts.getUnchecked(i), numSamples);
if (out != 0) if (out != 0)
outChans [numActiveOutChans++] = (float*) out; outChans [numActiveOutChans++] = (float*) out;
@@ -489,7 +489,7 @@ public:
// open a dummy client // open a dummy client
jack_status_t status; jack_status_t status;
jack_client_t* client = juce::jack_client_open ("JuceJackDummy", JackNoStartServer, &status);
jack_client_t* client = JUCE_NAMESPACE::jack_client_open ("JuceJackDummy", JackNoStartServer, &status);
if (client == 0) if (client == 0)
{ {
@@ -498,7 +498,7 @@ public:
else else
{ {
// scan for output devices // scan for output devices
const char** ports = juce::jack_get_ports (client, 0, 0, /* JackPortIsPhysical | */ JackPortIsOutput);
const char** ports = JUCE_NAMESPACE::jack_get_ports (client, 0, 0, /* JackPortIsPhysical | */ JackPortIsOutput);
if (ports != 0) if (ports != 0)
{ {
@@ -522,7 +522,7 @@ public:
} }
// scan for input devices // scan for input devices
ports = juce::jack_get_ports (client, 0, 0, /* JackPortIsPhysical | */ JackPortIsInput);
ports = JUCE_NAMESPACE::jack_get_ports (client, 0, 0, /* JackPortIsPhysical | */ JackPortIsInput);
if (ports != 0) if (ports != 0)
{ {
@@ -545,7 +545,7 @@ public:
free (ports); free (ports);
} }
juce::jack_client_close (client);
JUCE_NAMESPACE::jack_client_close (client);
} }
} }


+ 1
- 1
src/native/mac/juce_iphone_UIViewComponentPeer.mm View File

@@ -742,7 +742,7 @@ void UIViewComponentPeer::drawRect (CGRect r)
bool UIViewComponentPeer::canBecomeKeyWindow() bool UIViewComponentPeer::canBecomeKeyWindow()
{ {
return (getStyleFlags() & juce::ComponentPeer::windowIgnoresKeyPresses) == 0;
return (getStyleFlags() & JUCE_NAMESPACE::ComponentPeer::windowIgnoresKeyPresses) == 0;
} }
bool UIViewComponentPeer::windowShouldClose() bool UIViewComponentPeer::windowShouldClose()


+ 4
- 4
src/native/mac/juce_mac_NSViewComponentPeer.mm View File

@@ -543,10 +543,10 @@ END_JUCE_NAMESPACE
- (void) windowWillMove: (NSNotification*) notification - (void) windowWillMove: (NSNotification*) notification
{ {
if (juce::Component::getCurrentlyModalComponent() != 0
if (JUCE_NAMESPACE::Component::getCurrentlyModalComponent() != 0
&& owner->getComponent()->isCurrentlyBlockedByAnotherModalComponent() && owner->getComponent()->isCurrentlyBlockedByAnotherModalComponent()
&& (owner->getStyleFlags() & juce::ComponentPeer::windowHasTitleBar) != 0)
juce::Component::getCurrentlyModalComponent()->inputAttemptWhenModal();
&& (owner->getStyleFlags() & JUCE_NAMESPACE::ComponentPeer::windowHasTitleBar) != 0)
JUCE_NAMESPACE::Component::getCurrentlyModalComponent()->inputAttemptWhenModal();
} }
@end @end
@@ -1369,7 +1369,7 @@ void NSViewComponentPeer::drawRect (NSRect r)
bool NSViewComponentPeer::canBecomeKeyWindow() bool NSViewComponentPeer::canBecomeKeyWindow()
{ {
return (getStyleFlags() & juce::ComponentPeer::windowIgnoresKeyPresses) == 0;
return (getStyleFlags() & JUCE_NAMESPACE::ComponentPeer::windowIgnoresKeyPresses) == 0;
} }
bool NSViewComponentPeer::windowShouldClose() bool NSViewComponentPeer::windowShouldClose()


Loading…
Cancel
Save