Beispiel #1
0
/* JSTM (.STM (renamed .JSTM) from Tantei Jinguji Saburo - Kind of Blue) */
VGMSTREAM * init_vgmstream_ps2_jstm(STREAMFILE *streamFile) {
    VGMSTREAM * vgmstream = NULL;
    off_t start_offset = 0x20;
    int loop_flag;
    int channel_count;
    char filename[PATH_LIMIT];

    /* check extension */
    streamFile->get_name(streamFile,filename,sizeof(filename));
    if (strcasecmp("stm",filename_extension(filename)) &&
        strcasecmp("jstm",filename_extension(filename))) goto fail;

    /* check header (JSTM) */
    if (read_32bitBE(0x0,streamFile) != 0x4A53544D) goto fail;

    loop_flag = (read_32bitLE(0x14,streamFile) != 0);
    channel_count = read_16bitLE(0x4,streamFile);
    
    // hmm, don't know what 6 is, one is probably bytes per sample and the
    // other is channels, but who can say?
    if (channel_count != read_16bitLE(0x6,streamFile)) goto fail;

    vgmstream = allocate_vgmstream(channel_count,loop_flag);
    if (!vgmstream) goto fail;

    /* fill in the statistics vitale */
    vgmstream->sample_rate = read_32bitLE(0x8,streamFile);
    vgmstream->coding_type = coding_PCM16LE_XOR_int;
    vgmstream->num_samples = read_32bitLE(0xC,streamFile)/2/channel_count;
    vgmstream->layout_type = layout_none;

    vgmstream->meta_type = meta_PS2_JSTM;

    if (loop_flag) {
        vgmstream->loop_start_sample=read_32bitLE(0x14,streamFile)/2/channel_count;
        vgmstream->loop_end_sample=vgmstream->num_samples;
    }

    /* open the file for reading */
    {
        int i;
        STREAMFILE * file;
        file = streamFile->open(streamFile,filename,STREAMFILE_DEFAULT_BUFFER_SIZE);
        if (!file) goto fail;

        for (i=0; i < channel_count; i++) {
            vgmstream->ch[i].streamfile = file;
            vgmstream->ch[i].channel_start_offset = 
                vgmstream->ch[i].offset = start_offset + 2*i;
            vgmstream->ch[i].key_xor = 0x5A5A;
        }
    }

    return vgmstream;

fail:
    if (vgmstream) close_vgmstream(vgmstream);
    return NULL;
}
Beispiel #2
0
VGMSTREAM * init_vgmstream_ngc_adpdtk(STREAMFILE *streamFile) {
    VGMSTREAM * vgmstream = NULL;
    STREAMFILE * chstreamfile;
    char filename[PATH_LIMIT];
    
    size_t file_size;
    int i;

    /* check extension, case insensitive */
    streamFile->get_name(streamFile,filename,sizeof(filename));
    if (strcasecmp("adp",filename_extension(filename)) && 
		strcasecmp("dtk",filename_extension(filename))) goto fail;

    /* file size is the only way to determine sample count */
    file_size = get_streamfile_size(streamFile);

    /* .adp files have no header, so all we can do is look for a valid first frame */
    if (read_8bit(0,streamFile)!=read_8bit(2,streamFile) || read_8bit(1,streamFile)!=read_8bit(3,streamFile)) goto fail;

    /* Hopefully we haven't falsely detected something else... */
    /* build the VGMSTREAM */
    vgmstream = allocate_vgmstream(2,0);    /* always stereo, no loop */
    if (!vgmstream) goto fail;

    vgmstream->num_samples = file_size/32*28;
    vgmstream->sample_rate = 48000;
    vgmstream->coding_type = coding_NGC_DTK;
    vgmstream->layout_type = layout_dtk_interleave;
    vgmstream->meta_type = meta_NGC_ADPDTK;

    /* locality is such that two streamfiles is silly */
    chstreamfile = streamFile->open(streamFile,filename,32*0x400);
    if (!chstreamfile) goto fail;

    for (i=0;i<2;i++) {
        vgmstream->ch[i].channel_start_offset =
            vgmstream->ch[i].offset = 0;

        vgmstream->ch[i].streamfile = chstreamfile;
    }

    return vgmstream;

    /* clean up anything we may have opened */
fail:
    if (vgmstream) close_vgmstream(vgmstream);
    return NULL;
}
Beispiel #3
0
/* VAG files with custom headers */
VGMSTREAM * init_vgmstream_ps2_khv(STREAMFILE *streamFile) {
    VGMSTREAM * vgmstream = NULL;
    char filename[260];
    int loop_flag = 0;
		int channel_count;
    off_t start_offset;
    
    /* check extension, case insensitive */
    streamFile->get_name(streamFile,filename,sizeof(filename));
    if (strcasecmp("khv",filename_extension(filename))) goto fail;

    /* check header */
    if (read_32bitBE(0x00,streamFile) != 0x56414770) /* "VAGp" */
        goto fail;

    loop_flag = (read_32bitBE(0x14,streamFile)!=0);
    channel_count = 2;
    
		/* build the VGMSTREAM */
    vgmstream = allocate_vgmstream(channel_count,loop_flag);
    if (!vgmstream) goto fail;

		/* fill in the vital statistics */
    start_offset = 0x60;
		vgmstream->channels = channel_count;
    vgmstream->sample_rate = read_32bitBE(0x10,streamFile);
    vgmstream->coding_type = coding_PSX;
    vgmstream->num_samples = read_32bitBE(0x0C,streamFile);
    if (loop_flag) {
        vgmstream->loop_start_sample = read_32bitBE(0x14,streamFile);
        vgmstream->loop_end_sample = read_32bitBE(0x18,streamFile);
    }

    vgmstream->layout_type = layout_interleave;
    vgmstream->interleave_block_size = 0x10;
    vgmstream->meta_type = meta_PS2_KHV;

    /* open the file for reading */
    {
        int i;
        STREAMFILE * file;
        file = streamFile->open(streamFile,filename,STREAMFILE_DEFAULT_BUFFER_SIZE);
        if (!file) goto fail;
        for (i=0;i<channel_count;i++) {
            vgmstream->ch[i].streamfile = file;

            vgmstream->ch[i].channel_start_offset=
                vgmstream->ch[i].offset=start_offset+
                vgmstream->interleave_block_size*i;

        }
    }

    return vgmstream;

    /* clean up anything we may have opened */
fail:
    if (vgmstream) close_vgmstream(vgmstream);
    return NULL;
}
Beispiel #4
0
/* LPCM (from Ah! My Goddess (PS2)) */
VGMSTREAM * init_vgmstream_ps2_lpcm(STREAMFILE *streamFile) {
    VGMSTREAM * vgmstream = NULL;
    char filename[PATH_LIMIT];
    off_t start_offset;

    int loop_flag;
    int channel_count;

    /* check extension, case insensitive */
    streamFile->get_name(streamFile,filename,sizeof(filename));
    if (strcasecmp("lpcm",filename_extension(filename))) goto fail;

    /* check header */
    if (read_32bitBE(0,streamFile) != 0x4C50434D) /* LPCM */
        goto fail;
	    
    loop_flag = read_32bitLE(0x8,streamFile);
    channel_count = 2;

    /* build the VGMSTREAM */
    vgmstream = allocate_vgmstream(channel_count,loop_flag);
    if (!vgmstream) goto fail;

    /* fill in the vital statistics */
    start_offset = 0x10;
    vgmstream->channels = channel_count;
    vgmstream->sample_rate = 48000;
    vgmstream->coding_type = coding_PCM16LE;
    vgmstream->num_samples = read_32bitLE(0x4,streamFile);
    if (loop_flag) {
       vgmstream->loop_start_sample = read_32bitLE(0x8,streamFile);
       vgmstream->loop_end_sample = read_32bitLE(0xc,streamFile);
    }
    vgmstream->layout_type = layout_interleave;
    vgmstream->interleave_block_size = 2;
    vgmstream->meta_type = meta_PS2_LPCM;
   
    /* open the file for reading */
    {
        int i;
        STREAMFILE * file;
        file = streamFile->open(streamFile,filename,STREAMFILE_DEFAULT_BUFFER_SIZE);
        if (!file) goto fail;
        for (i=0;i<channel_count;i++) {
            vgmstream->ch[i].streamfile = file;

            vgmstream->ch[i].channel_start_offset=
                vgmstream->ch[i].offset=start_offset+
                vgmstream->interleave_block_size*i;

        }
    }

    return vgmstream;

fail:
    /* clean up anything we may have opened */
    if (vgmstream) close_vgmstream(vgmstream);
    return NULL;
}
Beispiel #5
0
/* MOGG - Harmonix Music Systems (Guitar Hero)[Unencrypted Type] */
VGMSTREAM * init_vgmstream_mogg(STREAMFILE *streamFile) {
#ifdef VGM_USE_VORBIS
	char filename[PATH_LIMIT];
	off_t start_offset;

	/* check extension, case insensitive */
	streamFile->get_name(streamFile, filename, sizeof(filename));
	if (strcasecmp("mogg", filename_extension(filename))) goto fail;

	{
		vgm_vorbis_info_t inf;
		VGMSTREAM * result = NULL;

		memset(&inf, 0, sizeof(inf));
		inf.layout_type = layout_ogg_vorbis;
		inf.meta_type = meta_MOGG;

		start_offset = read_32bitLE(0x04, streamFile);
		result = init_vgmstream_ogg_vorbis_callbacks(streamFile, filename, NULL, start_offset, &inf);

		if (result != NULL) {
			return result;
		}
	}

fail:
	/* clean up anything we may have opened */
#endif
	return NULL;
}
Beispiel #6
0
/**
 * checks if the stream filename is one of the extensions (comma-separated, ex. "adx" or "adx,aix")
 *
 * returns 0 on failure
 */
