Socapex | drobilla: 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 |
---|---|---|
drobilla | Socapex: i.e. your ring is empty | 00:26 |
Socapex | yes | 00:26 |
drobilla | Socapex: depends on the context, but generally reading from an empty ring is an error | 00:26 |
Socapex | or somehow tail caught up | 00:26 |
Socapex | allright | 00:26 |
drobilla | Socapex: Tail can't catch up. A ring can never be 100% full, there is a 1 element pad for this reason | 00:26 |
drobilla | Socapex: You need to check the read space before reading | 00:27 |
drobilla | if (ring.read_space() > amount_of_stuff_I_want) { ring.read(amount_of_stuff_I_want); } | 00:27 |
drobilla | You need to do this anyway or it wouldn't be threadsafe since a half write might be in there | 00:27 |
drobilla | >= rather | 00:27 |
Socapex | hmmm, I'm basing off of this simple implementation http://www.wannabegeek.com/?p=532. What I thought is just read then increment tail | 00:28 |
Socapex | interesting, ok I'll ponder this great information you just shared. thank you | 00:28 |
drobilla | I had an objectey ring once, but dropped it as more confusion than it's worth in favour of always using byte-oriented rings | 00:29 |
Socapex | yeah I wasn't sure if I wanted to go full fast C, or more c++ ish | 00:30 |
drobilla | Socapex: Well, if you need variable length things in there this doesn't work anyway | 00:30 |
Socapex | I went c++ cause there are so many C examples and implementations allready. I wanted to make another example for ppl | 00:30 |
Socapex | drobilla: That is true, but isn't the length allways equal? | 00:30 |
Socapex | at least, for my particular use cases | 00:31 |
HarryHaaren | Socapex, i have an "objecty" C++ variable size implementation tutorial thingy here https://github.com/harryhaaren/realtimeAudioThreading/blob/master/basicRingbufferEvent/ringbufferTest.cpp | 00:31 |
Socapex | HarryHaaren: Thank you very much! | 00:31 |
HarryHaaren | nah, the events you pass through the ringbuffer will change in size depending on the contents of the event | 00:31 |
Socapex | oh crap | 00:31 |
Socapex | then back to the drawing board | 00:31 |
drobilla | http://dev.drobilla.net/browser/trunk/raul/raul/RingBuffer.hpp | 00:31 |
Socapex | wow you guys are on fire with awesome info tonight! xD | 00:32 |
drobilla | Objectey one http://dev.drobilla.net/browser/trunk/raul/raul/SRSWQueue.hpp | 00:32 |
drobilla | Less sure about the correctness of the latter though | 00:32 |
Socapex | Maybe I'll keep my current one as a "FixedRingbuffer". Should work for audio buffers | 00:33 |
drobilla | http://svn.drobilla.net/zix/trunk/zix/ring.[ch] <= C | 00:33 |
HarryHaaren | ah you're adding a ring to zix? Nice | 00:33 |
HarryHaaren | i was gonna feature request that at some point :) | 00:33 |
drobilla | HarryHaaren: There's always been one | 00:33 |
HarryHaaren | really? Hmm i must have a really old git or partial zix then | 00:34 |
HarryHaaren | eitherway, nice :) | 00:34 |
Socapex | drobilla: Are you french? | 00:34 |
HarryHaaren | i 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 guys | 00:35 | |
Socapex | Oh 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 |
Socapex | HarryHaaren: gn, ty again | 00:36 |
drobilla | Socapex: Non, mon nom, seulment :) | 00:36 |
*** HarryHaaren has quit IRC | 00:36 | |
Socapex | drobilla: C'est ce que j;pensais ;) | 00:36 |
drobilla | or maybe "seulment mon nom", which only serves to prove the point | 00:36 |
Socapex | Alors tu as appris ca par coeur? | 00:36 |
drobilla | coeur... coeur... | 00:38 |
drobilla | oh | 00:38 |
Socapex | lol. I was asking if you learnt that by heart :) | 00:38 |
drobilla | Unfortunately I didn't learn at all, beyond what every Canadian kid does in elementary school :) | 00:39 |
Socapex | Where in Canada? | 00:39 |
drobilla | Now that I live in Ottawa and visit Montréal on occasion, this is considerably more unfortunate | 00:39 |
Socapex | I'm in Montreal, respect man :P | 00:39 |
Socapex | though you dont need to know french around here | 00:40 |
drobilla | I may join you when I escape this barren wasteland :) | 00:40 |
Socapex | looool | 00:40 |
drobilla | Well, yeah, but you know... | 00:40 |
Socapex | I know: "The french girls are hotter" | 00:40 |
Socapex | I feel you man | 00:40 |
Socapex | ^_^ | 00:40 |
drobilla | Nobody wants to be that guy :) | 00:41 |
Socapex | lol | 00:41 |
drobilla | I'm not exactly super keen on the hyper right wing Americanisation of anglo Canada as of late anyway | 00:42 |
Socapex | oh wow | 00:42 |
Socapex | yeah I'm not that type | 00:42 |
drobilla | I 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 |
Socapex | haha! I should actually marathon star trek... Oh man, I'll never get this ringbuffer done xD | 00:47 |
Socapex | So 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 | |
drobilla | Socapex: Basically, however. Several people made forked repos I just added as remotes and cherry pick from | 00:49 |
Socapex | drobilla: 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 click | 00:50 |
drobilla | Which 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 |
Socapex | haha | 00:50 |
drobilla | Socapex: I dunno, wouldn't that be identical to the big ol' Projects button? | 00:51 |
drobilla | The bar vs button thing is kind of a design issue | 00:51 |
Socapex | yes, but at like > 2milliseconds thought its not as good as a plugins page. | 00:51 |
Socapex | Projects is good, I'm going to make a page with images and all | 00:52 |
Socapex | It'll look sexy | 00:52 |
drobilla | Probably "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 |
drobilla | Feel free. Though this will rather harm its use as an index, and punish the plugins that didn't make the fancy screenshot cut | 00:52 |
Socapex | I know it sounds stupid and repetitive, but the brain works in weird ways (my markov chains want a plugins link lol) | 00:53 |
badosu | Socapex: I saw a discussion on licenses some days ago | 00:53 |
Socapex | your right... maybe just the plugins then | 00:53 |
badosu | Socapex: take care with these "radical" licenses, in some legislations you must specify some terms so that you're not sued | 00:54 |
Socapex | badosu: Yes, we were discussing licenses. For a toturial/example prototype, I want something like public domain or do what the fuck you want etc | 00:54 |
badosu | for example, if your software is used maliciously or with some "expected" warranties | 00:54 |
drobilla | Plugins could be split from other stuff | 00:54 |
badosu | so take care with these "what de fuck you want" style licenses | 00:54 |
drobilla | I guess it could be okay if there's a flat text index up top much like now that links to detailed sections below | 00:55 |
badosu | Socapex: your best bet would be extreme liberal licenses | 00:55 |
drobilla | I 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 yadda | 00:55 |
Socapex | badosu: Public domain or CC | 00:55 |
drobilla | Are we talking software or media? | 00:55 |
Socapex | drobilla: So just put the plugins from the projects page? Sounds good to me | 00:55 |
drobilla | Using weirdo licenses for software is generally a bad idea. | 00:55 |
Socapex | this is my current licens: http://paste.debian.net/158450/ | 00:56 |
Socapex | taken from Xiphs libao. Looks good enough to me | 00:56 |
drobilla | I'd suggest picking something from https://www.gnu.org/philosophy/license-list.html#SoftwareLicenses in either of the Free Software sections | 00:57 |
drobilla | Those look good enough to lawyers, so... | 00:57 |
Socapex | I just want ppl to be able to take the code, copy paste, and make cool stuff and spread the love | 00:57 |
Socapex | drobilla: CC0 ;) | 00:58 |
drobilla | Socapex: Yes, the FSF recommends CC0 for "public domain" | 00:58 |
Socapex | yes 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 happy | 00:59 |
Socapex | CC0 looks good | 01:00 |
badosu | Socapex: anything is better than wtfpl or something like this | 01:01 |
Socapex | badosu: It'll probably be CC0 or an equivalent. Thank you for the heads-up, I never thought I could get sued | 01:01 |
drobilla | For LV2 things I use/recommend the ISC license as, well, used in all LV2 things. Mainly because it's the shortest one. | 01:01 |
drobilla | Basically BSD/MIT less crap that's no longer necessary | 01:01 |
badosu | Socapex: not because "I don't like it", the idea is nice. But some countries have some implicit understandings of projects without license | 01:02 |
Socapex | yea, someone else brought it up earlier | 01:02 |
Socapex | drobilla: But ISC is different no? Its basically public domain but keep my name? | 01:03 |
badosu | Socapex: yeah, you can get. It's crazy, but that how it's life | 01:03 |
badosu | never seen CC0 for software | 01:03 |
badosu | anyway, I lawys choose the so-called Mit license | 01:04 |
drobilla | ISC is just a minified BSD license, which basically says no warranty. It does require the license to be forwarded though | 01:04 |
badosu | for liberal projects | 01:04 |
drobilla | (i.e. attribution) | 01:04 |
badosu | and Free software licenses for everything else | 01:04 |
Socapex | Yeah the page you linked me recommends freeBSD because of university of Pine thing... Man these lawyers! | 01:05 |
drobilla | MIT/(new)BSD/ISC, same thing basically | 01:05 |
Socapex | uhm, University of Washington pine | 01:05 |
Socapex | yeah. Same Idea, though CC0 is tempting as a big finger to everything lol | 01:06 |
badosu | drobilla: yeah, most people call it MIT, even if it makes more sense to call it ISC | 01:06 |
badosu | is it even possible to use CC0 for software? | 01:07 |
badosu | I can't help but wonder what would this look like | 01:07 |
badosu | because you can't hack a computer with an artistic creation | 01:07 |
badosu | So I guess the CC0 terms don | 01:07 |
drobilla | badosu: Distinct licenses | 01:07 |
Socapex | now 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 nervous | 01:07 |
badosu | Socapex: lol, don't worry. This most probably will never happen | 01:08 |
drobilla | MIT is probably a more solid bet because the FSF has this silly nitpick with the ISC license over "and/or" | 01:08 |
drobilla | But I am a fan of brevity, what can I say | 01:08 |
Socapex | badosu: Im still going to change it. Its basically a keylogger tutorial for OS X lol | 01:08 |
badosu | Socapex: and you can always change the license if you're the owner | 01:08 |
badosu | yeah, where are you located? | 01:08 |
Socapex | Canada | 01:09 |
badosu | So I guess it probably has restrictions similar to US | 01:09 |
* Socapex silently changes his key thing license | 01:09 | |
drobilla | "US during the Bush years" about sums it up. | 01:10 |
badosu | Every project implicitly makes you responsible for shit made by users and is "closed source" by default | 01:10 |
drobilla | That's internationally true almost everywhere these days anyway | 01:10 |
badosu | so saying "Do what the fuck you want" to the users is basically inconsequent lol | 01:11 |
Socapex | dang | 01:11 |
badosu | I don't know how it's for Brazil, lol | 01:13 |
badosu | Anyway, copyrighting as a small developer is a joke here, anyway | 01:13 |
*** edogawa has quit IRC | 01:30 | |
*** NickSB has quit IRC | 02:41 | |
*** NickSB has joined #lv2 | 02:43 | |
*** falktx has quit IRC | 03:18 | |
Socapex | drobilla: https://github.com/Socapex/lv2site/tree/plugin_link | 03:23 |
drobilla | Socapex: noted, thanks | 03:24 |
Socapex | np. Check it out and see if you like it. I think it serves a nice purpose (super quick plugin identification). | 03:25 |
Socapex | going to quickly add the examples to project page | 03:27 |
Socapex | I 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 ringbuffer | 03:56 |
Socapex | In a constant length struct/object/whatever | 03:57 |
drobilla | yep. | 03:58 |
drobilla | Which 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 yet | 03:59 |
Socapex | All right, I'll add a peek then :) | 04:00 |
drobilla | Actually, 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 matter | 04:02 |
drobilla | Which is the only reasonable peek anyway, so n/m the up front bit | 04:02 |
Socapex | hehe. 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 param | 04:04 |
Socapex | may be too complexe for nothing though | 04:04 |
drobilla | Variable 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 |
Socapex | tbh, 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 |
Socapex | yeah, pop/push was good for a constant size container. But if I use variable size, then its bad names. | 04:08 |
drobilla | Not even then, really. push/pop = stack | 04:09 |
Socapex | i guess push_front and pop_back would be more appropriate and conform to STL containers yes | 04:09 |
Socapex | or read/write ^_^ | 04:09 |
drobilla | I suppose. | 04:10 |
Socapex | but not if its custom size | 04:10 |
Socapex | so read/write it is | 04:10 |
drobilla | Trying to pretend a variable-sized ring is at all a C++ container is a futile effort anyway | 04:10 |
Socapex | touché | 04:11 |
Socapex | I do wish they provided one in STL though | 04:11 |
drobilla | It 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 gymnastics | 04:12 | |
drobilla | They can't. It violates pretty much every C++ rule there is | 04:12 |
Socapex | really? | 04:12 |
drobilla | It can work for POD objects, which you can at least ensure with C++11 | 04:13 |
drobilla | It very definitely will not work for non-POD objects | 04:13 |
drobilla | In horrible ways | 04:13 |
Socapex | but... you need them | 04:13 |
drobilla | Not through a ring, you don't. | 04:14 |
drobilla | If you're trying to essentially memcpy non-POD objects, you're going to have a bad time. | 04:14 |
Socapex | no I meant you need ringbuffers, is ISO standard that strict? | 04:14 |
drobilla | You need ringbuffers on bytes, perhaps. | 04:14 |
Socapex | but then you just make it constant size | 04:14 |
drobilla | 100% of all the above difficulty is because you're trying to make RingBuffer<T> as if it's some well-behaved C++ container | 04:14 |
drobilla | Which is why pretty much every ring you see just works with bytes and calls it a day | 04:15 |
Socapex | yes -__- | 04:15 |
drobilla | There isn't really such a thing as a variable sized object in C++ in the first place | 04:15 |
Socapex | true... | 04:16 |
drobilla | You can make a reasonable ring that acts like a FIFO queue for a constant sized T | 04:16 |
drobilla | As soon as you want variable size it makes no sense | 04:16 |
Socapex | I should just use plain old memory stuff | 04:16 |
drobilla | You're then in C territory anyway, since T does not encode the actual size of the thing | 04:16 |
Socapex | And wrap it up in a class, call it a day | 04:16 |
Socapex | im not using T anymore | 04:17 |
Socapex | whats the point anyways. All audio libs/audio code is C or uses C like structs/POD/arrays | 04:17 |
Socapex | I do exactly that in my play loop, (void*)buf, buf is uint8_t** | 04:18 |
drobilla | If you want to put non-POD objects through a ring you put pointers to them through instead and deal with the memory management | 04:18 |
Socapex | not very c++ at all | 04:18 |
Socapex | uhm, uint8_t* | 04:19 |
Socapex | anyways, yeah I'm just going to use plain old C stuff. Maybe keep my tail/head atomic | 04:19 |
*** aombk2 has quit IRC | 06:20 | |
*** aombk has joined #lv2 | 06:35 | |
*** gianMOD has joined #lv2 | 06:45 | |
*** gianMOD has quit IRC | 06:53 | |
*** aombk has quit IRC | 07:20 | |
*** gianMOD has joined #lv2 | 08:45 | |
*** gianMOD has quit IRC | 08:51 | |
*** Socapex has quit IRC | 09:07 | |
*** curlymorphic has quit IRC | 09:10 | |
*** ricardocrudo has joined #lv2 | 09:29 | |
*** ricardocrudo has quit IRC | 09:37 | |
*** edogawa has joined #lv2 | 09:48 | |
*** ricardocrudo has joined #lv2 | 09:56 | |
*** ricardocrudo has quit IRC | 10:02 | |
*** ricardocrudo has joined #lv2 | 10:35 | |
*** Na_Klar has joined #lv2 | 10:43 | |
Na_Klar | ./waf fails with "fatal error: sndfile.h: File or directory not found". What can I do? | 10:45 |
Na_Klar | configure finished without an error | 10:47 |
Na_Klar | a nvm, needed to install libsndfile-dev .. always that dev packages ^^ .. | 10:49 |
drobilla | Na_Klar: What project? Configure stage shouldn't have succeeded | 11:14 |
Na_Klar | what project? I installed lv2-1.10.0 for audacity on linux lubuntu 14.04. | 11:19 |
*** curlymorphic has joined #lv2 | 11:26 | |
*** edogawa has quit IRC | 11:27 | |
*** edogawa has joined #lv2 | 11:30 | |
*** falktx has joined #lv2 | 11:53 | |
*** falktx has quit IRC | 12:15 | |
*** Na_Klar has left #lv2 | 12:18 | |
*** falktx has joined #lv2 | 12:29 | |
*** rncbc has joined #lv2 | 12:31 | |
*** rncbc is now known as rncbc|AFK | 13:16 | |
*** falktx has quit IRC | 13:18 | |
*** ricardocrudo has quit IRC | 13:37 | |
*** falktx has joined #lv2 | 14:22 | |
*** HarryHaaren has joined #lv2 | 14:37 | |
*** rncbc|AFK is now known as rncbc | 14:53 | |
*** gianMOD has joined #lv2 | 15:23 | |
*** aombk has joined #lv2 | 15:31 | |
*** ricardocrudo has joined #lv2 | 16:00 | |
*** gianMOD has quit IRC | 16:19 | |
*** gianMOD_ has joined #lv2 | 16:21 | |
*** gianMOD_ has quit IRC | 16:27 | |
*** Socapex has joined #lv2 | 16:57 | |
Socapex | fiou! 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 o | 17:08 |
Socapex | ut issues with it. Please be polite when critisizing my work :) http://paste.debian.net/158724/ | 17:08 |
Socapex | Thank you for any help/ informtation/ tips! | 17:08 |
Socapex | Ooops, there are some silly mistakes in that version, here is better one http://paste.debian.net/158727/ | 17:11 |
*** gianMOD has joined #lv2 | 17:22 | |
drobilla | I doubt this "tail catch up" thing is correct. | 17:24 |
*** HarryHaaren has quit IRC | 17:24 | |
drobilla | The fundamental principle of a ring is that reader and writer do not touch each other's cursors | 17:25 |
drobilla | Except in a subtraction to see how much space there is, because that is conservative/safe | 17:26 |
drobilla | Implementing 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 IRC | 17:27 | |
drobilla | and 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, then | 17:28 |
drobilla | and certainly is not thread-safe, so neither is your ring | 17:29 |
Socapex | I know it isn't thread safe | 17:31 |
Socapex | I'll be removing the atomic variables | 17:31 |
drobilla | Soooooooooo.... what is the purpose of this structure, then? | 17:31 |
Socapex | But why shouldnt I make sure tail is pushed forward if head reaches tail? | 17:31 |
Socapex | its variable size, unlike deque | 17:32 |
drobilla | Because it's not thread safe. | 17:32 |
Socapex | Well, most Ringbuffers I've seen aren't | 17:32 |
drobilla | You can dynamically allocate variable sized whatever and stick that in a container | 17:33 |
drobilla | Well..... you must be looking in some pretty strange places, since that's the whole point of a ringbuffer | 17:33 |
Socapex | So I should just use a deque... O_o | 17:34 |
drobilla | Well, if you want a not-real-time-safe not-thread-safe structure to queue things through, yeah | 17:35 |
drobilla | That's not going to do you much good for talking to plugins from a UI, though | 17:36 |
*** mlpug has joined #lv2 | 18:21 | |
*** gianMOD has joined #lv2 | 18:24 | |
*** aombk2 has joined #lv2 | 18:27 | |
*** aombk has quit IRC | 18:27 | |
*** gianMOD has quit IRC | 18:29 | |
*** falktx has quit IRC | 18:33 | |
*** Socapex has quit IRC | 18:40 | |
*** falktx has joined #lv2 | 18:43 | |
*** rncbc has quit IRC | 18:50 | |
*** rncbc has joined #lv2 | 18:50 | |
*** gianMOD has joined #lv2 | 19:06 | |
*** gianMOD has quit IRC | 19:06 | |
*** gianMOD has joined #lv2 | 19:06 | |
*** aombk has joined #lv2 | 19:09 | |
*** aombk2 has quit IRC | 19:12 | |
*** gianMOD has quit IRC | 19:14 | |
*** gianMOD has joined #lv2 | 19:14 | |
*** NickSB2__ has joined #lv2 | 19:21 | |
*** NickSB2 has quit IRC | 19:23 | |
*** gianMOD has quit IRC | 19:38 | |
*** gianMOD has joined #lv2 | 19:52 | |
*** gianMOD has quit IRC | 20:04 | |
*** ricardocrudo has quit IRC | 20:41 | |
*** mlpug has quit IRC | 21:15 | |
*** ricardocrudo has joined #lv2 | 21:37 | |
*** gianMOD has joined #lv2 | 22:22 | |
*** gianMOD has quit IRC | 22:47 | |
*** ricardocrudo has quit IRC | 23:02 | |
*** rncbc has quit IRC | 23:08 | |
*** NickSB has quit IRC | 23:38 | |
*** NickSB has joined #lv2 | 23:41 |
Generated by irclog2html.py 2.13.0 by Marius Gedminas - find it at mg.pov.lt!