18 #ifndef MT32EMU_C_TYPES_H 19 #define MT32EMU_C_TYPES_H 24 #include "../globals.h" 26 #define MT32EMU_C_ENUMERATIONS 27 #include "../Enumerations.h" 28 #undef MT32EMU_C_ENUMERATIONS 31 # define MT32EMU_C_CALL __cdecl 33 # define MT32EMU_C_CALL 36 typedef unsigned int mt32emu_bit32u;
37 typedef signed int mt32emu_bit32s;
38 typedef unsigned short int mt32emu_bit16u;
39 typedef signed short int mt32emu_bit16s;
40 typedef unsigned char mt32emu_bit8u;
41 typedef signed char mt32emu_bit8s;
43 typedef char mt32emu_sha1_digest[41];
46 MT32EMU_BOOL_FALSE, MT32EMU_BOOL_TRUE
52 MT32EMU_RC_ADDED_CONTROL_ROM = 1,
53 MT32EMU_RC_ADDED_PCM_ROM = 2,
54 MT32EMU_RC_ADDED_PARTIAL_CONTROL_ROM = 3,
55 MT32EMU_RC_ADDED_PARTIAL_PCM_ROM = 4,
58 MT32EMU_RC_ROM_NOT_IDENTIFIED = -1,
59 MT32EMU_RC_FILE_NOT_FOUND = -2,
60 MT32EMU_RC_FILE_NOT_LOADED = -3,
61 MT32EMU_RC_MISSING_ROMS = -4,
62 MT32EMU_RC_NOT_OPENED = -5,
63 MT32EMU_RC_QUEUE_FULL = -6,
64 MT32EMU_RC_ROMS_NOT_PAIRABLE = -7,
65 MT32EMU_RC_MACHINE_NOT_IDENTIFIED = -8,
68 MT32EMU_RC_FAILED = -100
69 } mt32emu_return_code;
72 typedef struct mt32emu_data *mt32emu_context;
73 typedef const struct mt32emu_data *mt32emu_const_context;
77 typedef enum mt32emu_analog_output_mode mt32emu_analog_output_mode;
78 typedef enum mt32emu_dac_input_mode mt32emu_dac_input_mode;
79 typedef enum mt32emu_midi_delay_mode mt32emu_midi_delay_mode;
80 typedef enum mt32emu_partial_state mt32emu_partial_state;
81 typedef enum mt32emu_samplerate_conversion_quality mt32emu_samplerate_conversion_quality;
82 typedef enum mt32emu_renderer_type mt32emu_renderer_type;
87 const char *control_rom_id;
88 const char *control_rom_description;
89 const char *control_rom_sha1_digest;
90 const char *pcm_rom_id;
91 const char *pcm_rom_description;
92 const char *pcm_rom_sha1_digest;
97 mt32emu_bit16s *nonReverbLeft;
98 mt32emu_bit16s *nonReverbRight;
99 mt32emu_bit16s *reverbDryLeft;
100 mt32emu_bit16s *reverbDryRight;
101 mt32emu_bit16s *reverbWetLeft;
102 mt32emu_bit16s *reverbWetRight;
107 float *nonReverbLeft;
108 float *nonReverbRight;
109 float *reverbDryLeft;
110 float *reverbDryRight;
111 float *reverbWetLeft;
112 float *reverbWetRight;
119 MT32EMU_REPORT_HANDLER_VERSION_0 = 0,
120 MT32EMU_REPORT_HANDLER_VERSION_1 = 1,
121 MT32EMU_REPORT_HANDLER_VERSION_CURRENT = MT32EMU_REPORT_HANDLER_VERSION_1
122 } mt32emu_report_handler_version;
126 MT32EMU_MIDI_RECEIVER_VERSION_0 = 0,
127 MT32EMU_MIDI_RECEIVER_VERSION_CURRENT = MT32EMU_MIDI_RECEIVER_VERSION_0
128 } mt32emu_midi_receiver_version;
132 MT32EMU_SERVICE_VERSION_0 = 0,
133 MT32EMU_SERVICE_VERSION_1 = 1,
134 MT32EMU_SERVICE_VERSION_2 = 2,
135 MT32EMU_SERVICE_VERSION_3 = 3,
136 MT32EMU_SERVICE_VERSION_4 = 4,
137 MT32EMU_SERVICE_VERSION_5 = 5,
138 MT32EMU_SERVICE_VERSION_6 = 6,
139 MT32EMU_SERVICE_VERSION_CURRENT = MT32EMU_SERVICE_VERSION_6
140 } mt32emu_service_version;
147 #define MT32EMU_REPORT_HANDLER_I_V0 \ 149 mt32emu_report_handler_version (MT32EMU_C_CALL *getVersionID)(mt32emu_report_handler_i i); \ 152 void (MT32EMU_C_CALL *printDebug)(void *instance_data, const char *fmt, va_list list); \ 154 void (MT32EMU_C_CALL *onErrorControlROM)(void *instance_data); \ 155 void (MT32EMU_C_CALL *onErrorPCMROM)(void *instance_data); \ 157 void (MT32EMU_C_CALL *showLCDMessage)(void *instance_data, const char *message); \ 159 void (MT32EMU_C_CALL *onMIDIMessagePlayed)(void *instance_data); \ 165 mt32emu_boolean (MT32EMU_C_CALL *onMIDIQueueOverflow)(void *instance_data); \ 170 void (MT32EMU_C_CALL *onMIDISystemRealtime)(void *instance_data, mt32emu_bit8u system_realtime); \ 172 void (MT32EMU_C_CALL *onDeviceReset)(void *instance_data); \ 173 void (MT32EMU_C_CALL *onDeviceReconfig)(void *instance_data); \ 175 void (MT32EMU_C_CALL *onNewReverbMode)(void *instance_data, mt32emu_bit8u mode); \ 176 void (MT32EMU_C_CALL *onNewReverbTime)(void *instance_data, mt32emu_bit8u time); \ 177 void (MT32EMU_C_CALL *onNewReverbLevel)(void *instance_data, mt32emu_bit8u level); \ 179 void (MT32EMU_C_CALL *onPolyStateChanged)(void *instance_data, mt32emu_bit8u part_num); \ 180 void (MT32EMU_C_CALL *onProgramChanged)(void *instance_data, mt32emu_bit8u part_num, const char *sound_group_name, const char *patch_name); 182 #define MT32EMU_REPORT_HANDLER_I_V1 \ 187 void (MT32EMU_C_CALL *onLCDStateUpdated)(void *instance_data); \ 189 void (MT32EMU_C_CALL *onMidiMessageLEDStateUpdated)(void *instance_data, mt32emu_boolean led_state); 192 MT32EMU_REPORT_HANDLER_I_V0
196 MT32EMU_REPORT_HANDLER_I_V0
197 MT32EMU_REPORT_HANDLER_I_V1
205 union mt32emu_report_handler_i {
210 #undef MT32EMU_REPORT_HANDLER_I_V0 211 #undef MT32EMU_REPORT_HANDLER_I_V1 220 mt32emu_midi_receiver_version (MT32EMU_C_CALL *getVersionID)(mt32emu_midi_receiver_i i);
223 void (MT32EMU_C_CALL *handleShortMessage)(
void *instance_data,
const mt32emu_bit32u message);
226 void (MT32EMU_C_CALL *handleSysex)(
void *instance_data,
const mt32emu_bit8u stream[],
const mt32emu_bit32u length);
229 void (MT32EMU_C_CALL *handleSystemRealtimeMessage)(
void *instance_data,
const mt32emu_bit8u realtime);
237 union mt32emu_midi_receiver_i {
252 #define MT32EMU_SERVICE_I_V0 \ 254 mt32emu_service_version (MT32EMU_C_CALL *getVersionID)(mt32emu_service_i i); \ 255 mt32emu_report_handler_version (MT32EMU_C_CALL *getSupportedReportHandlerVersionID)(void); \ 256 mt32emu_midi_receiver_version (MT32EMU_C_CALL *getSupportedMIDIReceiverVersionID)(void); \ 258 mt32emu_bit32u (MT32EMU_C_CALL *getLibraryVersionInt)(void); \ 259 const char *(MT32EMU_C_CALL *getLibraryVersionString)(void); \ 261 mt32emu_bit32u (MT32EMU_C_CALL *getStereoOutputSamplerate)(const mt32emu_analog_output_mode analog_output_mode); \ 263 mt32emu_context (MT32EMU_C_CALL *createContext)(mt32emu_report_handler_i report_handler, void *instance_data); \ 264 void (MT32EMU_C_CALL *freeContext)(mt32emu_context context); \ 265 mt32emu_return_code (MT32EMU_C_CALL *addROMData)(mt32emu_context context, const mt32emu_bit8u *data, size_t data_size, const mt32emu_sha1_digest *sha1_digest); \ 266 mt32emu_return_code (MT32EMU_C_CALL *addROMFile)(mt32emu_context context, const char *filename); \ 267 void (MT32EMU_C_CALL *getROMInfo)(mt32emu_const_context context, mt32emu_rom_info *rom_info); \ 268 void (MT32EMU_C_CALL *setPartialCount)(mt32emu_context context, const mt32emu_bit32u partial_count); \ 269 void (MT32EMU_C_CALL *setAnalogOutputMode)(mt32emu_context context, const mt32emu_analog_output_mode analog_output_mode); \ 270 mt32emu_return_code (MT32EMU_C_CALL *openSynth)(mt32emu_const_context context); \ 271 void (MT32EMU_C_CALL *closeSynth)(mt32emu_const_context context); \ 272 mt32emu_boolean (MT32EMU_C_CALL *isOpen)(mt32emu_const_context context); \ 273 mt32emu_bit32u (MT32EMU_C_CALL *getActualStereoOutputSamplerate)(mt32emu_const_context context); \ 274 void (MT32EMU_C_CALL *flushMIDIQueue)(mt32emu_const_context context); \ 275 mt32emu_bit32u (MT32EMU_C_CALL *setMIDIEventQueueSize)(mt32emu_const_context context, const mt32emu_bit32u queue_size); \ 276 void (MT32EMU_C_CALL *setMIDIReceiver)(mt32emu_context context, mt32emu_midi_receiver_i midi_receiver, void *instance_data); \ 278 void (MT32EMU_C_CALL *parseStream)(mt32emu_const_context context, const mt32emu_bit8u *stream, mt32emu_bit32u length); \ 279 void (MT32EMU_C_CALL *parseStream_At)(mt32emu_const_context context, const mt32emu_bit8u *stream, mt32emu_bit32u length, mt32emu_bit32u timestamp); \ 280 void (MT32EMU_C_CALL *playShortMessage)(mt32emu_const_context context, mt32emu_bit32u message); \ 281 void (MT32EMU_C_CALL *playShortMessageAt)(mt32emu_const_context context, mt32emu_bit32u message, mt32emu_bit32u timestamp); \ 282 mt32emu_return_code (MT32EMU_C_CALL *playMsg)(mt32emu_const_context context, mt32emu_bit32u msg); \ 283 mt32emu_return_code (MT32EMU_C_CALL *playSysex)(mt32emu_const_context context, const mt32emu_bit8u *sysex, mt32emu_bit32u len); \ 284 mt32emu_return_code (MT32EMU_C_CALL *playMsgAt)(mt32emu_const_context context, mt32emu_bit32u msg, mt32emu_bit32u timestamp); \ 285 mt32emu_return_code (MT32EMU_C_CALL *playSysexAt)(mt32emu_const_context context, const mt32emu_bit8u *sysex, mt32emu_bit32u len, mt32emu_bit32u timestamp); \ 287 void (MT32EMU_C_CALL *playMsgNow)(mt32emu_const_context context, mt32emu_bit32u msg); \ 288 void (MT32EMU_C_CALL *playMsgOnPart)(mt32emu_const_context context, mt32emu_bit8u part, mt32emu_bit8u code, mt32emu_bit8u note, mt32emu_bit8u velocity); \ 289 void (MT32EMU_C_CALL *playSysexNow)(mt32emu_const_context context, const mt32emu_bit8u *sysex, mt32emu_bit32u len); \ 290 void (MT32EMU_C_CALL *writeSysex)(mt32emu_const_context context, mt32emu_bit8u channel, const mt32emu_bit8u *sysex, mt32emu_bit32u len); \ 292 void (MT32EMU_C_CALL *setReverbEnabled)(mt32emu_const_context context, const mt32emu_boolean reverb_enabled); \ 293 mt32emu_boolean (MT32EMU_C_CALL *isReverbEnabled)(mt32emu_const_context context); \ 294 void (MT32EMU_C_CALL *setReverbOverridden)(mt32emu_const_context context, const mt32emu_boolean reverb_overridden); \ 295 mt32emu_boolean (MT32EMU_C_CALL *isReverbOverridden)(mt32emu_const_context context); \ 296 void (MT32EMU_C_CALL *setReverbCompatibilityMode)(mt32emu_const_context context, const mt32emu_boolean mt32_compatible_mode); \ 297 mt32emu_boolean (MT32EMU_C_CALL *isMT32ReverbCompatibilityMode)(mt32emu_const_context context); \ 298 mt32emu_boolean (MT32EMU_C_CALL *isDefaultReverbMT32Compatible)(mt32emu_const_context context); \ 300 void (MT32EMU_C_CALL *setDACInputMode)(mt32emu_const_context context, const mt32emu_dac_input_mode mode); \ 301 mt32emu_dac_input_mode (MT32EMU_C_CALL *getDACInputMode)(mt32emu_const_context context); \ 303 void (MT32EMU_C_CALL *setMIDIDelayMode)(mt32emu_const_context context, const mt32emu_midi_delay_mode mode); \ 304 mt32emu_midi_delay_mode (MT32EMU_C_CALL *getMIDIDelayMode)(mt32emu_const_context context); \ 306 void (MT32EMU_C_CALL *setOutputGain)(mt32emu_const_context context, float gain); \ 307 float (MT32EMU_C_CALL *getOutputGain)(mt32emu_const_context context); \ 308 void (MT32EMU_C_CALL *setReverbOutputGain)(mt32emu_const_context context, float gain); \ 309 float (MT32EMU_C_CALL *getReverbOutputGain)(mt32emu_const_context context); \ 311 void (MT32EMU_C_CALL *setReversedStereoEnabled)(mt32emu_const_context context, const mt32emu_boolean enabled); \ 312 mt32emu_boolean (MT32EMU_C_CALL *isReversedStereoEnabled)(mt32emu_const_context context); \ 314 void (MT32EMU_C_CALL *renderBit16s)(mt32emu_const_context context, mt32emu_bit16s *stream, mt32emu_bit32u len); \ 315 void (MT32EMU_C_CALL *renderFloat)(mt32emu_const_context context, float *stream, mt32emu_bit32u len); \ 316 void (MT32EMU_C_CALL *renderBit16sStreams)(mt32emu_const_context context, const mt32emu_dac_output_bit16s_streams *streams, mt32emu_bit32u len); \ 317 void (MT32EMU_C_CALL *renderFloatStreams)(mt32emu_const_context context, const mt32emu_dac_output_float_streams *streams, mt32emu_bit32u len); \ 319 mt32emu_boolean (MT32EMU_C_CALL *hasActivePartials)(mt32emu_const_context context); \ 320 mt32emu_boolean (MT32EMU_C_CALL *isActive)(mt32emu_const_context context); \ 321 mt32emu_bit32u (MT32EMU_C_CALL *getPartialCount)(mt32emu_const_context context); \ 322 mt32emu_bit32u (MT32EMU_C_CALL *getPartStates)(mt32emu_const_context context); \ 323 void (MT32EMU_C_CALL *getPartialStates)(mt32emu_const_context context, mt32emu_bit8u *partial_states); \ 324 mt32emu_bit32u (MT32EMU_C_CALL *getPlayingNotes)(mt32emu_const_context context, mt32emu_bit8u part_number, mt32emu_bit8u *keys, mt32emu_bit8u *velocities); \ 325 const char *(MT32EMU_C_CALL *getPatchName)(mt32emu_const_context context, mt32emu_bit8u part_number); \ 326 void (MT32EMU_C_CALL *readMemory)(mt32emu_const_context context, mt32emu_bit32u addr, mt32emu_bit32u len, mt32emu_bit8u *data); 328 #define MT32EMU_SERVICE_I_V1 \ 329 mt32emu_analog_output_mode (MT32EMU_C_CALL *getBestAnalogOutputMode)(const double target_samplerate); \ 330 void (MT32EMU_C_CALL *setStereoOutputSampleRate)(mt32emu_context context, const double samplerate); \ 331 void (MT32EMU_C_CALL *setSamplerateConversionQuality)(mt32emu_context context, const mt32emu_samplerate_conversion_quality quality); \ 332 void (MT32EMU_C_CALL *selectRendererType)(mt32emu_context context, mt32emu_renderer_type renderer_type); \ 333 mt32emu_renderer_type (MT32EMU_C_CALL *getSelectedRendererType)(mt32emu_context context); \ 334 mt32emu_bit32u (MT32EMU_C_CALL *convertOutputToSynthTimestamp)(mt32emu_const_context context, mt32emu_bit32u output_timestamp); \ 335 mt32emu_bit32u (MT32EMU_C_CALL *convertSynthToOutputTimestamp)(mt32emu_const_context context, mt32emu_bit32u synth_timestamp); 337 #define MT32EMU_SERVICE_I_V2 \ 338 mt32emu_bit32u (MT32EMU_C_CALL *getInternalRenderedSampleCount)(mt32emu_const_context context); \ 339 void (MT32EMU_C_CALL *setNiceAmpRampEnabled)(mt32emu_const_context context, const mt32emu_boolean enabled); \ 340 mt32emu_boolean (MT32EMU_C_CALL *isNiceAmpRampEnabled)(mt32emu_const_context context); 342 #define MT32EMU_SERVICE_I_V3 \ 343 void (MT32EMU_C_CALL *setNicePanningEnabled)(mt32emu_const_context context, const mt32emu_boolean enabled); \ 344 mt32emu_boolean (MT32EMU_C_CALL *isNicePanningEnabled)(mt32emu_const_context context); \ 345 void (MT32EMU_C_CALL *setNicePartialMixingEnabled)(mt32emu_const_context context, const mt32emu_boolean enabled); \ 346 mt32emu_boolean (MT32EMU_C_CALL *isNicePartialMixingEnabled)(mt32emu_const_context context); \ 347 void (MT32EMU_C_CALL *preallocateReverbMemory)(mt32emu_const_context context, const mt32emu_boolean enabled); \ 348 void (MT32EMU_C_CALL *configureMIDIEventQueueSysexStorage)(mt32emu_const_context context, const mt32emu_bit32u storage_buffer_size); 350 #define MT32EMU_SERVICE_I_V4 \ 351 size_t (MT32EMU_C_CALL *getMachineIDs)(const char **machine_ids, size_t machine_ids_size); \ 352 size_t (MT32EMU_C_CALL *getROMIDs)(const char **rom_ids, size_t rom_ids_size, const char *machine_id); \ 353 mt32emu_return_code (MT32EMU_C_CALL *identifyROMData)(mt32emu_rom_info *rom_info, const mt32emu_bit8u *data, size_t data_size, const char *machine_id); \ 354 mt32emu_return_code (MT32EMU_C_CALL *identifyROMFile)(mt32emu_rom_info *rom_info, const char *filename, const char *machine_id); \ 356 mt32emu_return_code (MT32EMU_C_CALL *mergeAndAddROMData)(mt32emu_context context, const mt32emu_bit8u *part1_data, size_t part1_data_size, const mt32emu_sha1_digest *part1_sha1_digest, const mt32emu_bit8u *part2_data, size_t part2_data_size, const mt32emu_sha1_digest *part2_sha1_digest); \ 357 mt32emu_return_code (MT32EMU_C_CALL *mergeAndAddROMFiles)(mt32emu_context context, const char *part1_filename, const char *part2_filename); \ 358 mt32emu_return_code (MT32EMU_C_CALL *addMachineROMFile)(mt32emu_context context, const char *machine_id, const char *filename); 360 #define MT32EMU_SERVICE_I_V5 \ 361 mt32emu_boolean (MT32EMU_C_CALL *getDisplayState)(mt32emu_const_context context, char *target_buffer, const mt32emu_boolean narrow_lcd); \ 362 void (MT32EMU_C_CALL *setMainDisplayMode)(mt32emu_const_context context); \ 363 void (MT32EMU_C_CALL *setDisplayCompatibility)(mt32emu_const_context context, mt32emu_boolean old_mt32_compatibility_enabled); \ 364 mt32emu_boolean (MT32EMU_C_CALL *isDisplayOldMT32Compatible)(mt32emu_const_context context); \ 365 mt32emu_boolean (MT32EMU_C_CALL *isDefaultDisplayOldMT32Compatible)(mt32emu_const_context context); \ 366 void (MT32EMU_C_CALL *setPartVolumeOverride)(mt32emu_const_context context, mt32emu_bit8u part_number, mt32emu_bit8u volume_override); \ 367 mt32emu_bit8u (MT32EMU_C_CALL *getPartVolumeOverride)(mt32emu_const_context context, mt32emu_bit8u part_number); 369 #define MT32EMU_SERVICE_I_V6 \ 370 mt32emu_boolean (MT32EMU_C_CALL *getSoundGroupName)(mt32emu_const_context context, char *sound_group_name, mt32emu_bit8u timbre_group, mt32emu_bit8u timbre_number); \ 371 mt32emu_boolean (MT32EMU_C_CALL *getSoundName)(mt32emu_const_context context, char *sound_name, mt32emu_bit8u timbre_group, mt32emu_bit8u timbre_number); 427 union mt32emu_service_i {
437 #undef MT32EMU_SERVICE_I_V0 438 #undef MT32EMU_SERVICE_I_V1 439 #undef MT32EMU_SERVICE_I_V2 440 #undef MT32EMU_SERVICE_I_V3 441 #undef MT32EMU_SERVICE_I_V4 442 #undef MT32EMU_SERVICE_I_V5 443 #undef MT32EMU_SERVICE_I_V6 Definition: c_types.h:106
Definition: c_types.h:377
Definition: c_types.h:191
Definition: c_types.h:388
Definition: c_types.h:382
Definition: c_types.h:395
Definition: c_types.h:403
Definition: c_types.h:205
Definition: c_types.h:427
Definition: c_types.h:218
Definition: c_types.h:195
Definition: c_types.h:373
Definition: c_types.h:412
Definition: c_types.h:237