Instrument Interface


Defines

#define snd_instr_header_alloca(ptr)
#define SND_SEQ_INSTR_ATYPE_DATA   0
#define SND_SEQ_INSTR_ATYPE_ALIAS   1
#define SND_SEQ_INSTR_ID_DLS1   "DLS1"
#define SND_SEQ_INSTR_ID_DLS2   "DLS2"
#define SND_SEQ_INSTR_ID_SIMPLE   "Simple Wave"
#define SND_SEQ_INSTR_ID_SOUNDFONT   "SoundFont"
#define SND_SEQ_INSTR_ID_GUS_PATCH   "GUS Patch"
#define SND_SEQ_INSTR_ID_INTERWAVE   "Interwave FFFF"
#define SND_SEQ_INSTR_ID_OPL2_3   "OPL2/3 FM"
#define SND_SEQ_INSTR_ID_OPL4   "OPL4"
#define SND_SEQ_INSTR_TYPE0_DLS1   (1<<0)
#define SND_SEQ_INSTR_TYPE0_DLS2   (1<<1)
#define SND_SEQ_INSTR_TYPE1_SIMPLE   (1<<0)
#define SND_SEQ_INSTR_TYPE1_SOUNDFONT   (1<<1)
#define SND_SEQ_INSTR_TYPE1_GUS_PATCH   (1<<2)
#define SND_SEQ_INSTR_TYPE1_INTERWAVE   (1<<3)
#define SND_SEQ_INSTR_TYPE2_OPL2_3   (1<<0)
#define SND_SEQ_INSTR_TYPE2_OPL4   (1<<1)
#define SND_SEQ_INSTR_PUT_CMD_CREATE   0
#define SND_SEQ_INSTR_PUT_CMD_REPLACE   1
#define SND_SEQ_INSTR_PUT_CMD_MODIFY   2
#define SND_SEQ_INSTR_PUT_CMD_ADD   3
#define SND_SEQ_INSTR_PUT_CMD_REMOVE   4
#define SND_SEQ_INSTR_GET_CMD_FULL   0
#define SND_SEQ_INSTR_GET_CMD_PARTIAL   1
#define SND_SEQ_INSTR_QUERY_FOLLOW_ALIAS   (1<<0)
#define SND_SEQ_INSTR_FREE_CMD_ALL   0
#define SND_SEQ_INSTR_FREE_CMD_PRIVATE   1
#define SND_SEQ_INSTR_FREE_CMD_CLUSTER   2
#define SND_SEQ_INSTR_FREE_CMD_SINGLE   3

Typedefs

typedef _snd_instr_header snd_instr_header_t
typedef void snd_instr_fm_t
typedef void snd_instr_simple_t
typedef void snd_instr_iwffff_t
typedef _snd_iwffff_handle snd_iwffff_handle_t

Functions

size_t snd_instr_header_sizeof (void)
 get size of snd_instr_header_t
int snd_instr_header_malloc (snd_instr_header_t **ptr, size_t len)
 allocate an empty snd_instr_header_t using standard malloc
void snd_instr_header_free (snd_instr_header_t *ptr)
 frees a previously allocated snd_instr_header_t
void snd_instr_header_copy (snd_instr_header_t *dst, const snd_instr_header_t *src)
 copy one snd_instr_header_t to another
const snd_seq_instr_tsnd_instr_header_get_id (const snd_instr_header_t *info)
 Get the instrument id of an instr_header container.
snd_seq_instr_cluster_t snd_instr_header_get_cluster (const snd_instr_header_t *info)
 Get the cluster id of an instr_header container.
unsigned int snd_instr_header_get_cmd (const snd_instr_header_t *info)
 Get the command of an instr_header container.
size_t snd_instr_header_get_len (const snd_instr_header_t *info)
 Get the length of extra data of an instr_header container.
const char * snd_instr_header_get_name (const snd_instr_header_t *info)
 Get the data name of an instr_header container.
int snd_instr_header_get_type (const snd_instr_header_t *info)
 Get the data type of an instr_header container.
