@@ -31,6 +31,9 @@ | |||||
# include <xmmintrin.h> | # include <xmmintrin.h> | ||||
#endif | #endif | ||||
#include "AppConfig.h" | |||||
#include "juce_core/juce_core.h" | |||||
// must be last | // must be last | ||||
#include "jackbridge/JackBridge.hpp" | #include "jackbridge/JackBridge.hpp" | ||||
@@ -22,6 +22,9 @@ | |||||
#include "CarlaMathUtils.hpp" | #include "CarlaMathUtils.hpp" | ||||
#include "CarlaMIDI.h" | #include "CarlaMIDI.h" | ||||
#include "AppConfig.h" | |||||
#include "juce_audio_basics/juce_audio_basics.h" | |||||
using juce::AudioBuffer; | using juce::AudioBuffer; | ||||
using juce::FloatVectorOperations; | using juce::FloatVectorOperations; | ||||
using juce::MemoryBlock; | using juce::MemoryBlock; | ||||
@@ -26,7 +26,6 @@ | |||||
#include "CarlaStringList.hpp" | #include "CarlaStringList.hpp" | ||||
#include "jackey.h" | #include "jackey.h" | ||||
#include "juce_audio_basics/juce_audio_basics.h" | |||||
#ifdef __SSE2_MATH__ | #ifdef __SSE2_MATH__ | ||||
# include <xmmintrin.h> | # include <xmmintrin.h> | ||||
@@ -37,10 +36,6 @@ | |||||
#define URI_CANVAS_ICON "http://kxstudio.sf.net/ns/canvas/icon" | #define URI_CANVAS_ICON "http://kxstudio.sf.net/ns/canvas/icon" | ||||
using juce::FloatVectorOperations; | |||||
using juce::String; | |||||
using juce::StringArray; | |||||
CARLA_BACKEND_START_NAMESPACE | CARLA_BACKEND_START_NAMESPACE | ||||
class CarlaEngineJack; | class CarlaEngineJack; | ||||
@@ -137,7 +132,7 @@ public: | |||||
} | } | ||||
if (! kIsInput) | if (! kIsInput) | ||||
FloatVectorOperations::clear(fBuffer, static_cast<int>(bufferSize)); | |||||
carla_zeroFloats(fBuffer, static_cast<int>(bufferSize)); | |||||
} | } | ||||
void invalidate() noexcept | void invalidate() noexcept | ||||
@@ -229,7 +224,7 @@ public: | |||||
} | } | ||||
if (! kIsInput) | if (! kIsInput) | ||||
FloatVectorOperations::clear(fBuffer, static_cast<int>(bufferSize)); | |||||
carla_zeroFloats(fBuffer, static_cast<int>(bufferSize)); | |||||
} | } | ||||
void invalidate() noexcept | void invalidate() noexcept | ||||
@@ -1560,10 +1555,10 @@ protected: | |||||
if (pData->aboutToClose) | if (pData->aboutToClose) | ||||
{ | { | ||||
if (float* const audioOut1 = (float*)jackbridge_port_get_buffer(fRackPorts[kRackPortAudioOut1], nframes)) | if (float* const audioOut1 = (float*)jackbridge_port_get_buffer(fRackPorts[kRackPortAudioOut1], nframes)) | ||||
FloatVectorOperations::clear(audioOut1, static_cast<int>(nframes)); | |||||
carla_zeroFloats(audioOut1, nframes); | |||||
if (float* const audioOut2 = (float*)jackbridge_port_get_buffer(fRackPorts[kRackPortAudioOut2], nframes)) | if (float* const audioOut2 = (float*)jackbridge_port_get_buffer(fRackPorts[kRackPortAudioOut2], nframes)) | ||||
FloatVectorOperations::clear(audioOut2, static_cast<int>(nframes)); | |||||
carla_zeroFloats(audioOut2, nframes); | |||||
} | } | ||||
else if (pData->curPluginCount == 0) | else if (pData->curPluginCount == 0) | ||||
{ | { | ||||
@@ -1579,8 +1574,8 @@ protected: | |||||
CARLA_SAFE_ASSERT_RETURN(audioOut2 != nullptr,); | CARLA_SAFE_ASSERT_RETURN(audioOut2 != nullptr,); | ||||
// pass-through | // pass-through | ||||
FloatVectorOperations::copy(audioOut1, audioIn1, static_cast<int>(nframes)); | |||||
FloatVectorOperations::copy(audioOut2, audioIn2, static_cast<int>(nframes)); | |||||
carla_copyFloats(audioOut1, audioIn1, nframes); | |||||
carla_copyFloats(audioOut2, audioIn2, nframes); | |||||
// TODO pass-through MIDI as well | // TODO pass-through MIDI as well | ||||
if (void* const eventOut = jackbridge_port_get_buffer(fRackPorts[kRackPortEventOut], nframes)) | if (void* const eventOut = jackbridge_port_get_buffer(fRackPorts[kRackPortEventOut], nframes)) | ||||
@@ -2024,11 +2019,11 @@ private: | |||||
{ | { | ||||
CARLA_SAFE_ASSERT_RETURN(ourName != nullptr && ourName[0] != '\0',); | CARLA_SAFE_ASSERT_RETURN(ourName != nullptr && ourName[0] != '\0',); | ||||
StringArray parsedGroups; | |||||
CarlaStringList parsedGroups; | |||||
// add our client first | // add our client first | ||||
{ | { | ||||
parsedGroups.add(String(ourName)); | |||||
parsedGroups.append(ourName); | |||||
GroupNameToId groupNameToId; | GroupNameToId groupNameToId; | ||||
groupNameToId.setData(++fUsedGroups.lastId, ourName); | groupNameToId.setData(++fUsedGroups.lastId, ourName); | ||||
@@ -2061,9 +2056,7 @@ private: | |||||
CARLA_SAFE_ASSERT_CONTINUE(found); | CARLA_SAFE_ASSERT_CONTINUE(found); | ||||
String jGroupName(groupName.buffer()); | |||||
if (parsedGroups.contains(jGroupName)) | |||||
if (parsedGroups.contains(groupName)) | |||||
{ | { | ||||
groupId = fUsedGroups.getGroupId(groupName); | groupId = fUsedGroups.getGroupId(groupName); | ||||
CARLA_SAFE_ASSERT_CONTINUE(groupId > 0); | CARLA_SAFE_ASSERT_CONTINUE(groupId > 0); | ||||
@@ -2071,7 +2064,7 @@ private: | |||||
else | else | ||||
{ | { | ||||
groupId = ++fUsedGroups.lastId; | groupId = ++fUsedGroups.lastId; | ||||
parsedGroups.add(jGroupName); | |||||
parsedGroups.append(groupName); | |||||
int pluginId = -1; | int pluginId = -1; | ||||
PatchbayIcon icon = (jackPortFlags & JackPortIsPhysical) ? PATCHBAY_ICON_HARDWARE : PATCHBAY_ICON_APPLICATION; | PatchbayIcon icon = (jackPortFlags & JackPortIsPhysical) ? PATCHBAY_ICON_HARDWARE : PATCHBAY_ICON_APPLICATION; | ||||
@@ -34,6 +34,7 @@ | |||||
#include "CarlaHost.h" | #include "CarlaHost.h" | ||||
#include "CarlaNative.hpp" | #include "CarlaNative.hpp" | ||||
#include "AppConfig.h" | |||||
#include "juce_audio_basics/juce_audio_basics.h" | #include "juce_audio_basics/juce_audio_basics.h" | ||||
using juce::File; | using juce::File; | ||||
@@ -22,6 +22,7 @@ | |||||
#include "CarlaUtils.hpp" | #include "CarlaUtils.hpp" | ||||
#if defined(CARLA_OS_WIN) | #if defined(CARLA_OS_WIN) | ||||
# include "AppConfig.h" | |||||
# include "juce_core/juce_core.h" | # include "juce_core/juce_core.h" | ||||
#elif defined(HAVE_LIBMAGIC) | #elif defined(HAVE_LIBMAGIC) | ||||
# include <magic.h> | # include <magic.h> | ||||
@@ -129,10 +130,14 @@ BinaryType getBinaryTypeFromFile(const char* const filename) | |||||
if (std::strstr(output, "MS Windows") != nullptr) | if (std::strstr(output, "MS Windows") != nullptr) | ||||
if (std::strstr(output, "PE32 executable") != nullptr || std::strstr(output, "PE32+ executable") != nullptr) | if (std::strstr(output, "PE32 executable") != nullptr || std::strstr(output, "PE32+ executable") != nullptr) | ||||
return (std::strstr(output, "x86-64") != nullptr) ? BINARY_WIN64 : BINARY_WIN32; | |||||
return (std::strstr(output, "x86-64") != nullptr) | |||||
? BINARY_WIN64 | |||||
: BINARY_WIN32; | |||||
if (std::strstr(output, "ELF") != nullptr) | if (std::strstr(output, "ELF") != nullptr) | ||||
return (std::strstr(output, "x86-64") != nullptr || std::strstr(output, "aarch64") != nullptr) ? BINARY_POSIX64 : BINARY_POSIX32; | |||||
return (std::strstr(output, "x86-64") != nullptr || std::strstr(output, "aarch64") != nullptr) | |||||
? BINARY_POSIX64 | |||||
: BINARY_POSIX32; | |||||
#endif | #endif | ||||
return BINARY_NATIVE; | return BINARY_NATIVE; | ||||
@@ -21,11 +21,6 @@ | |||||
#include "CarlaEngine.hpp" | #include "CarlaEngine.hpp" | ||||
#include "CarlaUtils.hpp" | #include "CarlaUtils.hpp" | ||||
#include "CarlaMIDI.h" | |||||
#include "AppConfig.h" | |||||
#include "juce_audio_basics/juce_audio_basics.h" | |||||
CARLA_BACKEND_START_NAMESPACE | CARLA_BACKEND_START_NAMESPACE | ||||
// ----------------------------------------------------------------------- | // ----------------------------------------------------------------------- | ||||
@@ -115,94 +110,6 @@ const char* EngineControlEventType2Str(const EngineControlEventType type) noexce | |||||
return nullptr; | return nullptr; | ||||
} | } | ||||
// ----------------------------------------------------------------------- | |||||
static inline | |||||
void fillEngineEventsFromJuceMidiBuffer(EngineEvent engineEvents[kMaxEngineEventInternalCount], const juce::MidiBuffer& midiBuffer) | |||||
{ | |||||
const uint8_t* midiData; | |||||
int numBytes, sampleNumber; | |||||
ushort engineEventIndex = 0; | |||||
for (ushort i=0; i < kMaxEngineEventInternalCount; ++i) | |||||
{ | |||||
const EngineEvent& engineEvent(engineEvents[i]); | |||||
if (engineEvent.type != kEngineEventTypeNull) | |||||
continue; | |||||
engineEventIndex = i; | |||||
break; | |||||
} | |||||
for (juce::MidiBuffer::Iterator midiBufferIterator(midiBuffer); midiBufferIterator.getNextEvent(midiData, numBytes, sampleNumber) && engineEventIndex < kMaxEngineEventInternalCount;) | |||||
{ | |||||
CARLA_SAFE_ASSERT_CONTINUE(numBytes > 0); | |||||
CARLA_SAFE_ASSERT_CONTINUE(sampleNumber >= 0); | |||||
CARLA_SAFE_ASSERT_CONTINUE(numBytes < 0xFF /* uint8_t max */); | |||||
EngineEvent& engineEvent(engineEvents[engineEventIndex++]); | |||||
engineEvent.time = static_cast<uint32_t>(sampleNumber); | |||||
engineEvent.fillFromMidiData(static_cast<uint8_t>(numBytes), midiData, 0); | |||||
} | |||||
} | |||||
// ----------------------------------------------------------------------- | |||||
static inline | |||||
void fillJuceMidiBufferFromEngineEvents(juce::MidiBuffer& midiBuffer, const EngineEvent engineEvents[kMaxEngineEventInternalCount]) | |||||
{ | |||||
uint8_t size = 0; | |||||
uint8_t mdata[3] = { 0, 0, 0 }; | |||||
const uint8_t* mdataPtr = mdata; | |||||
uint8_t mdataTmp[EngineMidiEvent::kDataSize]; | |||||
for (ushort i=0; i < kMaxEngineEventInternalCount; ++i) | |||||
{ | |||||
const EngineEvent& engineEvent(engineEvents[i]); | |||||
if (engineEvent.type == kEngineEventTypeNull) | |||||
{ | |||||
break; | |||||
} | |||||
else if (engineEvent.type == kEngineEventTypeControl) | |||||
{ | |||||
const EngineControlEvent& ctrlEvent(engineEvent.ctrl); | |||||
ctrlEvent.convertToMidiData(engineEvent.channel, size, mdata); | |||||
mdataPtr = mdata; | |||||
} | |||||
else if (engineEvent.type == kEngineEventTypeMidi) | |||||
{ | |||||
const EngineMidiEvent& midiEvent(engineEvent.midi); | |||||
size = midiEvent.size; | |||||
if (size > EngineMidiEvent::kDataSize && midiEvent.dataExt != nullptr) | |||||
{ | |||||
mdataPtr = midiEvent.dataExt; | |||||
} | |||||
else | |||||
{ | |||||
// copy | |||||
carla_copy<uint8_t>(mdataTmp, midiEvent.data, size); | |||||
// add channel | |||||
mdataTmp[0] = static_cast<uint8_t>(mdataTmp[0] | (engineEvent.channel & MIDI_CHANNEL_BIT)); | |||||
// done | |||||
mdataPtr = mdataTmp; | |||||
} | |||||
} | |||||
else | |||||
{ | |||||
continue; | |||||
} | |||||
if (size > 0) | |||||
midiBuffer.addEvent(mdataPtr, static_cast<int>(size), static_cast<int>(engineEvent.time)); | |||||
} | |||||
} | |||||
// ------------------------------------------------------------------- | // ------------------------------------------------------------------- | ||||
// Helper classes | // Helper classes | ||||
@@ -202,12 +202,6 @@ private: | |||||
CARLA_PREVENT_HEAP_ALLOCATION | CARLA_PREVENT_HEAP_ALLOCATION | ||||
}; | }; | ||||
#ifdef CARLA_OS_WIN | |||||
namespace juce { | |||||
extern bool juce_isRunningInWine(); | |||||
} | |||||
#endif | |||||
//===================================================================================================================== | //===================================================================================================================== | ||||
#endif // CARLA_JUCE_UTILS_HPP_INCLUDED | #endif // CARLA_JUCE_UTILS_HPP_INCLUDED |
@@ -1,6 +1,6 @@ | |||||
/* | /* | ||||
* Carla patchbay utils | * Carla patchbay utils | ||||
* Copyright (C) 2011-2014 Filipe Coelho <falktx@falktx.com> | |||||
* Copyright (C) 2011-2017 Filipe Coelho <falktx@falktx.com> | |||||
* | * | ||||
* This program is free software; you can redistribute it and/or | * This program is free software; you can redistribute it and/or | ||||
* modify it under the terms of the GNU General Public License as | * modify it under the terms of the GNU General Public License as | ||||
@@ -1,6 +1,6 @@ | |||||
/* | /* | ||||
* Carla String List | * Carla String List | ||||
* Copyright (C) 2014 Filipe Coelho <falktx@falktx.com> | |||||
* Copyright (C) 2014-2017 Filipe Coelho <falktx@falktx.com> | |||||
* | * | ||||
* This program is free software; you can redistribute it and/or | * This program is free software; you can redistribute it and/or | ||||
* modify it under the terms of the GNU General Public License as | * modify it under the terms of the GNU General Public License as | ||||
@@ -261,6 +261,27 @@ public: | |||||
// ------------------------------------------------------------------- | // ------------------------------------------------------------------- | ||||
bool contains(const char* const string) noexcept | |||||
{ | |||||
CARLA_SAFE_ASSERT_RETURN(string != nullptr, false); | |||||
if (fCount == 0) | |||||
return false; | |||||
for (Itenerator it = begin2(); it.valid(); it.next()) | |||||
{ | |||||
const char* const stringComp(it.getValue(nullptr)); | |||||
CARLA_SAFE_ASSERT_CONTINUE(stringComp != nullptr); | |||||
if (std::strcmp(string, stringComp) == 0) | |||||
return true; | |||||
} | |||||
return false; | |||||
} | |||||
// ------------------------------------------------------------------- | |||||
void remove(Itenerator& it) noexcept | void remove(Itenerator& it) noexcept | ||||
{ | { | ||||
if (const char* const string = it.getValue(nullptr)) | if (const char* const string = it.getValue(nullptr)) | ||||