blob: 6392a91c4f6abe36ff7432dfb98186326bd1291f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
|
#include "mackie_control_protocol.h"
#include "midi_byte_array.h"
#include "surface_port.h"
#include "pbd/pthread_utils.h"
#include "pbd/error.h"
#include "midi++/types.h"
#include "midi++/port.h"
#include "midi++/manager.h"
#include "i18n.h"
#include <unistd.h>
#include <fcntl.h>
#include <poll.h>
#include <errno.h>
#include <string.h>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
using namespace Mackie;
using namespace PBD;
const char * MackieControlProtocol::default_port_name = "mcu";
bool MackieControlProtocol::probe()
{
if ( MIDI::Manager::instance()->port(default_port_name) == 0 ) {
info << "Mackie: No MIDI port called " << default_port_name << endmsg;
return false;
} else {
return true;
}
}
void MackieControlProtocol::handle_port_inactive( SurfacePort * port )
{
// port gone away. So stop polling it ASAP
{
// delete the port instance
Glib::Mutex::Lock lock( update_mutex );
MackiePorts::iterator it = find( _ports.begin(), _ports.end(), port );
if ( it != _ports.end() )
{
delete *it;
_ports.erase( it );
}
}
// TODO all the rebuilding of surfaces and so on
}
void MackieControlProtocol::handle_port_active (SurfacePort *)
{
// no need to re-add port because it was already added
// during the init phase. So just update the local surface
// representation and send the representation to
// all existing ports
// TODO update bank size
// TODO rebuild surface, to have new units
// finally update session state to the surface
// TODO but this is also done in set_active, and
// in fact update_surface won't execute unless
#ifdef DEBUG
cout << "update_surface in handle_port_active" << endl;
#endif
// _active == true
update_surface();
}
void MackieControlProtocol::handle_port_init (Mackie::SurfacePort *)
{
#ifdef DEBUG
cout << "MackieControlProtocol::handle_port_init" << endl;
#endif
#ifdef DEBUG
cout << "MackieControlProtocol::handle_port_init finish" << endl;
#endif
}
|