summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Emmas <johne53@tiscali.co.uk>2013-08-04 19:03:32 +0100
committerJohn Emmas <johne53@tiscali.co.uk>2013-08-04 19:03:32 +0100
commit0dc8806ee473f96d1f480f7a50b7a39efaf6d90a (patch)
tree2b82ec97fb14c89fe1316561c950def46e5aa85d
parentd176cbc80476cdc8ca082631efc171ea39116d63 (diff)
'libs/ardour' - Platform specific changes and includes
-rw-r--r--libs/ardour/ardour/audioengine.h2
-rw-r--r--libs/ardour/ardour/butler.h6
-rw-r--r--libs/ardour/audioengine.cc2
-rw-r--r--libs/ardour/butler.cc14
-rw-r--r--libs/ardour/file_source.cc2
-rw-r--r--libs/ardour/filesystem_paths.cc8
-rw-r--r--libs/ardour/globals.cc4
-rw-r--r--libs/ardour/io.cc6
-rw-r--r--libs/ardour/jack_utils.cc16
-rw-r--r--libs/ardour/ladspa_search_path.cc2
-rw-r--r--libs/ardour/lv2_plugin.cc2
-rw-r--r--libs/ardour/midi_ui.cc2
-rw-r--r--libs/ardour/port.cc2
-rw-r--r--libs/ardour/port_insert.cc2
-rw-r--r--libs/ardour/resampled_source.cc4
-rw-r--r--libs/ardour/route.cc4
-rw-r--r--libs/ardour/sndfilesource.cc21
-rw-r--r--libs/ardour/test/jack_utils_test.cc4
-rw-r--r--libs/ardour/test/test_common.cc2
19 files changed, 60 insertions, 45 deletions
diff --git a/libs/ardour/ardour/audioengine.h b/libs/ardour/ardour/audioengine.h
index 10400c41d7..ec31dd1ac2 100644
--- a/libs/ardour/ardour/audioengine.h
+++ b/libs/ardour/ardour/audioengine.h
@@ -37,7 +37,7 @@
#include "pbd/signals.h"
#include "pbd/stacktrace.h"
-#ifndef WIN32
+#ifndef PLATFORM_WINDOWS
#include <jack/weakjack.h>
#endif
diff --git a/libs/ardour/ardour/butler.h b/libs/ardour/ardour/butler.h
index 97020bed66..226aacbbad 100644
--- a/libs/ardour/ardour/butler.h
+++ b/libs/ardour/ardour/butler.h
@@ -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
diff --git a/libs/ardour/audioengine.cc b/libs/ardour/audioengine.cc
index 583ed1ae82..79a5125606 100644
--- a/libs/ardour/audioengine.cc
+++ b/libs/ardour/audioengine.cc
@@ -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;
diff --git a/libs/ardour/butler.cc b/libs/ardour/butler.cc
index 2998314443..747dfcd575 100644
--- a/libs/ardour/butler.cc
+++ b/libs/ardour/butler.cc
@@ -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
diff --git a/libs/ardour/file_source.cc b/libs/ardour/file_source.cc
index c7b03cbdb7..e06b3d624e 100644
--- a/libs/ardour/file_source.cc
+++ b/libs/ardour/file_source.cc
@@ -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"),
diff --git a/libs/ardour/filesystem_paths.cc b/libs/ardour/filesystem_paths.cc
index 4c7e996e46..8d48ea3068 100644
--- a/libs/ardour/filesystem_paths.cc
+++ b/libs/ardour/filesystem_paths.cc
@@ -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");
diff --git a/libs/ardour/globals.cc b/libs/ardour/globals.cc
index c0fca7c7a0..57b1e2db65 100644
--- a/libs/ardour/globals.cc
+++ b/libs/ardour/globals.cc
@@ -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) {
diff --git a/libs/ardour/io.cc b/libs/ardour/io.cc
index 4498e4fbd8..c7bf163d27 100644
--- a/libs/ardour/io.cc
+++ b/libs/ardour/io.cc
@@ -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
diff --git a/libs/ardour/jack_utils.cc b/libs/ardour/jack_utils.cc
index 29f7ca4f3e..1b94c2f3f7 100644
--- a/libs/ardour/jack_utils.cc
+++ b/libs/ardour/jack_utils.cc
@@ -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());
diff --git a/libs/ardour/ladspa_search_path.cc b/libs/ardour/ladspa_search_path.cc
index 6ecc1557a3..769e5cd617 100644
--- a/libs/ardour/ladspa_search_path.cc
+++ b/libs/ardour/ladspa_search_path.cc
@@ -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");
diff --git a/libs/ardour/lv2_plugin.cc b/libs/ardour/lv2_plugin.cc
index 4f1f9b9677..4ae1c7b452 100644
--- a/libs/ardour/lv2_plugin.cc
+++ b/libs/ardour/lv2_plugin.cc
@@ -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 + "/";
diff --git a/libs/ardour/midi_ui.cc b/libs/ardour/midi_ui.cc
index 82261b58ec..5822cc509e 100644
--- a/libs/ardour/midi_ui.cc
+++ b/libs/ardour/midi_ui.cc
@@ -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
diff --git a/libs/ardour/port.cc b/libs/ardour/port.cc
index a1eacca96e..0f28b31b57 100644
--- a/libs/ardour/port.cc
+++ b/libs/ardour/port.cc
@@ -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
diff --git a/libs/ardour/port_insert.cc b/libs/ardour/port_insert.cc
index e7ff69040d..b2758b2d57 100644
--- a/libs/ardour/port_insert.cc
+++ b/libs/ardour/port_insert.cc
@@ -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
diff --git a/libs/ardour/resampled_source.cc b/libs/ardour/resampled_source.cc
index 6184e1a3d6..0a81319108 100644
--- a/libs/ardour/resampled_source.cc
+++ b/libs/ardour/resampled_source.cc
@@ -26,7 +26,11 @@
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)
diff --git a/libs/ardour/route.cc b/libs/ardour/route.cc
index 0fbd334879..bb25c1f9b0 100644
--- a/libs/ardour/route.cc
+++ b/libs/ardour/route.cc
@@ -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
diff --git a/libs/ardour/sndfilesource.cc b/libs/ardour/sndfilesource.cc
index 2aae84085a..b5d821ffda 100644
--- a/libs/ardour/sndfilesource.cc
+++ b/libs/ardour/sndfilesource.cc
@@ -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;
diff --git a/libs/ardour/test/jack_utils_test.cc b/libs/ardour/test/jack_utils_test.cc
index ed80237f78..ce92955b7d 100644
--- a/libs/ardour/test/jack_utils_test.cc
+++ b/libs/ardour/test/jack_utils_test.cc
@@ -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;
diff --git a/libs/ardour/test/test_common.cc b/libs/ardour/test/test_common.cc
index 8364d91be1..68039b289b 100644
--- a/libs/ardour/test/test_common.cc
+++ b/libs/ardour/test/test_common.cc
@@ -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