KORG microX utility.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

225 lines
6.1 KiB

/*
* kmxtool - KORG microX utility
* Copyright (C) 2012,2013 Damien Goutte-Gattat
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef ICP20121016_MICROX_H
#define ICP20121016_MICROX_H
#include <midi.h>
/* Identifiers. */
#define KORG_ID 0x42
#define MICROX_ID 0x7A
#define MICROX_SUB_ID 0x09
/* Error codes. */
#define KMX_OK 0
#define KMX_IO_ERROR -1
#define KMX_INVALID_REPLY -2
#define KMX_NOT_KORG -3
#define KMX_NOT_MICROX -4
#define KMX_INVALID_QUERY -10
#define KMX_BUFFER_TOO_SMALL -11
#define KMX_ERROR_CODE -100
#define KMX_DEST_MEM_PROTECTED KMX_ERROR_CODE
#define KMX_DEST_PRG_MISSING KMX_ERROR_CODE - 1
#define KMX_WRONG_MODE KMX_ERROR_CODE - 2
#define KMX_MEM_OVERFLOW KMX_ERROR_CODE - 3
#define KMX_OTHER_ERROR KMX_ERROR_CODE - 40
/* Numbers of memories. */
#define MICROX_N_PROG_BANK 5
#define MICROX_N_COMB_BANK 3
#define MICROX_BANK_SIZE 128
#define MICROX_N_PROGRAM MICROX_N_PROG_BANK * MICROX_BANK_SIZE
#define MICROX_N_COMBINATION MICROX_N_COMB_BANK * MICROX_BANK_SIZE
#define MICROX_N_MULTI 128
#define MICROX_N_DRUMKIT 40
#define MICROX_N_ARPEGGIO 251
#define MICROX_N_EXTSET 64
/* Size of memories. */
#define MICROX_PROGRAM_SIZE 444
#define MICROX_COMBINATION_SIZE 544
#define MICROX_MULTI_SIZE 1220
#define MICROX_GLOBAL_SIZE 850
#define MICROX_DRUMKIT_SIZE 4112
#define MICROX_ARPEGGIO_SIZE 320
#define MICROX_EXTSET_SIZE 40
#define MICROX_ALLDATA_SIZE \
(MICROX_GLOBAL_SIZE + \
(MICROX_N_DRUMKIT * MICROX_DRUMKIT_SIZE) + \
(MICROX_N_ARPEGGIO * MICROX_ARPEGGIO_SIZE) + \
(MICROX_N_COMBINATION * MICROX_COMBINATION_SIZE) + \
(MICROX_N_PROGRAM * MICROX_PROGRAM_SIZE) + \
(MICROX_N_MULTI * MICROX_MULTI_SIZE) + \
(MICROX_N_EXTSET * MICROX_EXTSET_SIZE))
enum kmx_microx_data_type
{
PROGRAM_DATA = 0,
COMBINATION_DATA,
MULTI_DATA,
DRUMKIT_DATA,
ARPEGGIO_DATA,
EXTSET_DATA
};
struct kmx_microx_version
{
unsigned char major;
unsigned char minor;
unsigned char release;
unsigned char build;
};
enum kmx_microx_mode
{
COMBI_PLAY = 0x00,
COMBI_EDIT,
PROG_PLAY,
PROG_EDIT,
MULTI,
GLOBAL = 0x06,
DEMO = 0x7F
};
enum kmx_microx_clock
{
INTERNAL = 0x00,
EXT_MIDI,
EXT_USB,
AUTO
};
struct kmx_microx_status
{
unsigned char global_channel;
enum kmx_microx_mode active_mode;
struct {
unsigned char local_control;
enum kmx_microx_clock clock_source;
unsigned char bank_map;
unsigned char memorize_mode;
unsigned char rec_ext_rt_cmd;
unsigned char prgm_change;
unsigned char bank_change;
unsigned char comb_change;
unsigned char ctrl_change;
unsigned char aftertouch;
unsigned char note_filter;
struct {
unsigned char program;
unsigned char bank;
unsigned char multi;
unsigned char drum;
unsigned char arpeggio;
unsigned char ext_ctrl;
} protected_memory;
} global;
struct {
unsigned char current_bank;
unsigned char current_program;
} program;
struct {
unsigned char current_bank;
unsigned char current_combination;
} combination;
struct {
unsigned char current_multi;
unsigned char control_track;
} multi;
struct {
unsigned char enabled;
unsigned char current;
} ext_ctrl;
};
#define KMX_MICROX_DUMP_ALL -1
/** Represents a parameter dump/load request. */
struct kmx_microx_dump
{
/** The type of memory slot. */
enum kmx_microx_data_type type;
/** If non-zero, represents a load request. */
char load;
/** The bank letter.
* Represents the bank letter of a dump request
* (only for programs and combinations); if set to
* KMX_MICROX_DUMP_ALL, indicates to dump all
* programs or combinations in all banks. */
char bank;
/** The program number.
* Represents the program number (counting from
* zero); if set to KMX_MICROX_DUMP_ALL, indicates
* to dump all slots of the given type or of the
* given bank (for programs and combinations). */
short program;
};
#ifdef __cpluscplus
extern "C" {
#endif
int
kmx_microx_identify(midi_io_t *, struct kmx_microx_version *);
int
kmx_microx_query_status(midi_io_t *, struct kmx_microx_status *);
const char *
kmx_microx_error(midi_io_t *, int);
int
kmx_microx_parse_dump_request(const char *,
struct kmx_microx_dump *);
size_t
kmx_microx_get_dump_size(struct kmx_microx_dump *);
int
kmx_microx_read_dump(midi_io_t *,
unsigned char,
unsigned char *,
size_t);
int
kmx_microx_dump(midi_io_t *,
struct kmx_microx_dump *,
unsigned char *,
size_t);
int
kmx_microx_load(midi_io_t *,
struct kmx_microx_dump *,
unsigned char *,
size_t );
#ifdef __cplusplus
}
#endif
#endif /* !ICP20121016_MICROX_H */