musikinformatik / SuperDirt

Tidal Audio Engine

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

MIDI not working

yaxu opened this issue · comments

The problem seems to be introduced here: 90866bb

Running a simple once $ n 0 # s "midi" gives:

ERROR: Message 'asInteger' not understood.
RECEIVER:
   nil
ARGS:
CALL STACK:
	DoesNotUnderstandError:reportError
		arg this = <instance of DoesNotUnderstandError>
	Nil:handleError
		arg this = nil
		arg error = <instance of DoesNotUnderstandError>
	Thread:handleError
		arg this = <instance of Thread>
		arg error = <instance of DoesNotUnderstandError>
	Object:throw
		arg this = <instance of DoesNotUnderstandError>
	Object:doesNotUnderstand
		arg this = nil
		arg selector = 'asInteger'
		arg args = [*0]
	MIDIOut:noteOn
		arg this = <instance of MIDIOut>
		arg chan = nil
		arg note = 60
		arg veloc = 64
	Function:awake
		arg this = <instance of Function>
		arg beats = 45.184081564692
		arg seconds = 45.184081564692
		arg clock = <instance of Meta_SystemClock>
		var time = 45.184081564692
^^ The preceding error dump is for ERROR: Message 'asInteger' not understood.
RECEIVER: nil


ERROR: Selector not a Symbol :
ERROR: Primitive '_ObjectPerformList' failed.
Wrong type.
RECEIVER:
Instance of MIDIOut {    (0x56171cc067d8, gc=1C, fmt=00, flg=00, set=02)
  instance variables [3]
    port : Integer 0
    uid : Integer 917504
    latency : Integer 0
}
CALL STACK:
	MethodError:reportError
		arg this = <instance of PrimitiveFailedError>
	Nil:handleError
		arg this = nil
		arg error = <instance of PrimitiveFailedError>
	Thread:handleError
		arg this = <instance of Thread>
		arg error = <instance of PrimitiveFailedError>
	Object:throw
		arg this = <instance of PrimitiveFailedError>
	Object:primitiveFailed
		arg this = <instance of MIDIOut>
	Function:awake
		arg this = <instance of Function>
		arg beats = 45.184081564692
		arg seconds = 45.184081564692
		arg clock = <instance of Meta_SystemClock>
		var time = 45.184081564692
^^ The preceding error dump is for ERROR: Primitive '_ObjectPerformList' failed.
Wrong type.
RECEIVER: a MIDIOut


ERROR: Message 'asInteger' not understood.
RECEIVER:
   nil
ARGS:
CALL STACK:
	DoesNotUnderstandError:reportError
		arg this = <instance of DoesNotUnderstandError>
	Nil:handleError
		arg this = nil
		arg error = <instance of DoesNotUnderstandError>
	Thread:handleError
		arg this = <instance of Thread>
		arg error = <instance of DoesNotUnderstandError>
	Object:throw
		arg this = <instance of DoesNotUnderstandError>
	Object:doesNotUnderstand
		arg this = nil
		arg selector = 'asInteger'
		arg args = [*0]
	MIDIOut:noteOff
		arg this = <instance of MIDIOut>
		arg chan = nil
		arg note = 60
		arg veloc = 64
	Function:awake
		arg this = <instance of Function>
		arg beats = 46.294192728785
		arg seconds = 46.294192728785
		arg clock = <instance of Meta_SystemClock>
		var time = 46.294192728785
^^ The preceding error dump is for ERROR: Message 'asInteger' not understood.
RECEIVER: nil

In the first error, the ~midichan seems to be nil, but I have no clue who this can be.
You can set the receiveAction to post the received value:

~dirt.receiveAction = { |x| x.postcs }; // postcs will post the full compile string

In the second error, midicmd seems to be not a symbol as it should, but probably nil or 0.
Also this should feature in the message sent from tidal ...

Maybe some time we should make the API clearer and check for it.

Thanks, here's what is received:

( 'n': 0.0, 's': 'midi', 'cycle': 0.0, 'cps': 0.89999997615814, 
  'delta': 1.111111164093, 'latency': 0.18455786288996 )

midichan should default to 0:

~chan = ~midichan ? 0;

midicmd should in common cases be inferred by the message. But in the case of notes it isn't used at all. Instead

For completeness here's the error again but using the head of the develop branch, although it looks much the same to me.

ERROR: Message 'asInteger' not understood.
RECEIVER:
   nil
ARGS:
CALL STACK:
	DoesNotUnderstandError:reportError
		arg this = <instance of DoesNotUnderstandError>
	Nil:handleError
		arg this = nil
		arg error = <instance of DoesNotUnderstandError>
	Thread:handleError
		arg this = <instance of Thread>
		arg error = <instance of DoesNotUnderstandError>
	Object:throw
		arg this = <instance of DoesNotUnderstandError>
	Object:doesNotUnderstand
		arg this = nil
		arg selector = 'asInteger'
		arg args = [*0]
	MIDIOut:noteOn
		arg this = <instance of MIDIOut>
		arg chan = nil
		arg note = 60
		arg veloc = 64
	Function:awake
		arg this = <instance of Function>
		arg beats = 8241.2761779299
		arg seconds = 8241.2761779299
		arg clock = <instance of Meta_SystemClock>
		var time = 8241.2761779299
^^ The preceding error dump is for ERROR: Message 'asInteger' not understood.
RECEIVER: nil

ERROR: Selector not a Symbol :
ERROR: Primitive '_ObjectPerformList' failed.
Wrong type.
RECEIVER:
Instance of MIDIOut {    (0x56171ce10148, gc=64, fmt=00, flg=00, set=02)
  instance variables [3]
    port : Integer 0
    uid : Integer 917504
    latency : Integer 0
}
CALL STACK:
	MethodError:reportError
		arg this = <instance of PrimitiveFailedError>
	Nil:handleError
		arg this = nil
		arg error = <instance of PrimitiveFailedError>
	Thread:handleError
		arg this = <instance of Thread>
		arg error = <instance of PrimitiveFailedError>
	Object:throw
		arg this = <instance of PrimitiveFailedError>
	Object:primitiveFailed
		arg this = <instance of MIDIOut>
	Function:awake
		arg this = <instance of Function>
		arg beats = 8241.2761779299
		arg seconds = 8241.2761779299
		arg clock = <instance of Meta_SystemClock>
		var time = 8241.2761779299
^^ The preceding error dump is for ERROR: Primitive '_ObjectPerformList' failed.
Wrong type.
RECEIVER: a MIDIOut


ERROR: Message 'asInteger' not understood.
RECEIVER:
   nil
ARGS:
CALL STACK:
	DoesNotUnderstandError:reportError
		arg this = <instance of DoesNotUnderstandError>
	Nil:handleError
		arg this = nil
		arg error = <instance of DoesNotUnderstandError>
	Thread:handleError
		arg this = <instance of Thread>
		arg error = <instance of DoesNotUnderstandError>
	Object:throw
		arg this = <instance of DoesNotUnderstandError>
	Object:doesNotUnderstand
		arg this = nil
		arg selector = 'asInteger'
		arg args = [*0]
	MIDIOut:noteOff
		arg this = <instance of MIDIOut>
		arg chan = nil
		arg note = 60
		arg veloc = 64
	Function:awake
		arg this = <instance of Function>
		arg beats = 8242.386289094
		arg seconds = 8242.386289094
		arg clock = <instance of Meta_SystemClock>
		var time = 8242.386289094
^^ The preceding error dump is for ERROR: Message 'asInteger' not understood.
RECEIVER: nil

I think I found it, just an initialisation problem