summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Anderson <ardour@semiosix.com>2007-07-04 21:18:20 +0000
committerJohn Anderson <ardour@semiosix.com>2007-07-04 21:18:20 +0000
commit0518b045c62ef764eced6fff0b64d4f71832a7b0 (patch)
tree622fd91c772e742b46f349a17d3ce890530a21d3
parentfd6beee7c3e36fadecf1b18cd914378110ecef6d (diff)
ifdefs for debug output. Fix host.rb
git-svn-id: svn://localhost/ardour2/branches/2.0-ongoing@2105 d708f5d6-7413-0410-9779-e7cbd77b26cf
-rwxr-xr-xlibs/surfaces/mackie/scripts/host.rb43
-rw-r--r--libs/surfaces/mackie/surface_port.cc13
-rw-r--r--libs/surfaces/mackie/types.h2
3 files changed, 20 insertions, 38 deletions
diff --git a/libs/surfaces/mackie/scripts/host.rb b/libs/surfaces/mackie/scripts/host.rb
index 8972cba137..4f3e4ec605 100755
--- a/libs/surfaces/mackie/scripts/host.rb
+++ b/libs/surfaces/mackie/scripts/host.rb
@@ -18,6 +18,11 @@
require 'controls.rb'
require 'mackie.rb'
+if ARGV.size != 2
+ puts "#$0 /dev/snd/midiXXXX control-file.csv"
+ exit 1
+end
+
while !File.exist? ARGV[0]
sleep 0.010
end
@@ -30,46 +35,14 @@ puts ""
file = File.open ARGV[0], 'r+'
mck = Mackie.new( file )
-# send device query
-response = mck.sysex( "\x00" )
-puts "response: #{response.to_hex}"
-
-# decode host connection query
-status = response[0]
-if status != 1
- puts "expected 01, got " + response.to_hex.inspect
- exit(1)
-end
-serial = response[1..7]
-challenge = response[8..11]
-puts <<EOF
-serial: #{serial.to_hex.inspect}
-challenge: #{challenge.to_hex.inspect}
-EOF
-
-# send host connection reply
-response = mck.sysex( "\x02" + serial.pack('C*') + challenge.pack('C*') )
-
-# decode host connection confirmation
-status = response[0]
-if status != 3
- puts "expected 03, got " + response.to_hex.inspect
- exit(1)
-end
-
-serial = response[1..7]
-puts <<EOF
-serial: #{serial.to_hex.inspect}
-EOF
-
# faders to minimum. bcf2000 doesn't respond
-#file.write( hdr + "\x61\xf7" )
+mck.write_sysex "\x61"
# all leds off. bcf2000 doesn't respond
-#file.write( hdr + "\x62\xf7" )
+mck.write_sysex "\x62"
# get version. comes back as ASCII bytes
-version = mck.sysex( "\x13\x00" )
+version = mck.sysex "\x13\x00"
puts "version: #{version.map{|x| x.chr}}"
# write a welcome message. bcf2000 responds with exact
diff --git a/libs/surfaces/mackie/surface_port.cc b/libs/surfaces/mackie/surface_port.cc
index f0cdbdbe98..e74ae93841 100644
--- a/libs/surfaces/mackie/surface_port.cc
+++ b/libs/surfaces/mackie/surface_port.cc
@@ -71,7 +71,7 @@ MidiByteArray SurfacePort::read()
if ( !lock.locked() )
{
- //cout << "SurfacePort::read not locked" << endl;
+ cout << "SurfacePort::read not locked" << endl;
return retval;
}
@@ -101,13 +101,18 @@ MidiByteArray SurfacePort::read()
throw MackieControlException( os.str() );
}
}
+#ifdef DEBUG
+ cout << "SurfacePort::read: " << retval << endl;
+#endif
return retval;
}
void SurfacePort::write( const MidiByteArray & mba )
{
+#ifdef DEBUG
//if ( mba[0] == 0xf0 ) cout << "SurfacePort::write: " << mba << endl;
- //cout << "SurfacePort::write: " << mba << endl;
+ cout << "SurfacePort::write: " << mba << endl;
+#endif
// check active before and after lock - to make sure
// that the destructor doesn't destroy the mutex while
@@ -130,7 +135,9 @@ void SurfacePort::write( const MidiByteArray & mba )
throw MackieControlException( os.str() );
}
}
- //if ( mba[0] == 0xf0 ) cout << "SurfacePort::write " << count << endl;
+#ifdef DEBUG
+ if ( mba[0] == 0xf0 ) cout << "SurfacePort::write " << count << endl;
+#endif
}
void SurfacePort::write_sysex( const MidiByteArray & mba )
diff --git a/libs/surfaces/mackie/types.h b/libs/surfaces/mackie/types.h
index 2b47e15640..ce15d6f6a9 100644
--- a/libs/surfaces/mackie/types.h
+++ b/libs/surfaces/mackie/types.h
@@ -18,6 +18,8 @@
#ifndef mackie_types_h
#define mackie_types_h
+#define DEBUG 1
+
namespace Mackie
{