Implement System40.ini/AliceStart.ini mixers

Implement "VolumeValancer" mixer channels from the .ini file. Mixers are
now recursive, with the master and voice channels being parent nodes
(this seems to be hardcoded in system 4, or at least I haven't found
where the hierarchy is specified).

Also implement .wai file support (needed for mixer channel info on sound
files).
This commit is contained in:
Nunuhara Cabbage
2021-10-03 09:26:48 -07:00
parent 96356094d9
commit f53184d8f7
7 changed files with 275 additions and 66 deletions
+15
View File
@@ -28,10 +28,25 @@ struct bgi {
int volume;
};
struct wai {
//int uk1;
//int uk2;
int channel;
//int uk3; // version 4+
};
void bgi_read(const char *path);
struct bgi *bgi_get(int no);
void wai_load(const char *path);
struct wai *wai_get(int no);
void mixer_init(void);
int mixer_get_numof(void);
const char *mixer_get_name(int n);
int mixer_get_volume(int n, int *volume);
int mixer_set_volume(int n, int volume);
int mixer_get_mute(int n, int *mute);
int mixer_set_mute(int n, int mute);
struct channel;
enum asset_type;
+3 -2
View File
@@ -341,8 +341,9 @@ void sts_mixer_mix_audio(sts_mixer_t* mixer, void* output, unsigned int samples)
}
// write to buffer
left = sts_mixer__clamp_sample(left);
right = sts_mixer__clamp_sample(right);
// NOTE: xsystem4 change: use mixer gain (not sure why this isn't implemented upstream...)
left = sts_mixer__clamp_sample(left * mixer->gain);
right = sts_mixer__clamp_sample(right * mixer->gain);
switch (mixer->audio_format) {
case STS_MIXER_SAMPLE_FORMAT_8:
*out_8++ = (char)(left * 127.0f);
+2
View File
@@ -30,6 +30,8 @@ struct config {
int view_height;
size_t mixer_nr_channels;
char **mixer_channels;
int *mixer_volumes;
int default_volume;
char *bgi_path;
char *wai_path;