1999-05-23 16:49:10 +00:00
|
|
|
/****************************************************************************
|
|
|
|
|
* *
|
|
|
|
|
* instr.h *
|
|
|
|
|
* Instrument Interface *
|
|
|
|
|
* *
|
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
2001-04-24 13:02:58 +00:00
|
|
|
/**
|
|
|
|
|
* \defgroup Instrument Instrument Interface
|
|
|
|
|
* The Instrument Interface.
|
|
|
|
|
* \{
|
|
|
|
|
*/
|
|
|
|
|
|
2001-07-04 13:54:13 +00:00
|
|
|
/* instrument get/put */
|
2000-09-01 16:24:12 +00:00
|
|
|
|
2001-07-04 13:54:13 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
|
extern "C" {
|
|
|
|
|
#endif
|
|
|
|
|
|
2001-07-11 15:48:27 +00:00
|
|
|
/** container for sequencer instrument header */
|
2001-07-04 13:54:13 +00:00
|
|
|
typedef struct _snd_instr_header snd_instr_header_t;
|
|
|
|
|
|
|
|
|
|
size_t snd_instr_header_sizeof(void);
|
|
|
|
|
#define snd_instr_header_alloca(ptr) \
|
|
|
|
|
do {\
|
|
|
|
|
assert(ptr);\
|
|
|
|
|
*ptr = (snd_instr_header_t *)alloca(snd_instr_header_sizeof());\
|
|
|
|
|
memset(*ptr, 0, snd_instr_header_sizeof());\
|
2001-07-11 14:09:01 +00:00
|
|
|
} while (0) /**< allocate instrument header on stack */
|
2001-07-04 13:54:13 +00:00
|
|
|
int snd_instr_header_malloc(snd_instr_header_t **ptr, size_t len);
|
|
|
|
|
void snd_instr_header_free(snd_instr_header_t *ptr);
|
|
|
|
|
void snd_instr_header_copy(snd_instr_header_t *dst, const snd_instr_header_t *src);
|
|
|
|
|
|
|
|
|
|
const snd_seq_instr_t *snd_instr_header_get_id(const snd_instr_header_t *info);
|
|
|
|
|
snd_seq_instr_cluster_t snd_instr_header_get_cluster(const snd_instr_header_t *info);
|
|
|
|
|
unsigned int snd_instr_header_get_cmd(const snd_instr_header_t *info);
|
|
|
|
|
size_t snd_instr_header_get_len(const snd_instr_header_t *info);
|
|
|
|
|
const char *snd_instr_header_get_name(const snd_instr_header_t *info);
|
|
|
|
|
int snd_instr_header_get_type(const snd_instr_header_t *info);
|
|
|
|
|
const char *snd_instr_header_get_format(const snd_instr_header_t *info);
|
|
|
|
|
const snd_seq_instr_t *snd_instr_header_get_alias(const snd_instr_header_t *info);
|
|
|
|
|
void *snd_instr_header_get_data(const snd_instr_header_t *info);
|
|
|
|
|
int snd_instr_header_get_follow_alias(const snd_instr_header_t *info);
|
|
|
|
|
|
|
|
|
|
void snd_instr_header_set_id(snd_instr_header_t *info, const snd_seq_instr_t *id);
|
|
|
|
|
void snd_instr_header_set_cluster(snd_instr_header_t *info, snd_seq_instr_cluster_t cluster);
|
|
|
|
|
void snd_instr_header_set_cmd(snd_instr_header_t *info, unsigned int cmd);
|
|
|
|
|
void snd_instr_header_set_len(snd_instr_header_t *info, size_t len);
|
|
|
|
|
void snd_instr_header_set_name(snd_instr_header_t *info, const char *name);
|
|
|
|
|
void snd_instr_header_set_type(snd_instr_header_t *info, int type);
|
|
|
|
|
void snd_instr_header_set_format(snd_instr_header_t *info, const char *format);
|
|
|
|
|
void snd_instr_header_set_alias(snd_instr_header_t *info, const snd_seq_instr_t *instr);
|
2001-07-04 15:56:51 +00:00
|
|
|
void snd_instr_header_set_follow_alias(snd_instr_header_t *info, int val);
|
2001-07-04 13:54:13 +00:00
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Instrument abstraction layer
|
|
|
|
|
* - based on events
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
/** instrument types */
|
2001-08-20 13:15:30 +00:00
|
|
|
#define SND_SEQ_INSTR_ATYPE_DATA 0 /**< instrument data */
|
|
|
|
|
#define SND_SEQ_INSTR_ATYPE_ALIAS 1 /**< instrument alias */
|
2001-07-04 13:54:13 +00:00
|
|
|
|
|
|
|
|
/** instrument ASCII identifiers */
|
2001-08-20 13:15:30 +00:00
|
|
|
#define SND_SEQ_INSTR_ID_DLS1 "DLS1" /**< DLS1 */
|
|
|
|
|
#define SND_SEQ_INSTR_ID_DLS2 "DLS2" /**< DLS2 */
|
|
|
|
|
#define SND_SEQ_INSTR_ID_SIMPLE "Simple Wave" /**< Simple Wave */
|
|
|
|
|
#define SND_SEQ_INSTR_ID_SOUNDFONT "SoundFont" /**< SoundFont */
|
|
|
|
|
#define SND_SEQ_INSTR_ID_GUS_PATCH "GUS Patch" /**< Gravis Patch */
|
|
|
|
|
#define SND_SEQ_INSTR_ID_INTERWAVE "Interwave FFFF" /**< InterWave FFFF */
|
|
|
|
|
#define SND_SEQ_INSTR_ID_OPL2_3 "OPL2/3 FM" /**< OPL2/3 FM */
|
|
|
|
|
#define SND_SEQ_INSTR_ID_OPL4 "OPL4" /**< OPL4 */
|
2001-07-04 13:54:13 +00:00
|
|
|
|
|
|
|
|
/** instrument types */
|
2001-08-20 13:15:30 +00:00
|
|
|
#define SND_SEQ_INSTR_TYPE0_DLS1 (1<<0) /**< MIDI DLS v1 */
|
|
|
|
|
#define SND_SEQ_INSTR_TYPE0_DLS2 (1<<1) /**< MIDI DLS v2 */
|
|
|
|
|
#define SND_SEQ_INSTR_TYPE1_SIMPLE (1<<0) /**< Simple Wave */
|
|
|
|
|
#define SND_SEQ_INSTR_TYPE1_SOUNDFONT (1<<1) /**< EMU SoundFont */
|
|
|
|
|
#define SND_SEQ_INSTR_TYPE1_GUS_PATCH (1<<2) /**< Gravis UltraSound Patch */
|
|
|
|
|
#define SND_SEQ_INSTR_TYPE1_INTERWAVE (1<<3) /**< InterWave FFFF */
|
|
|
|
|
#define SND_SEQ_INSTR_TYPE2_OPL2_3 (1<<0) /**< Yamaha OPL2/3 FM */
|
|
|
|
|
#define SND_SEQ_INSTR_TYPE2_OPL4 (1<<1) /**< Yamaha OPL4 */
|
2001-07-04 13:54:13 +00:00
|
|
|
|
|
|
|
|
/** put commands */
|
2001-08-20 13:15:30 +00:00
|
|
|
#define SND_SEQ_INSTR_PUT_CMD_CREATE 0 /**< create a new layer */
|
|
|
|
|
#define SND_SEQ_INSTR_PUT_CMD_REPLACE 1 /**< replace the old layer with new one */
|
|
|
|
|
#define SND_SEQ_INSTR_PUT_CMD_MODIFY 2 /**< modify the existing layer */
|
|
|
|
|
#define SND_SEQ_INSTR_PUT_CMD_ADD 3 /**< add one to the existing layer */
|
|
|
|
|
#define SND_SEQ_INSTR_PUT_CMD_REMOVE 4 /**< remove the layer */
|
2001-07-04 13:54:13 +00:00
|
|
|
|
|
|
|
|
/** get commands */
|
2001-08-20 13:15:30 +00:00
|
|
|
#define SND_SEQ_INSTR_GET_CMD_FULL 0 /**< get the full data stream */
|
|
|
|
|
#define SND_SEQ_INSTR_GET_CMD_PARTIAL 1 /**< get the partial data stream */
|
|
|
|
|
|
|
|
|
|
/* query flags */
|
|
|
|
|
#define SND_SEQ_INSTR_QUERY_FOLLOW_ALIAS (1<<0)
|
2001-07-04 13:54:13 +00:00
|
|
|
|
|
|
|
|
/** free commands */
|
2001-08-20 13:15:30 +00:00
|
|
|
#define SND_SEQ_INSTR_FREE_CMD_ALL 0 /**< remove all matching instruments */
|
|
|
|
|
#define SND_SEQ_INSTR_FREE_CMD_PRIVATE 1 /**< remove only private instruments */
|
|
|
|
|
#define SND_SEQ_INSTR_FREE_CMD_CLUSTER 2 /**< remove only cluster instruments */
|
|
|
|
|
#define SND_SEQ_INSTR_FREE_CMD_SINGLE 3 /**< remove single instrument */
|
2001-07-04 13:54:13 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* FM instrument support
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
/** FM instrument data structure */
|
2000-09-01 16:24:12 +00:00
|
|
|
typedef void snd_instr_fm_t;
|
|
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
|
extern "C" {
|
|
|
|
|
#endif
|
|
|
|
|
|
2001-07-04 13:54:13 +00:00
|
|
|
int snd_instr_fm_convert_to_stream(snd_instr_fm_t *fm, const char *name, snd_instr_header_t **put, size_t *size);
|
|
|
|
|
int snd_instr_fm_convert_from_stream(snd_instr_header_t *data, size_t size, snd_instr_fm_t **fm);
|
2000-09-01 16:24:12 +00:00
|
|
|
int snd_instr_fm_free(snd_instr_fm_t *fm);
|
|
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
|
1999-07-10 08:52:04 +00:00
|
|
|
|
2001-07-04 13:54:13 +00:00
|
|
|
/**
|
|
|
|
|
* Simple Wave support
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
/** simple instrument data structure */
|
1999-07-10 08:52:04 +00:00
|
|
|
typedef void snd_instr_simple_t;
|
1999-05-23 16:49:10 +00:00
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
|
extern "C" {
|
|
|
|
|
#endif
|
|
|
|
|
|
2001-07-04 13:54:13 +00:00
|
|
|
int snd_instr_simple_convert_to_stream(snd_instr_simple_t *simple, const char *name, snd_instr_header_t **put, size_t *size);
|
|
|
|
|
int snd_instr_simple_convert_from_stream(snd_instr_header_t *data, size_t size, snd_instr_simple_t **simple);
|
1999-07-10 08:52:04 +00:00
|
|
|
int snd_instr_simple_free(snd_instr_simple_t *simple);
|
|
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
2001-07-04 13:54:13 +00:00
|
|
|
/**
|
|
|
|
|
* InterWave FFFF support
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
/** IW FFFF instrument data structure */
|
1999-07-10 08:52:04 +00:00
|
|
|
typedef void snd_instr_iwffff_t;
|
2001-07-04 13:54:13 +00:00
|
|
|
/** IW FFFF handler */
|
2000-11-20 20:10:46 +00:00
|
|
|
typedef struct _snd_iwffff_handle snd_iwffff_handle_t;
|
1999-07-10 08:52:04 +00:00
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
|
extern "C" {
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
int snd_instr_iwffff_open(snd_iwffff_handle_t **handle, const char *name_fff, const char *name_dta);
|
|
|
|
|
int snd_instr_iwffff_open_rom(snd_iwffff_handle_t **handle, int card, int bank, int file);
|
|
|
|
|
int snd_instr_iwffff_open_rom_file(snd_iwffff_handle_t **handle, const char *name, int bank, int file);
|
|
|
|
|
int snd_instr_iwffff_close(snd_iwffff_handle_t *handle);
|
|
|
|
|
int snd_instr_iwffff_load(snd_iwffff_handle_t *handle, int bank, int prg, snd_instr_iwffff_t **iwffff);
|
2001-07-04 13:54:13 +00:00
|
|
|
int snd_instr_iwffff_convert_to_stream(snd_instr_iwffff_t *iwffff, const char *name, snd_instr_header_t **data, size_t *size);
|
|
|
|
|
int snd_instr_iwffff_convert_from_stream(snd_instr_header_t *data, size_t size, snd_instr_iwffff_t **iwffff);
|
1999-05-23 16:49:10 +00:00
|
|
|
int snd_instr_iwffff_free(snd_instr_iwffff_t *iwffff);
|
|
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
|
}
|
|
|
|
|
#endif
|
2001-04-24 13:02:58 +00:00
|
|
|
|
|
|
|
|
/** \} */
|
|
|
|
|
|