diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2010-02-01 04:08:49 +0000 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2010-02-01 04:08:49 +0000 |
commit | ae1abc4ea6b77611399e37817cd2f837342238b2 (patch) | |
tree | 087fc05eac5256c74b18766bc5ad6eaff7132a6d /libs/midi++2/parser.cc | |
parent | 74c03b9fc057ca4ddb25ee7d8783d15e2b12c0c2 (diff) |
fix up boost signal return value so that the "edit" signal of MIDI::Parser works properly, and thus allows MIDI Clock etc.
git-svn-id: svn://localhost/ardour2/branches/3.0@6607 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/midi++2/parser.cc')
-rw-r--r-- | libs/midi++2/parser.cc | 29 |
1 files changed, 18 insertions, 11 deletions
diff --git a/libs/midi++2/parser.cc b/libs/midi++2/parser.cc index 60a321cefb..52de52c2d2 100644 --- a/libs/midi++2/parser.cc +++ b/libs/midi++2/parser.cc @@ -328,7 +328,7 @@ Parser::scanner (unsigned char inbyte) bool statusbit; // cerr << "parse: " << hex << (int) inbyte << dec << " state = " << state << " msgindex = " << msgindex << " runnable = " << runnable << endl; - + /* Check active sensing early, so it doesn't interrupt sysex. NOTE: active sense messages are not considered to fit under @@ -386,9 +386,11 @@ Parser::scanner (unsigned char inbyte) } if (rtmsg) { - if (edit (&inbyte, 1) >= 0 && !_offline) { + boost::optional<int> res = edit (&inbyte, 1); + + if (res.get_value_or (1) >= 0 && !_offline) { realtime_msg (inbyte); - } + } return; } @@ -419,17 +421,22 @@ Parser::scanner (unsigned char inbyte) } cerr << dec << endl; #endif - if (msgindex > 0 && (edit.empty() || !(*edit (msgbuf, msgindex) >= 0))) { - if (!possible_mmc (msgbuf, msgindex) || _mmc_forward) { - if (!possible_mtc (msgbuf, msgindex) || _mtc_forward) { - if (!_offline) { - sysex (*this, msgbuf, msgindex); + if (msgindex > 0) { + + boost::optional<int> res = edit (msgbuf, msgindex); + + if (res.get_value_or (1) >= 0) { + if (!possible_mmc (msgbuf, msgindex) || _mmc_forward) { + if (!possible_mtc (msgbuf, msgindex) || _mtc_forward) { + if (!_offline) { + sysex (*this, msgbuf, msgindex); + } } } + if (!_offline) { + any (*this, msgbuf, msgindex); + } } - if (!_offline) { - any (*this, msgbuf, msgindex); - } } } |