freenode/#lisp - IRC Chatlog
Search
12:00:53
Shinmera
C alone is already context-sensitive, but he's only talking about function pointers.
12:08:35
pjb
Happily, the non-context freeness is limited to small and restricted parts. It is mostly context free, with exceptions.
15:46:10
clintm
If you inspect the value of a long string in the slime debugger, you get a list of the individual characters. Do any of you know if there's a way to further inspect the string as a readable string instead of a vertical list of characters?
16:38:50
sjl
Shinmera: hey, is there any way to make playing sound effects in harmony faster than a bare (harmony-simple:play #p"foo.mp3" :sfx)?
16:39:12
sjl
I'm trying to play a sound effect in a game, but there's a noticeable latency between when I make that call and when the sound actually starts
16:39:39
sjl
which doesn't matter for music, but for the "you got a powerup" sound is a bit too much latency
16:40:44
sjl
yeah, I assume the issue is that it's loading it from scratch from the filesystem every time
16:40:59
sjl
I tried adding it paused and unpausing it, but when the sound finishes it gets removed from the source
16:41:30
sjl
what is the buffer class you mentioned? I grepped https://shirakumo.github.io/harmony/ for buffer but none of the results look promising
16:41:54
Shinmera
So there's an mp3-buffer-source, and I started working on a way to create a source from a buffer without copying stuff around but stopped working on harmony before that got completed.
16:42:54
Shinmera
namely the current audio buffer needs to be played to finish before any segment additions or things like that can be processed.
16:44:04
Shinmera
Which is currently actually disabled on windows since it was taking up to a second to synchronise with a monitor on SBCL (!!)
16:45:09
Shinmera
I wish I had time to work on everything I have, heh. If you do have the time to help improve Harmony, I'd love to do what I can to take you through the source and stuff.
16:47:12
Shinmera
Well it already works, but it's not really useful if you need to load a new buffer every time you want to play back, you know
16:47:26
Shinmera
So what needs to be done is to be able to "clone" additional sources from the same buffer
16:48:37
Shinmera
So either there needs to be a clone thingy, or you need to make the buffered-source work and give a convenient function to decode an mp3 in full to a buffer, or something.
16:50:26
sjl
okay. this could be tricky because I'm on the US west coast for work, so it's 09:50 here, lol
16:51:47
sjl
okay. I'll probably just ask you questions and then do the actual work... after my real job
16:52:53
sjl
It's okay. They "exist" which is already head and shoulders above most other Lisp libraries.
16:53:21
sjl
I need to find a JS bookmarklet that will generate a table of contents from an html page's headers...
16:53:35
Shinmera
I usually don't subscribe to the argument of "everything else is worse so this being bad is fine" ;)
16:54:50
|3b|
clintm: you can also hit p in slime inspector to pretty print an object, including the #<...> at top of inspector when you inspect a string
16:57:38
Shinmera
sjl: Anyway, starting from the bottom with https://github.com/Shirakumo/libmixed/blob/master/src/mixed.h and then moving on to https://shirakumo.github.io/cl-mixed/ would probably be the best way to start.
16:58:55
sjl
my audio-processing-in-lisp experience has so far been limited to dumping square/sine/sawtooth waves into a portaudio buffer, so it might take me a while to get my head around allt he parts here
17:01:34
sjl
Shinmera: I see the word "segment" a lot in the docs, but it's not defined first. what is a segment?
17:01:56
Shinmera
The basic idea is that there's a DAG of segments which do some computation on audio buffers. There's sources, which translate raw data from some format to the internal, "decompressed" buffers. Then there's drains which do the opposite. Everything else does buffer->buffer transformations.
17:03:50
Shinmera
Each segment has a number of options, and a number of input and output ports, each of which carry a buffer and potential, other options.
17:07:58
sjl
Shinmera: okay I gotta go, I'll ping you later after I read cl-mixed's docs on my lunch break
17:41:24
sjl
Shinmera: another unrelated question: I have a bunch of music files I'd like to play as background music for my game, and when one finishes I'd like to start another one
17:41:55
sjl
is the right way to do this to save the source I get back from (play ...)and check (ended-p ...) on each tick?
17:48:07
Shinmera
Better would probably be to subclass the source and add an :after method to (setf ended-p) that starts the next track.
17:51:23
sjl
That's another thing I wasn't clear on -- if I subclass the source, will that new subclass be used for ALL mp3 files?
17:52:13
Shinmera
PLAY doesn't do too much so you can also replicate what it does easily enough if you already have an instance.
17:53:10
sjl
So it would be something like (defclass music-source (mp3-source) ...) ..after method on setf ended-p... (play "foo.mp3" :music :source-type 'music-source) ?
17:53:32
Shinmera
Well, I'd probably make what you want to play next a slot on the class so you can chain things and parametrise it, yeah?
17:55:07
Shinmera
Actually you'd probably want to do it on a :before method and instead do something like (add (make-instance 'bla ...) (mixer source))
17:55:56
sjl
(mixer source) is to automatically add it to the same mixer as the thing that's ending?
18:42:37
Xach
Hmm, what's a good example of a project named "cl-foo" that defines a system named "foo"?
19:07:32
minion
dim, memo from _death: maybe you'll find what I hacked this past few hours a useful start - https://github.com/death/TIC-80
19:52:30
pjb
_death: given that you can define defglobal in two lines, why should it have it? Just do it!
20:00:37
scymtym
pjb: which aspects would that replicate? performance characteristics or behavior or both?
20:10:22
scymtym
then again, _death said "like sb-ext:defglobal", so he could have referred to a subset of its behavior
21:14:41
aeth
(defparameter *foo* (list 1 2 3)) (define-symbol-macro foobar (elt *foo* 2)) (macroexpand-1 'foobar) => (ELT *FOO* 2)
21:16:28
aeth
in fact, referencing things that aren't global won't work, e.g. (let ((temp (elt *foo* 2))) (define-symbol-macro barfoo temp)) ; barfoo will only work in places where there's a defined temp, like e.g. (let ((temp (elt *foo* 2))) barfoo)
21:27:52
aeth
I suppose the way to handle it properly would be to have a mutable global *foo* (probably an array or hash table, though) because otherwise setf won't work as expected.
21:27:54
_death
pjb: yes, for my purposes defvar+define-symbol-macro could work.. I just wanted to know whether ecl already has such a thing
21:34:57
aeth
At the very least, there's no mention of it here. https://common-lisp.net/project/ecl/static/ecldoc/Extensions.html
21:36:35
_death
guess that for a nicer CL experience w/ tic-80 there'd have to be a specific module.. but that is a job for another time
23:16:21
pierpa
CCL's DEFGLOBAL doesn't do what I understand you are talking about here. It's only vaguely related to global variables.