const char * snd_instr_header_get_format (const snd_instr_header_t *info)
 Get the data format of an instr_header container.
const snd_seq_instr_tsnd_instr_header_get_alias (const snd_instr_header_t *info)
 Get the data alias of an instr_header container.
void * snd_instr_header_get_data (const snd_instr_header_t *info)
 Get the extra data pointer of an instr_header container.
int snd_instr_header_get_follow_alias (const snd_instr_header_t *info)
 Get the flag to follow alias of an instr_header container.
void snd_instr_header_set_id (snd_instr_header_t *info, const snd_seq_instr_t *id)
 Set the instrument id of an instr_header container.
void snd_instr_header_set_cluster (snd_instr_header_t *info, snd_seq_instr_cluster_t cluster)
 Set the cluster id of an instr_header container.
void snd_instr_header_set_cmd (snd_instr_header_t *info, unsigned int cmd)
 Set the command of an instr_header container.
void snd_instr_header_set_len (snd_instr_header_t *info, size_t len)
 Set the length of extra data of an instr_header container.
void snd_instr_header_set_name (snd_instr_header_t *info, const char *name)
 Set the data name of an instr_header container.
void snd_instr_header_set_type (snd_instr_header_t *info, int type)
 Set the data type of an instr_header container.
void snd_instr_header_set_format (snd_instr_header_t *info, const char *format)
 Set the data format of an instr_header container.
void snd_instr_header_set_alias (snd_instr_header_t *info, const snd_seq_instr_t *instr)
 Set the data alias id of an instr_header container.
void snd_instr_header_set_follow_alias (snd_instr_header_t *info, int val)
 Set the flag to follow alias of an instr_header container.
int snd_instr_fm_convert_to_stream (snd_instr_fm_t *fm, const char *name, snd_instr_header_t **put, size_t *size)
 Convert the FM instrument to byte stream.
int snd_instr_fm_convert_from_stream (snd_instr_header_t *data, size_t size, snd_instr_fm_t **fm)
 Convert the byte stream to FM instrument.
int snd_instr_fm_free (snd_instr_fm_t *fm)
 Free the FM instrument handle.
int snd_instr_simple_convert_to_stream (snd_instr_simple_t *simple, const char *name, snd_instr_header_t **put, size_t *size)
 Convert the simple instrument to byte stream.
int snd_instr_simple_convert_from_stream (snd_instr_header_t *data, size_t size, snd_instr_simple_t **simple)
 Convert the byte stream to simple instrument.
int snd_instr_simple_free (snd_instr_simple_t *simple)
 Free simple instrument.
int snd_instr_iwffff_open (snd_iwffff_handle_t **handle, const char *name_fff, const char *name_dta)
 Open IWFFFF files.
int snd_instr_iwffff_open_rom (snd_iwffff_handle_t **handle, int card, int bank, int file)
 Open IWFFFF ROM.
int snd_instr_iwffff_open_rom_file (snd_iwffff_handle_t **handle, const char *name, int bank, int file)
 Open IWFFFF ROM file.
int snd_instr_iwffff_close (snd_iwffff_handle_t *handle)
 Close and free IWFFFF handle.
int snd_instr_iwffff_load (snd_iwffff_handle_t *handle, int bank, int prg, snd_instr_iwffff_t **iwffff)
 Load IWFFFF instrument.
int snd_instr_iwffff_convert_to_stream (snd_instr_iwffff_t *iwffff, const char *name, snd_instr_header_t **data, size_t *size)
 Convert the IWFFFF instrument to byte stream.
int snd_instr_iwffff_convert_from_stream (snd_instr_header_t *data, size_t size, snd_instr_iwffff_t **iwffff)
 Convert the byte stream to IWFFFF instrument.
int snd_instr_iwffff_free (snd_instr_iwffff_t *iwffff)
 Free IWFFFF instrument.

Detailed Description

The Instrument Interface.

Define Documentation

#define snd_instr_header_alloca ( ptr   ) 

Value:

