13
0

'libs/ardour' - Main body of changes required for building with MSVC

This commit is contained in:
John Emmas 2013-08-04 15:36:07 +01:00
parent 07d94b9b48
commit 490311bc08
30 changed files with 114 additions and 47 deletions

View File

@ -29,7 +29,6 @@
namespace ARDOUR {
class Session;
class Region;
class AudioRegion;
class Source;

View File

@ -29,6 +29,8 @@
#include "ardour/worker.h"
#include "pbd/ringbuffer.h"
typedef struct LV2_Evbuf_Impl LV2_Evbuf;
namespace ARDOUR {
// a callback function for lilv_state_new_from_instance(). friend of LV2Plugin

View File

@ -32,7 +32,6 @@ namespace ARDOUR
{
class Session;
class Region;
class MidiRegion;
class Source;
template<typename T> class MidiRingBuffer;

View File

@ -41,13 +41,13 @@
#include "evoral/types.hpp"
#include "ardour/ardour.h"
#include "ardour/region.h"
#include "ardour/session_object.h"
#include "ardour/data_type.h"
namespace ARDOUR {
class Session;
class Region;
class Playlist;
class Crossfade;

View File

@ -180,7 +180,7 @@ AudioSource::peaks_ready (boost::function<void()> doThisWhenReady, ScopedConnect
void
AudioSource::touch_peakfile ()
{
struct stat statbuf;
GStatBuf statbuf;
if (g_stat (peakpath.c_str(), &statbuf) != 0 || statbuf.st_size == 0) {
return;
@ -216,7 +216,7 @@ AudioSource::rename_peakfile (string newpath)
int
AudioSource::initialize_peakfile (string audio_path)
{
struct stat statbuf;
GStatBuf statbuf;
peakpath = peak_path (audio_path);

View File

@ -136,7 +136,7 @@ void
AutomationWatch::thread ()
{
while (_run_thread) {
Glib::usleep ((useconds_t) floor (Config->get_automation_interval_msecs() * 1000));
Glib::usleep ((gulong) floor (Config->get_automation_interval_msecs() * 1000));
timer ();
}
}

View File

@ -600,7 +600,7 @@ Diskstream::check_record_status (framepos_t transport_frame, bool can_record)
*/
rolling = _session.transport_speed() != 0.0f;
possibly_recording = (rolling << 2) | (record_enabled() << 1) | can_record;
possibly_recording = (rolling << 2) | ((int)record_enabled() << 1) | (int)can_record;
change = possibly_recording ^ last_possibly_recording;
if (possibly_recording == last_possibly_recording) {

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::fabs((rate) - sample_rate); \
diff = std::fabs((double)((rate) - sample_rate)); \
if(diff < smallest_diff) { \
smallest_diff = diff; \
best_match = (rate); \

View File

@ -20,6 +20,10 @@
#include "libardour-config.h"
#endif
#ifdef interface
#undef interface
#endif
#include <cstdio> // Needed so that libraptor (included in lrdf) won't complain
#include <cstdlib>
#include <sys/stat.h>
@ -44,7 +48,7 @@
#include "ardour/audio_unit.h"
#endif
#ifdef __SSE__
#if defined(__SSE__) || defined(USE_XMMINTRIN)
#include <xmmintrin.h>
#endif

View File

@ -584,12 +584,10 @@ Graph::process_one_route (Route* route)
bool
Graph::in_process_thread () const
{
#ifndef WIN32
for (list<pthread_t>::const_iterator i = _thread_list.begin (); i != _thread_list.end(); ++i) {
if (*i == pthread_self()) {
if (pthread_equal(*i, pthread_self())) {
return true;
}
}
return false;
#endif
}

View File

@ -150,7 +150,7 @@ LTC_Slave::reset()
}
void
LTC_Slave::parse_ltc(const jack_nframes_t nframes, const jack_default_audio_sample_t * const in, const framecnt_t posinfo)
LTC_Slave::parse_ltc(const jack_nframes_t nframes, const jack_default_audio_sample_t * const in, const ARDOUR::framecnt_t posinfo)
{
jack_nframes_t i;
unsigned char sound[8192];
@ -591,7 +591,7 @@ LTC_Slave::approximate_current_delta() const
snprintf(delta, sizeof(delta), _("flywheel"));
} else {
snprintf(delta, sizeof(delta), "\u0394<span foreground=\"green\" face=\"monospace\" >%s%s%" PRIi64 "</span>sm",
LEADINGZERO(abs(current_delta)), PLUSMINUS(-current_delta), abs(current_delta));
LEADINGZERO(llabs(current_delta)), PLUSMINUS(-current_delta), llabs(current_delta));
}
return std::string(delta);
}

View File

@ -219,7 +219,7 @@ lv2_evbuf_get(LV2_Evbuf_Iterator iter,
*subframes = 0;
*type = aev->body.type;
*size = aev->body.size;
*data = LV2_ATOM_BODY(&aev->body);
*data = (uint8_t*)LV2_ATOM_BODY(&aev->body);
break;
}

View File

@ -332,7 +332,7 @@ PeakMeter::meter ()
} else {
// do falloff
new_peak = _visible_peak_power[n] - (audio_meter_falloff);
_visible_peak_power[n] = std::max (new_peak, -INFINITY);
_visible_peak_power[n] = std::max ((double)new_peak, -INFINITY);
}
}
}

View File

@ -251,7 +251,7 @@ MIDIClock_Slave::stop (Parser& /*parser*/, framepos_t /*timestamp*/)
}
void
MIDIClock_Slave::position (Parser& /*parser*/, byte* message, size_t size)
MIDIClock_Slave::position (Parser& /*parser*/, MIDI::byte* message, size_t size)
{
// we are note supposed to get position messages while we are running
// so lets be robust and ignore those
@ -260,8 +260,8 @@ MIDIClock_Slave::position (Parser& /*parser*/, byte* message, size_t size)
}
assert(size == 3);
byte lsb = message[1];
byte msb = message[2];
MIDI::byte lsb = message[1];
MIDI::byte msb = message[2];
assert((lsb <= 0x7f) && (msb <= 0x7f));
uint16_t position_in_sixteenth_notes = (uint16_t(msb) << 7) | uint16_t(lsb);

View File

@ -626,9 +626,9 @@ void
MidiTrack::MidiControl::set_value(double val)
{
bool valid = false;
if (std::isinf(val)) {
if (isinf(val)) {
cerr << "MIDIControl value is infinity" << endl;
} else if (std::isnan(val)) {
} else if (isnan(val)) {
cerr << "MIDIControl value is NaN" << endl;
} else if (val < _list->parameter().min()) {
cerr << "MIDIControl value is < " << _list->parameter().min() << endl;

View File

@ -24,6 +24,8 @@
#include "ardour/runtime_functions.h"
#include <stdint.h>
using std::min;
using std::max;
using namespace ARDOUR;
#if defined (ARCH_X86) && defined (BUILD_SSE_OPTIMIZATIONS)
@ -93,22 +95,22 @@ default_compute_peak (const ARDOUR::Sample * buf, pframes_t nsamples, float curr
}
void
default_find_peaks (const ARDOUR::Sample * buf, pframes_t nframes, float *min, float *max)
default_find_peaks (const ARDOUR::Sample * buf, pframes_t nframes, float *minf, float *maxf)
{
pframes_t i;
float a, b;
a = *max;
b = *min;
a = *maxf;
b = *minf;
for (i = 0; i < nframes; i++)
{
a = fmax (buf[i], a);
b = fmin (buf[i], b);
a = max (buf[i], a);
b = min (buf[i], b);
}
*max = a;
*min = b;
*maxf = a;
*minf = b;
}
void

View File

@ -31,6 +31,8 @@
#include "ardour/session.h"
#include "ardour/audioengine.h"
#include <glibmm/timer.h>
#include "i18n.h"
using namespace std;
@ -233,7 +235,7 @@ MTC_Slave::read_current (SafeTime *st) const
do {
if (tries == 10) {
error << _("MTC Slave: atomic read of current time failed, sleeping!") << endmsg;
usleep (20);
Glib::usleep (20);
tries = 0;
}
*st = current;
@ -297,7 +299,7 @@ MTC_Slave::update_mtc_qtr (Parser& /*p*/, int which_qtr, framepos_t now)
* when a full TC has been received
* OR on locate */
void
MTC_Slave::update_mtc_time (const byte *msg, bool was_full, framepos_t now)
MTC_Slave::update_mtc_time (const MIDI::byte *msg, bool was_full, framepos_t now)
{
busy_guard1++;

View File

@ -56,7 +56,7 @@ static bool sort_ports_by_name (boost::shared_ptr<Port> a, boost::shared_ptr<Por
// if some of the names don't have a number as posfix, compare as strings
if (last_digit_position_a == aname.size() or last_digit_position_b == bname.size()) {
if (last_digit_position_a == aname.size() || last_digit_position_b == bname.size()) {
return aname < bname;
}

View File

@ -77,7 +77,7 @@ int
RCConfiguration::load_state ()
{
std::string rcfile;
struct stat statbuf;
GStatBuf statbuf;
/* load system configuration first */

View File

@ -31,7 +31,6 @@
using namespace std;
using namespace ARDOUR;
using namespace MIDI;
using namespace PBD;
using namespace Timecode;

View File

@ -440,7 +440,7 @@ Session::send_full_time_code (framepos_t const t)
* earlier already this cycle by send_full_time_code)
*/
int
Session::send_midi_time_code_for_cycle (framepos_t start_frame, framepos_t end_frame, pframes_t nframes)
Session::send_midi_time_code_for_cycle (framepos_t start_frame, framepos_t end_frame, ARDOUR::pframes_t nframes)
{
if (_engine.freewheeling() || !_send_qf_mtc || transmitting_timecode_time.negative || (next_quarter_frame_to_send < 0)) {
// cerr << "(MTC) Not sending MTC\n";
@ -512,7 +512,7 @@ Session::send_midi_time_code_for_cycle (framepos_t start_frame, framepos_t end_f
assert (msg_time < end_frame);
/* convert from session frames back to JACK frames using the transport speed */
pframes_t const out_stamp = (msg_time - start_frame) / _transport_speed;
ARDOUR::pframes_t const out_stamp = (msg_time - start_frame) / _transport_speed;
assert (out_stamp < nframes);
if (MIDI::Manager::instance()->mtc_output_port()->midimsg (mtc_msg, 2, out_stamp)) {

View File

@ -70,7 +70,7 @@ user_route_template_directory ()
}
static bool
template_filter (const string &str, void */*arg*/)
template_filter (const string &str, void* /*arg*/)
{
if (!Glib::file_test (str, Glib::FILE_TEST_IS_DIR)) {
return false;
@ -80,7 +80,7 @@ template_filter (const string &str, void */*arg*/)
}
static bool
route_template_filter (const string &str, void */*arg*/)
route_template_filter (const string &str, void* /*arg*/)
{
if (str.find (template_suffix) == str.length() - strlen (template_suffix)) {
return true;

View File

@ -528,8 +528,9 @@ VSTPlugin::connect_and_run (BufferSet& bufs,
{
Plugin::connect_and_run (bufs, in_map, out_map, nframes, offset);
float *ins[_plugin->numInputs];
float *outs[_plugin->numOutputs];
// VC++ doesn't support this C99 extension. Use alloca instead of dynamic array (rather than std::vector which allocs on the heap)
float** ins = (float**)alloca(_plugin->numInputs*sizeof(float*));
float** outs = (float**)alloca(_plugin->numInputs*sizeof(float*));
int32_t i;
const uint32_t nbufs = bufs.count().n_audio();
@ -552,7 +553,7 @@ VSTPlugin::connect_and_run (BufferSet& bufs,
}
/* we already know it can support processReplacing */
_plugin->processReplacing (_plugin, ins, outs, nframes);
_plugin->processReplacing (_plugin, &ins[0], &outs[0], nframes);
return 0;
}

View File

@ -23,6 +23,8 @@
#include "ardour/worker.h"
#include "pbd/error.h"
#include <glibmm/timer.h>
namespace ARDOUR {
Worker::Worker(Workee* workee, uint32_t ring_size)
@ -128,7 +130,7 @@ Worker::run()
continue;
}
while (!verify_message_completeness(_requests)) {
::usleep(2000);
Glib::usleep(2000);
if (_exit) {
return;
}

View File

@ -29,6 +29,7 @@ CreateHardLinkA( LPCSTR lpFileName,
#include <algorithm>
#include <string>
#include <io.h>
#include <math.h>
#include <fcntl.h>
#include <errno.h>
#include <stdlib.h>
@ -222,6 +223,24 @@ ssize_t ret;
return (ret);
}
//***************************************************************
//
// round()
//
// Emulates round() using floor().
//
// Returns:
//
// On Success: The largest integer that is less than or
// equal to 'x'.
// On Failure: None
//
PBD_API double PBD_APICALLTYPE
round(double x)
{
return (floor(x));
}
namespace PBD {
//***************************************************************

View File

@ -220,6 +220,7 @@ PBD_API int PBD_APICALLTYPE gettimeofday(struct timeval *__restrict tv, __tim
PBD_API ssize_t PBD_APICALLTYPE pread(int handle, void *buf, size_t nbytes, off_t offset);
PBD_API ssize_t PBD_APICALLTYPE pwrite(int handle, const void *buf, size_t nbytes, off_t offset);
PBD_API int PBD_APICALLTYPE poll(struct pollfd *fds, nfds_t nfds, int timeout);
PBD_API double PBD_APICALLTYPE round(double x);
namespace PBD {

View File

@ -24,6 +24,9 @@
# include <mach/mach.h>
#elif defined(PLATFORM_WINDOWS)
# include <windows.h>
#ifndef INFINITE
#define INFINITE 0xffffffffL
#endif
#else
# include <semaphore.h>
# include <errno.h>

View File

@ -68,6 +68,29 @@
return intgr ;
}
__inline long long int
llrint (double flt)
{ long long int intgr;
_asm
{ fld flt
fistp intgr
} ;
return intgr ;
}
__inline long long int
llrintf (float flt)
{ long long int intgr;
_asm
{ fld flt
fistp intgr
} ;
return intgr ;
}
#endif
#endif // __FLOAT_CAST_H__

View File

@ -36,10 +36,10 @@
#include <ardourext/float_cast.h>
// 'std::isnan()' is not available in MSVC. Assume '_isnan(double)'
#define isnan(val) (bool)_isnan((double)val)
#define isnan(val) _isnan((double)val)
// 'std::isinf()' is not available in MSVC. Assume '!_finite(double)'
#define isinf(val) !((bool)_finite((double)val))
#define isinf(val) !_finite((double)val)
// 'INFINITY' is not defined in MSVC. Assume 'HUGE_VAL'
#ifndef INFINITY
@ -179,7 +179,9 @@ typedef int register_t;
// Fortunately, 'round to nearest' seems to be the default action
// under Linux, so let's copy that until we find out otherwise.
#define rint(value) round(value)
#define round(value) floor((value) + 0.5)
#if !defined(PBD_API) || defined(PBD_IS_IN_WIN_STATIC_LIB)
extern double round(double x);
#endif
// System V compatibility
typedef unsigned short ushort;
@ -195,6 +197,15 @@ typedef _mode_t mode_t;
#endif /* NO_OLDNAMES */
#endif /* _MODE_T_ */
// int64 abs()
inline uint64_t abs(int64_t val)
{
if (val < 0)
return val * (-1);
else
return val;
}
// fmin() and fmax()
#define fmin(a, b) min((double)a, (double)b)
#define fmax(a, b) max((double)a, (double)b)

View File

@ -3,9 +3,11 @@
#pragma warning( disable : 4996 )
#ifndef HAVE_LV2
#define HAVE_SUIL
#define HAVE_LV2
#ifndef LV2_SUPPORT
#define LV2_SUPPORT 1
#define HAVE_SUIL 1
#define HAVE_LV2 1
//#define HAVE_NEW_LV2 1
/* Comment out the above lines to build Mixbus without LV2 support */
#endif