Changeset 3986


Ignore:
Timestamp:
2012-02-17 22:54:24 (2 years ago)
Author:
drobilla
Message:

Add -d option and implement proper communication dumping.

Location:
trunk/jalv
Files:
1 added
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/jalv/doc/jalv.1

    r3984 r3986  
    1 .TH JALV "17 Jan 2012" 
     1.TH JALV "18 Feb 2012" 
    22 
    33.SH NAME 
     
    2121Load state from state directory. 
    2222 
     23.TP 
     24\fB\-d DIR\fR 
     25Dump plugin <=> UI communication. 
     26 
    2327.SH SEE ALSO 
    2428.BR lv2ls(1), 
  • trunk/jalv/src/jalv.c

    r3985 r3986  
    11/* 
    2   Copyright 2007-2011 David Robillard <http://drobilla.net> 
     2  Copyright 2007-2012 David Robillard <http://drobilla.net> 
    33 
    44  Permission to use, copy, modify, and/or distribute this software for any 
     
    5353#define NS_MIDI "http://lv2plug.in/ns/ext/midi#" 
    5454#define NS_PSET "http://lv2plug.in/ns/ext/presets#" 
    55  
     55#define NS_RDF  "http://www.w3.org/1999/02/22-rdf-syntax-ns#" 
     56 
     57#define USTR(str) ((const uint8_t*)str) 
     58     
    5659ZixSem exit_sem;  /**< Exit semaphore */ 
    5760 
     
    387390                port->control = *(float*)body; 
    388391            } else if (ev.protocol == host->atom_prot_id) { 
    389                 printf("ATOM UI READ\n"); 
    390                 for (uint32_t i = 0; i < ev.size; ++i) { 
    391                     printf("%c", body[i]); 
    392                 } 
    393                 printf("\n"); 
    394392                LV2_Evbuf_Iterator    i    = lv2_evbuf_end(port->evbuf); 
    395393                const LV2_Atom* const atom = (const LV2_Atom*)body; 
     
    512510 
    513511    if (protocol == host->atom_prot_id) { 
    514         printf("ATOM UI WRITE: %d\n", protocol); 
    515         for (uint32_t i = 0; i < buffer_size; ++i) { 
    516             printf("%c", ((uint8_t*)buffer)[i]); 
    517         } 
    518         printf("\n"); 
     512        SerdNode s   = serd_node_from_string(SERD_BLANK, USTR("msg")); 
     513        SerdNode p   = serd_node_from_string(SERD_URI, USTR(NS_RDF "value")); 
     514        char*    str = atom_to_turtle(&host->unmap, &s, &p, (LV2_Atom*)buffer); 
     515        printf("\n## UI => Plugin ##\n%s\n", str); 
     516        free(str); 
    519517    } 
    520518 
     
    525523    ev->size     = buffer_size; 
    526524    memcpy(ev->body, buffer, buffer_size); 
    527     #if 0 
    528     printf("WRITE: "); 
    529     for (uint32_t i = 0; i < sizeof(buf); ++i) { 
    530         printf("%c", buf[i]); 
    531     } 
    532     printf("\n"); 
    533     #endif 
    534525    jack_ringbuffer_write(host->ui_events, buf, sizeof(buf)); 
    535526} 
     
    544535        char buf[ev.size]; 
    545536        jack_ringbuffer_read(host->plugin_events, buf, ev.size); 
     537 
     538        if (ev.protocol == host->atom_prot_id) { 
     539            SerdNode s   = serd_node_from_string(SERD_BLANK, USTR("msg")); 
     540            SerdNode p   = serd_node_from_string(SERD_URI, USTR(NS_RDF "value")); 
     541            char*    str = atom_to_turtle(&host->unmap, &s, &p, (LV2_Atom*)buf); 
     542            printf("\n## Plugin => UI ##\n%s\n", str); 
     543            free(str); 
     544        } 
     545 
    546546        suil_instance_port_event(host->ui_instance, ev.index, 
    547547                                 ev.size, ev.protocol, buf); 
  • trunk/jalv/src/jalv_console.c

    r3978 r3986  
    11/* 
    2   Copyright 2007-2011 David Robillard <http://drobilla.net> 
     2  Copyright 2007-2012 David Robillard <http://drobilla.net> 
    33 
    44  Permission to use, copy, modify, and/or distribute this software for any 
     
    3131    fprintf(os, "  -u UUID      UUID for Jack session restoration\n"); 
    3232    fprintf(os, "  -l DIR       Load state from save directory\n"); 
     33    fprintf(os, "  -d DIR       Dump plugin <=> UI communication\n"); 
    3334    return error ? 1 : 0; 
    3435} 
     
    5960            } 
    6061            opts->load = jalv_strdup((*argv)[a]); 
     62        } else if ((*argv)[a][1] == 'd') { 
     63            opts->dump = true; 
    6164        } else { 
    6265            fprintf(stderr, "Unknown option %s\n", (*argv)[a]); 
  • trunk/jalv/src/jalv_gtk2.c

    r3978 r3986  
    11/* 
    2   Copyright 2007-2011 David Robillard <http://drobilla.net> 
     2  Copyright 2007-2012 David Robillard <http://drobilla.net> 
    33 
    44  Permission to use, copy, modify, and/or distribute this software for any 
     
    3737        { "load", 'l', 0, G_OPTION_ARG_STRING, &opts->load, 
    3838          "Load state from save directory", "DIR" }, 
     39        { "dump", 'd', 0, G_OPTION_ARG_NONE, &opts->dump, 
     40          "Dump plugin <=> UI communication", NULL }, 
    3941        { 0, 0, 0, 0, 0, 0, 0 } }; 
    4042    GError* error = NULL; 
  • trunk/jalv/src/jalv_internal.h

    r3978 r3986  
    2828#include "suil/suil.h" 
    2929 
     30#include "lv2/lv2plug.in/ns/ext/atom/atom.h" 
    3031#include "lv2/lv2plug.in/ns/ext/urid/urid.h" 
    3132#include "lv2/lv2plug.in/ns/ext/state/state.h" 
     
    7980    char* uuid; 
    8081    char* load; 
     82    bool  dump; 
    8183} JalvOptions; 
    8284 
     
    190192jalv_apply_state(Jalv* jalv, LilvState* state); 
    191193 
     194char* 
     195atom_to_turtle(LV2_URID_Unmap* unmap, 
     196               const SerdNode* subject, 
     197               const SerdNode* predicate, 
     198               const LV2_Atom* atom); 
     199 
    192200static inline char* 
    193201jalv_strdup(const char* str) 
  • trunk/jalv/src/symap.c

    r3949 r3986  
    11/* 
    2   Copyright 2011 David Robillard <http://drobilla.net> 
     2  Copyright 2011-2012 David Robillard <http://drobilla.net> 
    33 
    44  Permission to use, copy, modify, and/or distribute this software for any 
     
    173173symap_unmap(Symap* map, uint32_t id) 
    174174{ 
    175     if (id <= map->size) { 
     175    if (id == 0) { 
     176        return NULL; 
     177    } else if (id <= map->size) { 
    176178        return map->symbols[id - 1]; 
    177179    } 
  • trunk/jalv/wscript

    r3981 r3986  
    8484    libs = 'LILV SUIL JACK SERD LV2CORE LV2_EVENT LV2_ATOM LV2_URI_MAP LV2_STATE' 
    8585 
    86     source = 'src/jalv.c src/symap.c src/state.c src/lv2_evbuf.c' 
     86    source = 'src/jalv.c src/symap.c src/state.c src/lv2_evbuf.c src/atom_rdf.c' 
    8787 
    8888    # Non-GUI version 
Note: See TracChangeset for help on using the changeset viewer.