[CM] Wrong Number of Arguments -> MIDI (snd-rt)

Esben Stien b0ef@esben-stien.name
Tue, 06 Mar 2007 14:28:34 +0100


I'm trying to use MIDI in my first endeavor into SND-rt, but trying to
insert just the first block to enable MIDI, gives me an error.

Wrong number of arguments to #<procedure #f ((type somethingmore) (let* ((c-type (hashq-ref rt-types type))) (if c-type (quasiquote (cast (unquote (c-type (quote c-type))) (unquote somethingmore))) (quasiquote (cast (unquote type) (unquote somethingmore))))))>
In /usr/local/snd-ls/snd-8/eval-c.scm:
 745: 31* [eval-c-parse (<void> rt_gen2__2 (lambda (# # # #) (the <void>)))]
 634: 32  (cond ((string? term) (<-> term " ")) ((number? term) (<-> # " ")) ...)
 641: 33  (if (string? (car term)) (eval-c-eval-funccall term) ...)
 643: 34  (let* ((type #)) (if (list? type) (let # #) (if # # #)))
 645: 35  (if (list? type) (let (#) (<-> "typedef " # ...)) ...)
 660: 36  (if (not (eval-c-symbol-is-type type)) (eval-c-macro-result term) ...)
 665: 37  (let* (# # #) (if # # #))
    ...
 725: 38  [string-append "" "" ...
 729: 39* [apply #<primitive-procedure string-append> ...
 729: 40* [map #<procedure eval-c-parse #> ("static void " rt_gen2__2 #)]
In unknown file:
   ?: 41* [eval-c-parse (lambda (# # # #) (the <void>))]
In /usr/local/snd-ls/snd-8/eval-c.scm:
 634: 42* (cond ((string? term) (<-> term " ")) ((number? term) (<-> # " ")) ...)
 641: 43  (if (string? (car term)) (eval-c-eval-funccall term) ...)
 643: 44  (let* ((type #)) (if (list? type) (let # #) (if # # #)))
 645: 45  (if (list? type) (let (#) (<-> "typedef " # ...)) ...)
 660: 46  (if (not (eval-c-symbol-is-type type)) (eval-c-macro-result term) ...)
 662: 47  [eval-c-macro-result (lambda (# # # #) (the <void>))]
 624: 48  (let* ((a #) (b #)) (if (not #) (eval-c-parse b) ...))
 625: 49* [macroexpand-1 (eval-c-macro-lambda (# # # #) (the <void>))]
In unknown file:
   ?: 50  (cond ((pair? e) (let* (# #) (if # # e))) (#t e))
   ?: 51  (let* ((a #) (val #)) (if (defmacro? val) (apply # #) e))
   ?: 52  (if (defmacro? val) (apply (defmacro-transformer val) (cdr e)) e)
   ?: 53  [apply #<procedure #f (# # #)> ((# # # #) (the <void>))]
   ?: 54  [#<procedure #f #> (# # # #) (the <void>)]
In /usr/local/snd-ls/snd-8/eval-c.scm:
1184: 55  (let* ((ret (<-> # #))) (eval-c-downlevel) ret)
1184: 56* [string-append "(struct RT_Globals *rt_globals , int control__3 , int data1__4 , int data2__5 )" ...
1190: 57* (if (eq? (quote decl) (car body)) "" ...)
1192: 58  [string-append "{" "
" ...
1193: 59* [eval-c-parse-lines ((the <void>))]
 748: 60  [apply #<primitive-procedure string-append> ...
 748: 61* [map #<procedure #f ((x) (<-> # " "))> ((the <void>))]
In unknown file:
   ?: 62* [#<procedure #f ((x) (<-> # " "))> (the <void>)]
In /usr/local/snd-ls/snd-8/eval-c.scm:
 748: 63* [string-append ...
 748: 64* [eval-c-parse-line (the <void>)]
 741: 65  (if (and (string? term) (not #) ...) (<-> term (string #\newline)) ...)
 745: 66  [string-append ...
 745: 67* [eval-c-parse (the <void>)]
 634: 68  (cond ((string? term) (<-> term " ")) ((number? term) (<-> # " ")) ...)
 641: 69  (if (string? (car term)) (eval-c-eval-funccall term) ...)
 643: 70  (let* ((type #)) (if (list? type) (let # #) (if # # #)))
 645: 71  (if (list? type) (let (#) (<-> "typedef " # ...)) ...)
 660: 72  (if (not (eval-c-symbol-is-type type)) (eval-c-macro-result term) ...)
 662: 73  [eval-c-macro-result (the <void>)]
 624: 74  (let* ((a #) (b #)) (if (not #) (eval-c-parse b) ...))
 625: 75* [macroexpand-1 (eval-c-macro-the <void>)]
In unknown file:
   ?: 76  (cond ((pair? e) (let* (# #) (if # # e))) (#t e))
   ?: 77  (let* ((a #) (val #)) (if (defmacro? val) (apply # #) e))
   ?: 78  (if (defmacro? val) (apply (defmacro-transformer val) (cdr e)) e)
   ?: 79  [apply #<procedure #f ((type somethingmore) (let* # #))> (<void>)]
   ?: 80  [#<procedure #f ((type somethingmore) (let* # #))> <void> ...

wrong-number-of-args

Here's my code. It compiles fine without the MIDI block. 

(definstrument (soldier_of_b0rkness_2 start-time duration frequency amplitude #:key
	 (partial0 1.0)(partial-amplitude0 0.8)
	 (partial1 1.593)(partial-amplitude1 0.6)
	 (partial2 2.135)(partial-amplitude2 0.6)
	 (partial3 2.295)(partial-amplitude3 0.35)
	 (partial4 2.917)(partial-amplitude4 0.3)
	 (partial5 3.598)(partial-amplitude5 0.2)
	 (amplitude-envelope '(0 0 .04 1 .4 1 1 0))
	 ;;(amplitude-envelope '(0 0.5 1 0 1 0)))
	 #:allow-other-keys)
  (let* ((start (floor (* start-time (mus-srate))))
	 (len (floor (* duration (mus-srate))))
	 ;;base oscillator
	 (sine0 (make-oscil :frequency frequency))
	 (sine1 (make-oscil :frequency (* partial0 frequency)))
	 (sine2 (make-oscil :frequency (* partial1 frequency)))
	 (sine3 (make-oscil :frequency (* partial2 frequency)))
	 (sine4 (make-oscil :frequency (* partial3 frequency)))
	 (sine5 (make-oscil :frequency (* partial4 frequency)))
	 (sine6 (make-oscil :frequency (* partial5 frequency)))
	 ;;insert modulating oscillator
	 (mod (make-oscil :frequency 50))
	 (indenv '(0 1 100 1))
;snare	 (indenv '(0 100 50 1))
	 (devf (make-env :envelope indenv
			 :scaler (in-hz 75)
			 :start start :end len))	 
	 (amplitude-envelope (make-env :envelope amplitude-envelope
				       :scaler amplitude
				       :start start
				       :end len))
	 (output (make-vct len))
	 ;delete these two old lines from havanna
	; (osc (make-oscil))
	 ;(vol 4/6)
	 )
    ;;
    (<rt-play> 0 2
	       (lambda ()
		 (receive-midi (lambda (control data1 data2)
                               (declare (<int> control data1 data2))
                               ;(printf "gakk! %x %x %x\\n" control data1 data2)
			       ))			       
	
		 (out 
		  (* (env amplitude-envelope)
		     (+ (* partial-amplitude0 (oscil sine1 (* (env devf) (+ (oscil sine0) (oscil mod)))))
			
			(* partial-amplitude1 (oscil sine2 (* (env devf) (+ (oscil sine0) (oscil mod)))))
			(* partial-amplitude2 (oscil sine3))
			(* partial-amplitude3 (oscil sine4))
			(* partial-amplitude4 (oscil sine5))
			(* partial-amplitude5 (oscil sine6))
			)
		     )
		  )
		 )
	       )
    )
  )

I'm on GNU/Linux with snd-ls-0.9.7.12.

Any pointers as to what I can try?

-- 
Esben Stien is b0ef@e     s      a             
         http://www. s     t    n m
          irc://irc.  b  -  i  .   e/%23contact
           sip:b0ef@   e     e 
           jid:b0ef@    n     n