Rename internal coding AICA to YAMAHA

AICA is simply Dreamcast's sound chip that uses standard Yamaha ADPCM,
codec used by Yamaha in many other places well before the Dreamcast
This commit is contained in:
bnnm 2019-03-03 02:30:52 +01:00
parent 0c39f4cf09
commit 8850ddacff
14 changed files with 62 additions and 61 deletions

View File

@ -129,11 +129,11 @@ void decode_msadpcm_ck(VGMSTREAM * vgmstream, sample * outbuf, int channelspacin
long msadpcm_bytes_to_samples(long bytes, int block_size, int channels);
/* yamaha_decoder */
void decode_aica(VGMSTREAMCHANNEL * stream, sample_t * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do, int channel, int is_stereo);
void decode_yamaha(VGMSTREAMCHANNEL * stream, sample_t * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do, int channel, int is_stereo);
void decode_aska(VGMSTREAMCHANNEL * stream, sample_t * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do, int channel);
void decode_yamaha_nxap(VGMSTREAMCHANNEL * stream, sample_t * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do);
size_t aica_bytes_to_samples(size_t bytes, int channels);
void decode_nxap(VGMSTREAMCHANNEL * stream, sample_t * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do);
size_t yamaha_bytes_to_samples(size_t bytes, int channels);
size_t aska_bytes_to_samples(size_t bytes, int channels);
/* nds_procyon_decoder */
void decode_nds_procyon(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do);

View File

@ -20,8 +20,9 @@ static const int scale_delta[16] = {
};
/* raw Yamaha ADPCM a.k.a AICA as it's mainly used in Naomi/Dreamcast (also in RIFF and older arcade sound chips). */
void decode_aica(VGMSTREAMCHANNEL * stream, sample_t * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do, int channel, int is_stereo) {
/* raw Yamaha ADPCM a.k.a AICA as it's prominently used in Naomi/Dreamcast's Yamaha AICA sound chip,
* also found in Windows RIFF and older Yamaha's arcade sound chips. */
void decode_yamaha(VGMSTREAMCHANNEL * stream, sample_t * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do, int channel, int is_stereo) {
int i, sample_count;
int32_t hist1 = stream->adpcm_history1_16;
@ -106,7 +107,7 @@ void decode_aska(VGMSTREAMCHANNEL * stream, sample_t * outbuf, int channelspacin
}
/* Yamaha ADPCM with unknown expand variation (noisy), step size is double of normal Yamaha? */
void decode_yamaha_nxap(VGMSTREAMCHANNEL * stream, sample_t * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do) {
void decode_nxap(VGMSTREAMCHANNEL * stream, sample_t * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do) {
int i, sample_count, num_frame;
int32_t hist1 = stream->adpcm_history1_32;
int step_size = stream->adpcm_step_index;
@ -149,12 +150,12 @@ void decode_yamaha_nxap(VGMSTREAMCHANNEL * stream, sample_t * outbuf, int channe
stream->adpcm_step_index = step_size;
}
size_t aica_bytes_to_samples(size_t bytes, int channels) {
size_t yamaha_bytes_to_samples(size_t bytes, int channels) {
/* 2 samples per byte (2 nibbles) in stereo or mono config */
return bytes * 2 / channels;
}
size_t yamaha_bytes_to_samples(size_t bytes, int channels) {
size_t aska_bytes_to_samples(size_t bytes, int channels) {
int block_align = 0x40;
return (bytes / block_align) * (block_align - 0x04*channels) * 2 / channels

View File

@ -632,10 +632,10 @@ static const coding_info coding_info_list[] = {
{coding_MSADPCM_int, "Microsoft 4-bit ADPCM (mono/interleave)"},
{coding_MSADPCM_ck, "Microsoft 4-bit ADPCM (Cricket Audio)"},
{coding_WS, "Westwood Studios VBR ADPCM"},
{coding_AICA, "Yamaha 4-bit ADPCM"},
{coding_AICA_int, "Yamaha 4-bit ADPCM (mono/interleave)"},
{coding_YAMAHA, "Yamaha 4-bit ADPCM"},
{coding_YAMAHA_int, "Yamaha 4-bit ADPCM (mono/interleave)"},
{coding_ASKA, "tri-Ace Aska 4-bit ADPCM"},
{coding_YAMAHA_NXAP, "Yamaha NXAP 4-bit ADPCM"},
{coding_NXAP, "Nex NXAP 4-bit ADPCM"},
{coding_NDS_PROCYON, "Procyon Studio Digital Sound Elements NDS 4-bit APDCM"},
{coding_L5_555, "Level-5 0x555 4-bit ADPCM"},
{coding_LSF, "lsf 4-bit ADPCM"},

View File

@ -92,7 +92,7 @@ VGMSTREAM * init_vgmstream_dc_dcsw_dcs(STREAMFILE *streamFile) {
vgmstream->interleave_block_size = 0x4000;
}
vgmstream->coding_type = coding_AICA_int;
vgmstream->coding_type = coding_YAMAHA_int;
vgmstream->meta_type = meta_DC_DCSW_DCS;
/* open the file for reading by each channel */
@ -103,7 +103,7 @@ VGMSTREAM * init_vgmstream_dc_dcsw_dcs(STREAMFILE *streamFile) {
if (!vgmstream->ch[i].streamfile) goto fail;
vgmstream->ch[i].channel_start_offset=
vgmstream->ch[i].offset=i*vgmstream->interleave_block_size;
vgmstream->ch[i].adpcm_step_index = 0x7f; /* AICA */
vgmstream->ch[i].adpcm_step_index = 0x7f;
}
}

View File

@ -39,7 +39,7 @@ VGMSTREAM * init_vgmstream_dc_str(STREAMFILE *streamFile) {
/* fill in the vital statistics */
switch (samples) {
case 4:
vgmstream->coding_type = coding_AICA_int;
vgmstream->coding_type = coding_YAMAHA_int;
vgmstream->num_samples = read_32bitLE(0x14,streamFile);
if (loop_flag) {
vgmstream->loop_start_sample = 0;

View File

@ -16,7 +16,7 @@ typedef enum {
DVI_IMA = 7, /* DVI IMA ADPCM (high nibble first) */
MPEG = 8, /* MPEG (MP3) */
IMA = 9, /* IMA ADPCM (low nibble first) */
AICA = 10, /* AICA ADPCM (Dreamcast games) */
YAMAHA = 10, /* YAMAHA (AICA) ADPCM (Dreamcast games) */
MSADPCM = 11, /* MS ADPCM (Windows games) */
NGC_DSP = 12, /* NGC DSP (Nintendo games) */
PCM8_U_int = 13, /* 8-bit unsigned PCM (interleaved) */
@ -101,7 +101,7 @@ VGMSTREAM * init_vgmstream_genh(STREAMFILE *streamFile) {
case MPEG: coding = coding_MPEG_layer3; break; /* we later find out exactly which */
#endif
case IMA: coding = coding_IMA; break;
case AICA: coding = coding_AICA; break;
case YAMAHA: coding = coding_YAMAHA; break;
case MSADPCM: coding = coding_MSADPCM; break;
case NGC_DSP: coding = coding_NGC_DSP; break;
case PCM8_U_int: coding = coding_PCM8_U_int; break;
@ -151,7 +151,7 @@ VGMSTREAM * init_vgmstream_genh(STREAMFILE *streamFile) {
case coding_PSX_badflags:
case coding_DVI_IMA:
case coding_IMA:
case coding_AICA:
case coding_YAMAHA:
case coding_APPLE_IMA4:
vgmstream->interleave_block_size = genh.interleave;
vgmstream->interleave_last_block_size = genh.interleave_last;
@ -170,8 +170,8 @@ VGMSTREAM * init_vgmstream_genh(STREAMFILE *streamFile) {
coding = coding_DVI_IMA_int;
if (coding == coding_IMA)
coding = coding_IMA_int;
if (coding == coding_AICA)
coding = coding_AICA_int;
if (coding == coding_YAMAHA)
coding = coding_YAMAHA_int;
}
/* to avoid endless loops */
@ -188,7 +188,7 @@ VGMSTREAM * init_vgmstream_genh(STREAMFILE *streamFile) {
}
/* setup adpcm */
if (coding == coding_AICA || coding == coding_AICA_int) {
if (coding == coding_YAMAHA || coding == coding_YAMAHA_int) {
int ch;
for (ch = 0; ch < vgmstream->channels; ch++) {
vgmstream->ch[ch].adpcm_step_index = 0x7f;

View File

@ -27,9 +27,9 @@ VGMSTREAM * init_vgmstream_naomi_adpcm(STREAMFILE *streamFile) {
if (!vgmstream) goto fail;
vgmstream->sample_rate = 44100;
vgmstream->num_samples = aica_bytes_to_samples(data_size, channel_count);
vgmstream->num_samples = yamaha_bytes_to_samples(data_size, channel_count);
vgmstream->coding_type = coding_AICA_int;
vgmstream->coding_type = coding_YAMAHA_int;
vgmstream->layout_type = layout_interleave;
vgmstream->interleave_block_size = data_size / channel_count;
vgmstream->meta_type = meta_NAOMI_ADPCM;

View File

@ -59,9 +59,9 @@ VGMSTREAM * init_vgmstream_naomi_spsd(STREAMFILE *streamFile) {
break;
case 0x03: /* standard */
vgmstream->coding_type = coding_AICA_int;
vgmstream->num_samples = aica_bytes_to_samples(data_size,channel_count);
vgmstream->loop_start_sample = /*read_32bitLE(0x2c,streamFile) +*/ aica_bytes_to_samples(0x2000*channel_count,channel_count);
vgmstream->coding_type = coding_YAMAHA_int;
vgmstream->num_samples = yamaha_bytes_to_samples(data_size,channel_count);
vgmstream->loop_start_sample = /*read_32bitLE(0x2c,streamFile) +*/ yamaha_bytes_to_samples(0x2000*channel_count,channel_count);
vgmstream->loop_end_sample = vgmstream->num_samples;
break;

View File

@ -35,7 +35,7 @@ VGMSTREAM * init_vgmstream_nxap(STREAMFILE *streamFile) {
//vgmstream->loop_end_sample = vgmstream->loop_start_sample + vgmstream->loop_end_sample;
vgmstream->meta_type = meta_NXAP;
vgmstream->coding_type = coding_YAMAHA_NXAP;
vgmstream->coding_type = coding_NXAP;
vgmstream->layout_type = layout_interleave;
vgmstream->interleave_block_size = 0x40;

View File

@ -124,7 +124,7 @@ static int read_fmt(int big_endian, STREAMFILE * streamFile, off_t current_chunk
case 0x00: /* Yamaha ADPCM (raw) [Headhunter (DC), Bomber hehhe (DC)] (unofficial) */
if (fmt->bps != 4) goto fail;
if (fmt->block_size != 0x02*fmt->channel_count) goto fail;
fmt->coding_type = coding_AICA_int;
fmt->coding_type = coding_YAMAHA_int;
fmt->interleave = 0x01;
break;
@ -162,7 +162,7 @@ static int read_fmt(int big_endian, STREAMFILE * streamFile, off_t current_chunk
case 0x20: /* Yamaha ADPCM (raw) [Takuyo/Dynamix/etc DC games] */
if (fmt->bps != 4) goto fail;
fmt->coding_type = coding_AICA;
fmt->coding_type = coding_YAMAHA;
break;
case 0x69: /* XBOX IMA ADPCM [Dynasty Warriors 5 (Xbox)] */
@ -572,9 +572,9 @@ VGMSTREAM * init_vgmstream_riff(STREAMFILE *streamFile) {
vgmstream->num_samples = fact_sample_count;
break;
case coding_AICA:
case coding_AICA_int:
vgmstream->num_samples = aica_bytes_to_samples(data_size, fmt.channel_count);
case coding_YAMAHA:
case coding_YAMAHA_int:
vgmstream->num_samples = yamaha_bytes_to_samples(data_size, fmt.channel_count);
break;
case coding_XBOX_IMA:
@ -652,7 +652,7 @@ VGMSTREAM * init_vgmstream_riff(STREAMFILE *streamFile) {
switch (fmt.coding_type) {
case coding_MSADPCM:
case coding_MS_IMA:
case coding_AICA:
case coding_YAMAHA:
case coding_XBOX_IMA:
case coding_IMA:
#ifdef VGM_USE_FFMPEG

View File

@ -300,9 +300,9 @@ VGMSTREAM * init_vgmstream_ta_aac_mobile(STREAMFILE *streamFile) {
vgmstream->coding_type = coding_ASKA;
vgmstream->layout_type = layout_none;
vgmstream->num_samples = yamaha_bytes_to_samples(data_size, channel_count);
vgmstream->loop_start_sample = yamaha_bytes_to_samples(read_32bitLE(0x130, streamFile), channel_count);
vgmstream->loop_end_sample = yamaha_bytes_to_samples(read_32bitLE(0x134, streamFile), channel_count);
vgmstream->num_samples = aska_bytes_to_samples(data_size, channel_count);
vgmstream->loop_start_sample = aska_bytes_to_samples(read_32bitLE(0x130, streamFile), channel_count);
vgmstream->loop_end_sample = aska_bytes_to_samples(read_32bitLE(0x134, streamFile), channel_count);
break;
default:

View File

@ -16,7 +16,7 @@ typedef enum {
DVI_IMA = 7, /* DVI IMA ADPCM (high nibble first) */
MPEG = 8, /* MPEG (MP3) */
IMA = 9, /* IMA ADPCM (low nibble first) */
AICA = 10, /* AICA ADPCM (Dreamcast games) */
YAMAHA = 10, /* YAMAHA (AICA) ADPCM (Dreamcast games) */
MSADPCM = 11, /* MS ADPCM (Windows games) */
NGC_DSP = 12, /* NGC DSP (Nintendo games) */
PCM8_U_int = 13, /* 8-bit unsigned PCM (interleaved) */
@ -163,7 +163,7 @@ VGMSTREAM * init_vgmstream_txth(STREAMFILE *streamFile) {
case MPEG: coding = coding_MPEG_layer3; break; /* we later find out exactly which */
#endif
case IMA: coding = coding_IMA; break;
case AICA: coding = coding_AICA; break;
case YAMAHA: coding = coding_YAMAHA; break;
case MSADPCM: coding = coding_MSADPCM; break;
case NGC_DSP: coding = coding_NGC_DSP; break;
case PCM8_U_int: coding = coding_PCM8_U_int; break;
@ -226,7 +226,7 @@ VGMSTREAM * init_vgmstream_txth(STREAMFILE *streamFile) {
case coding_PSX_badflags:
case coding_DVI_IMA:
case coding_IMA:
case coding_AICA:
case coding_YAMAHA:
case coding_APPLE_IMA4:
vgmstream->interleave_block_size = txth.interleave;
vgmstream->interleave_last_block_size = txth.interleave_last;
@ -245,8 +245,8 @@ VGMSTREAM * init_vgmstream_txth(STREAMFILE *streamFile) {
coding = coding_DVI_IMA_int;
if (coding == coding_IMA)
coding = coding_IMA_int;
if (coding == coding_AICA)
coding = coding_AICA_int;
if (coding == coding_YAMAHA)
coding = coding_YAMAHA_int;
}
/* to avoid endless loops */
@ -256,7 +256,7 @@ VGMSTREAM * init_vgmstream_txth(STREAMFILE *streamFile) {
coding == coding_IMA_int ||
coding == coding_DVI_IMA_int ||
coding == coding_SDX2_int ||
coding == coding_AICA_int) ) {
coding == coding_YAMAHA_int) ) {
goto fail;
}
} else {
@ -264,7 +264,7 @@ VGMSTREAM * init_vgmstream_txth(STREAMFILE *streamFile) {
}
/* setup adpcm */
if (coding == coding_AICA || coding == coding_AICA_int) {
if (coding == coding_YAMAHA || coding == coding_YAMAHA_int) {
int ch;
for (ch = 0; ch < vgmstream->channels; ch++) {
vgmstream->ch[ch].adpcm_step_index = 0x7f;
@ -611,8 +611,8 @@ static int parse_keyval(STREAMFILE * streamFile_, txth_header * txth, const char
else if (0==strcmp(val,"DVI_IMA")) txth->codec = DVI_IMA;
else if (0==strcmp(val,"MPEG")) txth->codec = MPEG;
else if (0==strcmp(val,"IMA")) txth->codec = IMA;
else if (0==strcmp(val,"YAMAHA")) txth->codec = AICA;
else if (0==strcmp(val,"AICA")) txth->codec = AICA;
else if (0==strcmp(val,"YAMAHA")) txth->codec = YAMAHA;
else if (0==strcmp(val,"AICA")) txth->codec = YAMAHA;
else if (0==strcmp(val,"MSADPCM")) txth->codec = MSADPCM;
else if (0==strcmp(val,"NGC_DSP")) txth->codec = NGC_DSP;
else if (0==strcmp(val,"DSP")) txth->codec = NGC_DSP;
@ -1011,8 +1011,8 @@ static int get_bytes_to_samples(txth_header * txth, uint32_t bytes) {
case IMA:
case DVI_IMA:
return ima_bytes_to_samples(bytes, txth->channels);
case AICA:
return aica_bytes_to_samples(bytes, txth->channels);
case YAMAHA:
return yamaha_bytes_to_samples(bytes, txth->channels);
case PCFX:
case OKI16:
return oki_bytes_to_samples(bytes, txth->channels);

View File

@ -1214,13 +1214,13 @@ int get_vgmstream_samples_per_frame(VGMSTREAM * vgmstream) {
return (vgmstream->interleave_block_size - 0x07)*2 + 2;
case coding_WS: /* only works if output sample size is 8 bit, which always is for WS ADPCM */
return vgmstream->ws_output_size;
case coding_AICA:
case coding_YAMAHA:
return 1;
case coding_AICA_int:
case coding_YAMAHA_int:
return 2;
case coding_ASKA:
return (0x40-0x04*vgmstream->channels) * 2 / vgmstream->channels;
case coding_YAMAHA_NXAP:
case coding_NXAP:
return (0x40-0x04) * 2;
case coding_NDS_PROCYON:
return 30;
@ -1402,11 +1402,11 @@ int get_vgmstream_frame_size(VGMSTREAM * vgmstream) {
return vgmstream->interleave_block_size;
case coding_WS:
return vgmstream->current_block_size;
case coding_AICA:
case coding_AICA_int:
case coding_YAMAHA:
case coding_YAMAHA_int:
return 0x01;
case coding_ASKA:
case coding_YAMAHA_NXAP:
case coding_NXAP:
return 0x40;
case coding_NDS_PROCYON:
return 0x10;
@ -1991,12 +1991,12 @@ void decode_vgmstream(VGMSTREAM * vgmstream, int samples_written, int samples_to
vgmstream->channels,vgmstream->samples_into_block, samples_to_do, ch);
}
break;
case coding_AICA:
case coding_AICA_int:
case coding_YAMAHA:
case coding_YAMAHA_int:
for (ch = 0; ch < vgmstream->channels; ch++) {
int is_stereo = (vgmstream->channels > 1 && vgmstream->coding_type == coding_AICA);
int is_stereo = (vgmstream->channels > 1 && vgmstream->coding_type == coding_YAMAHA);
decode_aica(&vgmstream->ch[ch],buffer+samples_written*vgmstream->channels+ch,
decode_yamaha(&vgmstream->ch[ch],buffer+samples_written*vgmstream->channels+ch,
vgmstream->channels,vgmstream->samples_into_block,samples_to_do, ch,
is_stereo);
}
@ -2007,9 +2007,9 @@ void decode_vgmstream(VGMSTREAM * vgmstream, int samples_written, int samples_to
vgmstream->channels,vgmstream->samples_into_block,samples_to_do, ch);
}
break;
case coding_YAMAHA_NXAP:
case coding_NXAP:
for (ch = 0; ch < vgmstream->channels; ch++) {
decode_yamaha_nxap(&vgmstream->ch[ch],buffer+samples_written*vgmstream->channels+ch,
decode_nxap(&vgmstream->ch[ch],buffer+samples_written*vgmstream->channels+ch,
vgmstream->channels,vgmstream->samples_into_block,samples_to_do);
}
break;

View File

@ -149,10 +149,10 @@ typedef enum {
coding_MSADPCM_ck, /* Microsoft ADPCM (Cricket Audio variation) */
coding_WS, /* Westwood Studios VBR ADPCM */
coding_AICA, /* Yamaha ADPCM (stereo) */
coding_AICA_int, /* Yamaha ADPCM (mono/interleave) */
coding_YAMAHA, /* Yamaha ADPCM (stereo) */
coding_YAMAHA_int, /* Yamaha ADPCM (mono/interleave) */
coding_ASKA, /* Aska ADPCM */
coding_YAMAHA_NXAP, /* NXAP ADPCM */
coding_NXAP, /* NXAP ADPCM */
coding_NDS_PROCYON, /* Procyon Studio ADPCM */
coding_L5_555, /* Level-5 0x555 ADPCM */