diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2014-01-10 16:07:57 -0500 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2014-01-10 16:07:57 -0500 |
commit | 3020b224fa2d6e1b6b8a576e8e8e211e0585f2a2 (patch) | |
tree | 314c3099bcc57d9af09d249e1e7dd8e45baca642 /libs/midi++2 | |
parent | d15fda6d751a465d278f477923075d4783f3b1ca (diff) | |
parent | 897fbdc652434d3aa1e67223c3c3ef7ae9be2318 (diff) |
Merge windows+cc branch into cairocanvas branch. Not finished, need to now merge windows branch to get changes from there
Diffstat (limited to 'libs/midi++2')
-rw-r--r-- | libs/midi++2/channel.cc | 8 | ||||
-rw-r--r-- | libs/midi++2/ipmidi_port.cc | 22 | ||||
-rw-r--r-- | libs/midi++2/midi++/ipmidi_port.h | 2 | ||||
-rw-r--r-- | libs/midi++2/midi++/port.h | 4 | ||||
-rw-r--r-- | libs/midi++2/midnam_patch.cc | 2 | ||||
-rw-r--r-- | libs/midi++2/mmc.cc | 22 | ||||
-rw-r--r-- | libs/midi++2/mtc.cc | 4 | ||||
-rw-r--r-- | libs/midi++2/parser.cc | 6 |
8 files changed, 45 insertions, 25 deletions
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 c4544c237b..567df99335 100644 --- a/libs/midi++2/ipmidi_port.cc +++ b/libs/midi++2/ipmidi_port.cc @@ -25,9 +25,17 @@ #include <errno.h> #include <stdlib.h> #include <string.h> +#ifdef COMPILER_MSVC +#undef O_NONBLOCK +#define O_NONBLOCK 0 +#endif +#if defined(PLATFORM_WINDOWS) +#include <winsock2.h> +#else #include <netdb.h> +#endif -#if defined(WIN32) +#if defined(PLATFORM_WINDOWS) static WSADATA g_wsaData; typedef int socklen_t; #else @@ -109,7 +117,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)); @@ -138,12 +146,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(PLATFORM_WINDOWS) int protonum = 0; struct protoent *proto = ::getprotobyname("IP"); @@ -240,10 +249,13 @@ IPMIDIPort::open_sockets (int base_port, const string& ifname) } return true; +#else + return false; +#endif // !PLATFORM_WINDOWS' } 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); @@ -257,7 +269,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/midi++/ipmidi_port.h b/libs/midi++2/midi++/ipmidi_port.h index 4aa55828f1..a056612514 100644 --- a/libs/midi++2/midi++/ipmidi_port.h +++ b/libs/midi++2/midi++/ipmidi_port.h @@ -21,7 +21,7 @@ #include <string> #include <iostream> -#if defined(WIN32) +#if defined(PLATFORM_WINDOWS) #include <winsock.h> #elif defined(__FREE_BSD__) #include <netinet/in.h> diff --git a/libs/midi++2/midi++/port.h b/libs/midi++2/midi++/port.h index d151a43814..6e55134bb5 100644 --- a/libs/midi++2/midi++/port.h +++ b/libs/midi++2/midi++/port.h @@ -26,8 +26,12 @@ * now due to use of JackPortIsXXXX */ +#include <pthread.h> + #include "pbd/xml++.h" +#ifndef PLATFORM_WINDOWS #include "pbd/crossthread.h" +#endif #include "pbd/signals.h" #include "pbd/ringbuffer.h" diff --git a/libs/midi++2/midnam_patch.cc b/libs/midi++2/midnam_patch.cc index bd8bbfc42d..9dd5bc33db 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<uint8_t>::iterator x = cns._available_for_channels.begin(); x != cns._available_for_channels.end(); ++x) { + for (set<uint8_t>::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 a3f8f01fe4..b92e686ce6 100644 --- a/libs/midi++2/mmc.cc +++ b/libs/midi++2/mmc.cc @@ -30,6 +30,10 @@ #include "midi++/port.h" #include "midi++/parser.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; @@ -226,19 +230,19 @@ MachineControl::set_ports (MIDI::Port* ip, MIDI::Port* op) } 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; @@ -257,7 +261,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; @@ -464,7 +468,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" */ @@ -490,7 +494,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; @@ -579,7 +583,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" @@ -594,7 +598,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; @@ -607,7 +611,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 0c2d8a41b3..1a477c3b8c 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 2f6b50899c..7d31c99781 100644 --- a/libs/midi++2/parser.cc +++ b/libs/midi++2/parser.cc @@ -136,7 +136,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; @@ -658,7 +658,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; @@ -761,7 +761,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; |