VGM playback library for Common Lisp
Révision | 399f3002950ff444ccaf18ec8fbf33793c56e8dc (tree) |
---|---|
l'heure | 2023-08-18 19:06:13 |
Auteur | Remilia Scarlet <remilia@post...> |
Commiter | Remilia Scarlet |
Add T/CHIP->NAME, T/CHIP->LONG-NAME, SUPPORTED-CHIPS, and
UNSUPPORTED-CHIPS
@@ -19,7 +19,9 @@ | ||
19 | 19 | (+default-sample-rate+ 44100 :documentation "The default output sample rate.") |
20 | 20 | (+min-sample-rate+ 8000 :documentation "The minimum supported output sample rate.") |
21 | 21 | (+volume-modifier-wrap+ #xC0) |
22 | - (+vgm-sample-rate+ 44100 :documentation "The rate that commands are sampled in VGM files.")) | |
22 | + (+vgm-sample-rate+ 44100 :documentation "The rate that commands are sampled in VGM files.") | |
23 | + | |
24 | + (+inv-int-16+ #.(/ 1 65536.0))) | |
23 | 25 | |
24 | 26 | (deftype t/stream-sample () |
25 | 27 | 't/int32) |
@@ -229,3 +231,158 @@ | ||
229 | 231 | |
230 | 232 | (deftype t/resampler-type () |
231 | 233 | '(member :old :upsampling :copy :downsampling)) |
234 | + | |
235 | +(defun t/chip->name (chip) | |
236 | + "Returns the short name for a T/CHIP as a string. | |
237 | + | |
238 | +Note: for the most accurate name when using a VGM file, instantiating a chip | |
239 | +instance and using the `CHIP-SHORT-NAME` method will be much more accurate. | |
240 | +This is because some chips have a different name depending on what they were | |
241 | +used for, and this can only be determined after parsing the VGM." | |
242 | + (declare (type t/chip chip) | |
243 | + (optimize speed (debug 1) (safety 1))) | |
244 | + (ecase chip | |
245 | + (:sn76489 "SN76489") | |
246 | + (:ym2413 "YM2413") | |
247 | + (:ym2612 "YM2612") | |
248 | + (:ym2151 "YM2151") | |
249 | + (:sega-pcm "SegaPCM") | |
250 | + (:rf5c69 "RF5C69") | |
251 | + (:ym2203 "YM2203") | |
252 | + (:ym2608 "YM2608") | |
253 | + (:ym2610 "YM2610") | |
254 | + (:ym3812 "YM3812") | |
255 | + (:ym3526 "YM3526") | |
256 | + (:y8950 "Y8950") | |
257 | + (:ymf262 "YMF262") | |
258 | + (:ymf278b "YMF278B") | |
259 | + (:ymf271 "YMF271") | |
260 | + (:ymz280b "YMZ280B") | |
261 | + (:rf5c164 "RF5C164") | |
262 | + (:pwm "32x PWM") | |
263 | + (:ay8910 "AY-1-8910") | |
264 | + (:dmg "DMG") | |
265 | + (:nes-apu "NES APU") | |
266 | + (:multipcm "MultiPCM") | |
267 | + (:upd7759 "µPD7759") | |
268 | + (:oki-m6258 "M6258") | |
269 | + (:oki-m6295 "M6295") | |
270 | + (:k051649 "K051649") | |
271 | + (:k054539 "K054539") | |
272 | + (:huc6280 "HuC6280") | |
273 | + (:c140 "C140") | |
274 | + (:k053260 "K053260") | |
275 | + (:pokey "POKEY") | |
276 | + (:qsound "QSound") | |
277 | + (:scsp "SCSP") | |
278 | + (:wonderswan "Wonderswan") | |
279 | + (:vsu "VSU-VUE") | |
280 | + (:saa1099 "SAA1099") | |
281 | + (:es5503 "ES5503") | |
282 | + (:es5506 "ES5506") | |
283 | + (:c352 "C352") | |
284 | + (:x1-010 "X1-010") | |
285 | + (:ga20 "GA20") | |
286 | + (:unknown "Unknown"))) | |
287 | + | |
288 | +(defun t/chip->long-name (chip) | |
289 | + "Returns the long name for a T/CHIP as a string. | |
290 | + | |
291 | +Note: for the most accurate name when using a VGM file, instantiating a chip | |
292 | +instance and using the `CHIP-SHORT-NAME` method will be much more accurate. | |
293 | +This is because some chips have a different name depending on what they were | |
294 | +used for, and this can only be determined after parsing the VGM." | |
295 | + (declare (type t/chip chip) | |
296 | + (optimize speed (debug 1) (safety 1))) | |
297 | + (ecase chip | |
298 | + (:sn76489 "Texas Instruments SN76489 and derivatives") | |
299 | + (:ym2413 "Yamaha YM2413 (OPLL)") | |
300 | + (:ym2612 "Yamaha YM2612/YM3438 (OPN2)") | |
301 | + (:ym2151 "Yamaha YM2151 (OPM)") | |
302 | + (:sega-pcm "Sega SegaPCM (315-5218)") | |
303 | + (:rf5c69 "Ricoh RF5C69/RF5C105") | |
304 | + (:ym2203 "Yamaha YM2203 (OPN)") | |
305 | + (:ym2608 "Yamaha YM2608 (OPNA)") | |
306 | + (:ym2610 "Yamaha YM2610 (OPNB)") | |
307 | + (:ym3812 "Yamaha YM3812 (OPL2)") | |
308 | + (:ym3526 "Yamaha YM3526 (OPL)") | |
309 | + (:y8950 "Yamaha Y8950 (MSX-Audio)") | |
310 | + (:ymf262 "Yamaha YMF262 (OPL3)") | |
311 | + (:ymf278b "Yamaha YMF278B (OPL4)") | |
312 | + (:ymf271 "Yamaha YMF271 (OPX)") | |
313 | + (:ymz280b "Yamaha YMZ280B (PCMD8)") | |
314 | + (:rf5c164 "Ricoh RF5C164") | |
315 | + (:pwm "Sega PWM (32x)") | |
316 | + (:ay8910 "General Instruments AY-1-8910 and derivatives") | |
317 | + (:dmg "Nintendo DMG (GameBoy/GameBoy Color)") | |
318 | + (:nes-apu "Nintendo APU (NES)") | |
319 | + (:multipcm "Sega MultiPCM") | |
320 | + (:upd7759 "NEC µPD7759") | |
321 | + (:oki-m6258 "OKI M6258") | |
322 | + (:oki-m6295 "OKI M6295") | |
323 | + (:k051649 "Konami 051649") | |
324 | + (:k054539 "Konami 054539") | |
325 | + (:huc6280 "Hudson HuC6280") | |
326 | + (:c140 "Namco C140/C219") | |
327 | + (:k053260 "Konami 053260") | |
328 | + (:pokey "Atari POKEY") | |
329 | + (:qsound "QSound DSP16A (Capcom CP System II)") | |
330 | + (:scsp "Sega Saturn Custom Sound Processori") | |
331 | + (:wonderswan "Bandai Wonderswan") | |
332 | + (:vsu "Nintendo VSU-VUE (Virtual Boy)") | |
333 | + (:saa1099 "Philips SAA1099") | |
334 | + (:es5503 "Ensoniq ES5503") | |
335 | + (:es5506 "Ensoniq ES5506") | |
336 | + (:c352 "Namco C352") | |
337 | + (:x1-010 "Sega X1-010") | |
338 | + (:ga20 "Irem GA20") | |
339 | + (:unknown "Unknown chip"))) | |
340 | + | |
341 | +(defun supported-chips () | |
342 | + "Returns a list of chips that are supported by this library as T/CHIP values." | |
343 | + '(:ym2151 | |
344 | + :sega-pcm | |
345 | + :multipcm | |
346 | + :huc6280 | |
347 | + :c352)) | |
348 | + | |
349 | +(defun unsupported-chips () | |
350 | + "Returns a list of chips that are not yet supported by this library as T/CHIP | |
351 | +values." | |
352 | + '(:sn76489 | |
353 | + :ym2413 | |
354 | + :ym2612 | |
355 | + :rf5c69 | |
356 | + :ym2203 | |
357 | + :ym2608 | |
358 | + :ym2610 | |
359 | + :ym3812 | |
360 | + :ym3526 | |
361 | + :y8950 | |
362 | + :ymf262 | |
363 | + :ymf278b | |
364 | + :ymf271 | |
365 | + :ymz280b | |
366 | + :rf5c164 | |
367 | + :pwm | |
368 | + :ay8910 | |
369 | + :dmg | |
370 | + :nes-apu | |
371 | + :upd7759 | |
372 | + :oki-m6258 | |
373 | + :oki-m6295 | |
374 | + :k051649 | |
375 | + :k054539 | |
376 | + :c140 | |
377 | + :k053260 | |
378 | + :pokey | |
379 | + :qsound | |
380 | + :scsp | |
381 | + :wonderswan | |
382 | + :vsu | |
383 | + :saa1099 | |
384 | + :es5503 | |
385 | + :es5506 | |
386 | + :x1-010 | |
387 | + :ga20 | |
388 | + :unknown)) |