Skip to content

Commit 237c6fd

Browse files
authored
Report pan value '---' for samples with no default panning. (#69)
1 parent 0779f8d commit 237c6fd

File tree

2 files changed

+22
-4
lines changed

2 files changed

+22
-4
lines changed

Changelog

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
Stable versions
22
---------------
33

4+
4.2.1 (?):
5+
Changes by Alice Rowan
6+
- Report pan value "---" for instruments/samples without
7+
a default panning value (sub->pan < 0).
8+
49
4.2.0 (20230615):
510
Changes by Özkan Sezer:
611
- Fix OS/2 and Amiga builds. OS-specific tweaks.

src/info.c

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -226,10 +226,20 @@ void info_frame(const struct xmp_module_info *mi, const struct xmp_frame_info *f
226226
fflush(stdout);
227227
}
228228

229+
static void get_sample_pan_string(char pan[4], const struct xmp_subinstrument *sub)
230+
{
231+
if (sub->pan >= 0) {
232+
snprintf(pan, 4, "P%02x", sub->pan & 0xff);
233+
} else {
234+
strcpy(pan, "---");
235+
}
236+
}
237+
229238
void info_ins_smp(const struct xmp_module_info *mi)
230239
{
231240
int i, j;
232241
const struct xmp_module *mod = mi->mod;
242+
char pan_string[4];
233243

234244
report("Instruments and samples:\n");
235245
report(" Instrument name Smp Size Loop End Vol Fine Xpo Pan\n");
@@ -260,9 +270,10 @@ void info_ins_smp(const struct xmp_module_info *mi)
260270
}
261271
report("%36.36s", " ");
262272
}
273+
get_sample_pan_string(pan_string, sub);
263274

264275
has_sub = 1;
265-
report("[%02x] %05x%c%05x %05x%c V%02x %+04d %+03d P%02x\n",
276+
report("[%02x] %05x%c%05x %05x%c V%02x %+04d %+03d %-3.3s\n",
266277
sub->sid + 1,
267278
smp->len,
268279
smp->flg & XMP_SAMPLE_16BIT ? '+' : ' ',
@@ -274,7 +285,7 @@ void info_ins_smp(const struct xmp_module_info *mi)
274285
sub->vol,
275286
sub->fin,
276287
sub->xpo,
277-
sub->pan & 0xff);
288+
pan_string);
278289
}
279290

280291
if (has_sub == 0) {
@@ -287,6 +298,7 @@ void info_instruments(const struct xmp_module_info *mi)
287298
{
288299
int i, j;
289300
const struct xmp_module *mod = mi->mod;
301+
char pan_string[4];
290302

291303
report("Instruments:\n");
292304
report(" Instrument name Vl Fade Env Ns Sub Gv Vl Fine Xpo Pan Sm\n");
@@ -323,15 +335,16 @@ void info_instruments(const struct xmp_module_info *mi)
323335
}
324336
report("%51.51s", " ");
325337
}
338+
get_sample_pan_string(pan_string, sub);
326339

327340
has_sub = 1;
328-
report("[%02x] %02x %02x %+04d %+03d P%02x %02x\n",
341+
report("[%02x] %02x %02x %+04d %+03d %-3.3s %02x\n",
329342
j + 1,
330343
sub->gvl,
331344
sub->vol,
332345
sub->fin,
333346
sub->xpo,
334-
sub->pan & 0xff,
347+
pan_string,
335348
sub->sid);
336349
}
337350

0 commit comments

Comments
 (0)