ifdefs for debug output. Fix host.rb

git-svn-id: svn://localhost/ardour2/branches/2.0-ongoing@2105 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
John Anderson 2007-07-04 21:18:20 +00:00
parent fd6beee7c3
commit 0518b045c6
3 changed files with 20 additions and 38 deletions

View file

@ -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

View file

@ -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 )

View file

@ -18,6 +18,8 @@
#ifndef mackie_types_h
#define mackie_types_h
#define DEBUG 1
namespace Mackie
{