do {\
        assert(ptr);\
        *ptr = (snd_instr_header_t *)alloca(snd_instr_header_sizeof());\
        memset(*ptr, 0, snd_instr_header_sizeof());\
} while (0)
allocate instrument header on stack

#define SND_SEQ_INSTR_ATYPE_ALIAS   1

instrument alias

#define SND_SEQ_INSTR_ATYPE_DATA   0

instrument types instrument data

#define SND_SEQ_INSTR_FREE_CMD_ALL   0

free commands remove all matching instruments

#define SND_SEQ_INSTR_FREE_CMD_CLUSTER   2

remove only cluster instruments

#define SND_SEQ_INSTR_FREE_CMD_PRIVATE   1

remove only private instruments

#define SND_SEQ_INSTR_FREE_CMD_SINGLE   3

remove single instrument

#define SND_SEQ_INSTR_GET_CMD_FULL   0

get commands get the full data stream

#define SND_SEQ_INSTR_GET_CMD_PARTIAL   1

get the partial data stream

#define SND_SEQ_INSTR_ID_DLS1   "DLS1"

instrument ASCII identifiers DLS1

#define SND_SEQ_INSTR_ID_DLS2   "DLS2"

DLS2

#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

#define SND_SEQ_INSTR_ID_SIMPLE   "Simple Wave"

Simple Wave

#define SND_SEQ_INSTR_ID_SOUNDFONT   "SoundFont"

SoundFont

#define SND_SEQ_INSTR_PUT_CMD_ADD   3

add one to the existing layer

#define SND_SEQ_INSTR_PUT_CMD_CREATE   0

put commands create a new layer

#define SND_SEQ_INSTR_PUT_CMD_MODIFY   2

modify the existing layer

#define SND_SEQ_INSTR_PUT_CMD_REMOVE   4

remove the layer

#define SND_SEQ_INSTR_PUT_CMD_REPLACE   1

replace the old layer with new one

#define SND_SEQ_INSTR_QUERY_FOLLOW_ALIAS   (1<<0)

follow alias to get the instrument data

#define SND_SEQ_INSTR_TYPE0_DLS1   (1<<0)

instrument types MIDI DLS v1

#define SND_SEQ_INSTR_TYPE0_DLS2   (1<<1)

MIDI DLS v2

#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_TYPE1_SIMPLE   (1<<0)

Simple Wave

#define SND_SEQ_INSTR_TYPE1_SOUNDFONT   (1<<1)

EMU SoundFont

#define SND_SEQ_INSTR_TYPE2_OPL2_3   (1<<0)

Yamaha OPL2/3 FM

#define SND_SEQ_INSTR_TYPE2_OPL4   (1<<1)

Yamaha OPL4


Typedef Documentation

typedef void snd_instr_fm_t

FM instrument data structure

typedef struct _snd_instr_header snd_instr_header_t

container for sequencer instrument header

typedef void snd_instr_iwffff_t

IW FFFF instrument data structure

typedef void snd_instr_simple_t

simple instrument data structure

typedef struct _snd_iwffff_handle snd_iwffff_handle_t

IW FFFF handler


Function Documentation

int snd_instr_fm_convert_from_stream ( snd_instr_header_t __data,
size_t  size,
snd_instr_fm_t **  simple 
)

Convert the byte stream to FM instrument.

Parameters:
__data Input - byte stream containing FM instrument definition
size Input - size of byte stream
simple Result - allocated FM instrument handle
Returns:
0 on success otherwise a negative error code

int snd_instr_fm_convert_to_stream ( snd_instr_fm_t fm,
const char *  name,
snd_instr_header_t **  __data,
size_t *  __size 
)

Convert the FM instrument to byte stream.

Parameters:
fm FM instrument handle
name FM instrument name
__data Result - allocated byte stream
__size Result - size of allocated byte stream
Returns:
0 on success otherwise a negative error code

int snd_instr_fm_free ( snd_instr_fm_t fm  ) 

Free the FM instrument handle.

Parameters:
fm FM instrument handle
Returns:
0 on success otherwise a negative error code

