Browse Source

Unicode fixes, closes #178

tags/1.9.6
falkTX 10 years ago
parent
commit
8a7c50ae05
7 changed files with 40 additions and 38 deletions
  1. +9
    -4
      source/backend/engine/CarlaEngine.cpp
  2. +5
    -2
      source/backend/plugin/CarlaPlugin.cpp
  3. +12
    -10
      source/bridges-plugin/CarlaBridgePlugin.cpp
  4. +2
    -0
      source/carla_app.py
  5. +5
    -2
      source/discovery/carla-discovery.cpp
  6. +3
    -12
      source/native-plugins/audio-file.cpp
  7. +4
    -8
      source/native-plugins/midi-file.cpp

+ 9
- 4
source/backend/engine/CarlaEngine.cpp View File

@@ -36,6 +36,7 @@
#include "jackbridge/JackBridge.hpp"
#include "juce_core.h"

using juce::CharPointer_UTF8;
using juce::File;
using juce::MemoryOutputStream;
using juce::ScopedPointer;
@@ -405,7 +406,8 @@ bool CarlaEngine::addPlugin(const BinaryType btype, const PluginType ptype, cons
// fallback to dssi-vst if possible
else if (btype == BINARY_WIN32 && File("/usr/lib/dssi/dssi-vst.so").existsAsFile())
{
File file(filename);
const String jfilename = String(CharPointer_UTF8(filename));
File file(jfilename);

CarlaString label2(file.getFileName().toRawUTF8());
label2.replace(' ', '*');
@@ -910,7 +912,8 @@ bool CarlaEngine::loadFile(const char* const filename)
CARLA_SAFE_ASSERT_RETURN_ERR(filename != nullptr && filename[0] != '\0', "Invalid filename");
carla_debug("CarlaEngine::loadFile(\"%s\")", filename);

File file(filename);
const String jfilename = String(CharPointer_UTF8(filename));
File file(jfilename);
CARLA_SAFE_ASSERT_RETURN_ERR(file.existsAsFile(), "Requested file does not exist or is not a readable file");

CarlaString baseName(file.getFileName().toRawUTF8());
@@ -989,7 +992,8 @@ bool CarlaEngine::loadProject(const char* const filename)
CARLA_SAFE_ASSERT_RETURN_ERR(filename != nullptr && filename[0] != '\0', "Invalid filename");
carla_debug("CarlaEngine::loadProject(\"%s\")", filename);

File file(filename);
const String jfilename = String(CharPointer_UTF8(filename));
File file(jfilename);
CARLA_SAFE_ASSERT_RETURN_ERR(file.existsAsFile(), "Requested file does not exist or is not a readable file");

XmlDocument xml(file);
@@ -1004,7 +1008,8 @@ bool CarlaEngine::saveProject(const char* const filename)
MemoryOutputStream out;
saveProjectInternal(out);

File file(filename);
const String jfilename = String(CharPointer_UTF8(filename));
File file(jfilename);

if (file.replaceWithData(out.getData(), out.getDataSize()))
return true;


+ 5
- 2
source/backend/plugin/CarlaPlugin.cpp View File

@@ -27,6 +27,7 @@

#include "juce_core.h"

using juce::CharPointer_UTF8;
using juce::File;
using juce::MemoryOutputStream;
using juce::ScopedPointer;
@@ -859,7 +860,8 @@ bool CarlaPlugin::saveStateToFile(const char* const filename)
out << getStateSave().toString();
out << "</CARLA-PRESET>\n";

File file(filename);
const String jfilename = String(CharPointer_UTF8(filename));
File file(jfilename);

if (file.replaceWithData(out.getData(), out.getDataSize()))
return true;
@@ -873,7 +875,8 @@ bool CarlaPlugin::loadStateFromFile(const char* const filename)
CARLA_SAFE_ASSERT_RETURN(filename != nullptr && filename[0] != '\0', false);
carla_debug("CarlaPlugin::loadStateFromFile(\"%s\")", filename);

File file(filename);
const String jfilename = String(CharPointer_UTF8(filename));
File file(jfilename);
CARLA_SAFE_ASSERT_RETURN(file.existsAsFile(), false);

XmlDocument xml(file);


+ 12
- 10
source/bridges-plugin/CarlaBridgePlugin.cpp View File

@@ -38,6 +38,7 @@ using CarlaBackend::CarlaEngine;
using CarlaBackend::EngineCallbackOpcode;
using CarlaBackend::EngineCallbackOpcode2Str;

using juce::CharPointer_UTF8;
using juce::File;
using juce::String;

@@ -99,7 +100,7 @@ static void initSignalHandler()

// -------------------------------------------------------------------------

static CarlaString gProjectFilename;
static String gProjectFilename;

static void gIdle()
{
@@ -111,7 +112,7 @@ static void gIdle()

if (gProjectFilename.isNotEmpty())
{
if (! carla_save_plugin_state(0, gProjectFilename))
if (! carla_save_plugin_state(0, gProjectFilename.toRawUTF8()))
carla_stderr("Plugin preset save failed, error was:\n%s", carla_get_last_error());
}
}
@@ -171,7 +172,6 @@ public:
CarlaBridgePlugin(const bool useBridge, const char* const clientName, const char* const audioPoolBaseName,
const char* const rtClientBaseName, const char* const nonRtClientBaseName, const char* const nonRtServerBaseName)
: fEngine(nullptr),
fProjFilename(),
fUsingBridge(false),
leakDetector_CarlaBridgePlugin()
{
@@ -211,13 +211,13 @@ public:
const CarlaPluginInfo* const pInfo(carla_get_plugin_info(0));
CARLA_SAFE_ASSERT_RETURN(pInfo != nullptr,);

fProjFilename = pInfo->name;
fProjFilename += ".carxs";
gProjectFilename = CharPointer_UTF8(pInfo->name);
gProjectFilename += ".carxs";

if (! File::isAbsolutePath(fProjFilename))
fProjFilename = File::getCurrentWorkingDirectory().getChildFile(fProjFilename).getFullPathName();
if (! File::isAbsolutePath(gProjectFilename))
gProjectFilename = File::getCurrentWorkingDirectory().getChildFile(gProjectFilename).getFullPathName();

if (File(fProjFilename).existsAsFile() && ! carla_load_plugin_state(0, fProjFilename.toRawUTF8()))
if (File(gProjectFilename).existsAsFile() && ! carla_load_plugin_state(0, gProjectFilename.toRawUTF8()))
carla_stderr("Plugin preset load failed, error was:\n%s", carla_get_last_error());
}

@@ -268,7 +268,6 @@ protected:

private:
const CarlaEngine* fEngine;
String fProjFilename;
bool fUsingBridge;

static void callback(void* ptr, EngineCallbackOpcode action, unsigned int pluginId, int value1, int value2, float value3, const char* valueStr)
@@ -364,7 +363,10 @@ int main(int argc, char* argv[])
CarlaString clientName(name != nullptr ? name : label);

if (clientName.isEmpty())
clientName = juce::File(filename).getFileNameWithoutExtension().toRawUTF8();
{
const String jfilename = String(CharPointer_UTF8(filename));
clientName = File(jfilename).getFileNameWithoutExtension().toRawUTF8();
}

// ---------------------------------------------------------------------
// Set extraStuff


+ 2
- 0
source/carla_app.py View File

@@ -224,6 +224,8 @@ class CarlaApplication(object):
print("Using \"%s\" theme" % self.fApp.style().objectName())

def arguments(self):
# FIXME - PyQt mishandles unicode characters, we'll use direct sys.argv for now
return sys.argv
return self.fApp.arguments()

def exec_(self):


+ 5
- 2
source/discovery/carla-discovery.cpp View File

@@ -46,6 +46,7 @@
#include <iostream>

#include "juce_core.h"
using juce::CharPointer_UTF8;
using juce::File;
using juce::String;
using juce::StringArray;
@@ -1495,7 +1496,8 @@ static void do_juce_check(const char* const filename_, const char* const stype,
static void do_fluidsynth_check(const char* const filename, const bool doInit)
{
#ifdef HAVE_FLUIDSYNTH
const File file(filename);
const String jfilename = String(CharPointer_UTF8(filename));
const File file(jfilename);

if (! file.existsAsFile())
{
@@ -1584,7 +1586,8 @@ static void do_fluidsynth_check(const char* const filename, const bool doInit)
static void do_linuxsampler_check(const char* const filename, const char* const stype, const bool doInit)
{
#ifdef HAVE_LINUXSAMPLER
const File file(filename);
const String jfilename = String(CharPointer_UTF8(filename));
const File file(jfilename);

if (! file.existsAsFile())
{


+ 3
- 12
source/native-plugins/audio-file.cpp View File

@@ -22,17 +22,7 @@

#include "juce_audio_formats.h"

using juce::AudioFormat;
using juce::AudioFormatManager;
using juce::AudioFormatReader;
using juce::AudioFormatReaderSource;
using juce::AudioSampleBuffer;
using juce::BufferingAudioReader;
using juce::File;
using juce::FloatVectorOperations;
using juce::MemoryMappedAudioFormatReader;
using juce::ScopedPointer;
using juce::TimeSliceThread;
using namespace juce;

// -----------------------------------------------------------------------

@@ -245,7 +235,8 @@ private:
delete reader;
}

File file(filename);
const String jfilename = String(CharPointer_UTF8(filename));
File file(jfilename);

if (! file.existsAsFile())
return;


+ 4
- 8
source/native-plugins/midi-file.cpp View File

@@ -124,14 +124,10 @@ private:
{
fMidiOut.clear();

using juce::File;
using juce::FileInputStream;
using juce::MidiFile;
using juce::MidiMessage;
using juce::MidiMessageSequence;
using juce::ScopedPointer;

File file(filename);
using namespace juce;

const String jfilename = String(CharPointer_UTF8(filename));
File file(jfilename);

if (! file.existsAsFile())
return;


Loading…
Cancel
Save