projects
/
ardour.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Manual merge of the backend (peakfile reading) part of waveview branch.
[ardour.git]
/
libs
/
midi++2
/
mmc.cc
diff --git
a/libs/midi++2/mmc.cc
b/libs/midi++2/mmc.cc
index b93dc0f260503bb5e84088683caa1296ba2cdaa7..d722a816eef104932a99669b875aed6bfd09de0b 100644
(file)
--- a/
libs/midi++2/mmc.cc
+++ b/
libs/midi++2/mmc.cc
@@
-22,6
+22,7
@@
#include <map>
#include "timecode/time.h"
#include <map>
#include "timecode/time.h"
+#include "timecode/bbt_time.h"
#include "pbd/error.h"
#include "pbd/error.h"
@@
-29,10
+30,21
@@
#include "midi++/port.h"
#include "midi++/parser.h"
#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;
using namespace std;
using namespace MIDI;
using namespace PBD;
+/**
+ * As libtimecode is linked statically to libmidi++ this
+ * is necessary to pull in all the symbols from libtimecode
+ * so they are exported for other users of libtimecode.
+ */
+double tmp = Timecode::BBT_Time::ticks_per_beat;
+
static std::map<int,string> mmc_cmd_map;
static void build_mmc_cmd_map ()
{
static std::map<int,string> mmc_cmd_map;
static void build_mmc_cmd_map ()
{
@@
-218,19
+230,19
@@
MachineControl::set_ports (MIDI::Port* ip, MIDI::Port* op)
}
void
}
void
-MachineControl::set_receive_device_id (byte id)
+MachineControl::set_receive_device_id (
MIDI::
byte id)
{
_receive_device_id = id & 0x7f;
}
void
{
_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
{
_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;
{
if (len < 4 || len > 48) {
return false;
@@
-249,7
+261,7
@@
MachineControl::is_mmc (byte *sysex_buf, size_t len)
}
void
}
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;
{
size_t skiplen;
byte *mmc_msg;
@@
-272,7
+284,7
@@
MachineControl::process_mmc_message (Parser &, byte *msg, size_t len)
cerr << endl;
#endif
cerr << endl;
#endif
- if (msg[1] != 0x7f && msg[1] != _receive_device_id) {
+ if (
_receive_device_id != 0x7f &&
msg[1] != 0x7f && msg[1] != _receive_device_id) {
return;
}
return;
}
@@
-456,7
+468,7
@@
MachineControl::process_mmc_message (Parser &, byte *msg, size_t len)
}
int
}
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" */
{
/* return the number of bytes "consumed" */
@@
-482,7
+494,7
@@
MachineControl::do_masked_write (byte *msg, size_t len)
}
void
}
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;
{
size_t n;
ssize_t base_track;
@@
-571,7
+583,7
@@
MachineControl::write_track_status (byte *msg, size_t /*len*/, byte reg)
}
int
}
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"
{
if (msg[2] == 0) {
warning << "MIDI::MMC: locate [I/F] command not supported"
@@
-586,7
+598,7
@@
MachineControl::do_locate (byte *msg, size_t /*msglen*/)
}
int
}
int
-MachineControl::do_step (byte *msg, size_t /*msglen*/)
+MachineControl::do_step (
MIDI::
byte *msg, size_t /*msglen*/)
{
int steps = msg[2] & 0x3f;
{
int steps = msg[2] & 0x3f;
@@
-599,7
+611,7
@@
MachineControl::do_step (byte *msg, size_t /*msglen*/)
}
int
}
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];
{
size_t forward;
byte sh = msg[2];
@@
-639,7
+651,7
@@
MachineControl::enable_send (bool yn)
* @param c command.
*/
void
* @param c command.
*/
void
-MachineControl::send (MachineControlCommand const & c)
+MachineControl::send (MachineControlCommand const & c
, timestamp_t when
)
{
if (_output_port == 0 || !_enable_send) {
// cerr << "Not delivering MMC " << _mmc->port() << " - " << session_send_mmc << endl;
{
if (_output_port == 0 || !_enable_send) {
// cerr << "Not delivering MMC " << _mmc->port() << " - " << session_send_mmc << endl;
@@
-649,7
+661,7
@@
MachineControl::send (MachineControlCommand const & c)
MIDI::byte buffer[32];
MIDI::byte* b = c.fill_buffer (this, buffer);
MIDI::byte buffer[32];
MIDI::byte* b = c.fill_buffer (this, buffer);
- if (_output_port->midimsg (buffer, b - buffer,
0
)) {
+ if (_output_port->midimsg (buffer, b - buffer,
when
)) {
error << "MMC: cannot send command" << endmsg;
}
}
error << "MMC: cannot send command" << endmsg;
}
}
@@
-698,7
+710,7
@@
MachineControlCommand::fill_buffer (MachineControl* mmc, MIDI::byte* b) const
if (_command == MachineControl::cmdLocate) {
*b++ = 0x6; // byte count
*b++ = 0x1; // "TARGET" subcommand
if (_command == MachineControl::cmdLocate) {
*b++ = 0x6; // byte count
*b++ = 0x1; // "TARGET" subcommand
- *b++ = _time.hours;
+ *b++ = _time.hours
% 24
;
*b++ = _time.minutes;
*b++ = _time.seconds;
*b++ = _time.frames;
*b++ = _time.minutes;
*b++ = _time.seconds;
*b++ = _time.frames;