void snd_instr_header_copy ( snd_instr_header_t dst,
const snd_instr_header_t src 
)

copy one snd_instr_header_t to another

Parameters:
dst pointer to destination
src pointer to source

void snd_instr_header_free ( snd_instr_header_t obj  ) 

frees a previously allocated snd_instr_header_t

Parameters:
obj poitner to object to free

const snd_seq_instr_t* snd_instr_header_get_alias ( const snd_instr_header_t info  ) 

Get the data alias of an instr_header container.

Parameters:
info instr_header container
Returns:
the data alias id

snd_seq_instr_cluster_t snd_instr_header_get_cluster ( const snd_instr_header_t info  ) 

Get the cluster id of an instr_header container.

Parameters:
info instr_header container
Returns:
cluster id

unsigned int snd_instr_header_get_cmd ( const snd_instr_header_t info  ) 

Get the command of an instr_header container.

Parameters:
info instr_header container
Returns:
command type

void* snd_instr_header_get_data ( const snd_instr_header_t info  ) 

Get the extra data pointer of an instr_header container.

Parameters:
info instr_header container
Returns:
the extra data pointer

int snd_instr_header_get_follow_alias ( const snd_instr_header_t info  ) 

Get the flag to follow alias of an instr_header container.

Parameters:
info instr_header container
Returns:
1 if follow alias

const char* snd_instr_header_get_format ( const snd_instr_header_t info  ) 

Get the data format of an instr_header container.

Parameters:
info instr_header container
Returns:
the data format string

const snd_seq_instr_t* snd_instr_header_get_id ( const snd_instr_header_t info  ) 

Get the instrument id of an instr_header container.

Parameters:
info instr_header container
Returns:
instrument id pointer

size_t snd_instr_header_get_len ( const snd_instr_header_t info  ) 

Get the length of extra data of an instr_header container.

Parameters:
info instr_header container
Returns:
the length in bytes

const char* snd_instr_header_get_name ( const snd_instr_header_t info  ) 

Get the data name of an instr_header container.

Parameters:
info instr_header container
Returns:
the name string

int snd_instr_header_get_type ( const snd_instr_header_t info  ) 

Get the data type of an instr_header container.

Parameters:
info instr_header container
Returns:
the data type

int snd_instr_header_malloc ( snd_instr_header_t **  ptr,
size_t  len 
)

allocate an empty snd_instr_header_t using standard malloc

Parameters:
ptr returned pointer
len additional data length
Returns:
0 on success otherwise negative error code

void snd_instr_header_set_alias ( snd_instr_header_t info,
const snd_seq_instr_t instr 
)

Set the data alias id of an instr_header container.

Parameters:
info instr_header container
instr alias instrument id

void snd_instr_header_set_cluster ( snd_instr_header_t info,
snd_seq_instr_cluster_t  cluster 
)

Set the cluster id of an instr_header container.

Parameters:
info instr_header container
cluster cluster id

void snd_instr_header_set_cmd ( snd_instr_header_t info,
unsigned int  cmd 
)

Set the command of an instr_header container.

Parameters:
info instr_header container
cmd command type

void snd_instr_header_set_follow_alias ( snd_instr_header_t info,
int  val 
)

Set the flag to follow alias of an instr_header container.

Parameters:
info instr_header container
val 1 if follow alias

void snd_instr_header_set_format ( snd_instr_header_t info,
const char *  format 
)

Set the data format of an instr_header container.

Parameters:
info instr_header container
format the data format string

void snd_instr_header_set_id ( snd_instr_header_t info,
const snd_seq_instr_t id 
)

Set the instrument id of an instr_header container.

Parameters:
info instr_header container
id instrument id pointer

void snd_instr_header_set_len ( snd_instr_header_t info,
size_t  len 
)

Set the length of extra data of an instr_header container.

Parameters:
info instr_header container
len size of extra data in bytes

void snd_instr_header_set_name ( snd_instr_header_t info,
const char *  name 
)

Set the data name of an instr_header container.

