13
0

'libs/midi++2' - Modify to be buildable with MSVC

This commit is contained in:
John Emmas 2013-07-25 07:19:51 +01:00
parent b8109ef87e
commit 369c0e4a66
8 changed files with 31 additions and 27 deletions

View File

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

View File

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

View File

@ -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<MIDI::byte> 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]);

View File

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

View File

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

View File

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

View File

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

View File

@ -2,7 +2,7 @@
#define _WINX_SYS_TIME_H_
//#include <features.h>
#include <WinSock.h> // gets 'struct timeval'
#include <WinSock2.h> // gets 'struct timeval' - Changed by JE - 23-07-2013. Was formerly. . . #include <WinSock.h>
#ifdef _TIMEVAL_DEFINED
# define _STRUCT_TIMEVAL 1