'libs/ardour' - Platform specific changes and includes

This commit is contained in:
John Emmas 2013-08-04 19:03:32 +01:00
parent d176cbc804
commit 0dc8806ee4
19 changed files with 60 additions and 45 deletions

View File

@ -37,7 +37,7 @@
#include "pbd/signals.h"
#include "pbd/stacktrace.h"
#ifndef WIN32
#ifndef PLATFORM_WINDOWS
#include <jack/weakjack.h>
#endif

View 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

View 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;

View 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

View 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"),

View 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");

View 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) {

View 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

View 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());

View 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");

View 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 + "/";

View 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

View 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

View 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

View File

@ -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)

View 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

View 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;

View 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;

View 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