freenode/#lisp - IRC Chatlog
Search
17:46:38
Shinmera
buffers are basically just float arrays. you can re-use them or not, but obviously if you have two channels you can't use the same buffer for both.
17:46:59
Shinmera
Harmony obscures that detail because it includes a system to automatically handle buffer allocation for you.
17:48:03
Shinmera
That stuff happens in pipeline.lisp. The actual allocation algorithm is in the Flow library, though.
17:49:19
sjl
what I'd probably want to do is use the vanilla mp3 source's (decode ...) to fill a buffer in memory in the initialize-instance :after method on my preloaded source
17:49:46
Shinmera
What I think you should do is look at https://github.com/Shirakumo/harmony/blob/master/sources/buffer.lisp and try to make it work with a data array that's initialised with a complete buffer read by cl-mpg123.
17:51:37
sjl
so instead of (play "foo.mp3" :sfx :type 'mp3-source), it would end up being (defparameter *foo* (read-mp3-file-into-buffer "foo.mp3")) ... (play *foo* :sfx :type 'buffer-source)
17:54:42
Shinmera
Maybe something like making play accept a CFFI pointer or some struct that encapsulates a raw audio array
17:54:58
Shinmera
And then change the source interface to include generic versions to decode stuff into such arrays.
17:55:10
sjl
What's the deal with https://github.com/Shirakumo/harmony/blob/master/sources/mp3.lisp#L70-L96 then?
17:55:51
Shinmera
That was a hasty attempt at making things work as I was pressed for time before a jam.
17:56:10
Shinmera
It's not because it ties logic that's part of the decoding and logic that's just part of the buffer together.
17:57:11
Shinmera
We'll probably want some class that contains a data array, size, encoding, channels, structure, and sample rate, from which actual sources can then be spawned.
17:58:51
Shinmera
The idea would be that you'd keep this structure around and allocate it ahead of time, whereas sources are used to actually play it back at run time.
17:59:39
sjl
well, I guess if you wanted multiple concurrent copies of some audio effect, you'd need to have multiple sources
17:59:46
Shinmera
You can, but especially with sfx where you might need to play multiple instances of the same thing simultaneously, that doesn't really work.
18:00:09
Shinmera
And just logic-wise it's easier to simply say "hey, play this back" and not have to worry about reusing it if you don't have to.
18:43:21
sjl
Shinmera: I guess the thing that still feels weird would be the filling of that preloaded buffer, because it would use an mp3-source to fill a buffer which would then be used by sources
18:43:36
sjl
or are you thinking there would be some really basic (read-mp3-file-into-buffer ) function
18:50:44
Shinmera
The high-level interface would probably then also get a LOAD function analogous to PLAY that loads to this buffer struct thingy based on the source implementation.
18:52:47
Shinmera
While I'm on that, more source types is another obvious improvement area. Especially supporting WAV, OGG, and FLAC would be good.
18:56:55
Shinmera
More filter segments on libmixed would also be nice, particularly high/low-pass filtering, reverb, and distorion.
19:05:49
jmercouris
beach: seems like people are always conflating language with implementation, now that you've made me aware of the difference, I see it everywhere: https://getstream.io/blog/switched-python-go/?a=b
19:22:48
bigos
https://github.com/bigos/qtools-testdrive/blob/hello-notepad/src/qtools-testdrive.lisp
19:32:09
bigos
i guess i will try another time, i found few c++ examples but i have no clue how to translate them to qtools, i guess it's time to have a break
19:39:27
phoe_
bigos: I have some qtools experience that includes translating C++ Qt to CL Qtools, I might be able to help you later on here or #lisp-pl
20:09:01
jmercouris
What's a good way of declaring an interface in CL? Let's say I have like a superclass "Potato" and then I want child classes to implement "grow" methods, how could I force them to do that?
20:12:16
Shinmera
jmercouris: Generally you don't force people to do things in CL. Just document it.
20:12:40
phoe_
it's GPL though, I haven't been able to contact the maintainer to relicense it elsewhere
20:13:27
jmercouris
Bicyclidine: pjb: thank you guys for your help, I'll either copy the macro into my code or just not use interfaces
20:13:50
Shinmera
If you want to check whether you didn't forget to implement methods, you could build a little tool that traverses the class hierarchy and checks whether your applicable generic functions do have a method that specialises on each class.
20:13:53
jmercouris
maybe this is an X-Y problem, let me describe what I'm actually trying to do, and you can tell me whether you think my approach is sound
20:14:57
jmercouris
Alright, so I have some graphical view, and I want to implement two different backends, because I want 99% of my code to be agnostic to the different graphical backends, I want to create an interface with some expected behavior, that way I can make a change to the "core" of the program, and know that it will work with both interfaces
20:17:34
phoe_
https://github.com/robert-strandh/McCLIM/blob/b3546424f68ccc72c762ccb8be16400768ad2479/Core/clim-basic/protocol-classes.lisp#L24
20:18:48
phoe_
jmercouris: I've mailed the author if he can relicense that code, maybe we'll get him to respond.
20:20:06
jmercouris
phoe_: http://gplv3.fsf.org/wiki/index.php/Compatible_licenses#GPLv2-compatible_licenses
20:23:42
phoe_
it's full GPLv2, so even using this code as a library in your code counts as being infected with stallmanovirus
20:24:58
jmercouris
phoe_: that's what I'm saying, I can't pull it into my code, I refuse that license
20:27:51
phoe_
in the worst case, I'll just clean-room reimplement that macro based on its specification
20:39:41
pjb
Not necessarily. AFAIK, You could include GPL2 code in a LGPL library, and use this library in a BSD project, as long as the library doesn't contain core functinality of your project, and it may easily be replaced by a BSD library.
20:44:43
phoe_
https://softwareengineering.stackexchange.com/questions/342156/can-i-use-some-gpl-code-in-lgpl-project
20:48:13
jackdaniel
also saying, that pulling gplv2 to repository makes your code have same license is bs, it just means, that derived work is gplv2 - you still may copy your bsd code from the core library to other bsd project without any implications
20:52:20
jackdaniel
I would appreciate (if you really dislike LGPL2+) not linking McCLIM project with a disclaimer, that it is a virus or as being infected by something, it is rude and belittles work of many people
20:59:53
phoe_
but it is a viral license, as https://www.gnu.org/philosophy/vaccination.en.html itself states
22:09:01
hrehf
I'm trying to implement read, as elegantly as possible. So far my only axiom/invariant/hard-coded rule is that everything that is not matched is returned as a symbol when (actually before) the next match is returned. This allows to implement everything else as a reader macro, however it does NOT easily cover rules like "whitespace before numbers"
22:19:27
pjb
hrehf: this channel is concerned by Common Lisp only. The specification of Common Lisp contains ONLY ONE algorithm. This is the reader algorithm.
4:27:43
drmeister
We are making faster progress optimizing clasp. We've figured out how to use profiling and flame graphs to identify what is taking time.
4:28:58
drmeister
For instance - from this it's easy to see that initialization is taking more time than allocation.
4:30:04
drmeister
Common Lisp code and C++ code are all compiled to the same llvm bitcode and on to native code - that lets us profile them together.
5:35:44
Zhivago
And as nil cannot be modified, (nconc *a* ...) cannot modify the value of *a*, since that value is nil.
5:40:50
Zhivago
And that sounds pretty pointless -- why don't you just put it in the other collection to start with?
5:42:13
borei
another collection is gl:array, and the first place where im generating first collection has no idea about gl: at all
5:43:37
Zhivago
Instead of building a collection, pass a function which can be called with each value.
5:43:59
Zhivago
Then have the receiver construct a suitable function to put the value where it needs to go.
5:45:54
Zhivago
Well, it's probably time to think about it since it would make your current problem evaporate.