'libs/ardour' - Platform specific changes and includes
authorJohn Emmas <johne53@tiscali.co.uk>
Sun, 4 Aug 2013 18:03:32 +0000 (19:03 +0100)
committerJohn Emmas <johne53@tiscali.co.uk>
Sun, 4 Aug 2013 18:03:32 +0000 (19:03 +0100)
19 files changed:
libs/ardour/ardour/audioengine.h
libs/ardour/ardour/butler.h
libs/ardour/audioengine.cc
libs/ardour/butler.cc
libs/ardour/file_source.cc
libs/ardour/filesystem_paths.cc
libs/ardour/globals.cc
libs/ardour/io.cc
libs/ardour/jack_utils.cc
libs/ardour/ladspa_search_path.cc
libs/ardour/lv2_plugin.cc
libs/ardour/midi_ui.cc
libs/ardour/port.cc
libs/ardour/port_insert.cc
libs/ardour/resampled_source.cc
libs/ardour/route.cc
libs/ardour/sndfilesource.cc
libs/ardour/test/jack_utils_test.cc
libs/ardour/test/test_common.cc

index 10400c41d759c5acef966c2647d72a4fc31fe616..ec31dd1ac23fb52e4228a63b481b0f65f11e8c4f 100644 (file)
@@ -37,7 +37,7 @@
 #include "pbd/signals.h"
 #include "pbd/stacktrace.h"
 
-#ifndef WIN32
+#ifndef PLATFORM_WINDOWS
 #include <jack/weakjack.h>
 #endif
 
index 97020bed66e710308b935cb00df1aae0a1ddb65f..226aacbbaddae54b9a24d34b186f751b3d8e1602 100644 (file)
@@ -24,7 +24,7 @@
 
 #include <glibmm/threads.h>
 
-#ifdef WIN32
+#ifdef PLATFORM_WINDOWS
 #include "pbd/glib_semaphore.h"
 #endif
 
@@ -84,7 +84,7 @@ class Butler : public SessionHandleRef
        uint32_t     midi_dstream_buffer_size;
        RingBuffer<CrossThreadPool*> pool_trash;
 
-#ifdef WIN32
+#ifdef PLATFORM_WINDOWS
        PBD::atomic_counter m_request_state;
        PBD::GlibSemaphore   m_request_sem;
 #else
@@ -95,7 +95,7 @@ private:
        void empty_pool_trash ();
        void config_changed (std::string);
 
-#ifndef WIN32
+#ifndef PLATFORM_WINDOWS
        int setup_request_pipe ();
 #endif
 
index 583ed1ae820bf2d03cf804a608688dadb57e6da8..79a5125606fa91225763c38fa65cefb235e038fa 100644 (file)
@@ -1568,7 +1568,7 @@ AudioEngine::stop_process_thread (jack_native_thread_t thread)
         * Jack 2 _jack arg is not used so it should be OK
         */
 
-#if defined(USING_JACK2_EXPANSION_OF_JACK_API) || defined(WIN32)
+#if defined(USING_JACK2_EXPANSION_OF_JACK_API) || defined(PLATFORM_WINDOWS)
        if (jack_client_stop_thread (_jack, thread) != 0) {
                error << "AudioEngine: cannot stop process thread" << endmsg;
                return false;
index 2998314443ec49b6d228c80c36a61bcc6ed1fd5c..747dfcd575dc164c02ee04b29b896871bfad035e 100644 (file)
@@ -21,7 +21,7 @@
 #include <fcntl.h>
 #include <unistd.h>
 
-#ifndef WIN32
+#ifndef PLATFORM_WINDOWS
 #include <poll.h>
 #endif
 
@@ -72,7 +72,7 @@ Butler::config_changed (std::string p)
         }
 }
 
