Changeset 6db2bea in ingen


Ignore:
Timestamp:
10/29/15 17:32:55 (2 years ago)
Author:
David Robillard <d@…>
Branches:
master, groups, nodeless, parallel, parameters, sequencefix
Children:
cc5ec74
Parents:
e203132
Message:

Make ingen.py and ingenish able to control anything

git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@5805 a436a847-0d15-0410-975c-d299462d15a1

Location:
scripts
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • scripts/ingen.py

    rccb7d73 r6db2bea  
    3838class Interface: 
    3939    'The core Ingen interface' 
    40     def put(self, path, body): 
    41         pass 
    42  
    43     def get(self, path): 
    44         pass 
    45  
    46     def set(self, path, body): 
     40    def put(self, subject, body): 
     41        pass 
     42 
     43    def patch(self, subject, remove, add): 
     44        pass 
     45 
     46    def get(self, subject): 
     47        pass 
     48 
     49    def set(self, subject, key, value): 
    4750        pass 
    4851 
     
    5356        pass 
    5457 
    55     def delete(self, path): 
     58    def delete(self, subject): 
    5659        pass 
    5760 
     
    217220        return self.update_model(response_model) 
    218221 
    219     def get(self, path): 
    220         return self.send(''' 
    221 [] 
    222     a patch:Get ; 
    223     patch:subject <ingen:/graph%s> . 
    224 ''' % path) 
    225  
    226     def put(self, path, body): 
    227         return self.send(''' 
    228 [] 
    229     a patch:Put ; 
    230     patch:subject <ingen:/graph%s> ; 
    231     patch:body [ 
    232 %s 
    233     ] . 
    234 ''' % (path, body)) 
    235  
    236     def set(self, path, body): 
    237         return self.send(''' 
    238 [] 
    239     a patch:Set ; 
    240     patch:subject <ingen:/graph%s> ; 
     222    def get(self, subject): 
     223        return self.send(''' 
     224[] 
     225    a patch:Get ; 
     226    patch:subject <%s> . 
     227''' % subject) 
     228 
     229    def put(self, subject, body): 
     230        return self.send(''' 
     231[] 
     232    a patch:Put ; 
     233    patch:subject <%s> ; 
    241234    patch:body [ 
    242235%s 
    243236    ] . 
    244 ''' % (path, body)) 
     237''' % (subject, body)) 
     238 
     239    def patch(self, subject, remove, add): 
     240        return self.send(''' 
     241[] 
     242    a patch:Patch ; 
     243    patch:subject <%s> ; 
     244    patch:remove [ 
     245%s 
     246    ] ; 
     247    patch:add [ 
     248%s 
     249    ] . 
     250''' % (subject, remove, add)) 
     251 
     252    def set(self, subject, key, value): 
     253        return self.send(''' 
     254[] 
     255    a patch:Set ; 
     256    patch:subject <%s> ; 
     257    patch:property <%s> ; 
     258    patch:value %s . 
     259''' % (subject, key, value)) 
    245260 
    246261    def connect(self, tail, head): 
     
    248263[] 
    249264    a patch:Put ; 
    250     patch:subject <ingen:/graph%s> ; 
     265    patch:subject <%s> ; 
    251266    patch:body [ 
    252267        a ingen:Arc ; 
    253         ingen:tail <ingen:/graph%s> ; 
    254         ingen:head <ingen:/graph%s> ; 
     268        ingen:tail <%s> ; 
     269        ingen:head <%s> ; 
    255270    ] . 
    256271''' % (os.path.commonprefix([tail, head]), tail, head)) 
     
    262277    patch:body [ 
    263278        a ingen:Arc ; 
    264         ingen:tail <ingen:/graph%s> ; 
    265         ingen:head <ingen:/graph%s> ; 
     279        ingen:tail <%s> ; 
     280        ingen:head <%s> ; 
    266281    ] . 
    267282''' % (tail, head)) 
    268283 
    269     def delete(self, path): 
     284    def delete(self, subject): 
    270285        return self.send(''' 
    271286[] 
    272287    a patch:Delete ; 
    273     patch:subject <ingen:/graph%s> . 
    274 ''' % path) 
     288    patch:subject <%s> . 
     289''' % subject) 
  • scripts/ingenish

    r7408e3b r6db2bea  
    3939 
    4040Commands: 
    41     put PATH TURTLE_FRAGMENT 
    42     set PATH TURTLE_FRAGMENT 
    43     connect TAIL_PATH HEAD_PATH 
    44     disconnect TAIL_PATH HEAD_PATH 
    45     delete PATH 
     41    put SUBJECT BODY 
     42    set SUBJECT BODY 
     43    connect TAIL HEAD 
     44    disconnect TAIL HEAD 
     45    patch SUBJECT REMOVE ADD 
     46    delete SUBJECT 
    4647    help 
    4748    exit 
    4849 
    49 Paths are UNIX-style paths with strict LV2 symbol components, e.g. /foo/bar_2. 
    50 Turtle fragments are used verbatim as the body of blank nodes, the syntax is 
    51 identical to the descriptions in Ingen patch files. 
     50Subjects are specified by URI, relative to the engine.  The top level audio 
     51graph has the path /graph, so for example, a port on a block might have the 
     52(relative) URI /graph/osc/freq. 
     53 
     54Bodies are specified in fragments of Turtle, just as written in Ingen graph files. 
    5255 
    5356Example: 
    54     ingenish put /left_in 'a lv2:InputPort ; a lv2:AudioPort' 
    55     ingenish put /left_out 'a lv2:OutputPort ; a lv2:AudioPort' 
    56  
    57     ingenish put /tone 'a ingen:Block ; lv2:prototype <http://drobilla.net/plugins/mda/Shepard>' 
    58     ingenish put /combo 'a ingen:Block ; lv2:prototype <http://drobilla.net/plugins/mda/Combo>' 
    59     ingenish connect /left_in /tone/left_in 
    60     ingenish connect /tone/left_out /combo/left_in 
    61     ingenish connect /combo/left_out /left_out 
    62     ingenish set /tone/output 'ingen:value 0.7' 
     57    put /graph/left_in 'a lv2:InputPort ; a lv2:AudioPort' 
     58    put /graph/left_out 'a lv2:OutputPort ; a lv2:AudioPort' 
     59    put /graph/tone 'a ingen:Block ; lv2:prototype <http://drobilla.net/plugins/mda/Shepard>' 
     60    put /graph/combo 'a ingen:Block ; lv2:prototype <http://drobilla.net/plugins/mda/Combo>' 
     61    connect /graph/left_in /graph/tone/left_in 
     62    connect /graph/tone/left_out /graph/combo/left_in 
     63    connect /graph/combo/left_out /graph/left_out 
     64    set /graph/tone/output ingen:value 0.7 
    6365''') 
    6466 
     
    7274    elif cmd[0] == 'put' and len(cmd) == 3: 
    7375        return ingen.put(cmd[1], cmd[2]) 
    74     elif cmd[0] == 'set' and len(cmd) == 3: 
    75         return ingen.set(cmd[1], cmd[2]) 
     76    elif cmd[0] == 'patch' and len(cmd) == 4: 
     77        return ingen.patch(cmd[1], cmd[2], cmd[3]) 
     78    elif cmd[0] == 'set' and len(cmd) == 4: 
     79        return ingen.set(cmd[1], cmd[2], cmd[3]) 
    7680    elif cmd[0] == 'connect' and len(cmd) == 3: 
    7781        return ingen.connect(cmd[1], cmd[2]) 
Note: See TracChangeset for help on using the changeset viewer.