summaryrefslogtreecommitdiff
path: root/libs/surfaces/mackie/interface.cc
diff options
context:
space:
mode:
Diffstat (limited to 'libs/surfaces/mackie/interface.cc')
-rw-r--r--libs/surfaces/mackie/interface.cc38
1 files changed, 29 insertions, 9 deletions
diff --git a/libs/surfaces/mackie/interface.cc b/libs/surfaces/mackie/interface.cc
index 500854fe71..eda485b5d6 100644
--- a/libs/surfaces/mackie/interface.cc
+++ b/libs/surfaces/mackie/interface.cc
@@ -18,27 +18,47 @@
#include <control_protocol/control_protocol.h>
#include "mackie_control_protocol.h"
+#include <pbd/error.h>
+
#include <stdexcept>
using namespace ARDOUR;
+using namespace PBD;
using namespace std;
ControlProtocol*
new_mackie_protocol (ControlProtocolDescriptor* descriptor, Session* s)
{
- MackieControlProtocol * mcp = 0;
- try
+ if ( Config->get_mmc_port_name().substr(0,3) == "mcu" )
+ {
+ error << "mcu already used as mmc port" << endmsg;
+ }
+ else if ( Config->get_mtc_port_name().substr(0,3) == "mcu" )
+ {
+ error << "mcu already used as mtc port" << endmsg;
+ }
+ else if ( Config->get_midi_port_name().substr(0,3) == "mcu" )
{
- mcp = new MackieControlProtocol (*s);
- mcp->set_active( true );
+ error << "mcu already used as midi port" << endmsg;
}
- catch( exception & e )
+ else
{
- cout << "Error instantiating MackieControlProtocol: " << e.what() << endl;
- delete mcp;
- mcp = 0;
+ // no one else is using the port, so try instantiate the object
+ MackieControlProtocol * mcp = 0;
+ try
+ {
+ mcp = new MackieControlProtocol (*s);
+ mcp->set_active( true );
+ }
+ catch( exception & e )
+ {
+ error << "Error instantiating MackieControlProtocol: " << e.what() << endmsg;
+ delete mcp;
+ mcp = 0;
+ }
+ return mcp;
}
- return mcp;
+ return 0;
}
void