-#ifndef WIN32
+#ifndef PLATFORM_WINDOWS
 int
 Butler::setup_request_pipe ()
 {
@@ -116,7 +116,7 @@ Butler::start_thread()
 
        should_run = false;
 
-#ifndef WIN32
+#ifndef PLATFORM_WINDOWS
        if (setup_request_pipe() != 0) return -1;
 #endif
 
@@ -149,7 +149,7 @@ Butler::_thread_work (void* arg)
 bool
 Butler::wait_for_requests ()
 {
-#ifndef WIN32
+#ifndef PLATFORM_WINDOWS
        struct pollfd pfd[1];
 
        pfd[0].fd = request_pipe[0];
@@ -187,7 +187,7 @@ Butler::wait_for_requests ()
 bool
 Butler::dequeue_request (Request::Type& r)
 {
-#ifndef WIN32
+#ifndef PLATFORM_WINDOWS
        char req;
        size_t nread = ::read (request_pipe[0], &req, sizeof (req));
        if (nread == 1) {
@@ -221,7 +221,7 @@ Butler::thread_work ()
                                Request::Type req;
 
                                /* empty the pipe of all current requests */
-#ifdef WIN32
+#ifdef PLATFORM_WINDOWS
                                dequeue_request (req);
                                {
 #else
@@ -387,7 +387,7 @@ Butler::schedule_transport_work ()
 void
 Butler::queue_request (Request::Type r)
 {
-#ifndef WIN32
+#ifndef PLATFORM_WINDOWS
        char c = r;
        (void) ::write (request_pipe[1], &c, 1);
 #else
index c7b03cbdb756fe8f989103fe7cd12a121e68f6d2..e06b3d624ef09adadc3b7f3131be8074d9fbe4bf 100644 (file)
@@ -487,7 +487,7 @@ FileSource::find_2X (Session& s, DataType type, const string& path, bool must_ex
                                goto out;
                        }
 
-#ifndef WIN32
+#ifndef PLATFORM_WINDOWS
                        if (errno != ENOENT) {
                                error << string_compose(
                                                _("Filesource: cannot check for existing file (%1): %2"),
index 4c7e996e462830efab0289a1ee69a08316817b65..8d48ea3068ec3458528f36bb1cd45002c53b609f 100644 (file)
@@ -86,7 +86,7 @@ user_config_directory ()
 std::string
 ardour_dll_directory ()
 {
-#ifdef WIN32
+#ifdef PLATFORM_WINDOWS
        std::string dll_dir_path(g_win32_get_package_installation_directory_of_module(NULL));
        dll_dir_path = Glib::build_filename (dll_dir_path, "lib");
        return Glib::build_filename (dll_dir_path, "ardour3");
@@ -100,7 +100,7 @@ ardour_dll_directory ()
 #endif
 }
 
-#ifdef WIN32
+#ifdef PLATFORM_WINDOWS
 SearchPath
 windows_search_path ()
 {
@@ -117,7 +117,7 @@ ardour_config_search_path ()
 
        if (search_path.empty()) {
                search_path += user_config_directory();
-#ifdef WIN32
+#ifdef PLATFORM_WINDOWS
                search_path += windows_search_path ();
 #else
                std::string s = Glib::getenv("ARDOUR_CONFIG_PATH");
@@ -140,7 +140,7 @@ ardour_data_search_path ()
 
        if (search_path.empty()) {
                search_path += user_config_directory();
-#ifdef WIN32
+#ifdef PLATFORM_WINDOWS
                search_path += windows_search_path ();
 #else
                std::string s = Glib::getenv("ARDOUR_DATA_PATH");
index c0fca7c7a017d295b9926aa5126fe2cf3a99026e..57b1e2db65b14f42b4caf49c936a27a472f26676 100644 (file)
@@ -29,7 +29,7 @@
 #include <sys/stat.h>
 #include <sys/types.h>
 #include <sys/time.h>
-#ifndef WIN32
+#ifndef PLATFORM_WINDOWS
 #include <sys/resource.h>
 #endif
 #include <unistd.h>
@@ -201,7 +201,7 @@ setup_hardware_optimization (bool try_optimization)
 static void
 lotsa_files_please ()
 {
-#ifndef WIN32
+#ifndef PLATFORM_WINDOWS
        struct rlimit rl;
 
        if (getrlimit (RLIMIT_NOFILE, &rl) == 0) {
index 4498e4fbd87759d61d07f610c79f03e1f42be923..c7bf163d2798a4f57eec4f685b1e637f6cdff139 100644 (file)
@@ -396,7 +396,7 @@ IO::disconnect (void* src)
 int
 IO::ensure_ports_locked (ChanCount count, bool clear, bool& changed)
 {
-#ifndef WIN32
+#ifndef PLATFORM_WINDOWS
        assert (!AudioEngine::instance()->process_lock().trylock());
 #endif
 
@@ -469,7 +469,7 @@ IO::ensure_ports_locked (ChanCount count, bool clear, bool& changed)
 int
 IO::ensure_ports (ChanCount count, bool clear, void* src)
 {
-#ifndef WIN32
+#ifndef PLATFORM_WINDOWS
        assert (!AudioEngine::instance()->process_lock().trylock());
 #endif
 
@@ -506,7 +506,7 @@ IO::ensure_ports (ChanCount count, bool clear, void* src)
 int
 IO::ensure_io (ChanCount count, bool clear, void* src)
 {
-#ifndef WIN32
+#ifndef PLATFORM_WINDOWS
        assert (!AudioEngine::instance()->process_lock().trylock());
 #endif
 
index 29f7ca4f3e446928737cb16bda995ebc05727fbc..1b94c2f3f724295fb3aa54caec8b97cfb89ac2d6 100644 (file)
@@ -105,7 +105,7 @@ get_none_string ()
 void
 ARDOUR::get_jack_audio_driver_names (vector<string>& audio_driver_names)
 {
-#ifdef WIN32
+#ifdef PLATFORM_WINDOWS
        audio_driver_names.push_back (portaudio_driver_name);
 #elif __APPLE__
        audio_driver_names.push_back (coreaudio_driver_name);
@@ -133,7 +133,7 @@ void
 ARDOUR::get_jack_midi_system_names (const string& driver, vector<string>& midi_system_names)
 {
        midi_system_names.push_back (get_none_string ());
-#ifdef WIN32
+#ifdef PLATFORM_WINDOWS
        midi_system_names.push_back (winmme_midi_driver_name);
 #elif __APPLE__
        midi_system_names.push_back (coreaudio_midi_driver_name);
@@ -563,7 +563,7 @@ ARDOUR::get_jack_audio_driver_supports_setting_period_count (const string& drive
 bool
 ARDOUR::get_jack_server_application_names (std::vector<std::string>& server_names)
 {
-#ifdef WIN32
+#ifdef PLATFORM_WINDOWS
        server_names.push_back ("jackd.exe");
 #else
        server_names.push_back ("jackd");
@@ -600,7 +600,7 @@ ARDOUR::get_jack_server_dir_paths (vector<std::string>& server_dir_paths)
 
        SearchPath sp(string(g_getenv("PATH")));
 
-#ifdef WIN32
+#ifdef PLATFORM_WINDOWS
        gchar *install_dir = g_win32_get_package_installation_directory_of_module (NULL);
        if (install_dir) {
                sp.push_back (install_dir);
@@ -708,7 +708,7 @@ ARDOUR::get_jack_command_line_string (const JackCommandLineOptions& options, str
 
        args.push_back (options.server_path);
 
-#ifdef WIN32
+#ifdef PLATFORM_WINDOWS
        // must use sync mode on windows
        args.push_back ("-S");
 
@@ -749,7 +749,7 @@ ARDOUR::get_jack_command_line_string (const JackCommandLineOptions& options, str
                args.push_back ("-v");
        }
 
-#ifndef WIN32
+#ifndef PLATFORM_WINDOWS
        if (options.temporary) {
                args.push_back ("-T");
        }
@@ -863,7 +863,7 @@ ARDOUR::get_jack_command_line_string (const JackCommandLineOptions& options, str
        ostringstream oss;
 
        for (vector<string>::const_iterator i = args.begin(); i != args.end();) {
-#ifdef WIN32
+#ifdef PLATFORM_WINDOWS
                oss << quote_string (*i);
 #else
                oss << *i;
@@ -911,7 +911,7 @@ ARDOUR::write_jack_config_file (const std::string& config_file_path, const strin
 bool
 ARDOUR::start_jack_server (const string& command_line)
 {
-#ifdef WIN32
+#ifdef PLATFORM_WINDOWS
        STARTUPINFO si;
        PROCESS_INFORMATION pi;
        char * cmdline = g_strdup (command_line.c_str());
index 6ecc1557a3a7c011c84bc1b2d8af327976b39b66..769e5cd6176a9cb7f720a09402e40f212b5babe0 100644 (file)
@@ -43,7 +43,7 @@ ladspa_search_path ()
        spath += ardour_dll_directory ();
        spath.add_subdirectory_to_paths (ladspa_dir_name);
 
-#ifndef WIN32
+#ifndef PLATFORM_WINDOWS
        spath.push_back ("/usr/local/lib64/ladspa");
        spath.push_back ("/usr/local/lib/ladspa");
        spath.push_back ("/usr/lib64/ladspa");
index 4f1f9b96776deb4fbecab1baa3efcb5540a6dcd6..4ae1c7b4524a61e6635d1af18e27e8ee252f2042 100644 (file)
@@ -1983,7 +1983,7 @@ LV2World::load_bundled_plugins()
                vector<string *> *plugin_objects = scanner (ARDOUR::lv2_bundled_search_path().to_string(), lv2_filter, 0, true, true);
                if (plugin_objects) {
                        for ( vector<string *>::iterator x = plugin_objects->begin(); x != plugin_objects->end (); ++x) {
-#ifdef WINDOWS
+#ifdef PLATFORM_WINDOWS
                                string uri = "file:///" + **x + "/";
 #else
                                string uri = "file://" + **x + "/";
index 82261b58ec05cfb28507cadc1cb1307ed95a0393..5822cc509e9be9f7c89c28695df26b21dde99f5c 100644 (file)
@@ -104,7 +104,7 @@ MidiControlUI::midi_input_handler (IOCondition ioc, MIDI::Port* port)
 
        if (ioc & IO_IN) {
 
-#ifndef WIN32
+#ifndef PLATFORM_WINDOWS
                CrossThreadChannel::drain (port->selectable());
 #endif
 
index a1eacca96eac5a87b3b88abd8c7d958c3238a969..0f28b31b579b8626c9c82e447e63298ac6c54cfb 100644 (file)
@@ -21,7 +21,7 @@
 #include "libardour-config.h"
 #endif
 
-#ifndef WIN32
+#ifndef PLATFORM_WINDOWS
 #include <jack/weakjack.h> // so that we can test for new functions at runtime
 #endif
 
index e7ff69040d60d3e1f4743082d01d3dced60c99fb..b2758b2d57249353dd7755d4c4b4df9b1ca10dc6 100644 (file)
@@ -250,7 +250,7 @@ PortInsert::signal_latency() const
 bool
 PortInsert::configure_io (ChanCount in, ChanCount out)
 {
-#ifndef WIN32
+#ifndef PLATFORM_WINDOWS
        assert (!AudioEngine::instance()->process_lock().trylock());
 #endif
 
index 6184e1a3d636879fabdfc6d32d63de363df53141..0a8131910827fefd5817ae76ece8619d572cdead 100644 (file)
 using namespace ARDOUR;
 using namespace PBD;
 
+#ifdef PLATFORM_WINDOWS
+const uint32_t ResampledImportableSource::blocksize = 524288U;
+#else
 const uint32_t ResampledImportableSource::blocksize = 16384U;
+#endif
 
 ResampledImportableSource::ResampledImportableSource (boost::shared_ptr<ImportableSource> src, framecnt_t rate, SrcQuality srcq)
        : source (src)
index 0fbd3348796adade78c935efbcc683563f907a79..bb25c1f9b0a0ceb5341ed568ff02d4158233bcb0 100644 (file)
@@ -1614,7 +1614,7 @@ Route::reset_instrument_info ()
 int
 Route::configure_processors (ProcessorStreams* err)
 {
-#ifndef WIN32
+#ifndef PLATFORM_WINDOWS
        assert (!AudioEngine::instance()->process_lock().trylock());
 #endif
 
@@ -1687,7 +1687,7 @@ Route::try_configure_processors_unlocked (ChanCount in, ProcessorStreams* err)
 int
 Route::configure_processors_unlocked (ProcessorStreams* err)
 {
-#ifndef WIN32
+#ifndef PLATFORM_WINDOWS
        assert (!AudioEngine::instance()->process_lock().trylock());
 #endif
 
index 2aae84085a42bb2d54471ded483407768875bd43..b5d821ffda62d8d7f47ed8d2f138edc7a1ab7dab 100644 (file)
@@ -28,6 +28,9 @@
 
 #include <sys/stat.h>
 
+#ifdef PLATFORM_WINDOWS
+#include <glibmm/convert.h>
+#endif
 #include <glibmm/miscutils.h>
 
 #include "ardour/sndfilesource.h"
@@ -182,22 +185,30 @@ SndFileSource::init_sndfile ()
 int
 SndFileSource::open ()
 {
-       _descriptor = new SndFileDescriptor (_path, writable(), &_info);
+       string path_to_open;
+
+#ifdef PLATFORM_WINDOWS
+       path_to_open = Glib::locale_from_utf8(_path);
+#else
+       path_to_open = _path;
+#endif
+
+       _descriptor = new SndFileDescriptor (path_to_open.c_str(), writable(), &_info);
        _descriptor->Closed.connect_same_thread (file_manager_connection, boost::bind (&SndFileSource::file_closed, this));
        SNDFILE* sf = _descriptor->allocate ();
 
        if (sf == 0) {
-               char errbuf[256];
+               char errbuf[1024];
                sf_error_str (0, errbuf, sizeof (errbuf) - 1);
 #ifndef HAVE_COREAUDIO
                /* if we have CoreAudio, we will be falling back to that if libsndfile fails,
                   so we don't want to see this message.
                */
 
-                cerr << "failed to open " << _path << " with name " << _name << endl;
+                cerr << "failed to open " << path_to_open << " with name " << _name << endl;
 
                error << string_compose(_("SndFileSource: cannot open file \"%1\" for %2 (%3)"),
-                                       _path, (writable() ? "read+write" : "reading"), errbuf) << endmsg;
+                                       path_to_open, (writable() ? "read+write" : "reading"), errbuf) << endmsg;
 #endif
                return -1;
        }
@@ -251,7 +262,7 @@ SndFileSource::open ()
 
                         if (!_broadcast_info->write_to_file (sf)) {
                                 error << string_compose (_("cannot set broadcast info for audio file %1 (%2); dropping broadcast info for this file"),
-                                                         _path, _broadcast_info->get_error())
+                                                         path_to_open, _broadcast_info->get_error())
                                       << endmsg;
                                 _flags = Flag (_flags & ~Broadcast);
                                 delete _broadcast_info;
index ed80237f78692d6a6ac25b1671dadb9c8c588664..ce92955b7d94bf0de8377eb5fa56ef384258166c 100644 (file)
@@ -1,7 +1,7 @@
 
 #include <stdexcept>
 
-#ifdef WIN32
+#ifdef PLATFORM_WINDOWS
 #include <windows.h> // only for Sleep
 #endif
 
@@ -274,7 +274,7 @@ JackUtilsTest::test_command_line ()
 void
 JackUtilsTest::test_start_server ()
 {
-#ifdef WIN32
+#ifdef PLATFORM_WINDOWS
        cout << endl;
 
        JackCommandLineOptions options;
index 8364d91be17dd47344c001fb2be1db193dedff0b..68039b289bc9e23ecf9d4679df11a384076423b8 100644 (file)
@@ -28,7 +28,7 @@ using namespace std;
 PBD::SearchPath
 test_search_path ()
 {
-#ifdef WIN32
+#ifdef PLATFORM_WINDOWS
        std::string wsp(g_win32_get_package_installation_directory_of_module(NULL));
        return Glib::build_filename (wsp, "ardour_testdata");
 #else