Parameters:
info instr_header container
name the name string

void snd_instr_header_set_type ( snd_instr_header_t info,
int  type 
)

Set the data type of an instr_header container.

Parameters:
info instr_header container
type the data type

size_t snd_instr_header_sizeof ( void   ) 

get size of snd_instr_header_t

Returns:
size in bytes

int snd_instr_iwffff_close ( snd_iwffff_handle_t handle  ) 

Close and free IWFFFF handle.

Parameters:
handle IWFFFF handle
Returns:
0 on success otherwise a negative error code

int snd_instr_iwffff_convert_from_stream ( snd_instr_header_t data,
size_t  size,
snd_instr_iwffff_t **  iwffff 
)

Convert the byte stream to IWFFFF instrument.

Parameters:
data Input - byte stream
size Input - size of byte stream
iwffff Result - allocated IWFFFF instrument handle
Returns:
0 on success otherwise a negative error code

int snd_instr_iwffff_convert_to_stream ( snd_instr_iwffff_t iwffff,
const char *  name,
snd_instr_header_t **  __data,
size_t *  __size 
)

Convert the IWFFFF instrument to byte stream.

Parameters:
iwffff IWFFFF instrument handle
name instrument name
__data Result - allocated byte stream
__size Result - size of allocated byte stream
Returns:
0 on success otherwise a negative error code

int snd_instr_iwffff_free ( snd_instr_iwffff_t __instr  ) 

Free IWFFFF instrument.

Parameters:
__instr IWFFFF instrument handle
Returns:
0 on success otherwise a negative error code

int snd_instr_iwffff_load ( snd_iwffff_handle_t iwf,
int  bank,
int  prg,
snd_instr_iwffff_t **  __iwffff 
)

Load IWFFFF instrument.

Parameters:
iwf IWFFFF handle
bank program bank number
prg program number
__iwffff allocated IWFFFF instrument
Returns:
0 on success otherwise a negative error code

int snd_instr_iwffff_open ( snd_iwffff_handle_t **  handle,
const char *  name_fff,
const char *  name_dat 
)

Open IWFFFF files.

Parameters:
handle IWFFFF handle
name_fff filename of an FFF (header) file
name_dat filename of an DAT (data) file
Returns:
0 on success otherwise a negative error code

int snd_instr_iwffff_open_rom ( snd_iwffff_handle_t **  handle,
int  card,
int  bank,
int  file 
)

Open IWFFFF ROM.

Parameters:
handle IWFFFF handle
card card number
bank ROM bank number (0-3)
file ROM file number
Returns:
0 on success otherwise a negative errno code
Opens file in bank in the ROM image of card card, and writes a handle pointer into *handle.

int snd_instr_iwffff_open_rom_file ( snd_iwffff_handle_t **  handle,
const char *  name,
int  bank,
int  file 
)

Open IWFFFF ROM file.

Parameters:
handle IWFFFF handle
name IWFFFF ROM filename
bank ROM bank number (0-3)
file ROM file number
Returns:
0 on success otherwise a negative error code

int snd_instr_simple_convert_from_stream ( snd_instr_header_t __data,
size_t  size,
snd_instr_simple_t **  simple 
)

Convert the byte stream to simple instrument.

Parameters:
__data byte stream
size size of byte stream
simple Result - simple instrument handle
Returns:
0 on success otherwise a negative error code

int snd_instr_simple_convert_to_stream ( snd_instr_simple_t simple,
const char *  name,
snd_instr_header_t **  __data,
size_t *  __size 
)

Convert the simple instrument to byte stream.

Parameters:
simple Simple instrument handle
name Simple instrument name
__data Result - allocated byte stream
__size Result - size of allocated byte stream
Returns:
0 on success otherwise a negative error code

int snd_instr_simple_free ( snd_instr_simple_t simple  ) 

Free simple instrument.

Parameters:
simple Simple instrument handle
Returns:
0 on success otherwise a negative error code


Generated on Tue Apr 10 08:32:01 2007 for ALSA project - the C library reference by  doxygen 1.5.1