Blame ld10k1/include/liblo10k1lf.h

Packit Service b98cfc
/*
Packit Service b98cfc
 *  EMU10k1 loader lib
Packit Service b98cfc
 *  Copyright (c) 2003,2004 by Peter Zubaj
Packit Service b98cfc
 *
Packit Service b98cfc
 *
Packit Service b98cfc
 *   This library is free software; you can redistribute it and/or modify
Packit Service b98cfc
 *   it under the terms of the GNU Lesser General Public License as
Packit Service b98cfc
 *   published by the Free Software Foundation; either version 2.1 of
Packit Service b98cfc
 *   the License, or (at your option) any later version.
Packit Service b98cfc
 *
Packit Service b98cfc
 *   This program is distributed in the hope that it will be useful,
Packit Service b98cfc
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit Service b98cfc
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
Packit Service b98cfc
 *   GNU Lesser General Public License for more details.
Packit Service b98cfc
 *
Packit Service b98cfc
 *   You should have received a copy of the GNU Lesser General Public
Packit Service b98cfc
 *   License along with this library; if not, write to the Free Software
Packit Service b98cfc
 *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
Packit Service b98cfc
 *
Packit Service b98cfc
 */
Packit Service b98cfc
 
Packit Service b98cfc
#ifndef __LIBLO10K1LF_H
Packit Service b98cfc
#define __LIBLO10K1LF_H
Packit Service b98cfc
Packit Service b98cfc
#ifdef __cplusplus
Packit Service b98cfc
extern "C" {
Packit Service b98cfc
#endif
Packit Service b98cfc
Packit Service b98cfc
/* description of structures used in native ld10k1 files */
Packit Service b98cfc
Packit Service b98cfc
typedef struct {
Packit Service b98cfc
	/* asciz string with signature - have to be 
Packit Service b98cfc
	"LD10K1 NATIVE EFFECT FILE      "
Packit Service b98cfc
	 01234567890123456789012345678901 */
Packit Service b98cfc
	char signature[32];
Packit Service b98cfc
	/* don't use this */
Packit Service b98cfc
	char reserved[32];
Packit Service b98cfc
} liblo10k1_file_header_t;
Packit Service b98cfc
Packit Service b98cfc
/* don't use this */
Packit Service b98cfc
#define LD10K1_FP_TYPE_RESERVED 0
Packit Service b98cfc
/* normal part type, part_length is valid */
Packit Service b98cfc
#define LD10K1_FP_TYPE_NORMAL 1
Packit Service b98cfc
/* part start type, part_length have to be 0 */
Packit Service b98cfc
#define LD10K1_FP_TYPE_START 2
Packit Service b98cfc
/* part end type, part_length have to be 0 */
Packit Service b98cfc
#define LD10K1_FP_TYPE_END 3
Packit Service b98cfc
Packit Service b98cfc
/* parts can be nested */
Packit Service b98cfc
typedef struct {
Packit Service b98cfc
	/* don't use this */
Packit Service b98cfc
	unsigned int reserved : 2,
Packit Service b98cfc
	/* part type definition
Packit Service b98cfc
		- normal
Packit Service b98cfc
		- part content start
Packit Service b98cfc
		- part content end */
Packit Service b98cfc
		part_type : 6,
Packit Service b98cfc
		part_id : 24;
Packit Service b98cfc
	/* part data length */
Packit Service b98cfc
	unsigned int part_length;
Packit Service b98cfc
} liblo10k1_file_part_t;
Packit Service b98cfc
Packit Service b98cfc
#define LD10K1_FP_INFO 0
Packit Service b98cfc
#define LD10K1_FP_DSP_SETUP 1
Packit Service b98cfc
#define LD10K1_FP_FX 2
Packit Service b98cfc
#define LD10K1_FP_FX_LIST 3
Packit Service b98cfc
#define LD10K1_FP_IN 4
Packit Service b98cfc
#define LD10K1_FP_IN_LIST 5
Packit Service b98cfc
#define LD10K1_FP_OUT 6
Packit Service b98cfc
#define LD10K1_FP_OUT_LIST 7
Packit Service b98cfc
#define LD10K1_FP_PATCH 8
Packit Service b98cfc
#define LD10K1_FP_PATCH_LIST 9
Packit Service b98cfc
#define LD10K1_FP_PATCH_INFO 10
Packit Service b98cfc
#define LD10K1_FP_PIO 11
Packit Service b98cfc
#define LD10K1_FP_PIN_LIST 12
Packit Service b98cfc
#define LD10K1_FP_POUT_LIST 13
Packit Service b98cfc
#define LD10K1_FP_CS 14
Packit Service b98cfc
#define LD10K1_FP_CONST_LIST 15
Packit Service b98cfc
#define LD10K1_FP_STA_LIST 16
Packit Service b98cfc
#define LD10K1_FP_DYN_LIST 17
Packit Service b98cfc
#define LD10K1_FP_HW 18
Packit Service b98cfc
#define LD10K1_FP_HW_LIST 19
Packit Service b98cfc
#define LD10K1_FP_TRAM 20
Packit Service b98cfc
#define LD10K1_FP_TRAM_LIST 21
Packit Service b98cfc
#define LD10K1_FP_TRAM_ACC 22
Packit Service b98cfc
#define LD10K1_FP_TRAM_ACC_LIST 23
Packit Service b98cfc
#define LD10K1_FP_CTL 24
Packit Service b98cfc
#define LD10K1_FP_CTL_LIST 25
Packit Service b98cfc
#define LD10K1_FP_INSTR 26
Packit Service b98cfc
#define LD10K1_FP_INSTR_LIST 27
Packit Service b98cfc
#define LD10K1_FP_POINT 28
Packit Service b98cfc
#define LD10K1_FP_POINT_LIST 29
Packit Service b98cfc
Packit Service b98cfc
#define LD10K1_FP_FILE_INFO_NAME 30
Packit Service b98cfc
#define LD10K1_FP_FILE_INFO_DESC 31
Packit Service b98cfc
#define LD10K1_FP_FILE_INFO_CREATER 32
Packit Service b98cfc
#define LD10K1_FP_FILE_INFO_AUTHOR 33
Packit Service b98cfc
#define LD10K1_FP_FILE_INFO_COPYRIGHT 34
Packit Service b98cfc
#define LD10K1_FP_FILE_INFO_LICENCE 35
Packit Service b98cfc
Packit Service b98cfc
/* file contains whole dsp config */
Packit Service b98cfc
#define LD10K1_FP_INFO_FILE_TYPE_DSP_SETUP 0
Packit Service b98cfc
/* file contains only 1 patch */
Packit Service b98cfc
#define LD10K1_FP_INFO_FILE_TYPE_PATCH 1
Packit Service b98cfc
Packit Service b98cfc
Packit Service b98cfc
typedef struct {
Packit Service b98cfc
	unsigned int file_type;
Packit Service b98cfc
	/* file version 
Packit Service b98cfc
	   application can ignore this version and read file, 
Packit Service b98cfc
	   but must be prepared to ignore unknown parts */
Packit Service b98cfc
	unsigned int file_version_major : 8,
Packit Service b98cfc
		file_version_minor : 8,
Packit Service b98cfc
		file_version_subminor : 8,
Packit Service b98cfc
		file_version_pad : 8;
Packit Service b98cfc
	/* minimal version of lo10k1/ld10k1 which will load file
Packit Service b98cfc
	   application must be prepared to ignore unknown parts */
Packit Service b98cfc
	unsigned int minimal_reader_version_major : 8,
Packit Service b98cfc
		minimal_reader_version_minor : 8,
Packit Service b98cfc
		minimal_reader_version_subminor : 8,
Packit Service b98cfc
		minimal_reader_version_pad : 8;
Packit Service b98cfc
	/* version of lo10k1/ld10k1 which which created file */
Packit Service b98cfc
	unsigned int creater_version_major : 8,
Packit Service b98cfc
		creater_version_minor : 8,
Packit Service b98cfc
		creater_version_subminor : 8,
Packit Service b98cfc
		creater_version_pad : 8;
Packit Service b98cfc
} liblo10k1_file_part_info_t;
Packit Service b98cfc
Packit Service b98cfc
#define LD10K1_FP_INFO_DSP_TYPE_EMU10K1 0
Packit Service b98cfc
#define LD10K1_FP_INFO_DSP_TYPE_EMU10K2 1
Packit Service b98cfc
typedef struct {
Packit Service b98cfc
	unsigned int dsp_type;
Packit Service b98cfc
	/* tram size to setup */
Packit Service b98cfc
	/* unsigned int externa_tram_size; */
Packit Service b98cfc
	/* used to restore io names */
Packit Service b98cfc
	unsigned int fx_count;
Packit Service b98cfc
	unsigned int in_count;
Packit Service b98cfc
	unsigned int out_count;
Packit Service b98cfc
	/* patch count contained in this file */
Packit Service b98cfc
	unsigned int patch_count;
Packit Service b98cfc
	/* point count contained in this file */
Packit Service b98cfc
	unsigned int point_count;
Packit Service b98cfc
} liblo10k1_file_part_dsp_setup_t;
Packit Service b98cfc
Packit Service b98cfc
Packit Service b98cfc
/* structure used to store and restore config */
Packit Service b98cfc
typedef struct {
Packit Service b98cfc
	unsigned int dsp_type;
Packit Service b98cfc
	/* used to restore io names */
Packit Service b98cfc
	unsigned int fx_count;
Packit Service b98cfc
	liblo10k1_get_io_t *fxs;
Packit Service b98cfc
	unsigned int in_count;
Packit Service b98cfc
	liblo10k1_get_io_t *ins;
Packit Service b98cfc
	unsigned int out_count;
Packit Service b98cfc
	liblo10k1_get_io_t *outs;
Packit Service b98cfc
	/* patch count contained in this file */
Packit Service b98cfc
	unsigned int patch_count;
Packit Service b98cfc
	liblo10k1_dsp_patch_t **patches;
Packit Service b98cfc
	/* point count contained in this file */
Packit Service b98cfc
	unsigned int point_count;
Packit Service b98cfc
	liblo10k1_point_info_t *points;
Packit Service b98cfc
} liblo10k1_file_dsp_setup_t;
Packit Service b98cfc
Packit Service b98cfc
typedef struct {
Packit Service b98cfc
	char patch_name[MAX_NAME_LEN];
Packit Service b98cfc
	unsigned int in_count;
Packit Service b98cfc
	unsigned int out_count;
Packit Service b98cfc
	unsigned int const_count;
Packit Service b98cfc
	unsigned int sta_count;
Packit Service b98cfc
	unsigned int dyn_count;
Packit Service b98cfc
	unsigned int hw_count;
Packit Service b98cfc
	unsigned int tram_count;
Packit Service b98cfc
	unsigned int tram_acc_count;
Packit Service b98cfc
	unsigned int ctl_count;
Packit Service b98cfc
	unsigned int instr_count;
Packit Service b98cfc
} liblo10k1_file_patch_info_t;
Packit Service b98cfc
Packit Service b98cfc
int liblo10k1lf_get_dsp_config(liblo10k1_connection_t *conn, liblo10k1_file_dsp_setup_t **setup);
Packit Service b98cfc
int liblo10k1lf_put_dsp_config(liblo10k1_connection_t *conn, liblo10k1_file_dsp_setup_t *setup);
Packit Service b98cfc
Packit Service b98cfc
liblo10k1_file_dsp_setup_t *liblo10k1lf_dsp_config_alloc();
Packit Service b98cfc
void liblo10k1lf_dsp_config_free(liblo10k1_file_dsp_setup_t *c);
Packit Service b98cfc
Packit Service b98cfc
typedef struct {
Packit Service b98cfc
	/* file name */
Packit Service b98cfc
	char *name;
Packit Service b98cfc
	/* file description */
Packit Service b98cfc
	char *desc;
Packit Service b98cfc
	/* description of creater application - can be anything */
Packit Service b98cfc
	char *creater;
Packit Service b98cfc
	/* author */
Packit Service b98cfc
	char *author;
Packit Service b98cfc
	/* copyright string */
Packit Service b98cfc
	char *copyright;
Packit Service b98cfc
	/* licence use for this file */
Packit Service b98cfc
	char *license;
Packit Service b98cfc
} liblo10k1_file_info_t;
Packit Service b98cfc
Packit Service b98cfc
liblo10k1_file_info_t *liblo10k1lf_file_info_alloc();
Packit Service b98cfc
void liblo10k1lf_file_info_free(liblo10k1_file_info_t *fi);
Packit Service b98cfc
Packit Service b98cfc
int liblo10k1lf_save_dsp_config(liblo10k1_file_dsp_setup_t *c, char *file_name, liblo10k1_file_info_t *fi);
Packit Service b98cfc
int liblo10k1lf_load_dsp_config(liblo10k1_file_dsp_setup_t **c, char *file_name, liblo10k1_file_info_t **fi);
Packit Service b98cfc
Packit Service b98cfc
int liblo10k1lf_save_dsp_patch(liblo10k1_dsp_patch_t *p, char *file_name, liblo10k1_file_info_t *fi);
Packit Service b98cfc
int liblo10k1lf_load_dsp_patch(liblo10k1_dsp_patch_t **p, char *file_name, liblo10k1_file_info_t **fi);
Packit Service b98cfc
Packit Service b98cfc
#define LD10K1_LF_ERR_OPEN -2000
Packit Service b98cfc
#define LD10K1_LF_ERR_WRITE -2001
Packit Service b98cfc
#define LD10K1_LF_ERR_READ -2002
Packit Service b98cfc
#define LD10K1_LF_ERR_SIGNATURE -2003
Packit Service b98cfc
#define LD10K1_LF_ERR_PART_TYPE -2004
Packit Service b98cfc
#define LD10K1_LF_ERR_PART_SIZE -2005
Packit Service b98cfc
#define LD10K1_LF_ERR_VERSION -2006
Packit Service b98cfc
#define LD10K1_LF_ERR_FILE_TYPE -2007
Packit Service b98cfc
Packit Service b98cfc
#ifdef __cplusplus
Packit Service b98cfc
}
Packit Service b98cfc
#endif
Packit Service b98cfc
Packit Service b98cfc
#endif /* __LIBLO10K1LF_H */