[Fluxus] midi default values
Adrien Rocher
ted.r at hotmail.fr
Mon Mar 15 08:52:41 PDT 2010
Her is the start.
I'm acually searching a way to access to actions by number of the control button, not parsing the list of actions every-time.
May my organisation is wrong, I'm aware to any suggestions.
Thanks
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
(clear)
;///Strucures delarations
(define-struct midi-action-default (name (value #:mutable) (mod #:mutable) (midi-cc #:mutable) (loaded #:mutable #:auto)) #:auto-value 0)
(define-struct midi-mode-default ((midi-actions-default #:mutable)))
(define-struct midi-script-default ((midi-modes-default #:mutable) (mode-select #:mutable)))
;///Filling with values
(define script-default
(make-midi-script-default
(list
(make-midi-mode-default
(list
(make-midi-action-default
'color 0.5 0 40)
(make-midi-action-default
'size 5 0 41)
(make-midi-action-default
'position 1 0 42)
)
)
(make-midi-mode-default
(list
(make-midi-action-default
'color 0 0 40)
(make-midi-action-default
'size 10 0 41)
(make-midi-action-default
'position 0 0 42)
)
)
)
1
)
)
(define (testy)
;/// Changing mode function, change the mode-select field
;/// and will load actual controllers values into "loaded" field
;/// to know if the default or button value have to be send.
(define (change-mode num level)
(set-midi-script-default-mode-select! script-default num)
)
;///get value by action name
(define (default action)
(for/first
((i
(build-list
(length
(midi-mode-default-midi-actions-default
(list-ref
(midi-script-default-midi-modes-default script-default)
(midi-script-default-mode-select script-default)
)
)
)
values
)
)
#:when
(equal?
(midi-action-default-name
(list-ref
(midi-mode-default-midi-actions-default
(list-ref
(midi-script-default-midi-modes-default script-default)
(midi-script-default-mode-select script-default)
)
)
i
)
)
action
)
)
(midi-action-default-value
(list-ref
(midi-mode-default-midi-actions-default
(list-ref
(midi-script-default-midi-modes-default script-default)
(midi-script-default-mode-select script-default)
)
)
i
)
)
)
)
;///get value my button number
(define (midi-default channel control coeff)
(for/first
((i
(build-list
(length
(midi-mode-default-midi-actions-default
(list-ref
(midi-script-default-midi-modes-default script-default)
(midi-script-default-mode-select script-default)
)
)
)
values
)
)
#:when
(equal?
(midi-action-default-midi-cc
(list-ref
(midi-mode-default-midi-actions-default
(list-ref
(midi-script-default-midi-modes-default script-default)
(midi-script-default-mode-select script-default)
)
)
i
)
)
control
)
)
(midi-action-default-value
(list-ref
(midi-mode-default-midi-actions-default
(list-ref
(midi-script-default-midi-modes-default script-default)
(midi-script-default-mode-select script-default)
)
)
i
)
)
)
)
;/// Changing mode with F1 F2 F3 F4
(cond
((key-special-pressed 1)
(change-mode 0 0))
((key-special-pressed 2)
(change-mode 1 0))
((key-special-pressed 3)
(change-mode 2 0))
((key-special-pressed 4)
(change-mode 3 0))
)
(scale (vector (midi-default 0 41 2) 1 1))
(translate (vector (midi-default 0 42 1) 0 0))
(colour (hsv->rgb (vector (default 'color) 1 1)))
(draw-cube)
)
(every-frame (testy))
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
CC: fluxus at lists.pawfal.org
From: lists at lowfrequency.org
To: ted.r at hotmail.fr
Subject: Re: [Fluxus] midi default values
Date: Mon, 15 Mar 2010 11:55:12 +0000
sounds complicated...
post some code?
On Mar 15, 2010, at 1:28 AM, Adrien Rocher wrote:
Hi the list.
I'm working on an ambitious implementation for me.
I try to make midi default values stored in a file loaded in structures.
But I'm loosing me in the code.
Plus, I want to make 4 different for each script... yes, one is too easy ;-)
I'm making a structure to store the four mode I want to store with a list inside.
A strucure of each mode is a list of actions stored linked to midi controllers.
Here is my problem.
I have to save a lot of things
name (optional), default value, controller linked to, value of the controller when mode loaded (to change when the controller move) , a boolean to say if the value have been changed (to say if the default or controller value have to be returned).
I have two problems with this.
How to set up the controller value when mode loading, wich depend of a field of his own structure.
And how to make an index or something like that, to find easily the action in the list of availables. Because I think searchin the list, even with a for/first will be too heavy.
Have anyone an advice for me?
I'm getting confused... ;-)
Télécharger en toute sécurité sur Internet ? La solution avec Internet Explorer 8
_________________________________________________________________
Découvrez comment SURFER DISCRETEMENT sur un site de rencontres !
http://clk.atdmt.com/FRM/go/206608211/direct/01/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.pawfal.org/pipermail/fluxus-pawfal.org/attachments/20100315/02431c6b/attachment.html>
More information about the Fluxus
mailing list