Tweak Yamaha/AICA codec naming

This commit is contained in:
bnnm 2019-09-21 19:15:01 +02:00
parent e372e19057
commit 97c090886f
14 changed files with 52 additions and 51 deletions

View File

@ -371,7 +371,7 @@ are used in few games.
- Microsoft MS IMA ADPCM (standard, Xbox, NDS, Radical, Wwise, FSB, WV6, etc)
- Microsoft MS ADPCM (standard, Cricket Audio)
- Westwood VBR ADPCM
- Yamaha ADPCM (standard, Aska)
- Yamaha ADPCM (AICA, Aska)
- Procyon Studio ADPCM
- Level-5 0x555 ADPCM
- lsf ADPCM
@ -562,7 +562,7 @@ This list is not complete and many other files are supported.
- .xmu
- .xvas
- .xwav
- Yamaha ADPCM:
- Yamaha AICA ADPCM:
- .adpcm
- .dcs+.dcsw
- .str

View File

@ -93,8 +93,8 @@ as explained below, but often will use default values. Accepted codec strings:
# * Special interleave is multiple of 0x1, often +0x80
# - DVI_IMA IMA ADPCM (DVI order)
# * Variation with modified encoding
# - YAMAHA|AICA Yamaha ADPCM (mono/stereo)
# * For some Dreamcast games, and some arcade games
# - AICA Yamaha AICA ADPCM (mono/stereo)
# * For some Dreamcast games, and some arcade (Naomi) games
# * Special interleave is multiple of 0x1
# - APPLE_IMA4 Apple Quicktime IMA ADPCM
# * For some Mac/iOS games

View File

