Consume libakgl 0.3.0: every workaround deleted, two capabilities gained
0.3.0 closed all ten API gaps this port had filed. The four workarounds go with them: the CMake block that declared libakgl's vendored dependencies by hand, the akgl/actor.h include in three files, and the six vtable pointers assigned by hand in two more, now akgl_render_bind2d(). Two gaps were capabilities rather than inconveniences, and both are now real: The line editor takes the composed UTF-8 text the ring carries in preference to the keycode, so shifted characters, keyboard layouts, compose keys and dead keys all work. A double quote can be typed, which means a BASIC string literal can be typed -- the sharp end of the old limitation. Letters are no longer folded to upper case. SOUND's dir/min/step reach akgl_audio_sweep instead of being refused. dir 3 sweeps once rather than oscillating and TODO.md section 5 says so. A backend with no sweep still refuses the swept note and plays the held one. The adaptors now carry an AKGL_VERSION_AT_LEAST(0, 3, 0) floor, verified by temporarily demanding 0.4.0 and watching it fire. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -191,6 +191,19 @@ static akerr_ErrorContext *mock_tone(akbasic_AudioBackend *self, int voice, doub
|
||||
SUCCEED_RETURN(errctx);
|
||||
}
|
||||
|
||||
static akerr_ErrorContext *mock_sweep(akbasic_AudioBackend *self, int voice, double from_hz, double to_hz, double step_hz, int ms)
|
||||
{
|
||||
PREPARE_ERROR(errctx);
|
||||
(void)self;
|
||||
|
||||
FAIL_ZERO_RETURN(errctx, (voice >= 0 && voice < AKBASIC_AUDIO_VOICES), AKBASIC_ERR_BOUNDS,
|
||||
"mock voice %d out of range", voice);
|
||||
MOCK.voice_active[voice] = true;
|
||||
mock_log("sweep v%d %.1fhz->%.1fhz step %.1fhz %dms\n",
|
||||
voice, from_hz, to_hz, step_hz, ms);
|
||||
SUCCEED_RETURN(errctx);
|
||||
}
|
||||
|
||||
static akerr_ErrorContext *mock_audio_stop(akbasic_AudioBackend *self, int voice)
|
||||
{
|
||||
PREPARE_ERROR(errctx);
|
||||
@@ -296,6 +309,13 @@ static void mock_devices_init(void)
|
||||
|
||||
MOCK_AUDIO.self = &MOCK;
|
||||
MOCK_AUDIO.tone = mock_tone;
|
||||
/*
|
||||
* Set here, and deliberately cleared again by the one test that needs a
|
||||
* backend without it: `sweep` may be NULL, which is what a host written
|
||||
* against libakgl 0.2.0 looks like, and SOUND has to refuse rather than
|
||||
* crash on one.
|
||||
*/
|
||||
MOCK_AUDIO.sweep = mock_sweep;
|
||||
MOCK_AUDIO.stop = mock_audio_stop;
|
||||
MOCK_AUDIO.waveform = mock_waveform;
|
||||
MOCK_AUDIO.envelope = mock_envelope;
|
||||
|
||||
Reference in New Issue
Block a user