From ab8918fa733efd1660761c9f50ced74948ce724c Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Thu, 11 Jul 2013 13:00:42 -0400 Subject: Changes to get IPMIDIPort to compile(but not functional) on MinGW --- libs/midi++2/ipmidi_port.cc | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'libs/midi++2/ipmidi_port.cc') diff --git a/libs/midi++2/ipmidi_port.cc b/libs/midi++2/ipmidi_port.cc index c90a3dbe6f..7f166f5b24 100644 --- a/libs/midi++2/ipmidi_port.cc +++ b/libs/midi++2/ipmidi_port.cc @@ -25,7 +25,11 @@ #include #include #include +#if defined(WIN32) +#include +#else #include +#endif #if defined(WIN32) static WSADATA g_wsaData; @@ -147,6 +151,7 @@ get_address (int sock, struct in_addr *inaddr, const string& ifname ) bool IPMIDIPort::open_sockets (int base_port, const string& ifname) { +#if !defined(WIN32) int protonum = 0; struct protoent *proto = ::getprotobyname("IP"); @@ -243,6 +248,9 @@ IPMIDIPort::open_sockets (int base_port, const string& ifname) } return true; +#else + return false; +#endif // !WIN32 } int -- cgit v1.2.3 From 369c0e4a6692f7f5fd356783be7da773e452cb34 Mon Sep 17 00:00:00 2001 From: John Emmas Date: Thu, 25 Jul 2013 07:19:51 +0100 Subject: 'libs/midi++2' - Modify to be buildable with MSVC --- libs/midi++2/channel.cc | 8 ++++---- libs/midi++2/ipmidi_port.cc | 4 ++-- libs/midi++2/jack_midi_port.cc | 10 +++++----- libs/midi++2/midnam_patch.cc | 2 +- libs/midi++2/mmc.cc | 22 +++++++++++++--------- libs/midi++2/mtc.cc | 4 ++-- libs/midi++2/parser.cc | 6 +++--- msvc_extra_headers/ardourext/sys/time.h.input | 2 +- 8 files changed, 31 insertions(+), 27 deletions(-) (limited to 'libs/midi++2/ipmidi_port.cc') diff --git a/libs/midi++2/channel.cc b/libs/midi++2/channel.cc index 66ce5ed71c..ed8f4da5bc 100644 --- a/libs/midi++2/channel.cc +++ b/libs/midi++2/channel.cc @@ -25,7 +25,7 @@ using namespace MIDI; -Channel::Channel (byte channelnum, Port &p) +Channel::Channel (MIDI::byte channelnum, Port &p) : _port (p) { _channel_number = channelnum; @@ -182,13 +182,13 @@ Channel::process_controller (Parser & /*parser*/, EventTwoBytes *tb) } void -Channel::process_program_change (Parser & /*parser*/, byte val) +Channel::process_program_change (Parser & /*parser*/, MIDI::byte val) { _program_number = val; } void -Channel::process_chanpress (Parser & /*parser*/, byte val) +Channel::process_chanpress (Parser & /*parser*/, MIDI::byte val) { _chanpress = val; } @@ -215,7 +215,7 @@ Channel::process_reset (Parser & /*parser*/) * \return true if success */ bool -Channel::channel_msg (byte id, byte val1, byte val2, timestamp_t timestamp) +Channel::channel_msg (MIDI::byte id, MIDI::byte val1, MIDI::byte val2, timestamp_t timestamp) { unsigned char msg[3]; int len = 0; diff --git a/libs/midi++2/ipmidi_port.cc b/libs/midi++2/ipmidi_port.cc index 7f166f5b24..297ad894f7 100644 --- a/libs/midi++2/ipmidi_port.cc +++ b/libs/midi++2/ipmidi_port.cc @@ -254,7 +254,7 @@ IPMIDIPort::open_sockets (int base_port, const string& ifname) } int -IPMIDIPort::write (const byte* msg, size_t msglen, timestamp_t /* ignored */) { +IPMIDIPort::write (const MIDI::byte* msg, size_t msglen, timestamp_t /* ignored */) { if (sockout) { Glib::Threads::Mutex::Lock lm (write_lock); @@ -268,7 +268,7 @@ IPMIDIPort::write (const byte* msg, size_t msglen, timestamp_t /* ignored */) { } int -IPMIDIPort::read (byte* /*buf*/, size_t /*bufsize*/) +IPMIDIPort::read (MIDI::byte* /*buf*/, size_t /*bufsize*/) { /* nothing to do here - all handled by parse() */ return 0; diff --git a/libs/midi++2/jack_midi_port.cc b/libs/midi++2/jack_midi_port.cc index 3220ca5b55..cb0d271837 100644 --- a/libs/midi++2/jack_midi_port.cc +++ b/libs/midi++2/jack_midi_port.cc @@ -214,12 +214,12 @@ JackMIDIPort::drain (int check_interval_usecs) if (vec.len[0] + vec.len[1] >= output_fifo.bufsize() - 1) { break; } - usleep (check_interval_usecs); + g_usleep (check_interval_usecs); } } int -JackMIDIPort::write (const byte * msg, size_t msglen, timestamp_t timestamp) +JackMIDIPort::write (const MIDI::byte * msg, size_t msglen, timestamp_t timestamp) { int ret = 0; @@ -347,7 +347,7 @@ JackMIDIPort::flush (void* jack_port_buffer) } int -JackMIDIPort::read (byte *, size_t) +JackMIDIPort::read (MIDI::byte *, size_t) { if (!receives_input()) { return 0; @@ -356,9 +356,9 @@ JackMIDIPort::read (byte *, size_t) timestamp_t time; Evoral::EventType type; uint32_t size; - byte buffer[input_fifo.capacity()]; + vector buffer(input_fifo.capacity()); - while (input_fifo.read (&time, &type, &size, buffer)) { + while (input_fifo.read (&time, &type, &size, &buffer[0])) { _parser->set_timestamp (time); for (uint32_t i = 0; i < size; ++i) { _parser->scanner (buffer[i]); diff --git a/libs/midi++2/midnam_patch.cc b/libs/midi++2/midnam_patch.cc index bf22792f70..0498168843 100644 --- a/libs/midi++2/midnam_patch.cc +++ b/libs/midi++2/midnam_patch.cc @@ -371,7 +371,7 @@ operator<< (std::ostream& os, const ChannelNameSet& cns) << "List size " << cns._patch_list.size() << endl << "Patch list name = [" << cns._patch_list_name << ']' << endl << "Available channels : "; - for (set::iterator x = cns._available_for_channels.begin(); x != cns._available_for_channels.end(); ++x) { + for (set::const_iterator x = cns._available_for_channels.begin(); x != cns._available_for_channels.end(); ++x) { os << (int) (*x) << ' '; } os << endl; diff --git a/libs/midi++2/mmc.cc b/libs/midi++2/mmc.cc index 06eadb5b34..1b8de40358 100644 --- a/libs/midi++2/mmc.cc +++ b/libs/midi++2/mmc.cc @@ -29,6 +29,10 @@ #include "midi++/parser.h" #include "midi++/manager.h" +#ifndef __INT_MAX__ // 'ssize_t' won't be defined yet +typedef long ssize_t; +#endif + using namespace std; using namespace MIDI; using namespace PBD; @@ -213,19 +217,19 @@ MachineControl::MachineControl (Manager* m, jack_client_t* jack) } void -MachineControl::set_receive_device_id (byte id) +MachineControl::set_receive_device_id (MIDI::byte id) { _receive_device_id = id & 0x7f; } void -MachineControl::set_send_device_id (byte id) +MachineControl::set_send_device_id (MIDI::byte id) { _send_device_id = id & 0x7f; } bool -MachineControl::is_mmc (byte *sysex_buf, size_t len) +MachineControl::is_mmc (MIDI::byte *sysex_buf, size_t len) { if (len < 4 || len > 48) { return false; @@ -244,7 +248,7 @@ MachineControl::is_mmc (byte *sysex_buf, size_t len) } void -MachineControl::process_mmc_message (Parser &, byte *msg, size_t len) +MachineControl::process_mmc_message (Parser &, MIDI::byte *msg, size_t len) { size_t skiplen; byte *mmc_msg; @@ -451,7 +455,7 @@ MachineControl::process_mmc_message (Parser &, byte *msg, size_t len) } int -MachineControl::do_masked_write (byte *msg, size_t len) +MachineControl::do_masked_write (MIDI::byte *msg, size_t len) { /* return the number of bytes "consumed" */ @@ -477,7 +481,7 @@ MachineControl::do_masked_write (byte *msg, size_t len) } void -MachineControl::write_track_status (byte *msg, size_t /*len*/, byte reg) +MachineControl::write_track_status (MIDI::byte *msg, size_t /*len*/, MIDI::byte reg) { size_t n; ssize_t base_track; @@ -566,7 +570,7 @@ MachineControl::write_track_status (byte *msg, size_t /*len*/, byte reg) } int -MachineControl::do_locate (byte *msg, size_t /*msglen*/) +MachineControl::do_locate (MIDI::byte *msg, size_t /*msglen*/) { if (msg[2] == 0) { warning << "MIDI::MMC: locate [I/F] command not supported" @@ -581,7 +585,7 @@ MachineControl::do_locate (byte *msg, size_t /*msglen*/) } int -MachineControl::do_step (byte *msg, size_t /*msglen*/) +MachineControl::do_step (MIDI::byte *msg, size_t /*msglen*/) { int steps = msg[2] & 0x3f; @@ -594,7 +598,7 @@ MachineControl::do_step (byte *msg, size_t /*msglen*/) } int -MachineControl::do_shuttle (byte *msg, size_t /*msglen*/) +MachineControl::do_shuttle (MIDI::byte *msg, size_t /*msglen*/) { size_t forward; byte sh = msg[2]; diff --git a/libs/midi++2/mtc.cc b/libs/midi++2/mtc.cc index affe65ec68..3c58b6684f 100644 --- a/libs/midi++2/mtc.cc +++ b/libs/midi++2/mtc.cc @@ -36,7 +36,7 @@ using namespace MIDI; #undef DEBUG_MTC bool -Parser::possible_mtc (byte *sysex_buf, size_t msglen) +Parser::possible_mtc (MIDI::byte *sysex_buf, size_t msglen) { byte fake_mtc_time[5]; @@ -91,7 +91,7 @@ Parser::reset_mtc_state () } void -Parser::process_mtc_quarter_frame (byte *msg) +Parser::process_mtc_quarter_frame (MIDI::byte *msg) { int which_quarter_frame = (msg[1] & 0xf0) >> 4; diff --git a/libs/midi++2/parser.cc b/libs/midi++2/parser.cc index 8e3af64504..94daef7871 100644 --- a/libs/midi++2/parser.cc +++ b/libs/midi++2/parser.cc @@ -137,7 +137,7 @@ Parser::~Parser () } void -Parser::trace_event (Parser &, byte *msg, size_t len) +Parser::trace_event (Parser &, MIDI::byte *msg, size_t len) { eventType type; ostream *o; @@ -659,7 +659,7 @@ Parser::system_msg (unsigned char inbyte) } void -Parser::signal (byte *msg, size_t len) +Parser::signal (MIDI::byte *msg, size_t len) { channel_t chan = msg[0]&0xF; int chan_i = chan; @@ -762,7 +762,7 @@ Parser::signal (byte *msg, size_t len) } bool -Parser::possible_mmc (byte *msg, size_t msglen) +Parser::possible_mmc (MIDI::byte *msg, size_t msglen) { if (!MachineControl::is_mmc (msg, msglen)) { return false; diff --git a/msvc_extra_headers/ardourext/sys/time.h.input b/msvc_extra_headers/ardourext/sys/time.h.input index 2e54976641..11bd6bf34d 100644 --- a/msvc_extra_headers/ardourext/sys/time.h.input +++ b/msvc_extra_headers/ardourext/sys/time.h.input @@ -2,7 +2,7 @@ #define _WINX_SYS_TIME_H_ //#include -#include // gets 'struct timeval' +#include // gets 'struct timeval' - Changed by JE - 23-07-2013. Was formerly. . . #include #ifdef _TIMEVAL_DEFINED # define _STRUCT_TIMEVAL 1 -- cgit v1.2.3 From eb2c4196200ee314e2d116ca30311c15c86c519f Mon Sep 17 00:00:00 2001 From: John Emmas Date: Thu, 25 Jul 2013 07:30:30 +0100 Subject: 'libs/midi++2' - Compiler specific changes --- libs/midi++2/ipmidi_port.cc | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'libs/midi++2/ipmidi_port.cc') diff --git a/libs/midi++2/ipmidi_port.cc b/libs/midi++2/ipmidi_port.cc index 297ad894f7..59606bffb2 100644 --- a/libs/midi++2/ipmidi_port.cc +++ b/libs/midi++2/ipmidi_port.cc @@ -25,6 +25,10 @@ #include #include #include +#ifdef COMPILER_MSVC +#undef O_NONBLOCK +#define O_NONBLOCK 0 +#endif #if defined(WIN32) #include #else -- cgit v1.2.3 From e5ab8c1c9e0474cf09192f012553efc3f04c58f0 Mon Sep 17 00:00:00 2001 From: John Emmas Date: Thu, 25 Jul 2013 07:45:24 +0100 Subject: 'libs/midi++2' - Platform specific includes --- libs/midi++2/ipmidi_port.cc | 12 ++++++------ libs/midi++2/jack_midi_port.cc | 6 +++--- libs/midi++2/midi++/ipmidi_port.h | 2 +- libs/midi++2/midi++/jack_midi_port.h | 4 ++-- libs/midi++2/midi++/port.h | 2 +- 5 files changed, 13 insertions(+), 13 deletions(-) (limited to 'libs/midi++2/ipmidi_port.cc') diff --git a/libs/midi++2/ipmidi_port.cc b/libs/midi++2/ipmidi_port.cc index 59606bffb2..4c0282f1f7 100644 --- a/libs/midi++2/ipmidi_port.cc +++ b/libs/midi++2/ipmidi_port.cc @@ -29,13 +29,13 @@ #undef O_NONBLOCK #define O_NONBLOCK 0 #endif -#if defined(WIN32) +#if defined(PLATFORM_WINDOWS) #include #else #include #endif -#if defined(WIN32) +#if defined(PLATFORM_WINDOWS) static WSADATA g_wsaData; typedef int socklen_t; #else @@ -120,7 +120,7 @@ get_address (int sock, struct in_addr *inaddr, const string& ifname ) { // Get interface address from supplied name. -#if !defined(WIN32) +#if !defined(PLATFORM_WINDOWS) struct ifreq ifr; ::strncpy(ifr.ifr_name, ifname.c_str(), sizeof(ifr.ifr_name)); @@ -149,13 +149,13 @@ get_address (int sock, struct in_addr *inaddr, const string& ifname ) return false; -#endif // !WIN32 +#endif // !PLATFORM_WINDOWS' } bool IPMIDIPort::open_sockets (int base_port, const string& ifname) { -#if !defined(WIN32) +#if !defined(PLATFORM_WINDOWS) int protonum = 0; struct protoent *proto = ::getprotobyname("IP"); @@ -254,7 +254,7 @@ IPMIDIPort::open_sockets (int base_port, const string& ifname) return true; #else return false; -#endif // !WIN32 +#endif // !PLATFORM_WINDOWS' } int diff --git a/libs/midi++2/jack_midi_port.cc b/libs/midi++2/jack_midi_port.cc index cb0d271837..38ec4d35c7 100644 --- a/libs/midi++2/jack_midi_port.cc +++ b/libs/midi++2/jack_midi_port.cc @@ -58,7 +58,7 @@ JackMIDIPort::JackMIDIPort (string const & name, Flags flags, jack_client_t* jac , _last_write_timestamp (0) , output_fifo (512) , input_fifo (1024) -#ifndef WIN32 +#ifndef PLATFORM_WINDOWS , xthread (true) #endif { @@ -75,7 +75,7 @@ JackMIDIPort::JackMIDIPort (const XMLNode& node, jack_client_t* jack_client) , _last_write_timestamp (0) , output_fifo (512) , input_fifo (1024) -#ifndef WIN32 +#ifndef PLATFORM_WINDOWS , xthread (true) #endif { @@ -174,7 +174,7 @@ JackMIDIPort::cycle_start (pframes_t nframes) } if (event_count) { -#ifndef WIN32 +#ifndef PLATFORM_WINDOWS xthread.wakeup (); #endif } diff --git a/libs/midi++2/midi++/ipmidi_port.h b/libs/midi++2/midi++/ipmidi_port.h index c077170026..a4adb14cf4 100644 --- a/libs/midi++2/midi++/ipmidi_port.h +++ b/libs/midi++2/midi++/ipmidi_port.h @@ -21,7 +21,7 @@ #include #include -#if defined(WIN32) +#if defined(PLATFORM_WINDOWS) #include #elif defined(__FREE_BSD__) #include diff --git a/libs/midi++2/midi++/jack_midi_port.h b/libs/midi++2/midi++/jack_midi_port.h index f91c7dab83..284df0ef2d 100644 --- a/libs/midi++2/midi++/jack_midi_port.h +++ b/libs/midi++2/midi++/jack_midi_port.h @@ -58,7 +58,7 @@ class JackMIDIPort : public Port { int read (byte *buf, size_t bufsize); void drain (int check_interval_usecs); int selectable () const { -#ifdef WIN32 +#ifdef PLATFORM_WINDOWS return false; #else return xthread.selectable(); @@ -86,7 +86,7 @@ private: RingBuffer< Evoral::Event > output_fifo; Evoral::EventRingBuffer input_fifo; Glib::Threads::Mutex output_fifo_lock; -#ifndef WIN32 +#ifndef PLATFORM_WINDOWS CrossThreadChannel xthread; #endif diff --git a/libs/midi++2/midi++/port.h b/libs/midi++2/midi++/port.h index d4f03b593e..153cfb0529 100644 --- a/libs/midi++2/midi++/port.h +++ b/libs/midi++2/midi++/port.h @@ -27,7 +27,7 @@ #include #include "pbd/xml++.h" -#ifndef WIN32 +#ifndef PLATFORM_WINDOWS #include "pbd/crossthread.h" #endif #include "pbd/signals.h" -- cgit v1.2.3