diff --git a/gtk2_ardour/ardour_ui.cc b/gtk2_ardour/ardour_ui.cc index ff65a683e0..3e76c3af5b 100644 --- a/gtk2_ardour/ardour_ui.cc +++ b/gtk2_ardour/ardour_ui.cc @@ -35,6 +35,8 @@ #include #include +#include +#include #include #include @@ -662,8 +664,14 @@ ARDOUR_UI::check_memory_locking () struct rlimit limits; int64_t ram; long pages, page_size; - - if ((page_size = sysconf (_SC_PAGESIZE)) < 0 ||(pages = sysconf (_SC_PHYS_PAGES)) < 0) { +#ifdef __FreeBSD__ + size_t pages_len=sizeof(pages); + if ((page_size = getpagesize()) < 0 || + sysctlbyname("hw.availpages", &pages, &pages_len, NULL, 0)) +#else + if ((page_size = sysconf (_SC_PAGESIZE)) < 0 ||(pages = sysconf (_SC_PHYS_PAGES)) < 0) +#endif + { ram = 0; } else { ram = (int64_t) pages * (int64_t) page_size; @@ -683,8 +691,14 @@ ARDOUR_UI::check_memory_locking () "This might cause %1 to run out of memory before your system " "runs out of memory. \n\n" "You can view the memory limit with 'ulimit -l', " - "and it is normally controlled by /etc/security/limits.conf"), - PROGRAM_NAME).c_str()); + "and it is normally controlled by %2"), + PROGRAM_NAME).c_str(), +#ifdef __FreeBSD__ + X_("/etc/login.conf") +#else + X_(" /etc/security/limits.conf") +#endif + ); msg.set_default_response (RESPONSE_OK); diff --git a/gtk2_ardour/editor_drag.cc b/gtk2_ardour/editor_drag.cc index 1cc5e97dc6..de211cbd18 100644 --- a/gtk2_ardour/editor_drag.cc +++ b/gtk2_ardour/editor_drag.cc @@ -1480,7 +1480,7 @@ RegionCreateDrag::motion (GdkEvent* event, bool first_move) place snapped notes at the start of the region. */ - framecnt_t const len = abs (f - grab_frame () - 1); + framecnt_t const len = (int) fabs (f - grab_frame () - 1); _region->set_length (len < 1 ? 1 : len); } } @@ -4694,7 +4694,7 @@ NoteCreateDrag::finished (GdkEvent*, bool had_movement) } framepos_t const start = min (_note[0], _note[1]); - framecnt_t length = abs (_note[0] - _note[1]); + framecnt_t length = (int) fabs (_note[0] - _note[1]); framecnt_t const g = grid_frames (start); double const one_tick = 1 / Timecode::BBT_Time::ticks_per_beat; diff --git a/gtk2_ardour/engine_dialog.cc b/gtk2_ardour/engine_dialog.cc index 2e51554a66..e8151f88ee 100644 --- a/gtk2_ardour/engine_dialog.cc +++ b/gtk2_ardour/engine_dialog.cc @@ -35,7 +35,7 @@ #include #include #include -#else +#elif !defined(__FreeBSD__) #include #endif @@ -139,7 +139,9 @@ EngineControl::EngineControl () #ifdef __APPLE__ strings.push_back (X_("CoreAudio")); #else +#ifndef __FreeBSD__ strings.push_back (X_("ALSA")); +#endif strings.push_back (X_("OSS")); strings.push_back (X_("FreeBoB")); strings.push_back (X_("FFADO")); @@ -192,7 +194,7 @@ EngineControl::EngineControl () basic_packer.attach (period_size_combo, 1, 2, row, row + 1, FILL|EXPAND, (AttachOptions) 0); row++; -#ifndef __APPLE__ +#if !defined(__APPLE__) && !defined(__FreeBSD__) label = manage (left_aligned_label (_("Number of buffers:"))); basic_packer.attach (*label, 0, 1, row, row + 1, FILL|EXPAND, (AttachOptions) 0); basic_packer.attach (periods_spinner, 1, 2, row, row + 1, FILL|EXPAND, (AttachOptions) 0); @@ -212,7 +214,7 @@ EngineControl::EngineControl () row++; /* no audio mode with CoreAudio, its duplex or nuthin' */ -#ifndef __APPLE__ +#if !defined(__APPLE__) && !defined(__FreeBSD__) label = manage (left_aligned_label (_("Audio mode:"))); basic_packer.attach (*label, 0, 1, row, row + 1, FILL|EXPAND, (AttachOptions) 0); basic_packer.attach (audio_mode_combo, 1, 2, row, row + 1, FILL|EXPAND, (AttachOptions) 0); @@ -252,7 +254,7 @@ EngineControl::EngineControl () #if PROVIDE_TOO_MANY_OPTIONS -#ifndef __APPLE__ +#if !defined(__APPLE__) && !defined(__FreeBSD__) options_packer.attach (no_memory_lock_button, 1, 2, row, row + 1, FILL|EXPAND, (AttachOptions) 0); ++row; options_packer.attach (unlock_memory_button, 1, 2, row, row + 1, FILL|EXPAND, (AttachOptions) 0); @@ -300,7 +302,7 @@ EngineControl::EngineControl () options_packer.attach (*label, 0, 1, row, row + 1, FILL|EXPAND, (AttachOptions) 0); ++row; -#ifndef __APPLE__ +#if !defined(__APPLE__) && !defined(__FreeBSD__) label = manage (left_aligned_label (_("Dither:"))); options_packer.attach (dither_mode_combo, 1, 2, row, row + 1, FILL|EXPAND, AttachOptions(0)); options_packer.attach (*label, 0, 1, row, row + 1, FILL|EXPAND, (AttachOptions) 0); @@ -329,7 +331,7 @@ EngineControl::EngineControl () device_packer.set_spacings (6); row = 0; -#ifndef __APPLE__ +#if !defined(__APPLE__) && !defined(__FreeBSD__) label = manage (left_aligned_label (_("Input device:"))); device_packer.attach (*label, 0, 1, row, row+1, FILL|EXPAND, (AttachOptions) 0); device_packer.attach (input_device_combo, 1, 2, row, row+1, FILL|EXPAND, (AttachOptions) 0); @@ -664,7 +666,7 @@ EngineControl::enumerate_devices (const string& driver) devices[driver] = enumerate_coreaudio_devices (); #endif -#ifndef __APPLE__ +#if !defined(__APPLE__) && !defined(__FreeBSD__) } else if (driver == "ALSA") { devices[driver] = enumerate_alsa_devices (); } else if (driver == "FreeBOB") { @@ -794,7 +796,7 @@ Ardour and choose the relevant device then." return devs; } -#else +#ifndef __FreeBSD__ vector EngineControl::enumerate_alsa_devices () { @@ -838,6 +840,7 @@ EngineControl::enumerate_alsa_devices () return devs; } +#endif vector EngineControl::enumerate_ffado_devices () @@ -937,7 +940,7 @@ void EngineControl::redisplay_latency () { uint32_t rate = get_rate(); -#ifdef __APPLE__ +#if defined(__APPLE__) || defined(__FreeBSD__) float periods = 2; #else float periods = periods_adjustment.get_value(); diff --git a/libs/ardour/audiofile_tagger.cc b/libs/ardour/audiofile_tagger.cc index 81ccf7a35e..57650860ee 100644 --- a/libs/ardour/audiofile_tagger.cc +++ b/libs/ardour/audiofile_tagger.cc @@ -40,7 +40,7 @@ namespace ARDOUR { bool -AudiofileTagger::tag_file (string const & filename, SessionMetadata const & metadata) +AudiofileTagger::tag_file (std::string const & filename, SessionMetadata const & metadata) { TagLib::FileRef file (filename.c_str()); TagLib::Tag & tag (*file.tag()); diff --git a/libs/ardour/export_format_base.cc b/libs/ardour/export_format_base.cc index c218b6154a..ed8bb9d5f8 100644 --- a/libs/ardour/export_format_base.cc +++ b/libs/ardour/export_format_base.cc @@ -185,7 +185,7 @@ ExportFormatBase::nearest_sample_rate (framecnt_t sample_rate) SampleRate best_match = SR_None; #define DO_SR_COMPARISON(rate) \ - diff = std::abs((rate) - sample_rate); \ + diff = std::fabs((rate) - sample_rate); \ if(diff < smallest_diff) { \ smallest_diff = diff; \ best_match = (rate); \ diff --git a/libs/fst/jackvst.h b/libs/fst/jackvst.h index b496f68493..8f2618879d 100644 --- a/libs/fst/jackvst.h +++ b/libs/fst/jackvst.h @@ -6,7 +6,9 @@ #include #include #include +#ifdef WITH_ALSA #include +#endif typedef struct _JackVST JackVST; @@ -28,7 +30,9 @@ struct _JackVST { int want_midi; pthread_t midi_thread; +#ifdef WITH_ALSA snd_seq_t* seq; +#endif WITH_ALSA int midiquit; jack_ringbuffer_t* event_queue; struct VstEvents* events; diff --git a/libs/fst/vsti.c b/libs/fst/vsti.c index a9f5076775..ed79ea0c3c 100644 --- a/libs/fst/vsti.c +++ b/libs/fst/vsti.c @@ -34,6 +34,8 @@ #include #include "ardour/vestige/aeffectx.h" +#ifdef WITH_ALSA + snd_seq_t * create_sequencer (const char* client_name, bool isinput) { @@ -185,6 +187,6 @@ void stop_midireceiver (JackVST *jvst) pthread_join (jvst->midi_thread,NULL); snd_seq_close (jvst->seq); } - +#endif diff --git a/libs/midi++2/midi++/ipmidi_port.h b/libs/midi++2/midi++/ipmidi_port.h index ff1691baab..c077170026 100644 --- a/libs/midi++2/midi++/ipmidi_port.h +++ b/libs/midi++2/midi++/ipmidi_port.h @@ -23,6 +23,17 @@ #include #if defined(WIN32) #include +#elif defined(__FREE_BSD__) +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #else #include #include diff --git a/libs/pbd/cpus.cc b/libs/pbd/cpus.cc index ba4ba32fe4..80c40162ea 100644 --- a/libs/pbd/cpus.cc +++ b/libs/pbd/cpus.cc @@ -25,6 +25,7 @@ #ifdef __linux__ #include #elif defined(__APPLE__) || defined(__FreeBSD__) +#include #include #include #endif