implement support for volume column byte

This commit is contained in:
Zack Buhman 2025-07-04 17:56:08 -05:00
parent 96adadac52
commit 28b5d5f52e
6 changed files with 35 additions and 2 deletions

View File

@ -91,8 +91,16 @@ void _play_note(int ch, const xm_pattern_format_t * pf)
if (loop_type == 2) // bidirectional
len += len - 2;
int volume_column = state.channel[ch].volume;
if (pf->volume_column_byte >= 0x10 && pf->volume_column_byte <= 0x50) {
volume_column = pf->volume_column_byte - 0x10;
state.channel[ch].volume = volume_column;
}
assert(sample_header->volume >= 0 && sample_header->volume <= 64);
int disdl = volume_table[sample_header->volume];
int volume = (sample_header->volume * volume_column) / 64;
assert(volume >= 0 && volume <= 64);
int disdl = volume_table[volume];
bool pcms = !sample_type;
wait(); aica_sound.channel[ch].PCMS(pcms);
wait(); aica_sound.channel[ch].SA(start);
@ -341,6 +349,7 @@ void init(float clock_multiplier)
next_pattern();
for (int ch = 0; ch < 64; ch++) {
state.channel[ch].keyon = 0;
state.channel[ch].volume = 64;
}
state.paused = false;

View File

@ -9,6 +9,7 @@ constexpr int max_channels = 64;
struct channel_state {
uint8_t instrument;
uint8_t keyon;
uint8_t volume;
};
struct interpreter_state {

View File

@ -6,6 +6,7 @@
#include "xm/milkypack01.xm.h"
#include "xm/CottageFantasy2.xm.h"
#include "xm/CloudsAhead6.xm.h"
#include "xm/SummerDreamsDemoTrackv4.xm.h"
#include "scene/tracker/cover.hpp"
@ -28,6 +29,12 @@ namespace playlist {
.start = (int)&_binary_xm_CloudsAhead6_xm_start,
.cover_ix = scene::tracker::cover::mountain,
},
{
.artist = "Cai",
.title = "SummerDreamsDemov4",
.start = (int)&_binary_xm_SummerDreamsDemoTrackv4_xm_start,
.cover_ix = scene::tracker::cover::mountain,
},
};
const int playlist_length = (sizeof (playlist)) / (sizeof (playlist[0]));

Binary file not shown.

View File

@ -0,0 +1,15 @@
#pragma once
#include <stdint.h>
#ifdef __cplusplus
extern "C" {
#endif
extern uint32_t _binary_xm_SummerDreamsDemoTrackv4_xm_start __asm("_binary_xm_SummerDreamsDemoTrackv4_xm_start");
extern uint32_t _binary_xm_SummerDreamsDemoTrackv4_xm_end __asm("_binary_xm_SummerDreamsDemoTrackv4_xm_end");
extern uint32_t _binary_xm_SummerDreamsDemoTrackv4_xm_size __asm("_binary_xm_SummerDreamsDemoTrackv4_xm_size");
#ifdef __cplusplus
}
#endif

View File

@ -1,7 +1,8 @@
XM_OBJ = \
xm/milkypack01.xm.o \
xm/CottageFantasy2.xm.o \
xm/CloudsAhead6.xm.o
xm/CloudsAhead6.xm.o \
xm/SummerDreamsDemoTrackv4.xm.o
TEXTURE_OBJ = \
font/tandy1k.data.o \