Friday, 2016-08-26

*** unclechu has quit IRC00:52
*** gabrbedd has quit IRC02:54
*** gabrbedd has joined #lv202:58
*** falktx has joined #lv203:22
*** falktx` has quit IRC03:26
*** oofus_lt has joined #lv207:19
*** unclechu has joined #lv208:17
*** ricardocrudo has joined #lv209:19
*** falktx|work has joined #lv209:19
*** arguy has quit IRC10:50
*** rncbc has joined #lv214:19
*** oofus_lt has quit IRC14:27
*** ssj71 has joined #lv215:18
*** son0p_ has quit IRC15:25
*** son0p_ has joined #lv215:27
*** oofus has joined #lv216:36
*** jcelerier has joined #lv216:52
jcelerierhello :)16:52
jcelerierI'd like to make my sequencer LV2-compatible, is there a quick tutorial somewhere ?16:53
jcelerierI've looked into lilv library16:53
jcelerierbut I don't really know where to starT...16:53
*** ricardocrudo has quit IRC16:55
*** falktx|work has quit IRC16:55
*** unclechu has quit IRC17:04
*** unclechu has joined #lv217:16
ColaEuphoriajcelerier, could you describe your sequencer and what it does, specifically?17:17
jcelerierColaEuphoria: www.i-score.org17:17
jcelerierit works like a tree and allows to use elements of programming in the score (conditions, loops, etc.)17:17
jcelerierand allows to react to external events (network requests, etc..)17:18
jcelerierthe idea is to go a bit further than ableton in terms of interactivity17:19
jceleriercurrently I use Faust for audio effects17:19
ColaEuphoriahmm17:23
ColaEuphoriacurrently AFAIK, jcelerier, jalv is an example host for lv2 plugins17:23
ColaEuphoriabut IMO it isn't the smallest working example of an LV2 host17:24
jcelerierI'm more looking for an explanation of the concepts behind LV2 to be fair17:24
jceleriere.g. what's the relationship between nodes, ports, plug-ins, plug-in classes, etc...17:24
jcelerierhow "everything fits together" basically17:24
ColaEuphoriaplug-in classes are nothing more than metadata, something that the host can use to put plugins into convenient locations for the user if it so desires17:25
ColaEuphorialv2 is essentially one big graph database17:26
jceleriernot atree ?17:26
jceleriera tree *17:26
ColaEuphoriain that sense, no17:27
ColaEuphoriabut lilv makes traversing the graph easier than, e.g., writing your own RDF query code17:27
ColaEuphoriaall the LilvNode stuff in lilv seems to be abstractions of the nodes in the lv2 graph database17:28
jcelerierhuh, it's using RDF behind the scenes ?17:30
jcelerierwow17:30
jcelerierokay, but I guess most of it is useful if I want to recreate UIs from the plug-ins17:31
ColaEuphoriajcelerier, i made a super simple, non-general host for what it's worth http://pastebin.com/upB7ieBD17:32
jcelerierfor now just calling some process(float** in, float** out) would be fine for me :p17:32
jcelerieralso it seems to load plug-ins automagically, but does this work reliabely on every platform or is there a way to load things manually ?17:32
jcelerier(for instance for weirder stuff such as emscripten, etc...)17:32
jcelerierthanks, checking it17:33
jcelerierlilv_new_uri(lworld, "https://sine.synth.love/"); > it can load stuff directly from the net ? Oo17:33
ColaEuphorianoooo17:33
ColaEuphoriathe URI scheme is simply a universally unique identifier17:34
jcelerierxD17:34
ColaEuphoriait's just convention to make it a URI17:34
jcelerier... okay17:34
ColaEuphoriait doesn't actually connect to anything17:34
ColaEuphoriafor example17:35
ColaEuphoriawell, just that LV2 doesn't really load plugins by filepath17:35
jcelerierso, here, port 0 is an input constant, and port 1 is the data output.17:35
ColaEuphoriait "queries" for turtle files in the standard LV2 paths on your system17:36
ColaEuphoriain here, yes17:36
ColaEuphoriait was a quick simple lv2 plugin i made17:36
jcelerierand I guess that I can check for all the ports and see what they do17:36
jcelerierin order to find the ones that I'm interested in.17:36
jceleriercan ports vary dynamically ?17:36
jcelerieror can I assume that they won't chang e?17:36
ColaEuphoriakeep in mind that what i'm doing with my "host" is extremely specific and won't work for much more than that specific plugin17:37
ColaEuphoriaports can change if they make use of the Morph feature17:38
ColaEuphoriaI don't think it's worth implementing though, at least not when you're trying to just get basic LV2 functionality working17:38
ColaEuphoriahosts should query the ports for each plugin it loads and not make assumptions about what ports do what17:38
jcelerierokay17:38
jcelerierand hopefully there will be a port that will allow some audio processing17:39
ColaEuphoriayes17:39
ColaEuphoriaand that port17:39
ColaEuphoriaor ports17:39
ColaEuphoriawill be a lv2:AudioPort and an  lv2:OutputPort17:40
jceleriernice, thanks17:40
jcelerierI guess there are some macros / enum somewhere to allow finding themù17:40
ColaEuphorialilv has plenty of port-specific functions17:40
jcelerierdamn, that C++ API needs a good overhaul imho17:42
ColaEuphoriawhat C++ API?17:43
jcelerierlilvmm.hpp17:43
ColaEuphoriaugh17:43
ColaEuphoriahonestly17:43
ColaEuphoriaC++ "wrapper" APIs tend to ubiquitously be garbage17:43
ColaEuphoriait's also important to point17:48
ColaEuphoriathat lv2 discovery17:48
ColaEuphoriasimply queries your system for lv2 stuff17:48
ColaEuphoriabut DOESN'T immediately load the actual binaries17:48
jceleriernice17:48
ColaEuphoria    LilvNode *pluguri = lilv_new_uri(lworld, "https://sine.synth.love/");17:49
ColaEuphoriathis queries the turtle files in your LV2 paths for a plugin who identifies itself as "https://sine.synth.love"17:49
ColaEuphorianothing more than a string17:49
ColaEuphoria    LilvInstance *synth = lilv_plugin_instantiate(plug, 44100, NULL);17:49
ColaEuphoriai believe this actually loads the binary17:49
jcelerierokay17:51
ColaEuphoriai should probably fix this up and make it into some official "babby's first" host example17:51
ColaEuphoriaand note that an actual host must pay attention to the LV2 threading rules in http://lv2plug.in/ns/lv2core/17:52
jcelerierhmmm17:55
jceleriermakes sense I guess17:55
jcelerier>17:55
jcelerierPlugin functions in any class MUST NOT manipulate any state which might affect other plugin or host code17:56
jcelerierhehe17:56
jcelerierthat's a bit naive :p17:56
ColaEuphoriayou'd be surprised17:59
ColaEuphoriahow many people think it's a good idea to, for example, use `static` variables in functions18:00
ColaEuphoriawhen writing a plugin18:00
jcelerieryeah that's what I meant, it's like saying "Plugin authors MUST NOT write buggy plugins"18:00
ColaEuphoriaeh, it's just a formal way of saying it18:00
jcelerierI think that the Bitwig Studio approach is cool for this : run each plug-in in its own process18:01
ColaEuphoriayou'd think that's cool18:01
ColaEuphoriauntil you notice it's pretty tricky to get the inter-process communication to be efficient18:01
jcelerierah sure, but for the end-user it's so good to not loose data due to some_1998_vst.dll18:02
jcelerierokay, this seems like it won't be such a terrible task after all. thanks a lot for your help :)18:08
ColaEuphoriaI'm also working on the "babby's first lv2 host" example now18:10
ColaEuphoriagoing to try and formalize it18:10
jcelerierthat lv2_atom api smells a lot like max/msp's api18:21
ColaEuphoriadoes it? i've never dealt with max/msp18:22
jcelerierhttps://cycling74.com/sdk/MaxSDK-6.0.4/html/group__atom.html18:23
jcelerier(do yourself a favor and keep not dealing with it ^^)18:24
ColaEuphorialol18:27
ColaEuphoriaalright i won't. i've had enough after VST18:27
ColaEuphoria;)18:27
drobillaI suggest looking at the lilv API and/or simpler example hosts to get basic things working first18:33
drobillaDiving down the rabbit hole of trying to understand absolutely everything from the specs first is not going to end well18:33
drobillalv2file is pretty small as well, but it's a bit messy18:35
ColaEuphoriadrobilla, at what point does lilv actually load a plugin binary?18:44
drobillainstantiate19:00
jcelerier@drobilla: are there examples somewhere on your website ?19:01
drobillaThis is not twitter :P19:02
drobillajcelerier: No, other than what's in lilv itself (utils) and Jalv19:02
drobillaJalv started much smaller/simpler than it is these days, it's probably outgrown its life as an "example"19:02
jcelerierokay19:02
jcelerieryeah, I was a bit discouraged when I saw 7-level-deep nested if-else19:03
jcelerier:p19:03
jcelerierI also tried to look at qtractor's source but it's intertwined with the gui and various ifdef for LV2_ATOM19:03
drobillaOne of the utils, say lv2info, has everything in there needed to get at a plugin19:03
drobillaFrom there, instantiate, and the rest is kind of self-explanatory and/or direct usage of the LV2 plugin API itself19:04
jcelerierokay19:04
jcelerierhttps://github.com/jeremysalwen/lv2file/blob/master/lv2file.c#L333 if someone can help me, I don't really graps what's going on from here19:59
jcelerieris it looking for the number of ports and their type to compare with the loaded file's channels and create more instances in case the plug-in is mono and the file stereo ?20:00
*** kwmiebach has quit IRC20:02
jcelerieralso, is there a reason for Instance to not call lilv_instance_free in its dtor ?20:11
jcelerierkinky API20:26
jcelerierplug.me20:26
drobillaProbably don't want to use the C++ API.20:29
ColaEuphoriadrobilla, http://drobilla.net/docs/lilv/#gad973d7894eb44e7dd62328e8d9e6a82a20:30
ColaEuphoria"void(*" isn't a helpful definition for a function pointer...20:30
* drobilla shrugs20:31
drobillaDoxygen bug20:31
ColaEuphoriait could also be overuse of typedef ;)20:32
drobillaIt could also not be.  and isn't.20:32
ColaEuphoriai just have no idea what type its parameters are20:33
ColaEuphoriacould it at least be possible to get past the doxygen weirdness by explicitly putting the type under the Parameters list?20:33
*** kwmiebach has joined #lv220:33
drobillaYou can get past it like I and roughly everyone else does by just reading the header ;)20:33
ColaEuphoriaI could20:34
ColaEuphoriaBut that's only because I'm already really invested in this20:34
ColaEuphoriaMaybe I could see if I could get around this and possibly put a merge request or something20:35
drobillaFeel free to figure out why Doxygen barfs or file a ticket.20:35
drobillaI seem to recall this working, so maybe something broke.  I dunno.20:36
drobillaWorks here: http://lv2plug.in/doc/html/group__state.html20:37
ColaEuphoriainteresting20:37
drobillaEr, no, it doesn't work there, just in the index at the top20:55
ColaEuphoriaI can't believe doxygen would do something this narrow-sighted20:59
ColaEuphoriaIt's as if they never anticipated people to typedef a function pointer20:59
jcelerierweird, I checked on some docs for one of my libs and typedefs are... well, correct21:02
jcelerierit looks like a parsing bug21:02
drobillaC++ tool from Qt people, I'm not terribly surprised :)21:06
jceleriermy main processing function looks like this : http://paste.ofcode.org/kTc3pjS9WSNmFTHYmb98KM21:15
jcelerierbut I get a segfault in run :(21:15
jcelerierhave I forgotten something ?21:15
ColaEuphoriado you even gdb?21:15
jcelerier(input and output are both valid and of the correct size)21:15
ColaEuphoriai don't think activate() is allowed to be called from the audio thread21:16
ColaEuphoriaeven if that isn't why it's segfaulting21:16
ColaEuphoriait isn't allowed21:16
jcelerierwell, all the pointers seem valid in gdb21:16
jcelerierokay21:16
ColaEuphoriasame with deactivate()21:16
ColaEuphoriahttp://lv2plug.in/ns/lv2core/21:17
ColaEuphoriasee "Threading Rules"21:17
ColaEuphoriayou also shouldn't be calling activate() or deactivate() on every call to run()21:17
ColaEuphoriait's very expensive to do that21:18
jcelerierso LV2_Descriptor == LilvInstance ?21:18
ColaEuphoriamore like LV2_Handle21:18
jcelerierdamn, it even botched jackd21:18
* drobilla cringes at capitalized method name21:18
jcelerierdrobilla: it gets worse :p21:19
drobillaYou are probably connecting to junk, but yes, not only can you not call activate in the audio thread, activate() and deactivate() must be called in pairs21:19
jcelerierin pairs ?21:19
drobillai.e. you can't activate() run() activate() run(), it's a double activate()21:19
jcelerierah yes21:19
jcelerierokay, I guess doing activate in the constructor and deactivate in the destructor would work ?21:20
drobilla(and since activate() nukes plugin state you can't process a stream like that anyway)21:20
drobillaYou probably want activate and deactivate as their own methods, as they are in the LV2 API21:20
drobillacf,21:21
drobillalv2.h21:21
ColaEuphoriahe's using it through lilv21:21
drobillaI'm aware.21:21
ColaEuphoriaoh21:21
ColaEuphoriai see21:22
drobillaThe lilv_instance_* are trivial inline wrappers for the LV2 methods21:22
ColaEuphoriawhen are de|activate() typically called anyway?21:22
drobilla"Soon" before and after calling (a series of) run(), respectively.21:23
jcelerierI ran this code : http://paste.ofcode.org/vEqXFaKEEmESQAg4G4E9sX and I still get a segfault in lilv_instance_run, not when dereferencing my buffers21:23
ColaEuphoriathey WILL be dereferenced by the plugin inside the plugin21:23
jcelerierwell yes, but I guess that if the pointer wasn't valid, it would have crashed in the for-loop at the beginning21:24
drobillaPlease actually show us enough code to see what is happening and/or a backtrace21:24
ColaEuphoriait'll crash on lilv_instance_run() as the plugin will dereference its port connections21:24
ColaEuphoria(if anything)21:25
drobillaI assume you're just not connecting at least one port21:25
jcelerierthe back trace directly goes in lilv_instance_run and then in stereoecho::Dsp::compute_static(int, float *, float *, float *, float *, PluginLV2 *)21:25
jcelerierand in_port.size() == out_port.size() == 221:26
jcelerierokay well..21:27
jcelerierI tried with another plugin and it works21:27
ColaEuphoriaahh the wonders of coding a host :)21:27
jcelerierT_T21:28
ColaEuphoriahaving a plugin ruin everything21:28
jcelerierand all this for what ? running guitarix plug-ins while I already handle Faust x)21:29
ColaEuphoriaDoes it handle midi?21:30
jceleriermh.... you can get midi note_on, note_off, and CC but there is no piano roll for now21:31
ColaEuphoriaI'm still looking for enough reasons to finish Delicate Synth and finally get it into a state where I'm comfortable sharing it21:31
jcelerier(but originally it's not a DAW, it's a show control software)21:31
jcelerieris there a built-in way to handle for instance stereo sounds with a mono plug-in, or should I just duplicate the instances, apply the same paramters, and hope that the plug-in doesn't call rand() too much ?21:41
drobillaNo, up to the host21:42
jcelerierokay21:44
ColaEuphoriayou don't need to duplicate the instances for that...21:44
ColaEuphoriajust duplicate their write buffer21:44
drobillaYou do if the plugin has internal state, which is almost all of them21:45
drobilla(You don't for the other way around)21:45
ColaEuphoriaoh21:46
ColaEuphoriai read that backwards21:46
jcelerieryeah, echo plug-ins would sound funny :p21:46
ColaEuphoriai thought he wanted to apply a stereo effect to a mono source21:46
jceleriershit, I've got a conference in three days and I'm here procrastinating T_T21:47
jcelerierdamn, I understood my crash22:20
jcelerieryou actually have to connect *all the ports22:20
ColaEuphoriayes22:21
ColaEuphoriabecause the plugin WILL dereference all its data that it works with22:21
jcelerier:]22:21
drobilla<drobilla> I assume you're just not connecting at least one port22:21
jcelerierI thought that you were referring to an audio port22:22
ColaEuphoria<ColaEuphoria> it'll crash on lilv_instance_run() as the plugin will dereference its port connections22:22
ColaEuphoriadrobilla, should ports be connected before calling lilv_state_restore()?22:25
ColaEuphoriai'm assuming yes22:26
drobillaDoesn't matter22:26
drobillaPorts are only accessible in the run() context22:26
drobilla(In a better world, they'd be parameters and this pointless internal state wouldn't exist at all)22:26
jcelerieris there some kind of "test-plugin" that could be used to check that everything works ?22:29
jcelerieri.e. by using most or all of the features22:29
jcelerier(or at least that nothing crashes)22:30
*** ssj71 has quit IRC22:31
drobillaI wrote a simpler sndfile example: http://pastebin.com/HBnq3J0z22:49
* drobilla is also clearly procrastinating22:49
*** kwmiebach has quit IRC23:01
jceleriernice, thanks !23:02
jcelerierwell commented and everything :p23:02
jcelerieryou should put this on the website imho23:02
drobillaIt'll go in lilv23:14
drobillaThough it's pretty dumb about I/O mapping so doesn't make the most useful thing in the world right now, whatever23:15
*** rncbc has quit IRC23:16
*** kwmiebach has joined #lv223:18
jcelerierwell, it looks like everything works more or less as I wish !23:36
jcelerierwould any of you be interested in alpha-testing my software one day ?23:37
*** kwmiebach has quit IRC23:46

Generated by irclog2html.py 2.13.0 by Marius Gedminas - find it at mg.pov.lt!