Пример #1
0
    static void setUniqueIdForMidiPort (MIDIObjectRef device, const String& portName, bool isInput)
    {
        String portUniqueId;
       #if defined (JucePlugin_CFBundleIdentifier)
        portUniqueId = JUCE_STRINGIFY (JucePlugin_CFBundleIdentifier);
       #else
        File appBundle (File::getSpecialLocation (File::currentApplicationFile));
        CFURLRef bundleURL = CFURLCreateWithFileSystemPath (kCFAllocatorDefault, appBundle.getFullPathName().toCFString(), kCFURLPOSIXPathStyle, true);
        if (bundleURL != nullptr)
        {
            CFBundleRef bundleRef = CFBundleCreate (kCFAllocatorDefault, bundleURL);
            CFRelease (bundleURL);

            if (bundleRef != nullptr)
            {
                if (auto bundleId = CFBundleGetIdentifier (bundleRef))
                    portUniqueId = String::fromCFString (bundleId);

                CFRelease (bundleRef);
            }
        }
       #endif

        if (portUniqueId.isNotEmpty())
        {
            portUniqueId += (String ("." + portName + String (isInput ? ".input" : ".output")));

            CHECK_ERROR (MIDIObjectSetStringProperty (device, kMIDIPropertyUniqueID, portUniqueId.toCFString()));
        }
    }
Пример #2
0
String SystemStats::getJUCEVersion()
{
    // Some basic tests, to keep an eye on things and make sure these types work ok
    // on all platforms. Let me know if any of these assertions fail on your system!
    static_jassert (sizeof (pointer_sized_int) == sizeof (void*));
    static_jassert (sizeof (int8) == 1);
    static_jassert (sizeof (uint8) == 1);
    static_jassert (sizeof (int16) == 2);
    static_jassert (sizeof (uint16) == 2);
    static_jassert (sizeof (int32) == 4);
    static_jassert (sizeof (uint32) == 4);
    static_jassert (sizeof (int64) == 8);
    static_jassert (sizeof (uint64) == 8);

    return "JUCE v" JUCE_STRINGIFY(JUCE_MAJOR_VERSION)
                "." JUCE_STRINGIFY(JUCE_MINOR_VERSION)
                "." JUCE_STRINGIFY(JUCE_BUILDNUMBER);
}
Пример #3
0
LUCE_API int luaopen_luce_core_d (lua_State *L) {
#else
LUCE_API int luaopen_luce_core (lua_State *L) {
#endif
    LUA::Set(L);
    DBG("LUCE " JUCE_STRINGIFY(LUCE_VERSION_MAJOR) "." JUCE_STRINGIFY(LUCE_VERSION_MINOR));
    juce::JUCEApplicationBase::createInstance = &juce_CreateApplication;
    initialiseJuce_GUI();

    lua_newtable(L);
    int i = lua_gettop(L);
    for (int f = 0; luce_lib[f].name ; ++f ) {
        DBG(String("adding ") +luce_lib[f].name );
        lua_pushstring(L,luce_lib[f].name);
        lua_pushcfunction(L, luce_lib[f].func);
        lua_settable(L, i);
    }
    register_enums(L);
    return 1;
}
Пример #4
0
LUCE_API int luaopen_core(lua_State *L) {
    LUA::Set(L);
    DBG("LUCE " JUCE_STRINGIFY(LUCE_VERSION_MAJOR) "." JUCE_STRINGIFY(LUCE_VERSION_MINOR));
    juce::JUCEApplicationBase::createInstance = &juce_CreateApplication;

    // X11 requires this at this point, but OS X can't stand it this soon
    #if ! JUCE_MAC && ! JUCE_IOS && ! JUCE_ANDROID
    initialiseJuce_GUI();
    #endif

    #if LUA_VERSION_NUM > 501
    #ifdef DEBUG
    luaL_requiref(L, "luce.core", luaopen_luce_core_d, 1);
    #else
    luaL_requiref(L, "luce.core", luaopen_luce_core, 1);
    #endif
    #else
    luaL_register(L, "luce.core", luce_lib);
    register_enums(L);
    #endif

    return 0;
}
Пример #5
0
    static MemoryBlock createRequestHeader (const String& hostName, const int hostPort,
                                            const String& proxyName, const int proxyPort,
                                            const String& hostPath, const String& originalURL,
                                            const String& userHeaders, const MemoryBlock& postData,
                                            const bool isPost)
    {
        MemoryOutputStream header;

        if (proxyName.isEmpty())
            writeHost (header, isPost, hostPath, hostName, hostPort);
        else
            writeHost (header, isPost, originalURL, proxyName, proxyPort);

        writeValueIfNotPresent (header, userHeaders, "User-Agent:", "JUCE/" JUCE_STRINGIFY(JUCE_MAJOR_VERSION)
                                                                        "." JUCE_STRINGIFY(JUCE_MINOR_VERSION)
                                                                        "." JUCE_STRINGIFY(JUCE_BUILDNUMBER));
        writeValueIfNotPresent (header, userHeaders, "Connection:", "Close");
        writeValueIfNotPresent (header, userHeaders, "Content-Length:", String ((int) postData.getSize()));

        header << "\r\n" << userHeaders
               << "\r\n" << postData;

        return header.getMemoryBlock();
    }