libera/#commonlisp - IRC Chatlog
Search
12:08:18
Josh_2
Yes but if you check quicklisp-projects issues nothing has been closed for a long time, plus no updates on planet.lisp
12:50:07
pjb
Josh_2: a few years ago he had some health issues. Perhaps he's again busy with that, or a new job?
19:01:33
mathrick
Shinmera: does the MPG123 segment accept files by content, or does it require a pathname and will always try to open it itself? It's not clear to me from reading the docs and source
19:38:19
Shinmera
Fwiw mp3s are a bad idea for games. They're slower to decode, don't loop smoothly, and aren't great for short effects aynhow.
19:53:33
mathrick
Shinmera: because having to specify paths on the local filesystem is really constraining for the rest of the design
19:54:58
mathrick
yes! It's really convenient to have the option of having the library open a file for you, but it's really inconvenient if that's the only way you have to talk to it
19:58:01
Shinmera
And anyway, please don't feel like this is closed source software. Everything is there and can be adapted should the need arise.
19:58:52
mathrick
but I also wanted to know ahead of time, because I don't think I've ever used a library for longer than the tutorial without wanting to use in-memory sources, so it's one of those API corners I explore immediately
20:00:42
Shinmera
any source in cl-mixed can pretty trivially be turned into an in-memory source, anyhow.
20:01:24
mathrick
howso? I thought they'd need to serve uncompressed samples for the rest of the segments to be able to consume them?
20:02:49
mathrick
right, but that would require using the underlying decompression library, which in the case of mpg123 at least isn't supported I thought?
20:03:32
Shinmera
I mean, you read it from file into one uncompressed pack buffer. and then you just use that pack as a source.
20:04:59
Shinmera
a source segment just outputs stuff into a PACK when MIX is called. So you attach a PACK that's big enough to contain all the data, attach it to the source, call MIX, and you got all the data uncompressed and decoded in-memory.
20:06:51
Shinmera
by default harmony takes care of buffer and pack allocation for you, sizing things in accordance to its internal samplerate and buffer length.
20:07:07
Shinmera
but there's nothing stopping you from doing a thingy before hand or manually managing stuff outside harmony.
20:08:00
Shinmera
A feature I haven't tested yet is even providing your own malloc/free for libmixed to use so you could have it allocate everything in a static-vector or something to keep things lisp-side.
20:14:58
gin
is there a more elegant way to do this? (if (zerop (length *a*)) "" (concatenate 'string "prefix: " *a*))
20:15:38
gin
I am trying to return "prefix: " followed by the string only if it is non-empty string. If it is an empty string, just return the empty string.
20:19:26
_death
almost.. (defun nonempty-string-p (x) (if (equal x "") nil x)) then pass (nonempty-string-p *a*) to format
20:20:17
Shinmera
I often have a handy OR* that treats empty strings as NIL, so with that it would be (format .. (or* *a*)) :)
20:22:48
thuna`
I thought there was a format directive that checked for equality between its arguments but am I misremembering?
20:26:31
aeth
there's some point in complexity that's sooner than most people think but later than I usually attempt where with-output-to-string is a way simpler way to make strings
20:27:03
aeth
(I usually spend about 10 minutes on with-output-to-string, give up, and then do it in a very short FORMAT, but I guess that's better than building a FORMAT that's too elaborate)
20:29:05
_death
I had in mind something that pops a small buffer with short directive description as you move around in a format control string
20:32:48
thuna`
I would be surprised if something like cl-ppcre for format strings doesn't exist already
20:36:19
_death
welp. there's (macroexpand-1 '(formatter "insert ~A here")) ;) .. but then there's http://cs-www.cs.yale.edu/homes/dvm/format-stinks.html and derivatives
21:41:19
gin
(let* ((a 10) (a 20)) (print a)) ; <= this prints 20. is there anyway to access the outer a = 10 within LET*?
22:22:15
mathrick
_death: FORMAT is extremely useful. That page is essentially cout for CL, and there's a reason cout is widely regarded to be toxic. No matter how cryptic, format strings are always superior to alternatives, and it's precisely the fact that they separate the printing code from the specification of what to print and how
22:22:51
mathrick
OUT, cout, and anything else that builds strings immediately in the code cannot be localised