mirror of
https://github.com/vgmstream/vgmstream.git
synced 2025-01-17 23:36:41 +01:00
G.722.1 support for mingw32 and MSVC (needs testing) build.
.s14 and .sss support. Other builds will probably not build correctly, I'll follow up with something to disable G.722.1 there in a bit. git-svn-id: https://vgmstream.svn.sourceforge.net/svnroot/vgmstream@760 51a99a44-fe44-0410-b1ba-c3e57ba2b86b
This commit is contained in:
parent
6475e89d44
commit
e5ddad3b1f
25
ext_includes/g7221.h
Normal file
25
ext_includes/g7221.h
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
/*
|
||||||
|
Interface to reference G.722.1 decoder
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef G7221_H
|
||||||
|
#define G7221_H
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
|
/* forward definition for the opaque handle object */
|
||||||
|
typedef struct g7221_handle_s g7221_handle;
|
||||||
|
|
||||||
|
/* return a handle for decoding on successful init, NULL on failure */
|
||||||
|
g7221_handle * g7221_init(int bytes_per_frame, int bandwidth);
|
||||||
|
|
||||||
|
/* decode a frame, at code_words, into 16-bit PCM in sample_buffer */
|
||||||
|
void g7221_decode_frame(g7221_handle *handle, int16_t *code_words, int16_t *sample_buffer);
|
||||||
|
|
||||||
|
/* reset the decoder to its initial state */
|
||||||
|
void g7221_reset(g7221_handle *handle);
|
||||||
|
|
||||||
|
/* free resources */
|
||||||
|
void g7221_free(g7221_handle *handle);
|
||||||
|
|
||||||
|
#endif
|
@ -7,5 +7,8 @@ libvorbis.a: libvorbis.def
|
|||||||
libmpg123-0.a: libmpg123-0.def
|
libmpg123-0.a: libmpg123-0.def
|
||||||
$(DLLTOOL) -d libmpg123-0.def -l libmpg123-0.a
|
$(DLLTOOL) -d libmpg123-0.def -l libmpg123-0.a
|
||||||
|
|
||||||
|
libg7221_decode.a: libg7221_decode.def
|
||||||
|
$(DLLTOOL) -d libg7221_decode.def -l libg7221_decode.a
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -f libvorbis.a libmpg123-0.a
|
rm -f libvorbis.a libmpg123-0.a libg7221_decode.a
|
||||||
|
@ -107,6 +107,30 @@
|
|||||||
/>
|
/>
|
||||||
</FileConfiguration>
|
</FileConfiguration>
|
||||||
</File>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\libg7221_decode.def"
|
||||||
|
>
|
||||||
|
<FileConfiguration
|
||||||
|
Name="Debug|Win32"
|
||||||
|
>
|
||||||
|
<Tool
|
||||||
|
Name="VCCustomBuildTool"
|
||||||
|
Description="Building library stub"
|
||||||
|
CommandLine="lib /def:libg7221_decode.def /machine:x86
"
|
||||||
|
Outputs="libg7221_decode.lib libg7221_decode.exp"
|
||||||
|
/>
|
||||||
|
</FileConfiguration>
|
||||||
|
<FileConfiguration
|
||||||
|
Name="Release|Win32"
|
||||||
|
>
|
||||||
|
<Tool
|
||||||
|
Name="VCCustomBuildTool"
|
||||||
|
Description="Building library stub"
|
||||||
|
CommandLine="lib /def:libg7221_decode.def /machine:x86
"
|
||||||
|
Outputs="libg7221_decode.lib libg7221_decode.exp"
|
||||||
|
/>
|
||||||
|
</FileConfiguration>
|
||||||
|
</File>
|
||||||
</Files>
|
</Files>
|
||||||
<Globals>
|
<Globals>
|
||||||
</Globals>
|
</Globals>
|
||||||
|
6
ext_libs/libg7221_decode.def
Normal file
6
ext_libs/libg7221_decode.def
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
LIBRARY libg7221_decode.dll
|
||||||
|
EXPORTS
|
||||||
|
g7221_decode_frame @1
|
||||||
|
g7221_free @2
|
||||||
|
g7221_init @3
|
||||||
|
g7221_reset @4
|
@ -281,6 +281,7 @@ bool input_vgmstream::g_is_our_path(const char * p_path,const char * p_extension
|
|||||||
if(!stricmp_utf8(p_extension,"bh2pcm")) return 1;
|
if(!stricmp_utf8(p_extension,"bh2pcm")) return 1;
|
||||||
if(!stricmp_utf8(p_extension,"bmdx")) return 1;
|
if(!stricmp_utf8(p_extension,"bmdx")) return 1;
|
||||||
if(!stricmp_utf8(p_extension,"bns")) return 1;
|
if(!stricmp_utf8(p_extension,"bns")) return 1;
|
||||||
|
if(!stricmp_utf8(p_extension,"bnsf")) return 1;
|
||||||
if(!stricmp_utf8(p_extension,"brstmspm")) return 1;
|
if(!stricmp_utf8(p_extension,"brstmspm")) return 1;
|
||||||
if(!stricmp_utf8(p_extension,"brstm")) return 1;
|
if(!stricmp_utf8(p_extension,"brstm")) return 1;
|
||||||
|
|
||||||
@ -388,6 +389,7 @@ bool input_vgmstream::g_is_our_path(const char * p_path,const char * p_extension
|
|||||||
if(!stricmp_utf8(p_extension,"rwx")) return 1;
|
if(!stricmp_utf8(p_extension,"rwx")) return 1;
|
||||||
if(!stricmp_utf8(p_extension,"rxw")) return 1;
|
if(!stricmp_utf8(p_extension,"rxw")) return 1;
|
||||||
|
|
||||||
|
if(!stricmp_utf8(p_extension,"s14")) return 1;
|
||||||
if(!stricmp_utf8(p_extension,"sab")) return 1;
|
if(!stricmp_utf8(p_extension,"sab")) return 1;
|
||||||
if(!stricmp_utf8(p_extension,"sad")) return 1;
|
if(!stricmp_utf8(p_extension,"sad")) return 1;
|
||||||
if(!stricmp_utf8(p_extension,"sap")) return 1;
|
if(!stricmp_utf8(p_extension,"sap")) return 1;
|
||||||
@ -412,6 +414,7 @@ bool input_vgmstream::g_is_our_path(const char * p_path,const char * p_extension
|
|||||||
if(!stricmp_utf8(p_extension,"ss3")) return 1;
|
if(!stricmp_utf8(p_extension,"ss3")) return 1;
|
||||||
if(!stricmp_utf8(p_extension,"ss7")) return 1;
|
if(!stricmp_utf8(p_extension,"ss7")) return 1;
|
||||||
if(!stricmp_utf8(p_extension,"ssm")) return 1;
|
if(!stricmp_utf8(p_extension,"ssm")) return 1;
|
||||||
|
if(!stricmp_utf8(p_extension,"sss")) return 1;
|
||||||
if(!stricmp_utf8(p_extension,"ster")) return 1;
|
if(!stricmp_utf8(p_extension,"ster")) return 1;
|
||||||
if(!stricmp_utf8(p_extension,"stma")) return 1;
|
if(!stricmp_utf8(p_extension,"stma")) return 1;
|
||||||
if(!stricmp_utf8(p_extension,"str")) return 1;
|
if(!stricmp_utf8(p_extension,"str")) return 1;
|
||||||
@ -539,6 +542,7 @@ DECLARE_MULTIPLE_FILE_TYPE("BGW Audio File (*.BGW)", bgw);
|
|||||||
DECLARE_MULTIPLE_FILE_TYPE("BH2PCM Audio File (*.BH2PCM)", bh2pcm);
|
DECLARE_MULTIPLE_FILE_TYPE("BH2PCM Audio File (*.BH2PCM)", bh2pcm);
|
||||||
DECLARE_MULTIPLE_FILE_TYPE("BMDX Audio File (*.BMDX)", bmdx);
|
DECLARE_MULTIPLE_FILE_TYPE("BMDX Audio File (*.BMDX)", bmdx);
|
||||||
DECLARE_MULTIPLE_FILE_TYPE("BNS Audio File (*.BNS)", bns);
|
DECLARE_MULTIPLE_FILE_TYPE("BNS Audio File (*.BNS)", bns);
|
||||||
|
DECLARE_MULTIPLE_FILE_TYPE("BNSF Audio File (*.BNSF)", bnsf);
|
||||||
DECLARE_MULTIPLE_FILE_TYPE("BRSTM Audio File (*.BRSTM)", brstm);
|
DECLARE_MULTIPLE_FILE_TYPE("BRSTM Audio File (*.BRSTM)", brstm);
|
||||||
DECLARE_MULTIPLE_FILE_TYPE("BRSTM Audio File [2] (*.BRSTM)", brstmspm);
|
DECLARE_MULTIPLE_FILE_TYPE("BRSTM Audio File [2] (*.BRSTM)", brstmspm);
|
||||||
|
|
||||||
@ -646,6 +650,7 @@ DECLARE_MULTIPLE_FILE_TYPE("RWSD Audio File (*.RWSD)", rwsd);
|
|||||||
DECLARE_MULTIPLE_FILE_TYPE("RWX Audio File (*.RWX)", rwx);
|
DECLARE_MULTIPLE_FILE_TYPE("RWX Audio File (*.RWX)", rwx);
|
||||||
DECLARE_MULTIPLE_FILE_TYPE("PS2 RXWS File (*.RXW)", rxw);
|
DECLARE_MULTIPLE_FILE_TYPE("PS2 RXWS File (*.RXW)", rxw);
|
||||||
|
|
||||||
|
DECLARE_MULTIPLE_FILE_TYPE("S14 Audio File (*.S14)", s14);
|
||||||
DECLARE_MULTIPLE_FILE_TYPE("SAB Audio File (*.SAB)", sab);
|
DECLARE_MULTIPLE_FILE_TYPE("SAB Audio File (*.SAB)", sab);
|
||||||
DECLARE_MULTIPLE_FILE_TYPE("SAD Audio File (*.SAD)", sad);
|
DECLARE_MULTIPLE_FILE_TYPE("SAD Audio File (*.SAD)", sad);
|
||||||
DECLARE_MULTIPLE_FILE_TYPE("SAP Audio File (*.SAP)", sap);
|
DECLARE_MULTIPLE_FILE_TYPE("SAP Audio File (*.SAP)", sap);
|
||||||
@ -670,6 +675,7 @@ DECLARE_MULTIPLE_FILE_TYPE("PS2 SS2 Audio File (*.SS2)", ss2);
|
|||||||
DECLARE_MULTIPLE_FILE_TYPE("SS3 Audio File (*.SS3)", ss3);
|
DECLARE_MULTIPLE_FILE_TYPE("SS3 Audio File (*.SS3)", ss3);
|
||||||
DECLARE_MULTIPLE_FILE_TYPE("SS7 Audio File (*.SS7)", ss7);
|
DECLARE_MULTIPLE_FILE_TYPE("SS7 Audio File (*.SS7)", ss7);
|
||||||
DECLARE_MULTIPLE_FILE_TYPE("SSM Audio File (*.SSM)", ssm);
|
DECLARE_MULTIPLE_FILE_TYPE("SSM Audio File (*.SSM)", ssm);
|
||||||
|
DECLARE_MULTIPLE_FILE_TYPE("SSS Audio File (*.SSS)", sss);
|
||||||
DECLARE_MULTIPLE_FILE_TYPE("STER Audio File (*.STER)", ster);
|
DECLARE_MULTIPLE_FILE_TYPE("STER Audio File (*.STER)", ster);
|
||||||
DECLARE_MULTIPLE_FILE_TYPE("STMA Audio File (*.STMA)", stma);
|
DECLARE_MULTIPLE_FILE_TYPE("STMA Audio File (*.STMA)", stma);
|
||||||
DECLARE_MULTIPLE_FILE_TYPE("STR Audio File (*.STR)", str);
|
DECLARE_MULTIPLE_FILE_TYPE("STR Audio File (*.STR)", str);
|
||||||
|
@ -222,6 +222,7 @@ etc:
|
|||||||
- .afc (GC AFC ADPCM)
|
- .afc (GC AFC ADPCM)
|
||||||
- .ahx (MPEG-2 Layer II)
|
- .ahx (MPEG-2 Layer II)
|
||||||
- .aix (CRI ADX ADPCM)
|
- .aix (CRI ADX ADPCM)
|
||||||
|
- .bnsf (G.722.1)
|
||||||
- .caf (Apple IMA4 ADPCM)
|
- .caf (Apple IMA4 ADPCM)
|
||||||
- .bgw (FFXI PS-like ADPCM)
|
- .bgw (FFXI PS-like ADPCM)
|
||||||
- .de2 (MS ADPCM)
|
- .de2 (MS ADPCM)
|
||||||
@ -230,6 +231,7 @@ etc:
|
|||||||
- .ogg, .logg (Ogg Vorbis)
|
- .ogg, .logg (Ogg Vorbis)
|
||||||
- .rsf (CCITT G.721 ADPCM)
|
- .rsf (CCITT G.721 ADPCM)
|
||||||
- .sab (Worms 4 soundpacks)
|
- .sab (Worms 4 soundpacks)
|
||||||
|
- .s14/.sss (G.722.1)
|
||||||
- .sc (Activision EXAKT SASSC DPCM)
|
- .sc (Activision EXAKT SASSC DPCM)
|
||||||
- .sd9 (MS ADPCM)
|
- .sd9 (MS ADPCM)
|
||||||
- .spw (FFXI PS-like ADPCM)
|
- .spw (FFXI PS-like ADPCM)
|
||||||
|
@ -225,8 +225,9 @@ META_OBJS=meta/adx_header.o \
|
|||||||
meta/ngc_aaap.o \
|
meta/ngc_aaap.o \
|
||||||
meta/ngc_dsp_tmnt2.o \
|
meta/ngc_dsp_tmnt2.o \
|
||||||
meta/ps2_ster.o \
|
meta/ps2_ster.o \
|
||||||
|
meta/ps2_wb.o \
|
||||||
meta/bnsf.o \
|
meta/bnsf.o \
|
||||||
meta/ps2_wb.o
|
meta/s14_sss.o
|
||||||
|
|
||||||
OBJECTS=vgmstream.o streamfile.o util.o $(CODING_OBJS) $(LAYOUT_OBJS) $(META_OBJS)
|
OBJECTS=vgmstream.o streamfile.o util.o $(CODING_OBJS) $(LAYOUT_OBJS) $(META_OBJS)
|
||||||
|
|
||||||
|
@ -1,27 +1,27 @@
|
|||||||
#include "../vgmstream.h"
|
#include "../vgmstream.h"
|
||||||
|
|
||||||
#ifdef VGM_USE_G7221
|
#ifdef VGM_USE_G7221
|
||||||
#include <stdio.h>
|
#include "g7221.h"
|
||||||
#include "coding.h"
|
#include "coding.h"
|
||||||
#include "../util.h"
|
#include "../util.h"
|
||||||
|
|
||||||
/* just dump channels to files for now */
|
|
||||||
void decode_g7221(VGMSTREAM * vgmstream,
|
void decode_g7221(VGMSTREAM * vgmstream,
|
||||||
sample * outbuf, int channelspacing, int32_t samples_to_do, int channel) {
|
sample * outbuf, int channelspacing, int32_t samples_to_do, int channel) {
|
||||||
|
VGMSTREAMCHANNEL *ch = &vgmstream->ch[channel];
|
||||||
static FILE *dumpfiles[2] = {NULL,NULL};
|
g7221_codec_data *data = vgmstream->codec_data;
|
||||||
|
g7221_codec_data *ch_data = &data[channel];
|
||||||
|
int i;
|
||||||
|
|
||||||
if (0 == vgmstream->samples_into_block)
|
if (0 == vgmstream->samples_into_block)
|
||||||
{
|
{
|
||||||
uint8_t buffer[960/8];
|
int16_t code_buffer[960/8];
|
||||||
if (NULL == dumpfiles[channel])
|
vgmstream->ch[channel].streamfile->read(ch->streamfile, (uint8_t*)code_buffer, ch->offset, vgmstream->interleave_block_size);
|
||||||
{
|
g7221_decode_frame(ch_data->handle, code_buffer, ch_data->buffer);
|
||||||
char filename[] = "dump0.bin";
|
|
||||||
snprintf(filename,sizeof(filename),"dump%d.bin",channel);
|
|
||||||
dumpfiles[channel] = fopen(filename, "wb");
|
|
||||||
}
|
}
|
||||||
vgmstream->ch[channel].streamfile->read(vgmstream->ch[channel].streamfile, buffer, vgmstream->ch[channel].offset, vgmstream->interleave_block_size);
|
|
||||||
fwrite(buffer, 1, vgmstream->interleave_block_size, dumpfiles[channel]);
|
for (i = 0; i < samples_to_do; i++)
|
||||||
|
{
|
||||||
|
outbuf[i*channelspacing] = ch_data->buffer[vgmstream->samples_into_block+i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -774,6 +774,10 @@
|
|||||||
RelativePath=".\meta\rwx.c"
|
RelativePath=".\meta\rwx.c"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\meta\s14_sss.c"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath=".\meta\sat_baka.c"
|
RelativePath=".\meta\sat_baka.c"
|
||||||
>
|
>
|
||||||
|
@ -183,5 +183,6 @@ libmeta_la_SOURCES += ngc_dsp_tmnt2.c
|
|||||||
libmeta_la_SOURCES += ps2_ster.c
|
libmeta_la_SOURCES += ps2_ster.c
|
||||||
libmeta_la_SOURCES += bnsf.c
|
libmeta_la_SOURCES += bnsf.c
|
||||||
libmeta_la_SOURCES += ps2_wb.c
|
libmeta_la_SOURCES += ps2_wb.c
|
||||||
|
libmeta_la_SOURCES += s14_sss.c
|
||||||
|
|
||||||
EXTRA_DIST = meta.h
|
EXTRA_DIST = meta.h
|
||||||
|
@ -1,6 +1,10 @@
|
|||||||
#include "meta.h"
|
#include "meta.h"
|
||||||
#include "../layout/layout.h"
|
#include "../layout/layout.h"
|
||||||
#include "../util.h"
|
#include "../util.h"
|
||||||
|
#include "../vgmstream.h"
|
||||||
|
#ifdef VGM_USE_G7221
|
||||||
|
#include "g7221.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Namco Bandai's Bandai Namco Sound Format/File (BNSF) */
|
/* Namco Bandai's Bandai Namco Sound Format/File (BNSF) */
|
||||||
/* similar to RIFX */
|
/* similar to RIFX */
|
||||||
@ -125,13 +129,6 @@ VGMSTREAM * init_vgmstream_bnsf(STREAMFILE *streamFile) {
|
|||||||
coding_type = coding_G7221C;
|
coding_type = coding_G7221C;
|
||||||
sample_count = data_size/block_size*block_samples;
|
sample_count = data_size/block_size*block_samples;
|
||||||
|
|
||||||
/* check for 0 bytes at start */
|
|
||||||
if (0 != read_32bitBE(start_offset,streamFile))
|
|
||||||
{
|
|
||||||
goto fail;
|
|
||||||
}
|
|
||||||
/* skip */
|
|
||||||
start_offset += 4;
|
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
default:
|
default:
|
||||||
@ -160,6 +157,33 @@ VGMSTREAM * init_vgmstream_bnsf(STREAMFILE *streamFile) {
|
|||||||
}
|
}
|
||||||
vgmstream->meta_type = meta_BNSF;
|
vgmstream->meta_type = meta_BNSF;
|
||||||
|
|
||||||
|
#ifdef VGM_USE_G7221
|
||||||
|
if (coding_G7221C == coding_type)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
g7221_codec_data *data;
|
||||||
|
|
||||||
|
/* one data structure per channel */
|
||||||
|
data = malloc(sizeof(g7221_codec_data) * channel_count);
|
||||||
|
if (!data)
|
||||||
|
{
|
||||||
|
goto fail;
|
||||||
|
}
|
||||||
|
memset(data,0,sizeof(g7221_codec_data) * channel_count);
|
||||||
|
vgmstream->codec_data = data;
|
||||||
|
|
||||||
|
for (i = 0; i < channel_count; i++)
|
||||||
|
{
|
||||||
|
/* Siren 14 == 14khz bandwidth */
|
||||||
|
data[i].handle = g7221_init(vgmstream->interleave_block_size, 14000);
|
||||||
|
if (!data[i].handle)
|
||||||
|
{
|
||||||
|
goto fail; /* close_vgmstream is able to clean up */
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/* open the file, set up each channel */
|
/* open the file, set up each channel */
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
@ -451,4 +451,6 @@ VGMSTREAM * init_vgmstream_bnsf(STREAMFILE* streamFile);
|
|||||||
|
|
||||||
VGMSTREAM * init_vgmstream_ps2_wb(STREAMFILE* streamFile);
|
VGMSTREAM * init_vgmstream_ps2_wb(STREAMFILE* streamFile);
|
||||||
|
|
||||||
|
VGMSTREAM * init_vgmstream_s14_sss(STREAMFILE* streamFile);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
105
src/meta/s14_sss.c
Normal file
105
src/meta/s14_sss.c
Normal file
@ -0,0 +1,105 @@
|
|||||||
|
#include "../vgmstream.h"
|
||||||
|
|
||||||
|
#ifdef VGM_USE_G7221
|
||||||
|
|
||||||
|
#include "meta.h"
|
||||||
|
#include "../util.h"
|
||||||
|
#include "../coding/coding.h"
|
||||||
|
|
||||||
|
/* .s14 and .sss - from Idolm@ster DS (and others?)
|
||||||
|
* Raw 24kbit Siren 14 stream, s14 is mono and sss is
|
||||||
|
* frame-interleaved stereo
|
||||||
|
*/
|
||||||
|
|
||||||
|
VGMSTREAM * init_vgmstream_s14_sss(STREAMFILE *streamFile) {
|
||||||
|
VGMSTREAM * vgmstream = NULL;
|
||||||
|
char filename[260];
|
||||||
|
int channel_count;
|
||||||
|
|
||||||
|
size_t file_size;
|
||||||
|
|
||||||
|
/* check extension, case insensitive */
|
||||||
|
/* this is all we have to go on, rsf is completely headerless */
|
||||||
|
streamFile->get_name(streamFile,filename,sizeof(filename));
|
||||||
|
if (!strcasecmp("sss",filename_extension(filename)))
|
||||||
|
{
|
||||||
|
channel_count = 2;
|
||||||
|
}
|
||||||
|
else if (!strcasecmp("s14",filename_extension(filename)))
|
||||||
|
{
|
||||||
|
channel_count = 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
goto fail;
|
||||||
|
}
|
||||||
|
|
||||||
|
file_size = get_streamfile_size(streamFile);
|
||||||
|
|
||||||
|
/* build the VGMSTREAM */
|
||||||
|
|
||||||
|
vgmstream = allocate_vgmstream(channel_count,0);
|
||||||
|
if (!vgmstream) goto fail;
|
||||||
|
|
||||||
|
/* fill in the vital statistics */
|
||||||
|
vgmstream->num_samples = file_size/0x3c/channel_count*(32000/50);
|
||||||
|
vgmstream->sample_rate = 32768;
|
||||||
|
|
||||||
|
vgmstream->coding_type = coding_G7221C;
|
||||||
|
vgmstream->layout_type = layout_interleave;
|
||||||
|
vgmstream->interleave_block_size = 0x3c;
|
||||||
|
if (1 == channel_count)
|
||||||
|
{
|
||||||
|
vgmstream->meta_type = meta_S14;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
vgmstream->meta_type = meta_SSS;
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
g7221_codec_data *data;
|
||||||
|
|
||||||
|
/* one data structure per channel */
|
||||||
|
data = malloc(sizeof(g7221_codec_data) * channel_count);
|
||||||
|
if (!data)
|
||||||
|
{
|
||||||
|
goto fail;
|
||||||
|
}
|
||||||
|
memset(data,0,sizeof(g7221_codec_data) * channel_count);
|
||||||
|
vgmstream->codec_data = data;
|
||||||
|
|
||||||
|
for (i = 0; i < channel_count; i++)
|
||||||
|
{
|
||||||
|
/* Siren 14 == 14khz bandwidth */
|
||||||
|
data[i].handle = g7221_init(vgmstream->interleave_block_size, 14000);
|
||||||
|
if (!data[i].handle)
|
||||||
|
{
|
||||||
|
goto fail; /* close_vgmstream is able to clean up */
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* open the file for reading by each channel */
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
for (i=0;i<channel_count;i++) {
|
||||||
|
vgmstream->ch[i].streamfile = streamFile->open(streamFile,filename,STREAMFILE_DEFAULT_BUFFER_SIZE);
|
||||||
|
|
||||||
|
if (!vgmstream->ch[i].streamfile) goto fail;
|
||||||
|
|
||||||
|
vgmstream->ch[i].channel_start_offset=
|
||||||
|
vgmstream->ch[i].offset=0x3c*i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return vgmstream;
|
||||||
|
|
||||||
|
/* clean up anything we may have opened */
|
||||||
|
fail:
|
||||||
|
if (vgmstream) close_vgmstream(vgmstream);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
@ -244,8 +244,9 @@ VGMSTREAM * (*init_vgmstream_fcns[])(STREAMFILE *streamFile) = {
|
|||||||
init_vgmstream_ngc_aaap,
|
init_vgmstream_ngc_aaap,
|
||||||
init_vgmstream_ngc_dsp_tmnt2,
|
init_vgmstream_ngc_dsp_tmnt2,
|
||||||
init_vgmstream_ps2_ster,
|
init_vgmstream_ps2_ster,
|
||||||
init_vgmstream_bnsf,
|
|
||||||
init_vgmstream_ps2_wb,
|
init_vgmstream_ps2_wb,
|
||||||
|
init_vgmstream_bnsf,
|
||||||
|
init_vgmstream_s14_sss,
|
||||||
};
|
};
|
||||||
|
|
||||||
#define INIT_VGMSTREAM_FCNS (sizeof(init_vgmstream_fcns)/sizeof(init_vgmstream_fcns[0]))
|
#define INIT_VGMSTREAM_FCNS (sizeof(init_vgmstream_fcns)/sizeof(init_vgmstream_fcns[0]))
|
||||||
@ -347,6 +348,18 @@ void reset_vgmstream(VGMSTREAM * vgmstream) {
|
|||||||
data->buffer_full = data->buffer_used = 0;
|
data->buffer_full = data->buffer_used = 0;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef VGM_USE_G7221
|
||||||
|
if (vgmstream->coding_type==coding_G7221 ||
|
||||||
|
vgmstream->coding_type==coding_G7221C) {
|
||||||
|
g7221_codec_data *data = vgmstream->codec_data;
|
||||||
|
int i;
|
||||||
|
|
||||||
|
for (i = 0; i < vgmstream->channels; i++)
|
||||||
|
{
|
||||||
|
g7221_reset(data[i].handle);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
if (vgmstream->coding_type==coding_ACM) {
|
if (vgmstream->coding_type==coding_ACM) {
|
||||||
mus_acm_codec_data *data = vgmstream->codec_data;
|
mus_acm_codec_data *data = vgmstream->codec_data;
|
||||||
@ -492,6 +505,27 @@ void close_vgmstream(VGMSTREAM * vgmstream) {
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef VGM_USE_G7221
|
||||||
|
if (vgmstream->coding_type == coding_G7221 ||
|
||||||
|
vgmstream->coding_type == coding_G7221C) {
|
||||||
|
|
||||||
|
g7221_codec_data *data = vgmstream->codec_data;
|
||||||
|
|
||||||
|
if (data)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
|
for (i = 0; i < vgmstream->channels; i++)
|
||||||
|
{
|
||||||
|
g7221_free(data[i].handle);
|
||||||
|
}
|
||||||
|
free(data);
|
||||||
|
}
|
||||||
|
|
||||||
|
vgmstream->codec_data = NULL;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
if (vgmstream->coding_type==coding_ACM) {
|
if (vgmstream->coding_type==coding_ACM) {
|
||||||
mus_acm_codec_data *data = vgmstream->codec_data;
|
mus_acm_codec_data *data = vgmstream->codec_data;
|
||||||
|
|
||||||
@ -1169,7 +1203,7 @@ void decode_vgmstream(VGMSTREAM * vgmstream, int samples_written, int samples_to
|
|||||||
case coding_G7221C:
|
case coding_G7221C:
|
||||||
for (chan=0;chan<vgmstream->channels;chan++) {
|
for (chan=0;chan<vgmstream->channels;chan++) {
|
||||||
decode_g7221(vgmstream,
|
decode_g7221(vgmstream,
|
||||||
buffer+samples_written*vgmstream->channels,
|
buffer+samples_written*vgmstream->channels+chan,
|
||||||
vgmstream->channels,
|
vgmstream->channels,
|
||||||
samples_to_do,
|
samples_to_do,
|
||||||
chan);
|
chan);
|
||||||
@ -2445,6 +2479,12 @@ void describe_vgmstream(VGMSTREAM * vgmstream, char * desc, int length) {
|
|||||||
case meta_PS2_WB:
|
case meta_PS2_WB:
|
||||||
snprintf(temp,TEMPSIZE,"Shooting Love. ~TRIZEAL~ WB header");
|
snprintf(temp,TEMPSIZE,"Shooting Love. ~TRIZEAL~ WB header");
|
||||||
break;
|
break;
|
||||||
|
case meta_S14:
|
||||||
|
snprintf(temp,TEMPSIZE,"assumed Polycom Siren 14 by .s14 extension");
|
||||||
|
break;
|
||||||
|
case meta_SSS:
|
||||||
|
snprintf(temp,TEMPSIZE,"assumed Polycom Siren 14 by .sss extension");
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
snprintf(temp,TEMPSIZE,"THEY SHOULD HAVE SENT A POET");
|
snprintf(temp,TEMPSIZE,"THEY SHOULD HAVE SENT A POET");
|
||||||
}
|
}
|
||||||
|
@ -5,14 +5,14 @@
|
|||||||
#ifndef _VGMSTREAM_H
|
#ifndef _VGMSTREAM_H
|
||||||
#define _VGMSTREAM_H
|
#define _VGMSTREAM_H
|
||||||
|
|
||||||
/* Due mostly to licensing issues, Vorbis, MPEG, G.722.1 decoding are
|
/* Due mostly to licensing issues, Vorbis, MPEG, and G.722.1 decoding are
|
||||||
* done by external libraries.
|
* done by external libraries.
|
||||||
* If someone wants to do a standalone build, they can do it by simply
|
* If someone wants to do a standalone build, they can do it by simply
|
||||||
* removing these defines (and the references to the libraries in the
|
* removing these defines (and the references to the libraries in the
|
||||||
* Makefile) */
|
* Makefile) */
|
||||||
#define VGM_USE_VORBIS
|
#define VGM_USE_VORBIS
|
||||||
#define VGM_USE_MPEG
|
#define VGM_USE_MPEG
|
||||||
//#define VGM_USE_G7221
|
#define VGM_USE_G7221
|
||||||
|
|
||||||
#include "streamfile.h"
|
#include "streamfile.h"
|
||||||
#include "coding/g72x_state.h"
|
#include "coding/g72x_state.h"
|
||||||
@ -22,6 +22,9 @@
|
|||||||
#ifdef VGM_USE_MPEG
|
#ifdef VGM_USE_MPEG
|
||||||
#include <mpg123.h>
|
#include <mpg123.h>
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef VGM_USE_G7221
|
||||||
|
#include "g7221.h"
|
||||||
|
#endif
|
||||||
#include "coding/acm_decoder.h"
|
#include "coding/acm_decoder.h"
|
||||||
#include "coding/nwa_decoder.h"
|
#include "coding/nwa_decoder.h"
|
||||||
|
|
||||||
@ -441,6 +444,8 @@ typedef enum {
|
|||||||
meta_NGC_AAAP, /* Turok: Evolution (NGC) */
|
meta_NGC_AAAP, /* Turok: Evolution (NGC) */
|
||||||
meta_PS2_STER, /* Juuni Kokuki: Kakukaku Taru Ou Michi Beni Midori no Uka */
|
meta_PS2_STER, /* Juuni Kokuki: Kakukaku Taru Ou Michi Beni Midori no Uka */
|
||||||
meta_PS2_WB, /* Shooting Love. ~TRIZEAL~ */
|
meta_PS2_WB, /* Shooting Love. ~TRIZEAL~ */
|
||||||
|
meta_S14, /* raw Siren 14, 24kbit mono */
|
||||||
|
meta_SSS, /* raw Siren 14, 48kbit stereo */
|
||||||
} meta_t;
|
} meta_t;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
@ -588,6 +593,13 @@ typedef struct {
|
|||||||
} mpeg_codec_data;
|
} mpeg_codec_data;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef VGM_USE_G7221
|
||||||
|
typedef struct {
|
||||||
|
sample buffer[640];
|
||||||
|
g7221_handle *handle;
|
||||||
|
} g7221_codec_data;
|
||||||
|
#endif
|
||||||
|
|
||||||
/* with one file this is also used for just
|
/* with one file this is also used for just
|
||||||
ACM */
|
ACM */
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
@ -1,13 +1,13 @@
|
|||||||
export SHELL = /bin/sh
|
export SHELL = /bin/sh
|
||||||
export CFLAGS=-Wall -O3 -I../ext_includes
|
export CFLAGS=-Wall -O3 -I../ext_includes
|
||||||
export LDFLAGS=-lm -L../src -L../ext_libs -lvgmstream -lvorbis -lmpg123-0
|
export LDFLAGS=-lm -L../src -L../ext_libs -lvgmstream -lvorbis -lmpg123-0 -lg7221_decode
|
||||||
export CC=i586-mingw32msvc-gcc
|
export CC=i586-mingw32msvc-gcc
|
||||||
export AR=i586-mingw32msvc-ar
|
export AR=i586-mingw32msvc-ar
|
||||||
export STRIP=i586-mingw32msvc-strip
|
export STRIP=i586-mingw32msvc-strip
|
||||||
|
|
||||||
.PHONY: libvgmstream.a libvorbis.a libmpg123-0.a
|
.PHONY: libvgmstream.a libvorbis.a libmpg123-0.a libg7221_decode.a
|
||||||
|
|
||||||
test.exe: libvgmstream.a libvorbis.a libmpg123-0.a
|
test.exe: libvgmstream.a libvorbis.a libmpg123-0.a libg7221_decode.a
|
||||||
$(CC) $(CFLAGS) "-DVERSION=\"`../version.sh`\"" test.c $(LDFLAGS) -o test.exe
|
$(CC) $(CFLAGS) "-DVERSION=\"`../version.sh`\"" test.c $(LDFLAGS) -o test.exe
|
||||||
$(STRIP) test.exe
|
$(STRIP) test.exe
|
||||||
|
|
||||||
@ -20,5 +20,8 @@ libvorbis.a:
|
|||||||
libmpg123-0.a:
|
libmpg123-0.a:
|
||||||
$(MAKE) -C ../ext_libs -f Makefile.mingw $@
|
$(MAKE) -C ../ext_libs -f Makefile.mingw $@
|
||||||
|
|
||||||
|
libg7221_decode.a:
|
||||||
|
$(MAKE) -C ../ext_libs -f Makefile.mingw $@
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -f test.exe
|
rm -f test.exe
|
||||||
|
@ -44,6 +44,7 @@ gchar *vgmstream_exts [] = {
|
|||||||
"bh2pcm",
|
"bh2pcm",
|
||||||
"bmdx",
|
"bmdx",
|
||||||
"bns",
|
"bns",
|
||||||
|
"bnsf",
|
||||||
"brstm",
|
"brstm",
|
||||||
"brstmspm",
|
"brstmspm",
|
||||||
|
|
||||||
@ -148,6 +149,7 @@ gchar *vgmstream_exts [] = {
|
|||||||
"rwx",
|
"rwx",
|
||||||
"rxw",
|
"rxw",
|
||||||
|
|
||||||
|
"s14",
|
||||||
"sab",
|
"sab",
|
||||||
"sad",
|
"sad",
|
||||||
"sap",
|
"sap",
|
||||||
@ -170,8 +172,9 @@ gchar *vgmstream_exts [] = {
|
|||||||
"spw",
|
"spw",
|
||||||
"ss2",
|
"ss2",
|
||||||
"ss3",
|
"ss3",
|
||||||
"ss7"
|
"ss7",
|
||||||
"ssm",
|
"ssm",
|
||||||
|
"sss",
|
||||||
"ster",
|
"ster",
|
||||||
"stma",
|
"stma",
|
||||||
"str",
|
"str",
|
||||||
|
@ -1,14 +1,14 @@
|
|||||||
export SHELL = /bin/sh
|
export SHELL = /bin/sh
|
||||||
export CFLAGS=-Wall -O3 -I../ext_includes
|
export CFLAGS=-Wall -O3 -I../ext_includes
|
||||||
export LDFLAGS=-lm -L../src -L../ext_libs -lvgmstream -lvorbis -lmpg123-0
|
export LDFLAGS=-lm -L../src -L../ext_libs -lvgmstream -lvorbis -lmpg123-0 -lg7221_decode
|
||||||
export CC=i586-mingw32msvc-gcc
|
export CC=i586-mingw32msvc-gcc
|
||||||
export AR=i586-mingw32msvc-ar
|
export AR=i586-mingw32msvc-ar
|
||||||
export STRIP=i586-mingw32msvc-strip
|
export STRIP=i586-mingw32msvc-strip
|
||||||
export WINDRES=i586-mingw32msvc-windres
|
export WINDRES=i586-mingw32msvc-windres
|
||||||
|
|
||||||
.PHONY: libvgmstream.a libvorbis.a libmpg123-0.a
|
.PHONY: libvgmstream.a libvorbis.a libmpg123-0.a libg7221_decode.a
|
||||||
|
|
||||||
in_vgmstream.dll: libvgmstream.a libvorbis.a libmpg123-0.a in_vgmstream.c resource.o
|
in_vgmstream.dll: libvgmstream.a libvorbis.a libmpg123-0.a libg7221_decode.a in_vgmstream.c resource.o
|
||||||
$(CC) -shared $(CFLAGS) "-DVERSION=\"`../version.sh`\"" in_vgmstream.c resource.o $(LDFLAGS) -o in_vgmstream.dll
|
$(CC) -shared $(CFLAGS) "-DVERSION=\"`../version.sh`\"" in_vgmstream.c resource.o $(LDFLAGS) -o in_vgmstream.dll
|
||||||
$(STRIP) in_vgmstream.dll
|
$(STRIP) in_vgmstream.dll
|
||||||
|
|
||||||
@ -19,10 +19,13 @@ libvgmstream.a:
|
|||||||
$(MAKE) -C ../src libvgmstream.a
|
$(MAKE) -C ../src libvgmstream.a
|
||||||
|
|
||||||
libvorbis.a:
|
libvorbis.a:
|
||||||
$(MAKE) -C ../ext_libs -f Makefile.mingw libvorbis.a
|
$(MAKE) -C ../ext_libs -f Makefile.mingw $@
|
||||||
|
|
||||||
libmpg123-0.a:
|
libmpg123-0.a:
|
||||||
$(MAKE) -C ../ext_libs -f Makefile.mingw libmpg123-0.a
|
$(MAKE) -C ../ext_libs -f Makefile.mingw $@
|
||||||
|
|
||||||
|
libg7221_decode.a:
|
||||||
|
$(MAKE) -C ../ext_libs -f Makefile.mingw $@
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -f in_vgmstream.dll resource.o
|
rm -f in_vgmstream.dll resource.o
|
||||||
|
@ -110,6 +110,7 @@ char * extension_list[] = {
|
|||||||
"bh2pcm\0BH2PCM Audio File (*.BH2PCM)\0",
|
"bh2pcm\0BH2PCM Audio File (*.BH2PCM)\0",
|
||||||
"bmdx\0BMDX Audio File (*.BMDX)\0",
|
"bmdx\0BMDX Audio File (*.BMDX)\0",
|
||||||
"bns\0BNS Audio File (*.BNS)\0",
|
"bns\0BNS Audio File (*.BNS)\0",
|
||||||
|
"bnsf\0BNSF Audio File (*.BNSF)\0",
|
||||||
"brstm;brstmspm\0BRSTM Audio File (*.BRSTM)\0",
|
"brstm;brstmspm\0BRSTM Audio File (*.BRSTM)\0",
|
||||||
|
|
||||||
"caf\0CAF Audio File (*.CAF)\0",
|
"caf\0CAF Audio File (*.CAF)\0",
|
||||||
@ -216,6 +217,7 @@ char * extension_list[] = {
|
|||||||
"rwx\0RWX Audio File (*.RWX)\0",
|
"rwx\0RWX Audio File (*.RWX)\0",
|
||||||
"rxw\0PS2 RXWS File (*.RXW)\0",
|
"rxw\0PS2 RXWS File (*.RXW)\0",
|
||||||
|
|
||||||
|
"s14\0S14 Audio File (*.S14)\0",
|
||||||
"sab\0SAB Audio File (*.SAB)\0",
|
"sab\0SAB Audio File (*.SAB)\0",
|
||||||
"sad\0SAD Audio File (*.SAD)\0",
|
"sad\0SAD Audio File (*.SAD)\0",
|
||||||
"sap\0SAP Audio File (*.SAP)\0",
|
"sap\0SAP Audio File (*.SAP)\0",
|
||||||
@ -240,6 +242,7 @@ char * extension_list[] = {
|
|||||||
"ss3\0SS3 Audio File (*.SS3)\0",
|
"ss3\0SS3 Audio File (*.SS3)\0",
|
||||||
"ss7\0SS7 Audio File (*.SS7)\0",
|
"ss7\0SS7 Audio File (*.SS7)\0",
|
||||||
"ssm\0SSM Audio File (*.SSM)\0",
|
"ssm\0SSM Audio File (*.SSM)\0",
|
||||||
|
"sss\0SSS Audio File (*.SSS)\0",
|
||||||
"ster\0STER Audio File (*.STER)\0",
|
"ster\0STER Audio File (*.STER)\0",
|
||||||
"stma\0STMA Audio File (*.STMA)\0",
|
"stma\0STMA Audio File (*.STMA)\0",
|
||||||
"str\0STR Audio File (*.STR)\0",
|
"str\0STR Audio File (*.STR)\0",
|
||||||
|
@ -61,7 +61,7 @@
|
|||||||
/>
|
/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCLinkerTool"
|
Name="VCLinkerTool"
|
||||||
AdditionalDependencies="../ext_libs/libvorbis.lib ../ext_libs/libmpg123-0.lib"
|
AdditionalDependencies="../ext_libs/libvorbis.lib ../ext_libs/libmpg123-0.lib ../ext_libs/libg7221_decode.lib"
|
||||||
LinkIncremental="2"
|
LinkIncremental="2"
|
||||||
GenerateDebugInformation="true"
|
GenerateDebugInformation="true"
|
||||||
SubSystem="2"
|
SubSystem="2"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user