merge Marcel Bonnet's patches for Free-BSD

(may need further cleanup:
 compare with timbyr's windows patch,
 verify fst/vsti + ALSA)

git-svn-id: svn://localhost/ardour2/branches/3.0@13774 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Robin Gareus 2013-01-04 17:36:52 +00:00
parent 2c95bfcd46
commit bb3690db58
9 changed files with 53 additions and 18 deletions

View File

@ -35,6 +35,8 @@
#include <iostream>
#include <sys/resource.h>
#include <sys/types.h>
#include <sys/sysctl.h>
#include <gtkmm/messagedialog.h>
#include <gtkmm/accelmap.h>
@ -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);

View File

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

View File

@ -35,7 +35,7 @@
#include <CoreFoundation/CFString.h>
#include <sys/param.h>
#include <mach-o/dyld.h>
#else
#elif !defined(__FreeBSD__)
#include <alsa/asoundlib.h>
#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<string>
EngineControl::enumerate_alsa_devices ()
{
@ -838,6 +840,7 @@ EngineControl::enumerate_alsa_devices ()
return devs;
}
#endif
vector<string>
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();

View File

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

View File

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

View File

@ -6,7 +6,9 @@
#include <jack/jack.h>
#include <jack/ringbuffer.h>
#include <fst.h>
#ifdef WITH_ALSA
#include <alsa/asoundlib.h>
#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;

View File

@ -34,6 +34,8 @@
#include <sched.h>
#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

View File

@ -23,6 +23,17 @@
#include <iostream>
#if defined(WIN32)
#include <winsock.h>
#elif defined(__FREE_BSD__)
#include <netinet/in.h>
#include <sys/socket.h>
#include <sys/_sockaddr_storage.h>
#include <arpa/inet.h>
#include <netinet/ip_carp.h>
#include <sys/types.h>
#include <sys/time.h>
#include <sys/socket.h>
#include <net/if.h>
#include <net/route.h>
#else
#include <arpa/inet.h>
#include <net/if.h>

View File

@ -25,6 +25,7 @@
#ifdef __linux__
#include <unistd.h>
#elif defined(__APPLE__) || defined(__FreeBSD__)
#include <sys/stddef.h>
#include <sys/types.h>
#include <sys/sysctl.h>
#endif