@ -133,7 +133,7 @@ void decode_msadpcm_ck(VGMSTREAM * vgmstream, sample_t * outbuf, int channelspac
long msadpcm_bytes_to_samples(long bytes, int block_size, int channels);
/* yamaha_decoder */
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_aica(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_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);

View File

@ -80,7 +80,7 @@ static void yamaha_aica_expand_nibble(VGMSTREAMCHANNEL * stream, off_t byte_offs
/* Yamaha AICA ADPCM (also used in YMZ280B with high nibble first) */
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_aica(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 = 0;
int16_t out_sample;
int32_t hist1 = stream->adpcm_history1_16;

View File

@ -676,8 +676,8 @@ 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_YAMAHA, "Yamaha 4-bit ADPCM"},
{coding_YAMAHA_int, "Yamaha 4-bit ADPCM (mono/interleave)"},
{coding_AICA, "Yamaha AICA 4-bit ADPCM"},
{coding_AICA_int, "Yamaha AICA 4-bit ADPCM (mono/interleave)"},
{coding_ASKA, "tri-Ace Aska 4-bit ADPCM"},
{coding_NXAP, "Nex NXAP 4-bit ADPCM"},
{coding_NDS_PROCYON, "Procyon Studio Digital Sound Elements NDS 4-bit APDCM"},

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_YAMAHA_int;
vgmstream->coding_type = coding_AICA_int;
vgmstream->num_samples = read_32bitLE(0x14,streamFile);
if (loop_flag) {
vgmstream->loop_start_sample = 0;

View File

@ -42,7 +42,7 @@ VGMSTREAM * init_vgmstream_dcs_wav(STREAMFILE *streamFile) {
vgmstream->meta_type = meta_DCS_WAV;
vgmstream->sample_rate = sample_rate;
vgmstream->num_samples = yamaha_bytes_to_samples(get_streamfile_size(streamFile), channel_count);
vgmstream->coding_type = coding_YAMAHA_int;
vgmstream->coding_type = coding_AICA_int;
vgmstream->layout_type = layout_interleave;
vgmstream->interleave_block_size = 0x4000;

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) */
YAMAHA = 10, /* YAMAHA (AICA) ADPCM (Dreamcast games) */
AICA = 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) */
@ -102,7 +102,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 YAMAHA: coding = coding_YAMAHA; break;
case AICA: coding = coding_AICA; 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;
@ -153,7 +153,7 @@ VGMSTREAM * init_vgmstream_genh(STREAMFILE *streamFile) {
case coding_PSX_badflags:
case coding_DVI_IMA:
case coding_IMA:
case coding_YAMAHA:
case coding_AICA:
case coding_APPLE_IMA4:
vgmstream->interleave_block_size = genh.interleave;
vgmstream->interleave_last_block_size = genh.interleave_last;
@ -172,8 +172,8 @@ VGMSTREAM * init_vgmstream_genh(STREAMFILE *streamFile) {
coding = coding_DVI_IMA_int;
if (coding == coding_IMA)
coding = coding_IMA_int;
if (coding == coding_YAMAHA)
coding = coding_YAMAHA_int;
if (coding == coding_AICA)
coding = coding_AICA_int;
}
/* to avoid endless loops */
@ -190,11 +190,11 @@ VGMSTREAM * init_vgmstream_genh(STREAMFILE *streamFile) {
}
/* to avoid problems with dual stereo files (_L+_R) for codecs with stereo modes */
if (coding == coding_YAMAHA && genh.channels == 1)
coding = coding_YAMAHA_int;
if (coding == coding_AICA && genh.channels == 1)
coding = coding_AICA_int;
/* setup adpcm */
if (coding == coding_YAMAHA || coding == coding_YAMAHA_int) {
if (coding == coding_AICA || coding == coding_AICA_int) {
int ch;
for (ch = 0; ch < vgmstream->channels; ch++) {
vgmstream->ch[ch].adpcm_step_index = 0x7f;

View File

@ -29,7 +29,7 @@ VGMSTREAM * init_vgmstream_naomi_adpcm(STREAMFILE *streamFile) {
vgmstream->sample_rate = 44100;
vgmstream->num_samples = yamaha_bytes_to_samples(data_size, channel_count);
vgmstream->coding_type = coding_YAMAHA_int;
vgmstream->coding_type = coding_AICA_int;
vgmstream->layout_type = layout_interleave;
vgmstream->interleave_block_size = data_size / channel_count;
vgmstream->meta_type = meta_NAOMI_ADPCM;

View File

@ -59,7 +59,7 @@ VGMSTREAM * init_vgmstream_naomi_spsd(STREAMFILE *streamFile) {
break;
case 0x03: /* standard */
vgmstream->coding_type = coding_YAMAHA_int;
vgmstream->coding_type = coding_AICA_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;

View File

@ -135,10 +135,10 @@ static int read_fmt(int big_endian, STREAMFILE * streamFile, off_t current_chunk
}
switch (fmt->codec) {
case 0x00: /* Yamaha ADPCM (raw) [Headhunter (DC), Bomber hehhe (DC)] (unofficial) */
case 0x00: /* Yamaha AICA 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_YAMAHA_int;
fmt->coding_type = coding_AICA_int;
fmt->interleave = 0x01;
break;
@ -174,9 +174,11 @@ static int read_fmt(int big_endian, STREAMFILE * streamFile, off_t current_chunk
fmt->coding_type = coding_MS_IMA;
break;
case 0x20: /* Yamaha ADPCM (raw) [Takuyo/Dynamix/etc DC games] */
case 0x20: /* Yamaha AICA ADPCM (raw) [Takuyo/Dynamix/etc DC games] */
if (fmt->bps != 4) goto fail;
fmt->coding_type = coding_YAMAHA;
fmt->coding_type = coding_AICA;
/* official RIFF spec has 0x20 as 'Yamaha ADPCM', but data is probably not pure AICA
* (maybe with headered frames and would need extra detection?) */
break;
case 0x69: /* XBOX IMA ADPCM [Dynasty Warriors 5 (Xbox)] */
@ -598,8 +600,8 @@ VGMSTREAM * init_vgmstream_riff(STREAMFILE *streamFile) {
vgmstream->num_samples = fact_sample_count;
break;
case coding_YAMAHA:
case coding_YAMAHA_int:
case coding_AICA:
case coding_AICA_int:
vgmstream->num_samples = yamaha_bytes_to_samples(data_size, fmt.channel_count);
break;
@ -675,7 +677,7 @@ VGMSTREAM * init_vgmstream_riff(STREAMFILE *streamFile) {
switch (fmt.coding_type) {
case coding_MSADPCM:
case coding_MS_IMA:
case coding_YAMAHA:
case coding_AICA:
case coding_XBOX_IMA:
case coding_IMA:
#ifdef VGM_USE_FFMPEG

View File

@ -17,7 +17,7 @@ typedef enum {
DVI_IMA = 7, /* DVI IMA ADPCM (high nibble first) */
MPEG = 8, /* MPEG (MP3) */
IMA = 9, /* IMA ADPCM (low nibble first) */
YAMAHA = 10, /* YAMAHA (AICA) ADPCM (Dreamcast games) */
AICA = 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) */
@ -200,7 +200,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 YAMAHA: coding = coding_YAMAHA; break;
case AICA: coding = coding_AICA; 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;
@ -264,7 +264,7 @@ VGMSTREAM * init_vgmstream_txth(STREAMFILE *streamFile) {
case coding_PSX_badflags:
case coding_DVI_IMA:
case coding_IMA:
case coding_YAMAHA:
case coding_AICA:
case coding_APPLE_IMA4:
vgmstream->interleave_block_size = txth.interleave;
vgmstream->interleave_last_block_size = txth.interleave_last;
@ -283,8 +283,8 @@ VGMSTREAM * init_vgmstream_txth(STREAMFILE *streamFile) {
coding = coding_DVI_IMA_int;
if (coding == coding_IMA)
coding = coding_IMA_int;
if (coding == coding_YAMAHA)
coding = coding_YAMAHA_int;
if (coding == coding_AICA)
coding = coding_AICA_int;
}
/* to avoid endless loops */
@ -294,7 +294,7 @@ VGMSTREAM * init_vgmstream_txth(STREAMFILE *streamFile) {
coding == coding_IMA_int ||
coding == coding_DVI_IMA_int ||
coding == coding_SDX2_int ||
coding == coding_YAMAHA_int) ) {
coding == coding_AICA_int) ) {
goto fail;
}
} else {
@ -302,11 +302,11 @@ VGMSTREAM * init_vgmstream_txth(STREAMFILE *streamFile) {
}
/* to avoid problems with dual stereo files (_L+_R) for codecs with stereo modes */
if (coding == coding_YAMAHA && txth.channels == 1)
coding = coding_YAMAHA_int;
if (coding == coding_AICA && txth.channels == 1)
coding = coding_AICA_int;
/* setup adpcm */
if (coding == coding_YAMAHA || coding == coding_YAMAHA_int) {
if (coding == coding_AICA || coding == coding_AICA_int) {
int ch;
for (ch = 0; ch < vgmstream->channels; ch++) {
vgmstream->ch[ch].adpcm_step_index = 0x7f;
@ -813,8 +813,7 @@ static int parse_keyval(STREAMFILE * streamFile_, txth_header * txth, const char
else if (is_string(val,"DVI_IMA")) txth->codec = DVI_IMA;
else if (is_string(val,"MPEG")) txth->codec = MPEG;
else if (is_string(val,"IMA")) txth->codec = IMA;
else if (is_string(val,"YAMAHA")) txth->codec = YAMAHA;
else if (is_string(val,"AICA")) txth->codec = YAMAHA;
else if (is_string(val,"AICA")) txth->codec = AICA;
else if (is_string(val,"MSADPCM")) txth->codec = MSADPCM;
else if (is_string(val,"NGC_DSP")) txth->codec = NGC_DSP;
else if (is_string(val,"DSP")) txth->codec = NGC_DSP;
@ -1302,7 +1301,7 @@ static int is_string_match(const char * text, const char * pattern) {
int t_pos = 0, p_pos = 0;
int p_size, t_size;
uint16_t p_char, t_char;
;VGM_LOG("TXTH: match '%s' vs '%s'\n", text,pattern);
//;VGM_LOG("TXTH: match '%s' vs '%s'\n", text,pattern);
/* compares 2 strings (case insensitive, to a point) allowing wildcards
* ex. for "test": match = "Test*", "*est", "*teSt","T*ES*T"; fail = "tst", "teest"
@ -1321,7 +1320,7 @@ static int is_string_match(const char * text, const char * pattern) {
while(text[t_pos] != '\0') {
t_char = get_string_wchar(text, t_pos, &t_size);
;VGM_LOG("TXTH: consume %i '%s'\n", t_size, (text+t_pos) );
//;VGM_LOG("TXTH: consume %i '%s'\n", t_size, (text+t_pos) );
if (t_char == p_char)
break;
@ -1704,7 +1703,7 @@ 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 YAMAHA:
case AICA:
return yamaha_bytes_to_samples(bytes, txth->channels);
case PCFX:
case OKI16:

View File

@ -1214,9 +1214,9 @@ 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_YAMAHA:
case coding_AICA:
return 1;
case coding_YAMAHA_int:
case coding_AICA_int:
return 2;
case coding_ASKA:
return (0x40-0x04*vgmstream->channels) * 2 / vgmstream->channels;
@ -1410,8 +1410,8 @@ int get_vgmstream_frame_size(VGMSTREAM * vgmstream) {
return vgmstream->interleave_block_size;
case coding_WS:
return vgmstream->current_block_size;
case coding_YAMAHA:
case coding_YAMAHA_int:
case coding_AICA:
case coding_AICA_int:
return 0x01;
case coding_ASKA:
case coding_NXAP:
@ -2010,12 +2010,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_YAMAHA:
case coding_YAMAHA_int:
case coding_AICA:
case coding_AICA_int:
for (ch = 0; ch < vgmstream->channels; ch++) {
int is_stereo = (vgmstream->channels > 1 && vgmstream->coding_type == coding_YAMAHA);
int is_stereo = (vgmstream->channels > 1 && vgmstream->coding_type == coding_AICA);
decode_yamaha(&vgmstream->ch[ch],buffer+samples_written*vgmstream->channels+ch,
decode_aica(&vgmstream->ch[ch],buffer+samples_written*vgmstream->channels+ch,
vgmstream->channels,vgmstream->samples_into_block,samples_to_do, ch,
is_stereo);
}

View File

@ -148,8 +148,8 @@ typedef enum {
coding_MSADPCM_ck, /* Microsoft ADPCM (Cricket Audio variation) */
coding_WS, /* Westwood Studios VBR ADPCM */
coding_YAMAHA, /* Yamaha ADPCM (stereo) */
coding_YAMAHA_int, /* Yamaha ADPCM (mono/interleave) */
coding_AICA, /* Yamaha AICA ADPCM (stereo) */
coding_AICA_int, /* Yamaha AICA ADPCM (mono/interleave) */
coding_ASKA, /* Aska ADPCM */
coding_NXAP, /* NXAP ADPCM */