mirror of
https://github.com/charlesvestal/fm1-x0x.git
synced 2026-12-05 12:24:35 +01:00
The line, its five patches and where levels are measured from were written out in tools/drive_render.c, again in bass303_drive_test.c (the acid patch, the line, its render loop and the measuring window), and fit_drive_migration.py kept the patch names and the window, in drive_render.c's order. A patch added to drive_render.c would have been left out of the fit and --check without a word. Move them to tools/drive_line.h, with one render function (Drive changes at given samples), which drive_render.c and the test include. drive_render now writes the line from step 16, where its levels are measured, and prints the patches' names (drive_render patches), which both Python tools read instead of a list of their own. Every render is unchanged: drive_render's output, against this firmware and the old one, on every patch and both types at Volume 70 and 96, Drive 0, 5, 64 and 127, is the old output from step 16 byte for byte, the migration maps are identical, bass303_drive_test prints the same figures, measure_drive_makeup.py prints the committed tables, and fit_drive_migration.py's fit prints the committed migration tables. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
55 lines
2.4 KiB
C
55 lines
2.4 KiB
C
/* SPDX-License-Identifier: GPL-3.0-only */
|
|
/* The 303 drive's acid line (tools/drive_line.h) through dsp/bass303.c at one drive setting, for
|
|
* tools/fit_drive_migration.py, which builds it twice: against this firmware's bass303.c and against
|
|
* the one from before the drive was rescaled; and for tools/measure_drive_makeup.py.
|
|
* drive_render TYPE VOLUME DRIVE [PATCH] TYPE: 1 Soft, 2 RAT; PATCH: an index into DRIVE_PATCHES
|
|
* (0); writes the line from step 16 (DRIVE_LINE_SEG0) on,
|
|
* where its levels are measured: the length n (int32),
|
|
* then n samples (float32)
|
|
* drive_render patches the patches' names, one a line, in order
|
|
* drive_render map TYPE (built with -DDRIVE_MAP, against this firmware's bass303.c)
|
|
* the migration of every old setting of that type: for each
|
|
* old Volume, each old Drive, a line "new Drive, new Volume" */
|
|
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include <string.h>
|
|
#include "bass303.h"
|
|
#include "drive_line.h"
|
|
|
|
static bass303_t B;
|
|
static float out[DRIVE_LINE_BUF];
|
|
|
|
int main(int argc, char **argv)
|
|
{
|
|
#ifdef DRIVE_MAP
|
|
if (argc == 3 && !strcmp(argv[1], "map")) {
|
|
for (int v = 0; v < 128; v++)
|
|
for (int d = 0; d < 128; d++) {
|
|
int nd, nv;
|
|
bass303_pre_rescale(atoi(argv[2]), v, d, &nd, &nv);
|
|
printf("%d %d\n", nd, nv);
|
|
}
|
|
return 0;
|
|
}
|
|
#endif
|
|
if (argc == 2 && !strcmp(argv[1], "patches")) {
|
|
for (int p = 0; p < DRIVE_NPATCH; p++)
|
|
printf("%s\n", DRIVE_PATCHES[p].name);
|
|
return 0;
|
|
}
|
|
if (argc != 4 && argc != 5) {
|
|
fprintf(stderr, "usage: drive_render TYPE VOLUME DRIVE [PATCH] | drive_render patches\n");
|
|
return 2;
|
|
}
|
|
const int pt = argc == 5 ? atoi(argv[4]) : 0;
|
|
if (pt < 0 || pt >= DRIVE_NPATCH) {
|
|
fprintf(stderr, "drive_render: PATCH 0..%d\n", DRIVE_NPATCH - 1);
|
|
return 2;
|
|
}
|
|
const int drive = atoi(argv[3]), from = 0, n = DRIVE_LINE_LEN - DRIVE_LINE_SEG0;
|
|
drive_line_render(&B, out, pt, atoi(argv[1]), atoi(argv[2]), &drive, &from, 1);
|
|
fwrite(&n, sizeof n, 1, stdout);
|
|
fwrite(out + DRIVE_LINE_SEG0, sizeof *out, (size_t)n, stdout);
|
|
return 0;
|
|
}
|