Saturday, 2015-02-28

Socapexdrobilla: Sorry to directly ask this, but you are very knowledgeable in the ways of the force. What would you recommend if my ringbuffer pop() tail is at same position as head? Just return null?00:25
drobillaSocapex: i.e. your ring is empty00:26
Socapexyes00:26
drobillaSocapex: depends on the context, but generally reading from an empty ring is an error00:26
Socapexor somehow tail caught up00:26
Socapexallright00:26
drobillaSocapex: Tail can't catch up.  A ring can never be 100% full, there is a 1 element pad for this reason00:26
drobillaSocapex: You need to check the read space before reading00:27
drobillaif (ring.read_space() > amount_of_stuff_I_want) { ring.read(amount_of_stuff_I_want); }00:27
drobillaYou need to do this anyway or it wouldn't be threadsafe since a half write might be in there00:27
drobilla>= rather00:27
Socapexhmmm, I'm basing off of this simple implementation http://www.wannabegeek.com/?p=532. What I thought is just read then increment tail00:28
Socapexinteresting, ok I'll ponder this great information you just shared. thank you00:28
drobillaI had an objectey ring once, but dropped it as more confusion than it's worth in favour of always using byte-oriented rings00:29
Socapexyeah I wasn't sure if I wanted to go full fast C, or more c++ ish00:30
drobillaSocapex: Well, if you need variable length things in there this doesn't work anyway00:30
SocapexI went c++ cause there are so many C examples and implementations allready. I wanted to make another example for ppl00:30
Socapexdrobilla: That is true, but isn't the length allways equal?00:30
Socapexat least, for my particular use cases00:31
HarryHaarenSocapex, i have an "objecty" C++ variable size implementation tutorial thingy here https://github.com/harryhaaren/realtimeAudioThreading/blob/master/basicRingbufferEvent/ringbufferTest.cpp00:31
SocapexHarryHaaren: Thank you very much!00:31
HarryHaarennah, the events you pass through the ringbuffer will change in size depending on the contents of the event00:31
Socapexoh crap00:31
Socapexthen back to the drawing board00:31
drobillahttp://dev.drobilla.net/browser/trunk/raul/raul/RingBuffer.hpp00:31
Socapexwow you guys are on fire with awesome info tonight! xD00:32
drobillaObjectey one http://dev.drobilla.net/browser/trunk/raul/raul/SRSWQueue.hpp00:32
drobillaLess sure about the correctness of the latter though00:32
SocapexMaybe I'll keep my current one as a "FixedRingbuffer". Should work for audio buffers00:33
drobillahttp://svn.drobilla.net/zix/trunk/zix/ring.[ch] <= C00:33
HarryHaarenah you're adding a ring to zix? Nice00:33
HarryHaareni was gonna feature request that at some point :)00:33
drobillaHarryHaaren: There's always been one00:33
HarryHaarenreally? Hmm i must have a really old git or partial zix then00:34
HarryHaareneitherway, nice :)00:34
Socapexdrobilla: Are you french?00:34
HarryHaareni wrote a 4 channel LV2 capture plugin for use on the MOD a while ago, used Zix semas + thread, JACK ringbuff. Will port to Zix ring for cleanliness. Cheers!00:35
* HarryHaaren off to bed, laters guys00:35
SocapexOh and off topic, I wanted to change something on website, you guys ok with me sending a PR? For new users: Add a Plugins link in top bar (instead of in developing -> projects)00:35
SocapexHarryHaaren: gn, ty again00:36
drobillaSocapex: Non, mon nom, seulment :)00:36
*** HarryHaaren has quit IRC00:36
Socapexdrobilla: C'est ce que j;pensais ;)00:36
drobillaor maybe "seulment mon nom", which only serves to prove the point00:36
SocapexAlors tu as appris ca par coeur?00:36
drobillacoeur... coeur...00:38
drobillaoh00:38
Socapexlol. I was asking if you learnt that by heart :)00:38
drobillaUnfortunately I didn't learn at all, beyond what every Canadian kid does in elementary school :)00:39
SocapexWhere in Canada?00:39
drobillaNow that I live in Ottawa and visit Montréal on occasion, this is considerably more unfortunate00:39
SocapexI'm in Montreal, respect man :P00:39
Socapexthough you dont need to know french around here00:40
drobillaI may join you when I escape this barren wasteland :)00:40
Socapexlooool00:40
drobillaWell, yeah, but you know...00:40
SocapexI know: "The french girls are hotter"00:40
SocapexI feel you man00:40
Socapex^_^00:40
drobillaNobody wants to be that guy :)00:41
Socapexlol00:41
drobillaI'm not exactly super keen on the hyper right wing Americanisation of anglo Canada as of late anyway00:42
Socapexoh wow00:42
Socapexyeah I'm not that type00:42
drobillaI should probably resume my bedtime French study habit, but I laze around like a piece of crap and marathon Star Trek or whatever instead :)00:47
Socapexhaha! I should actually marathon star trek... Oh man, I'll never get this ringbuffer done xD00:47
SocapexSo how do you guys work for pull requests on website?00:47
* drobilla 's family pronounces his name with hard l's. It's awful. Only in rural Ontario...00:48
drobillaSocapex: Basically, however.  Several people made forked repos I just added as remotes and cherry pick from00:49
Socapexdrobilla: Allright, so Adding "Plugins" to the top bar sounds good? I was searching for that first time, my friend did the same when I talked about LV2. Basically brains want to see Plugin and click00:50
drobillaWhich is generally a better way than anything that requires me to do any work, like that email I just remembered that's rotting away in my inbox from last week or so :)00:50
Socapexhaha00:50
drobillaSocapex: I dunno, wouldn't that be identical to the big ol' Projects button?00:51
drobillaThe bar vs button thing is kind of a design issue00:51
Socapexyes, but at like > 2milliseconds thought its not as good as a plugins page.00:51
SocapexProjects is good, I'm going to make a page with images and all00:52
SocapexIt'll look sexy00:52
drobillaProbably "Developing" is questionable, but then there's nothing there but Git (though this is consistent with the cgit header I made to match at the moment)00:52
drobillaFeel free.  Though this will rather harm its use as an index, and punish the plugins that didn't make the fancy screenshot cut00:52
SocapexI know it sounds stupid and repetitive, but the brain works in weird ways (my markov chains want a plugins link lol)00:53
badosuSocapex: I saw a discussion on licenses some days ago00:53
Socapexyour right... maybe just the plugins then00:53
badosuSocapex: take care with these "radical" licenses, in some legislations you must specify some terms so that you're not sued00:54
Socapexbadosu: Yes, we were discussing licenses. For a toturial/example prototype, I want something like public domain or do what the fuck you want etc00:54
badosufor example, if your software is used maliciously or with some "expected" warranties00:54
drobillaPlugins could be split from other stuff00:54
badosuso take care with these "what de fuck you want" style licenses00:54
drobillaI guess it could be okay if there's a flat text index up top much like now that links to detailed sections below00:55
badosuSocapex: your best bet would be extreme liberal licenses00:55
drobillaI don't want a war where people submit patches to throw their UIs all over the place and move them to the top and yadda yadda00:55
Socapexbadosu: Public domain or CC00:55
drobillaAre we talking software or media?00:55
Socapexdrobilla: So just put the plugins from the projects page? Sounds good to me00:55
drobillaUsing weirdo licenses for software is generally a bad idea.00:55
Socapexthis is my current licens: http://paste.debian.net/158450/00:56
Socapextaken from Xiphs libao. Looks good enough to me00:56
drobillaI'd suggest picking something from https://www.gnu.org/philosophy/license-list.html#SoftwareLicenses in either of the Free Software sections00:57
drobillaThose look good enough to lawyers, so...00:57
SocapexI just want ppl to be able to take the code, copy paste, and make cool stuff and spread the love00:57
Socapexdrobilla: CC0 ;)00:58
drobillaSocapex: Yes, the FSF recommends CC0 for "public domain"00:58
Socapexyes that is one I was thinking earlier. Anyways, this is all an after-thought to me. If ever I get this example host working as I wish we can discuss what you guys prefer. I'll have to ask the libAV guys too, because they were quite happy00:59
SocapexCC0 looks good01:00
badosuSocapex: anything is better than wtfpl or something like this01:01
Socapexbadosu: It'll probably be CC0 or an equivalent. Thank you for the heads-up, I never thought I could get sued01:01
drobillaFor LV2 things I use/recommend the ISC license as, well, used in all LV2 things.  Mainly because it's the shortest one.01:01
drobillaBasically BSD/MIT less crap that's no longer necessary01:01
badosuSocapex: not because "I don't like it", the idea is nice. But some countries have some implicit understandings of projects without license01:02
Socapexyea, someone else brought it up earlier01:02
Socapexdrobilla: But ISC is different no? Its basically public domain but keep my name?01:03
badosuSocapex: yeah, you can get. It's crazy, but that how it's life01:03
badosunever seen CC0 for software01:03
badosuanyway, I lawys choose the so-called Mit license01:04
drobillaISC is just a minified BSD license, which basically says no warranty.  It does require the license to be forwarded though01:04
badosufor liberal projects01:04
drobilla(i.e. attribution)01:04
badosuand Free software licenses for everything else01:04
SocapexYeah the page you linked me recommends freeBSD because of university of Pine thing... Man these lawyers!01:05
drobillaMIT/(new)BSD/ISC, same thing basically01:05
Socapexuhm, University of Washington pine01:05
Socapexyeah. Same Idea, though CC0 is tempting as a big finger to everything lol01:06
badosudrobilla: yeah, most people call it MIT, even if it makes more sense to call it ISC01:06
badosuis it even possible to use CC0 for software?01:07
badosuI can't help but wonder what would this look like01:07
badosubecause you can't hack a computer with an artistic creation01:07
badosuSo I guess the CC0 terms don01:07
drobillabadosu: Distinct licenses01:07
Socapexnow that you guys mention this, I have a wtfl software for capturing keys and changing them that could be used as a keylogger on my github... oh shit, now I'm nervous01:07
badosuSocapex: lol, don't worry. This most probably will never happen01:08
drobillaMIT is probably a more solid bet because the FSF has this silly nitpick with the ISC license over "and/or"01:08
drobillaBut I am a fan of brevity, what can I say01:08
Socapexbadosu: Im still going to change it. Its basically a keylogger tutorial for OS X lol01:08
badosuSocapex: and you can always change the license if you're the owner01:08
badosuyeah, where are you located?01:08
SocapexCanada01:09
badosuSo I guess it probably has restrictions similar to US01:09
* Socapex silently changes his key thing license01:09
drobilla"US during the Bush years" about sums it up.01:10
badosuEvery project implicitly makes you responsible for shit made by users and is "closed source" by default01:10
drobillaThat's internationally true almost everywhere these days anyway01:10
badosuso saying "Do what the fuck you want" to the users is basically inconsequent lol01:11
Socapexdang01:11
badosuI don't know how it's for Brazil, lol01:13
badosuAnyway, copyrighting as a small developer is a joke here, anyway01:13
*** edogawa has quit IRC01:30
*** NickSB has quit IRC02:41
*** NickSB has joined #lv202:43
*** falktx has quit IRC03:18
Socapexdrobilla: https://github.com/Socapex/lv2site/tree/plugin_link03:23
drobillaSocapex: noted, thanks03:24
Socapexnp. Check it out and see if you like it. I think it serves a nice purpose (super quick plugin identification).03:25
Socapexgoing to quickly add the examples to project page03:27
SocapexI am perplexed, but I may have answered this myself. If I have a ring buffer of variable size, how can one read it without knowing the size? In the case of ControlChange struct, I imagine you read the ControlChange, then check the size, then read the body? Specifying the second read size of the body. So I guess thats hoe its done, you store the object size in the ringbuffer03:56
SocapexIn a constant length struct/object/whatever03:57
drobillayep.03:58
drobillaWhich can get you into a sort of race condition.  Ideally you can put the size right up front and peek() it so you never end up reading a header and not having a body to read yet03:59
SocapexAll right, I'll add a peek then :)04:00
drobillaActually, I guess if you have a peek() that does the same thing as read() but without advancing the read head, location/size of the size field doesn't matter04:02
drobillaWhich is the only reasonable peek anyway, so n/m the up front bit04:02
Socapexhehe. I'm considering actually offering a the user to store the "control" part size. And if you dont specify the size for pop, then you are constant size and use stored size. Or basically your reading the first param04:04
Socapexmay be too complexe for nothing though04:04
drobillaVariable size and anything but bytes doesn't really make sense in the first place.04:06
drobilla(and pop is probably not the best term for something that is not LIFO)04:07
Socapextbh, I've used ringbuffers before, but this is the first time coding one. Its fun, but also I need to consider many things. Actually its the first time I code a custom container :/04:07
Socapexyeah, pop/push was good for a constant size container. But if I use variable size, then its bad names.04:08
drobillaNot even then, really.  push/pop = stack04:09
Socapexi guess push_front and pop_back would be more appropriate and conform to STL containers yes04:09
Socapexor read/write ^_^04:09
drobillaI suppose.04:10
Socapexbut not if its custom size04:10
Socapexso read/write it is04:10
drobillaTrying to pretend a variable-sized ring is at all a C++ container is a futile effort anyway04:10
Socapextouché04:11
SocapexI do wish they provided one in STL though04:11
drobillaIt might be possible to make such a thing for specific types with some fancy custom allocator gymnastics...04:11
* Socapex is scared of fancy custom allocator gymnastics04:12
drobillaThey can't.  It violates pretty much every C++ rule there is04:12
Socapexreally?04:12
drobillaIt can work for POD objects, which you can at least ensure with C++1104:13
drobillaIt very definitely will not work for non-POD objects04:13
drobillaIn horrible ways04:13
Socapexbut... you need them04:13
drobillaNot through a ring, you don't.04:14
drobillaIf you're trying to essentially memcpy non-POD objects, you're going to have a bad time.04:14
Socapexno I meant you need ringbuffers, is ISO standard that strict?04:14
drobillaYou need ringbuffers on bytes, perhaps.04:14
Socapexbut then you just make it constant size04:14
drobilla100% of all the above difficulty is because you're trying to make RingBuffer<T> as if it's some well-behaved C++ container04:14
drobillaWhich is why pretty much every ring you see just works with bytes and calls it a day04:15
Socapexyes -__-04:15
drobillaThere isn't really such a thing as a variable sized object in C++ in the first place04:15
Socapextrue...04:16
drobillaYou can make a reasonable ring that acts like a FIFO queue for a constant sized T04:16
drobillaAs soon as you want variable size it makes no sense04:16
SocapexI should just use plain old memory stuff04:16
drobillaYou're then in C territory anyway, since T does not encode the actual size of the thing04:16
SocapexAnd wrap it up in a class, call it a day04:16
Socapexim not using T anymore04:17
Socapexwhats the point anyways. All audio libs/audio code is C or uses C like structs/POD/arrays04:17
SocapexI do exactly that in my play loop, (void*)buf, buf is uint8_t**04:18
drobillaIf you want to put non-POD objects through a ring you put pointers to them through instead and deal with the memory management04:18
Socapexnot very c++ at all04:18
Socapexuhm, uint8_t*04:19
Socapexanyways, yeah I'm just going to use plain old C stuff. Maybe keep my tail/head atomic04:19
*** aombk2 has quit IRC06:20
*** aombk has joined #lv206:35
*** gianMOD has joined #lv206:45
*** gianMOD has quit IRC06:53
*** aombk has quit IRC07:20
*** gianMOD has joined #lv208:45
*** gianMOD has quit IRC08:51
*** Socapex has quit IRC09:07
*** curlymorphic has quit IRC09:10
*** ricardocrudo has joined #lv209:29
*** ricardocrudo has quit IRC09:37
*** edogawa has joined #lv209:48
*** ricardocrudo has joined #lv209:56
*** ricardocrudo has quit IRC10:02
*** ricardocrudo has joined #lv210:35
*** Na_Klar has joined #lv210:43
Na_Klar./waf fails with "fatal error: sndfile.h: File or directory not found". What can I do?10:45
Na_Klarconfigure finished without an error10:47
Na_Klara nvm, needed to install libsndfile-dev .. always that dev packages ^^ ..10:49
drobillaNa_Klar: What project?  Configure stage shouldn't have succeeded11:14
Na_Klarwhat project? I installed lv2-1.10.0 for audacity on linux lubuntu 14.04.11:19
*** curlymorphic has joined #lv211:26
*** edogawa has quit IRC11:27
*** edogawa has joined #lv211:30
*** falktx has joined #lv211:53
*** falktx has quit IRC12:15
*** Na_Klar has left #lv212:18
*** falktx has joined #lv212:29
*** rncbc has joined #lv212:31
*** rncbc is now known as rncbc|AFK13:16
*** falktx has quit IRC13:18
*** ricardocrudo has quit IRC13:37
*** falktx has joined #lv214:22
*** HarryHaaren has joined #lv214:37
*** rncbc|AFK is now known as rncbc14:53
*** gianMOD has joined #lv215:23
*** aombk has joined #lv215:31
*** ricardocrudo has joined #lv216:00
*** gianMOD has quit IRC16:19
*** gianMOD_ has joined #lv216:21
*** gianMOD_ has quit IRC16:27
*** Socapex has joined #lv216:57
Socapexfiou! I think I got my basic ringbuffer done (I've been dreaming rings for the last few days). Anyways, main characteristics are: You don't need to specify read size (the buffer stores the sizes for you). Instead of blocking write, if tail isn't consuming fast enough, we never block writing and push tail forward to the next objects stored. Here is a pastebin, feel free to check it out and maybe help me spot o17:08
Socapexut issues with it. Please be polite when critisizing my work :) http://paste.debian.net/158724/17:08
SocapexThank you for any help/ informtation/ tips!17:08
SocapexOoops, there are some silly mistakes in that version, here is better one http://paste.debian.net/158727/17:11
*** gianMOD has joined #lv217:22
drobillaI doubt this "tail catch up" thing is correct.17:24
*** HarryHaaren has quit IRC17:24
drobillaThe fundamental principle of a ring is that reader and writer do not touch each other's cursors17:25
drobillaExcept in a subtraction to see how much space there is, because that is conservative/safe17:26
drobillaImplementing your own is all well and good as a learning exercise, but this is not something you want to try and get creative and weird about.  A standard ringbuffer is known correct.17:26
*** gianMOD has quit IRC17:27
drobillaand std::deque isn't RT safe anyway, which destroys the whole point of using a static ringbuffer anyway.  You might as well just stick the data in an STL queue, then17:28
drobillaand certainly is not thread-safe, so neither is your ring17:29
SocapexI know it isn't thread safe17:31
SocapexI'll be removing the atomic variables17:31
drobillaSoooooooooo.... what is the purpose of this structure, then?17:31
SocapexBut why shouldnt I make sure tail is pushed forward if head reaches tail?17:31
Socapexits variable size, unlike deque17:32
drobillaBecause it's not thread safe.17:32
SocapexWell, most Ringbuffers I've seen aren't17:32
drobillaYou can dynamically allocate variable sized whatever and stick that in a container17:33
drobillaWell..... you must be looking in some pretty strange places, since that's the whole point of a ringbuffer17:33
SocapexSo I should just use a deque... O_o17:34
drobillaWell, if you want a not-real-time-safe not-thread-safe structure to queue things through, yeah17:35
drobillaThat's not going to do you much good for talking to plugins from a UI, though17:36
*** mlpug has joined #lv218:21
*** gianMOD has joined #lv218:24
*** aombk2 has joined #lv218:27
*** aombk has quit IRC18:27
*** gianMOD has quit IRC18:29
*** falktx has quit IRC18:33
*** Socapex has quit IRC18:40
*** falktx has joined #lv218:43
*** rncbc has quit IRC18:50
*** rncbc has joined #lv218:50
*** gianMOD has joined #lv219:06
*** gianMOD has quit IRC19:06
*** gianMOD has joined #lv219:06
*** aombk has joined #lv219:09
*** aombk2 has quit IRC19:12
*** gianMOD has quit IRC19:14
*** gianMOD has joined #lv219:14
*** NickSB2__ has joined #lv219:21
*** NickSB2 has quit IRC19:23
*** gianMOD has quit IRC19:38
*** gianMOD has joined #lv219:52
*** gianMOD has quit IRC20:04
*** ricardocrudo has quit IRC20:41
*** mlpug has quit IRC21:15
*** ricardocrudo has joined #lv221:37
*** gianMOD has joined #lv222:22
*** gianMOD has quit IRC22:47
*** ricardocrudo has quit IRC23:02
*** rncbc has quit IRC23:08
*** NickSB has quit IRC23:38
*** NickSB has joined #lv223:41

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