int check_extensions(STREAMFILE *streamFile, const char * cmp_exts) {
    char filename[PATH_LIMIT];
    const char * ext = NULL;
    const char * cmp_ext = NULL;
    const char * ststr_res = NULL;
    size_t ext_len, cmp_len;

    streamFile->get_name(streamFile,filename,sizeof(filename));
    ext = filename_extension(filename);
    ext_len = strlen(ext);

    cmp_ext = cmp_exts;
    do {
        ststr_res = strstr(cmp_ext, ",");
        cmp_len = ststr_res == NULL
                  ? strlen(cmp_ext) /* total length if more not found */
                  : (intptr_t)ststr_res - (intptr_t)cmp_ext; /* find next ext; ststr_res should always be greater than cmp_ext, resulting in a positive cmp_len */

        if (ext_len == cmp_len && strncasecmp(ext,cmp_ext, ext_len) == 0)
            return 1;

        cmp_ext = ststr_res;
        if (cmp_ext != NULL)
            cmp_ext = cmp_ext + 1; /* skip comma */

    } while (cmp_ext != NULL);

    return 0;
}
VGMSTREAM * init_vgmstream_ps3_sgd(STREAMFILE *streamFile) {
    VGMSTREAM * vgmstream = NULL;
    char filename[260];
    off_t start_offset;
    int loop_flag = 0;
	int channel_count;

    /* check extension, case insensitive */
    streamFile->get_name(streamFile,filename,sizeof(filename));
    if (strcasecmp("sgd",filename_extension(filename))) goto fail;

    /* check header */
    if (read_32bitBE(0x00,streamFile) != 0x53475844) /* "SGXD" */
        goto fail;

    loop_flag = (read_32bitLE(0x44,streamFile) != 0xFFFFFFFF);
    channel_count = read_8bit(0x29,streamFile);
    
	/* build the VGMSTREAM */
    vgmstream = allocate_vgmstream(channel_count,loop_flag);
    if (!vgmstream) goto fail;

	/* fill in the vital statistics */
    start_offset = read_32bitLE(0x8,streamFile);
	vgmstream->channels = channel_count;
    vgmstream->sample_rate = read_32bitLE(0x2C,streamFile);
    vgmstream->coding_type = coding_PSX;
    vgmstream->num_samples = read_32bitLE(0x40,streamFile)/16/channel_count*28;
    if (loop_flag) {
        vgmstream->loop_start_sample = read_32bitLE(0x44,streamFile);
        vgmstream->loop_end_sample = read_32bitLE(0x48,streamFile);
    }

    vgmstream->layout_type = layout_interleave;
    vgmstream->interleave_block_size = read_8bit(0x39,streamFile); // just a guess, all of my samples seem to be 0x10 interleave
    vgmstream->meta_type = meta_PS3_SGX;

    /* open the file for reading */
    {
        int i;
        STREAMFILE * file;
        file = streamFile->open(streamFile,filename,STREAMFILE_DEFAULT_BUFFER_SIZE);
        if (!file) goto fail;
        for (i=0;i<channel_count;i++) {
            vgmstream->ch[i].streamfile = file;

            vgmstream->ch[i].channel_start_offset=
                vgmstream->ch[i].offset=start_offset+
                vgmstream->interleave_block_size*i;

        }
    }

    return vgmstream;

    /* clean up anything we may have opened */
fail:
	if (vgmstream) close_vgmstream(vgmstream);
    return NULL;
}
Beispiel #8
0
// returns the file compression type
int cmpr_checkfiletype(const char *filename)
{ int cmpr=0;
  char extension[CMPR_BUFLEN];
  filename_extension(extension,CMPR_BUFLEN,filename);
  cmpr = cmpr_checkextension(extension);
  return( cmpr );
} // cmpr_checkfiletype
Beispiel #9
0
/* FFW (from Freedom Fighters [NGC]) */
VGMSTREAM * init_vgmstream_ffw(STREAMFILE *streamFile) {
    VGMSTREAM * vgmstream = NULL;
    char filename[260];
    off_t start_offset;
    int loop_flag = 0;
		int channel_count;

    /* check extension, case insensitive */
    streamFile->get_name(streamFile,filename,sizeof(filename));
    if (strcasecmp("ffw",filename_extension(filename))) goto fail;

    loop_flag = 0;
    channel_count = read_32bitLE(0x11C,streamFile);
    
		/* build the VGMSTREAM */
    vgmstream = allocate_vgmstream(channel_count,loop_flag);
    if (!vgmstream) goto fail;

		/* fill in the vital statistics */
    start_offset = 0x130;
		vgmstream->channels = channel_count;
    vgmstream->sample_rate = read_32bitLE(0x10C,streamFile);
    vgmstream->coding_type = coding_PCM16BE;
    vgmstream->num_samples = (get_streamfile_size(streamFile)-start_offset)/2/channel_count;

    if (channel_count == 1)
    {
        vgmstream->layout_type = layout_none;
    }
    else
    {
        vgmstream->layout_type = layout_interleave;
        vgmstream->interleave_block_size = 0x10000;
    }
    
    vgmstream->meta_type = meta_FFW;

    /* open the file for reading */
    {
        int i;
        STREAMFILE * file;
        file = streamFile->open(streamFile,filename,STREAMFILE_DEFAULT_BUFFER_SIZE);
        if (!file) goto fail;
        for (i=0;i<channel_count;i++) {
            vgmstream->ch[i].streamfile = file;

            vgmstream->ch[i].channel_start_offset=
                vgmstream->ch[i].offset=start_offset+
                vgmstream->interleave_block_size*i;

        }
    }

    return vgmstream;

    /* clean up anything we may have opened */
fail:
    if (vgmstream) close_vgmstream(vgmstream);
    return NULL;
}
Beispiel #10
0
VGMSTREAM * init_vgmstream_ps2_int(STREAMFILE *streamFile) {
    VGMSTREAM * vgmstream = NULL;
    char filename[1024];
	int i,channel_count;

    /* check extension, case insensitive */
    streamFile->get_name(streamFile,filename,sizeof(filename));
    if (strcasecmp("int",filename_extension(filename)) && 
		strcasecmp("wp2",filename_extension(filename))) goto fail;

	if(!strcasecmp("int",filename_extension(filename)))
		channel_count = 2;
	else
		channel_count = 4;

    /* build the VGMSTREAM */
    vgmstream = allocate_vgmstream(channel_count,0);
    if (!vgmstream) goto fail;

    /* fill in the vital statistics */
	vgmstream->channels=channel_count;
    vgmstream->sample_rate = 48000;
    vgmstream->coding_type = coding_PCM16LE;
    vgmstream->num_samples = (int32_t)(get_streamfile_size(streamFile)/(vgmstream->channels*2));
    vgmstream->interleave_block_size = 0x200;
    vgmstream->layout_type = layout_interleave;
    vgmstream->meta_type = meta_PS2_RAW;

    /* open the file for reading by each channel */
    {
        for (i=0;i<vgmstream->channels;i++) {
            vgmstream->ch[i].streamfile = streamFile->open(streamFile,filename,0x8000);

            if (!vgmstream->ch[i].streamfile) goto fail;

            vgmstream->ch[i].channel_start_offset=
                vgmstream->ch[i].offset=i*vgmstream->interleave_block_size;
        }
    }

    return vgmstream;

    /* clean up anything we may have opened */
fail:
    if (vgmstream) close_vgmstream(vgmstream);
    return NULL;
}
Beispiel #11
0
Datei: acm.c Projekt: 1c0n/xbmc
/* The real work is done by libacm */
VGMSTREAM * init_vgmstream_acm(STREAMFILE *streamFile) {
    VGMSTREAM * vgmstream = NULL;
    ACMStream *acm_stream = NULL;
    mus_acm_codec_data *data;

    char filename[260];

    int loop_flag = 0;
	int channel_count;

    /* check extension, case insensitive */
    streamFile->get_name(streamFile,filename,sizeof(filename));
    if (strcasecmp("acm",filename_extension(filename))) goto fail;

	/* check header */
    if (read_32bitBE(0x0,streamFile) != 0x97280301)
		goto fail;

    data = calloc(1,sizeof(mus_acm_codec_data));
    if (!data) goto fail;

    data->files = calloc(1,sizeof(ACMStream *));
    if (!data->files) {
        free(data); data = NULL;
        goto fail;
    }

    /* gonna do this a little backwards, open and parse the file
       before creating the vgmstream */

    if (acm_open_decoder(&acm_stream,streamFile,filename) != ACM_OK) {
        goto fail;
    }

    channel_count = acm_stream->info.channels;
    vgmstream = allocate_vgmstream(channel_count,loop_flag);
    if (!vgmstream) goto fail;

    vgmstream->channels = channel_count;
    vgmstream->sample_rate = acm_stream->info.rate;
    vgmstream->coding_type = coding_ACM;
    vgmstream->num_samples = acm_stream->total_values / acm_stream->info.channels;
    vgmstream->layout_type = layout_acm;
    vgmstream->meta_type = meta_ACM;

    data->file_count = 1;
    data->current_file = 0;
    data->files[0] = acm_stream;
    /*data->end_file = -1;*/

    vgmstream->codec_data = data;

    return vgmstream;

    /* clean up anything we may have opened */
fail:
    if (vgmstream) close_vgmstream(vgmstream);
    return NULL;
}
Beispiel #12
0
/* ADP (from Balls of Steel) */
VGMSTREAM * init_vgmstream_bos_adp(STREAMFILE *streamFile) {
    VGMSTREAM * vgmstream = NULL;
    char filename[PATH_LIMIT];
    off_t start_offset;
    int loop_flag = 0;
	int channel_count;

    /* check extension, case insensitive */
    streamFile->get_name(streamFile,filename,sizeof(filename));
    if (strcasecmp("adp",filename_extension(filename))) goto fail;

    /* check header */
    if (read_32bitBE(0x00,streamFile) != 0x41445021) /* "ADP!" */
        goto fail;

    loop_flag = (-1 != read_32bitLE(0x08,streamFile));
    channel_count = 1;
    
	/* build the VGMSTREAM */
    vgmstream = allocate_vgmstream(channel_count,loop_flag);
    if (!vgmstream) goto fail;

	/* fill in the vital statistics */
    start_offset = 0x18;
	vgmstream->channels = channel_count;
    vgmstream->sample_rate = read_32bitLE(0x0C,streamFile);
    vgmstream->coding_type = coding_DVI_IMA;
    vgmstream->num_samples = read_32bitLE(0x04,streamFile);
    if (loop_flag) {
        vgmstream->loop_start_sample = read_32bitLE(0x08,streamFile);
        vgmstream->loop_end_sample = vgmstream->num_samples;
    }

    vgmstream->layout_type = layout_none;
    vgmstream->meta_type = meta_BOS_ADP;

    /* open the file for reading */
    {
        STREAMFILE * file;
        file = streamFile->open(streamFile,filename,STREAMFILE_DEFAULT_BUFFER_SIZE);
        if (!file) goto fail;
        vgmstream->ch[0].streamfile = file;

        vgmstream->ch[0].channel_start_offset=
            vgmstream->ch[0].offset=start_offset;

        // 0x10, 0x12 - both initial history?
        //vgmstream->ch[0].adpcm_history1_32 = read_16bitLE(0x10,streamFile);
        // 0x14 - initial step index?
        //vgmstream->ch[0].adpcm_step_index = read_32bitLE(0x14,streamFile);
    }

    return vgmstream;

    /* clean up anything we may have opened */
fail:
    if (vgmstream) close_vgmstream(vgmstream);
    return NULL;
}
VGMSTREAM * init_vgmstream_xbox_wvs(STREAMFILE *streamFile) {
    VGMSTREAM * vgmstream = NULL;
    char filename[260];

    int loop_flag=0;
	int channel_count;
    int i;

    /* check extension, case insensitive */
    streamFile->get_name(streamFile,filename,sizeof(filename));
    if (strcasecmp("wvs",filename_extension(filename))) goto fail;

	if((read_16bitLE(0x0C,streamFile)!=0x69) && 
	   (read_16bitLE(0x08,streamFile)!=0x4400) && 
	   (read_32bitLE(0x0,streamFile)!=get_streamfile_size(streamFile)+0x20))
		goto fail;

    /* Loop seems to be set if offset(0x0A) == 0x472C */
	loop_flag = (read_16bitLE(0x0A,streamFile)==0x472C);
    
	/* Always stereo files */
	channel_count=read_16bitLE(0x0E,streamFile);
    
	/* build the VGMSTREAM */
    vgmstream = allocate_vgmstream(channel_count,loop_flag);
    if (!vgmstream) goto fail;

	/* fill in the vital statistics */
	/* allways 2 channels @ 44100 Hz */
	vgmstream->channels = channel_count;
    vgmstream->sample_rate = read_32bitLE(0x10,streamFile);

	vgmstream->coding_type = coding_XBOX;
    vgmstream->num_samples = read_32bitLE(0,streamFile) / 36 * 64 / vgmstream->channels;
    vgmstream->layout_type = layout_none;
    vgmstream->meta_type = meta_XBOX_WVS;

	if(loop_flag) {
		vgmstream->loop_start_sample=0;
		vgmstream->loop_end_sample=vgmstream->num_samples;
	}

    /* open the file for reading by each channel */
    {
        for (i=0;i<channel_count;i++) {
            vgmstream->ch[i].streamfile = streamFile->open(streamFile,filename,36);
            vgmstream->ch[i].offset = 0x20;

            if (!vgmstream->ch[i].streamfile) goto fail;
        }
    }

    return vgmstream;

    /* clean up anything we may have opened */
fail:
    if (vgmstream) close_vgmstream(vgmstream);
    return NULL;
}
Beispiel #14
0
/* RSD6RADP */
VGMSTREAM * init_vgmstream_rsd6radp(STREAMFILE *streamFile) {
    VGMSTREAM * vgmstream = NULL;
    char filename[260];
    off_t start_offset;

	int loop_flag;
	int channel_count;

    /* check extension, case insensitive */
    streamFile->get_name(streamFile,filename,sizeof(filename));
    if (strcasecmp("rsd",filename_extension(filename))) goto fail;

    /* check header */
    if (read_32bitBE(0x0,streamFile) != 0x52534436) /* RSD6 */
		goto fail;
	if (read_32bitBE(0x4,streamFile) != 0x52414450)	/* RADP */
        goto fail;

    loop_flag = 0;
    channel_count = read_32bitLE(0x8,streamFile);
    
	/* build the VGMSTREAM */
    vgmstream = allocate_vgmstream(channel_count,loop_flag);
    if (!vgmstream) goto fail;

	/* fill in the vital statistics */
  start_offset = 0x800;
	vgmstream->channels = channel_count;
    vgmstream->sample_rate = read_32bitLE(0x10,streamFile);
    vgmstream->coding_type = coding_RAD_IMA;
    vgmstream->num_samples = (get_streamfile_size(streamFile)-start_offset)/0x14/channel_count*32;
    if (loop_flag) {
        vgmstream->loop_start_sample = loop_flag;
        vgmstream->loop_end_sample = (get_streamfile_size(streamFile)-start_offset)*28/16/channel_count;
    }
    vgmstream->layout_type = layout_none;
    vgmstream->interleave_block_size = 0x14*channel_count;
    vgmstream->meta_type = meta_RSD6RADP;

    /* open the file for reading */
    {
        int i;
        STREAMFILE * file;
        file = streamFile->open(streamFile,filename,STREAMFILE_DEFAULT_BUFFER_SIZE);
        if (!file) goto fail;
        for (i=0;i<channel_count;i++) {
            vgmstream->ch[i].streamfile = file;
   
            vgmstream->ch[i].offset=vgmstream->ch[i].channel_start_offset=start_offset;
        }
    }
    
	return vgmstream;

fail:
    /* clean up anything we may have opened */
    if (vgmstream) close_vgmstream(vgmstream);
    return NULL;
}
Beispiel #15
0
/* Opens an stream using the base streamFile name plus a new extension (ex. for headers in a separate file) */
STREAMFILE * open_stream_ext(STREAMFILE *streamFile, const char * ext) {
    char filename_ext[PATH_LIMIT];

    streamFile->get_name(streamFile,filename_ext,sizeof(filename_ext));
    strcpy(filename_ext + strlen(filename_ext) - strlen(filename_extension(filename_ext)), ext);

    return streamFile->open(streamFile,filename_ext,STREAMFILE_DEFAULT_BUFFER_SIZE);
}
Beispiel #16
0
VGMSTREAM * init_vgmstream_xbox_xmu(STREAMFILE *streamFile) {
    VGMSTREAM * vgmstream = NULL;
    char filename[PATH_LIMIT];

    int loop_flag=0;
	int channel_count;
    int i;

    /* check extension, case insensitive */
    streamFile->get_name(streamFile,filename,sizeof(filename));
    if (strcasecmp("xmu",filename_extension(filename))) goto fail;

	if((read_32bitBE(0x00,streamFile)!=0x584D5520) && 
	   (read_32bitBE(0x08,streamFile)!=0x46524D54))
		goto fail;

    /* No Loop found atm */
	loop_flag = read_8bit(0x16,streamFile);;
    
	/* Always stereo files */
	channel_count=read_8bit(0x14,streamFile);
    
	/* build the VGMSTREAM */
    vgmstream = allocate_vgmstream(channel_count,loop_flag);
    if (!vgmstream) goto fail;

	/* fill in the vital statistics */
	vgmstream->channels = channel_count;
    vgmstream->sample_rate = read_32bitLE(0x10,streamFile);

	vgmstream->coding_type = coding_XBOX;
    vgmstream->num_samples = read_32bitLE(0x7FC,streamFile) / 36 * 64 / vgmstream->channels;
    vgmstream->layout_type = layout_none;
    vgmstream->meta_type = meta_XBOX_XMU;

	if(loop_flag) {
		vgmstream->loop_start_sample=0;
		vgmstream->loop_end_sample=vgmstream->num_samples;
	}
	
	/* open the file for reading by each channel */
    {
        for (i=0;i<channel_count;i++) {
            vgmstream->ch[i].streamfile = streamFile->open(streamFile,filename,36);
            vgmstream->ch[i].offset = 0x800;

            if (!vgmstream->ch[i].streamfile) goto fail;
        }
    }

    return vgmstream;

    /* clean up anything we may have opened */
fail:
    if (vgmstream) close_vgmstream(vgmstream);
    return NULL;
}
Beispiel #17
0
VGMSTREAM * init_vgmstream_xbox_stma(STREAMFILE *streamFile) {
    VGMSTREAM * vgmstream = NULL;
    char filename[260];

    int loop_flag=0;
	int channel_count;
    int i;

    /* check extension, case insensitive */
    streamFile->get_name(streamFile,filename,sizeof(filename));
    if (strcasecmp("stma",filename_extension(filename))) goto fail;

	if(read_32bitBE(0x0,streamFile)!=0x53544D41)
		goto fail;

	loop_flag = ((read_32bitLE(0x20,streamFile)==1) || (read_32bitLE(0x18,streamFile)>read_32bitLE(0x1C,streamFile)));
    
	/* Seems that the loop flag is not allways well defined */
	/* Some of the tracks should loop, but without flag set */
	channel_count=read_32bitLE(0x14,streamFile);
    
	/* build the VGMSTREAM */
    vgmstream = allocate_vgmstream(channel_count,loop_flag);
    if (!vgmstream) goto fail;

	/* fill in the vital statistics */
	vgmstream->channels = channel_count;
    vgmstream->sample_rate = read_32bitLE(0x0C,streamFile);
	vgmstream->coding_type = coding_INT_DVI_IMA;
    vgmstream->num_samples = read_32bitLE(0x18,streamFile)*2/vgmstream->channels;
    vgmstream->layout_type = layout_interleave;
	vgmstream->interleave_block_size=0x40;
    vgmstream->meta_type = meta_XBOX_STMA;

	if(loop_flag) {
		vgmstream->loop_start_sample=read_32bitLE(0x24,streamFile);
		vgmstream->loop_end_sample=vgmstream->num_samples;
	}

    /* open the file for reading by each channel */
    {
        for (i=0;i<channel_count;i++) {
            vgmstream->ch[i].streamfile = streamFile->open(streamFile,filename,36);
            vgmstream->ch[i].offset = 0x800+(i*vgmstream->interleave_block_size);

            if (!vgmstream->ch[i].streamfile) goto fail;
        }
    }

    return vgmstream;

    /* clean up anything we may have opened */
fail:
    if (vgmstream) close_vgmstream(vgmstream);
    return NULL;
}
Beispiel #18
0
/* ZSD (Dragon Booster) */
VGMSTREAM * init_vgmstream_zsd(STREAMFILE *streamFile) {

	VGMSTREAM * vgmstream = NULL;
	char filename[PATH_LIMIT];
	off_t start_offset;

    int loop_flag;
    int channel_count;

	/* check extension, case insensitive */
	streamFile->get_name(streamFile,filename,sizeof(filename));
	if (strcasecmp("zsd",filename_extension(filename))) goto fail;

	/* check header */
    if (read_32bitBE(0x00,streamFile) != 0x5A534400) goto fail;

    loop_flag = 0;
    channel_count = 1;

    /* build the VGMSTREAM */
    vgmstream = allocate_vgmstream(channel_count,loop_flag);
    if (!vgmstream) goto fail;

    /* fill in the vital statistics */
    start_offset = read_32bitLE(0x20,streamFile);
    vgmstream->channels = channel_count;
    vgmstream->sample_rate = read_32bitLE(0x10,streamFile);
    vgmstream->coding_type = coding_PCM8;
    vgmstream->num_samples = read_32bitLE(0x18,streamFile)/channel_count;
    vgmstream->interleave_block_size=0x0;

    vgmstream->layout_type = layout_none;
    vgmstream->meta_type = meta_ZSD;


    /* open the file for reading */
    {
        int i;
        STREAMFILE * file;
        file = streamFile->open(streamFile,filename,STREAMFILE_DEFAULT_BUFFER_SIZE);
        if (!file) goto fail;
        for (i=0;i<channel_count;i++) {
            vgmstream->ch[i].streamfile = file;
            vgmstream->ch[i].channel_start_offset=
                vgmstream->ch[i].offset=start_offset+
                vgmstream->interleave_block_size*i;
        }
    }

    return vgmstream;

    /* clean up anything we may have opened */
fail:
    if (vgmstream) close_vgmstream(vgmstream);
    return NULL;
}
Beispiel #19
0
/* XA2 (RC Revenge Pro) */
VGMSTREAM * init_vgmstream_ps2_xa2_rrp(STREAMFILE *streamFile) {
    VGMSTREAM * vgmstream = NULL;
    char filename[260];
    off_t start_offset;

    int loop_flag = 0;
	int channel_count;

    /* check extension, case insensitive */
    streamFile->get_name(streamFile,filename,sizeof(filename));
    if (strcasecmp("xa2",filename_extension(filename))) goto fail;

	/* check header */
    if (read_32bitBE(0xC,streamFile) != 0x00000000)
        goto fail;

    loop_flag = 0;
    channel_count = read_32bitLE(0x0,streamFile);

	/* build the VGMSTREAM */
    vgmstream = allocate_vgmstream(channel_count,loop_flag);
    if (!vgmstream) goto fail;

	/* fill in the vital statistics */
    start_offset = 0x800;
	vgmstream->channels = channel_count;
    vgmstream->sample_rate = 44100;
    vgmstream->coding_type = coding_PSX;
    vgmstream->num_samples = (get_streamfile_size(streamFile)-0x800)*28/16/channel_count;
    vgmstream->layout_type = layout_interleave;
    vgmstream->interleave_block_size = 0x1000;
	vgmstream->meta_type = meta_PS2_XA2_RRP;

    /* open the file for reading */
    {
        int i;
        STREAMFILE * file;
        file = streamFile->open(streamFile,filename,STREAMFILE_DEFAULT_BUFFER_SIZE);
        if (!file) goto fail;
        for (i=0;i<channel_count;i++) {
            vgmstream->ch[i].streamfile = file;

            vgmstream->ch[i].channel_start_offset=
                vgmstream->ch[i].offset=start_offset+
                vgmstream->interleave_block_size*i;
        }
    }

    return vgmstream;

fail:
    /* clean up anything we may have opened */
    if (vgmstream) close_vgmstream(vgmstream);
    return NULL;
}
Beispiel #20
0
VGMSTREAM * init_vgmstream_myspd(STREAMFILE *streamFile) {
    VGMSTREAM * vgmstream = NULL;
    char filename[260];
    int channel_count;
    int loop_flag = 0;
    off_t start_offset;

    /* check extension, case insensitive */
    streamFile->get_name(streamFile,filename,sizeof(filename));
    if (strcasecmp("myspd",filename_extension(filename))) goto fail;

    channel_count = 2;
    start_offset = 0x20;

    /* check size */
	if ((read_32bitBE(0x0,streamFile)*channel_count+start_offset) != get_streamfile_size(streamFile))
		goto fail;

	/* build the VGMSTREAM */
    vgmstream = allocate_vgmstream(channel_count,loop_flag);
    if (!vgmstream) goto fail;

    /* fill in the vital statistics */
	vgmstream->num_samples = read_32bitBE(0x0,streamFile) * 2;
    vgmstream->sample_rate = read_32bitBE(0x4,streamFile);

	vgmstream->coding_type = coding_IMA;
    vgmstream->meta_type = meta_MYSPD;
    vgmstream->layout_type = layout_none;

    /* open the file for reading */
    {
        STREAMFILE * file;
        file = streamFile->open(streamFile,filename,STREAMFILE_DEFAULT_BUFFER_SIZE);
        if (!file) goto fail;
        vgmstream->ch[0].streamfile = file;

        vgmstream->ch[0].channel_start_offset=
            vgmstream->ch[0].offset=start_offset;

        file = streamFile->open(streamFile,filename,STREAMFILE_DEFAULT_BUFFER_SIZE);
        if (!file) goto fail;
        vgmstream->ch[1].streamfile = file;
        
        vgmstream->ch[0].channel_start_offset=
            vgmstream->ch[1].offset=start_offset + read_32bitBE(0x0,streamFile);
    }
    
    return vgmstream;

    /* clean up anything we may have opened */
fail:
    if (vgmstream) close_vgmstream(vgmstream);
    return NULL;
}
Beispiel #21
0
VGMSTREAM * init_vgmstream_pos(STREAMFILE *streamFile) {
    
	VGMSTREAM * vgmstream = NULL;
    STREAMFILE * streamFileWAV = NULL;
    char filename[1024];
	char filenameWAV[1024];

	int i;

    /* check extension, case insensitive */
    streamFile->get_name(streamFile,filename,sizeof(filename));
    if (strcasecmp("pos",filename_extension(filename))) goto fail;

	/* check for .WAV file */
	strcpy(filenameWAV,filename);
	strcpy(filenameWAV+strlen(filenameWAV)-3,"wav");

	streamFileWAV = streamFile->open(streamFile,filenameWAV,STREAMFILE_DEFAULT_BUFFER_SIZE);
	if (!streamFileWAV) {
        /* try again, ucase */
        for (i=strlen(filenameWAV);i>=0&&filenameWAV[i]!=DIRSEP;i--)
            filenameWAV[i]=toupper(filenameWAV[i]);

        streamFileWAV = streamFile->open(streamFile,filenameWAV,STREAMFILE_DEFAULT_BUFFER_SIZE);
        if (!streamFileWAV) goto fail;
    }

    /* let the real initer do the parsing */
    vgmstream = init_vgmstream_riff(streamFileWAV);
    if (!vgmstream) goto fail;

    close_streamfile(streamFileWAV);
    streamFileWAV = NULL;

    /* install loops */
    if (!vgmstream->loop_flag) {
        vgmstream->loop_flag = 1;
        vgmstream->loop_ch = calloc(vgmstream->channels,
                sizeof(VGMSTREAMCHANNEL));
        if (!vgmstream->loop_ch) goto fail;
    }

    vgmstream->loop_start_sample = read_32bitLE(0,streamFile);
    vgmstream->loop_end_sample = read_32bitLE(4,streamFile);
    vgmstream->meta_type = meta_RIFF_WAVE_POS;

    return vgmstream;

    /* clean up anything we may have opened */
fail:
    if (streamFileWAV) close_streamfile(streamFileWAV);
    if (vgmstream) close_vgmstream(vgmstream);
    return NULL;
}
Beispiel #22
0
VGMSTREAM * init_vgmstream_lsf_n1nj4n(STREAMFILE *streamFile) {
    VGMSTREAM * vgmstream = NULL;
    char filename[260];

    size_t file_size;
    off_t start_offset;

    /* check extension, case insensitive */
    streamFile->get_name(streamFile,filename,sizeof(filename));
    if (strcasecmp("lsf",filename_extension(filename))) goto fail;

    /* check header */
    if (read_32bitBE(0x0, streamFile) != 0x216E316E || // "!n1n"
        read_32bitBE(0x4, streamFile) != 0x6A346E00)   // "j4n\0"
        goto fail;

    /* check size */
    file_size = get_streamfile_size(streamFile);
    if (read_32bitLE(0xC, streamFile) + 0x10 != file_size)
        goto fail;

    start_offset = 0x10;

    /* build the VGMSTREAM */
    vgmstream = allocate_vgmstream(1,0);
    if (!vgmstream) goto fail;

    /* fill in the vital statistics */
    vgmstream->num_samples = (file_size-0x10)/0x1c*0x1b*2;
    vgmstream->sample_rate = read_32bitLE(0x8, streamFile);

    vgmstream->coding_type = coding_LSF;
    vgmstream->layout_type = layout_none;
    vgmstream->meta_type = meta_LSF_N1NJ4N;

    /* open the file for reading */
    {
        vgmstream->ch[0].streamfile = streamFile->open(streamFile,filename,STREAMFILE_DEFAULT_BUFFER_SIZE);

        if (!vgmstream->ch[0].streamfile) goto fail;

        vgmstream->ch[0].channel_start_offset=
            vgmstream->ch[0].offset=start_offset;
    }

    return vgmstream;

    /* clean up anything we may have opened */
fail:
    if (vgmstream) close_vgmstream(vgmstream);
    return NULL;
}
Beispiel #23
0
VGMSTREAM * init_vgmstream_xbox_matx(STREAMFILE *streamFile) {
    VGMSTREAM * vgmstream = NULL;
    char filename[PATH_LIMIT];

    int loop_flag=0;
	int channel_count;
    int i;

    /* check extension, case insensitive */
    streamFile->get_name(streamFile,filename,sizeof(filename));
    if (strcasecmp("matx",filename_extension(filename))) goto fail;

	loop_flag = 0;
	channel_count=read_16bitLE(0x4,streamFile);
    
	/* build the VGMSTREAM */
    vgmstream = allocate_vgmstream(channel_count,loop_flag);
    if (!vgmstream) goto fail;

	/* fill in the vital statistics */
	vgmstream->channels = channel_count;
    vgmstream->sample_rate = read_16bitLE(0x06,streamFile) & 0xffff;
	vgmstream->coding_type = coding_XBOX;

    vgmstream->layout_type = layout_matx_blocked;
    vgmstream->meta_type = meta_XBOX_MATX;

    /* open the file for reading by each channel */
    {
        for (i=0;i<channel_count;i++) {
            vgmstream->ch[i].streamfile = streamFile->open(streamFile,filename,36);
            if (!vgmstream->ch[i].streamfile) goto fail;
        }
    }

	/* Calc num_samples */
	matx_block_update(0,vgmstream);
	vgmstream->num_samples=0;

	do {
		vgmstream->num_samples += vgmstream->current_block_size/36*64;
		matx_block_update(vgmstream->next_block_offset,vgmstream);
	} while (vgmstream->next_block_offset<get_streamfile_size(streamFile));

	matx_block_update(0,vgmstream);
    return vgmstream;

    /* clean up anything we may have opened */
fail:
    if (vgmstream) close_vgmstream(vgmstream);
    return NULL;
}
Beispiel #24
0
/* B1S (found in 7 Wonders of the Ancient World) */
VGMSTREAM * init_vgmstream_ps2_b1s(STREAMFILE *streamFile) {
    VGMSTREAM * vgmstream = NULL;
    char filename[PATH_LIMIT];
		int channel_count;
		off_t start_offset;
    
    /* check extension, case insensitive */
    streamFile->get_name(streamFile,filename,sizeof(filename));
    if (strcasecmp("b1s",filename_extension(filename))) goto fail;

    if ((read_32bitLE(0x04,streamFile)+0x18) != get_streamfile_size(streamFile))
        goto fail;

    channel_count = read_32bitLE(0x14,streamFile);

		/* build the VGMSTREAM */
    vgmstream = allocate_vgmstream(channel_count,0);
    if (!vgmstream) goto fail;

		/* fill in the vital statistics */
    start_offset = 0x18;
		vgmstream->channels = channel_count;
    vgmstream->sample_rate = read_32bitBE(0x10,streamFile);
    vgmstream->coding_type = coding_PSX;
    vgmstream->num_samples = read_32bitLE(0x04,streamFile)/16/channel_count*28;
    vgmstream->layout_type = layout_interleave;
    vgmstream->interleave_block_size = read_32bitLE(0x0C,streamFile);
    vgmstream->meta_type = meta_PS2_B1S;

    /* open the file for reading */
    {
        int i;
        STREAMFILE * file;
        file = streamFile->open(streamFile,filename,STREAMFILE_DEFAULT_BUFFER_SIZE);
        if (!file) goto fail;
        for (i=0;i<channel_count;i++) {
            vgmstream->ch[i].streamfile = file;

            vgmstream->ch[i].channel_start_offset=
                vgmstream->ch[i].offset=start_offset+
                vgmstream->interleave_block_size*i;

        }
    }

    return vgmstream;

    /* clean up anything we may have opened */
fail:
    if (vgmstream) close_vgmstream(vgmstream);
    return NULL;
}
Beispiel #25
0
VGMSTREAM * init_vgmstream_ss_stream(STREAMFILE *streamFile) {
    VGMSTREAM * vgmstream = NULL;
    char filename[260];
    int loop_flag=0;
	int channel_count;
    int i;

    /* check extension, case insensitive */
    streamFile->get_name(streamFile,filename,sizeof(filename));
    if (strcasecmp("ss7",filename_extension(filename))) goto fail;

	loop_flag = 0;
	channel_count=read_8bit(0x0C,streamFile)+1;
    
	/* build the VGMSTREAM */
    vgmstream = allocate_vgmstream(channel_count,loop_flag);
    if (!vgmstream) goto fail;

	/* fill in the vital statistics */
	vgmstream->channels = channel_count;
	vgmstream->sample_rate = 44100;
	
	if(channel_count==1)
		vgmstream->coding_type = coding_IMA;
	else
		vgmstream->coding_type = coding_EACS_IMA;

    vgmstream->num_samples = (int32_t)((get_streamfile_size(streamFile) -0x44)* 2 / vgmstream->channels);
    vgmstream->layout_type = layout_none;
	
    vgmstream->meta_type = meta_XBOX_WAVM;
	vgmstream->get_high_nibble=0;

    /* open the file for reading by each channel */
    {
        for (i=0;i<channel_count;i++) {
            vgmstream->ch[i].streamfile = streamFile->open(streamFile,filename,36);
            vgmstream->ch[i].offset = 0x44;
			vgmstream->ch[i].adpcm_history1_32=(int32_t)read_16bitLE(0x10+i*4,streamFile);
			vgmstream->ch[i].adpcm_step_index =(int)read_8bit(0x12+i*4,streamFile);
            if (!vgmstream->ch[i].streamfile) goto fail;
        }
    }

    return vgmstream;

    /* clean up anything we may have opened */
fail:
    if (vgmstream) close_vgmstream(vgmstream);
    return NULL;
}
Beispiel #26
0
/* TRA

   TRA is an headerless format which can be found on DefJam Rapstar (X360)
   known extensions : WAVM

   2010-12-03 - Fastelbja : First version ...
*/
VGMSTREAM * init_vgmstream_x360_tra(STREAMFILE *streamFile) {
    VGMSTREAM * vgmstream = NULL;
    char filename[PATH_LIMIT];

    int loop_flag=0;
	int channel_count;
    int i;

    /* check extension, case insensitive */
    streamFile->get_name(streamFile,filename,sizeof(filename));
    if (strcasecmp("tra",filename_extension(filename))) goto fail;

    /* No loop on wavm */
	loop_flag = 0;
    
	/* Always stereo files */
	channel_count=2;
    
	/* build the VGMSTREAM */
    vgmstream = allocate_vgmstream(channel_count,loop_flag);
    if (!vgmstream) goto fail;

	/* fill in the vital statistics */
	/* allways 2 channels @ 44100 Hz */
	vgmstream->channels = 2;
    vgmstream->sample_rate = 24000;

	vgmstream->coding_type = coding_DVI_IMA;
    vgmstream->num_samples = (int32_t)(get_streamfile_size(streamFile) - ((get_streamfile_size(streamFile)/0x204)*4));
    vgmstream->layout_type = layout_tra_blocked;
	
    vgmstream->meta_type = meta_X360_TRA;

    /* open the file for reading by each channel */
    {
        for (i=0;i<channel_count;i++) {
            vgmstream->ch[i].streamfile = streamFile->open(streamFile,filename,36);

            if (!vgmstream->ch[i].streamfile) goto fail;
        }
    }

	tra_block_update(0,vgmstream);
    return vgmstream;

    /* clean up anything we may have opened */
fail:
    if (vgmstream) close_vgmstream(vgmstream);
    return NULL;
}
Beispiel #27
0
// OMU is a PS2 .INT file with header ...
// found in Alter Echo
VGMSTREAM * init_vgmstream_ps2_omu(STREAMFILE *streamFile) {
    VGMSTREAM * vgmstream = NULL;
    char filename[1024];
	int i,channel_count;

    /* check extension, case insensitive */
    streamFile->get_name(streamFile,filename,sizeof(filename));
    if (strcasecmp("omu",filename_extension(filename))) goto fail;

	/* check header */
	if((read_32bitBE(0,streamFile)!=0x4F4D5520) && (read_32bitBE(0x08,streamFile)!=0x46524D54))
		goto fail;

	channel_count = (int)read_8bit(0x14,streamFile);

    /* build the VGMSTREAM */
    vgmstream = allocate_vgmstream(channel_count,1);
    if (!vgmstream) goto fail;

    /* fill in the vital statistics */
	vgmstream->channels=channel_count;
    vgmstream->sample_rate = read_32bitLE(0x10,streamFile);
    vgmstream->coding_type = coding_PCM16LE;
    vgmstream->num_samples = (int32_t)(read_32bitLE(0x3C,streamFile)/(vgmstream->channels*2));
    vgmstream->interleave_block_size = 0x200;
    vgmstream->layout_type = layout_interleave;
    vgmstream->meta_type = meta_PS2_OMU;

	vgmstream->loop_start_sample=0;
	vgmstream->loop_end_sample=vgmstream->num_samples;

    /* open the file for reading by each channel */
    {
        for (i=0;i<vgmstream->channels;i++) {
            vgmstream->ch[i].streamfile = streamFile->open(streamFile,filename,0x8000);

            if (!vgmstream->ch[i].streamfile) goto fail;

            vgmstream->ch[i].channel_start_offset=
                vgmstream->ch[i].offset=0x40+(i*vgmstream->interleave_block_size);
        }
    }

    return vgmstream;

    /* clean up anything we may have opened */
fail:
    if (vgmstream) close_vgmstream(vgmstream);
    return NULL;
}
Beispiel #28
0
VGMSTREAM * init_vgmstream_exakt_sc(STREAMFILE *streamFile) {
    VGMSTREAM * vgmstream = NULL;
    char filename[260];

    size_t file_size;

    /* check extension, case insensitive */
    /* this is all we have to go on, SC is completely headerless */
    streamFile->get_name(streamFile,filename,sizeof(filename));
    if (strcasecmp("sc",filename_extension(filename))) goto fail;

    file_size = get_streamfile_size(streamFile);

    /* build the VGMSTREAM */

    vgmstream = allocate_vgmstream(2,0);
    if (!vgmstream) goto fail;

    /* fill in the vital statistics */
    vgmstream->num_samples = file_size / 2;
    vgmstream->sample_rate = 48000;

    vgmstream->coding_type = coding_SASSC;
    vgmstream->layout_type = layout_interleave;
    vgmstream->interleave_block_size = 0x100;
    vgmstream->meta_type = meta_EXAKT_SC;

    /* open the file for reading by each channel */
    {
        int i;
        for (i=0;i<2;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=vgmstream->interleave_block_size*i;

        }
    }

    return vgmstream;

    /* clean up anything we may have opened */
fail:
    if (vgmstream) close_vgmstream(vgmstream);
    return NULL;
}
Beispiel #29
0
static int subr_ui_load_view(lua_State* L)
{
  const char *filename;
  int retval;

  if (lua_isnoneornil(L,1))
    return luaL_error(L,"Expecting one parameter: a filename (string)");

  filename = lua_tostring(L,1);

  if (strcmp(filename_extension(filename),".lua")==0)
  {
    log_printf(LOG_WARNING,"%s seems to be a card LUA script: perhaps you should use the 'Analyzer'"
        " menu instead to open this file.",filename_base(filename));
  }

  dyntree_model_iter_remove(gui_cardview_get_store(),NULL);

  retval =  dyntree_model_iter_from_xml_file(gui_cardview_get_store(),NULL,filename);
  
  lua_pushboolean(L,retval);
  return 1;
}
Beispiel #30
0
/* RSD6OGG */
VGMSTREAM * init_vgmstream_rsd6oogv(STREAMFILE *streamFile) {
#ifdef VGM_USE_VORBIS
    char filename[260];
    off_t start_offset;

    /* check extension, case insensitive */
    streamFile->get_name(streamFile,filename,sizeof(filename));
    if (strcasecmp("rsd",filename_extension(filename))) goto fail;

    /* check header */
    if (read_32bitBE(0x0,streamFile) != 0x52534436) /* RSD6 */
		goto fail;
	if (read_32bitBE(0x4,streamFile) != 0x4F4F4756)	/* OOGV */
        goto fail;

    {
        vgm_vorbis_info_t inf;
        VGMSTREAM * result = NULL;

        memset(&inf, 0, sizeof(inf));
        inf.layout_type = layout_ogg_vorbis;
        inf.meta_type = meta_RSD6OOGV;

        start_offset = 0x800;
		result = init_vgmstream_ogg_vorbis_callbacks(streamFile, filename, NULL, start_offset, &inf);

        if (result != NULL) {
            return result;
        }
	   }

fail:
    /* clean up anything we may have opened */
#endif
    return NULL;
}