Update internal MUNT to version 2.7.0
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/* Copyright (C) 2003, 2004, 2005, 2006, 2008, 2009 Dean Beeler, Jerome Fisher
|
||||
* Copyright (C) 2011-2017 Dean Beeler, Jerome Fisher, Sergey V. Mikayev
|
||||
* Copyright (C) 2011-2022 Dean Beeler, Jerome Fisher, Sergey V. Mikayev
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* Copyright (C) 2003, 2004, 2005, 2006, 2008, 2009 Dean Beeler, Jerome Fisher
|
||||
* Copyright (C) 2011-2017 Dean Beeler, Jerome Fisher, Sergey V. Mikayev
|
||||
* Copyright (C) 2011-2022 Dean Beeler, Jerome Fisher, Sergey V. Mikayev
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* Copyright (C) 2003, 2004, 2005, 2006, 2008, 2009 Dean Beeler, Jerome Fisher
|
||||
* Copyright (C) 2011-2017 Dean Beeler, Jerome Fisher, Sergey V. Mikayev
|
||||
* Copyright (C) 2011-2022 Dean Beeler, Jerome Fisher, Sergey V. Mikayev
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
@@ -24,7 +24,9 @@
|
||||
#include "c_types.h"
|
||||
|
||||
#undef MT32EMU_EXPORT
|
||||
#undef MT32EMU_EXPORT_V
|
||||
#define MT32EMU_EXPORT MT32EMU_EXPORT_ATTRIBUTE
|
||||
#define MT32EMU_EXPORT_V(symbol_version_tag) MT32EMU_EXPORT
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
@@ -35,24 +37,28 @@ extern "C" {
|
||||
/* === Interface handling === */
|
||||
|
||||
/** Returns mt32emu_service_i interface. */
|
||||
MT32EMU_EXPORT mt32emu_service_i mt32emu_get_service_i();
|
||||
MT32EMU_EXPORT mt32emu_service_i MT32EMU_C_CALL mt32emu_get_service_i(void);
|
||||
|
||||
#if MT32EMU_EXPORTS_TYPE == 2
|
||||
#undef MT32EMU_EXPORT
|
||||
#undef MT32EMU_EXPORT_V
|
||||
#define MT32EMU_EXPORT
|
||||
#define MT32EMU_EXPORT_V(symbol_version_tag) MT32EMU_EXPORT
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Returns the version ID of mt32emu_report_handler_i interface the library has been compiled with.
|
||||
* This allows a client to fall-back gracefully instead of silently not receiving expected event reports.
|
||||
*/
|
||||
MT32EMU_EXPORT mt32emu_report_handler_version mt32emu_get_supported_report_handler_version();
|
||||
MT32EMU_EXPORT mt32emu_report_handler_version MT32EMU_C_CALL mt32emu_get_supported_report_handler_version(void);
|
||||
|
||||
/**
|
||||
* Returns the version ID of mt32emu_midi_receiver_version_i interface the library has been compiled with.
|
||||
* This allows a client to fall-back gracefully instead of silently not receiving expected MIDI messages.
|
||||
*/
|
||||
MT32EMU_EXPORT mt32emu_midi_receiver_version mt32emu_get_supported_midi_receiver_version();
|
||||
MT32EMU_EXPORT mt32emu_midi_receiver_version MT32EMU_C_CALL mt32emu_get_supported_midi_receiver_version(void);
|
||||
|
||||
/* === Utility === */
|
||||
|
||||
/**
|
||||
* Returns library version as an integer in format: 0x00MMmmpp, where:
|
||||
@@ -60,67 +66,149 @@ MT32EMU_EXPORT mt32emu_midi_receiver_version mt32emu_get_supported_midi_receiver
|
||||
* mm - minor version number
|
||||
* pp - patch number
|
||||
*/
|
||||
MT32EMU_EXPORT mt32emu_bit32u mt32emu_get_library_version_int();
|
||||
MT32EMU_EXPORT mt32emu_bit32u MT32EMU_C_CALL mt32emu_get_library_version_int(void);
|
||||
|
||||
/**
|
||||
* Returns library version as a C-string in format: "MAJOR.MINOR.PATCH".
|
||||
*/
|
||||
MT32EMU_EXPORT const char *mt32emu_get_library_version_string();
|
||||
MT32EMU_EXPORT const char * MT32EMU_C_CALL mt32emu_get_library_version_string(void);
|
||||
|
||||
/**
|
||||
* Returns output sample rate used in emulation of stereo analog circuitry of hardware units for particular analog_output_mode.
|
||||
* See comment for mt32emu_analog_output_mode.
|
||||
*/
|
||||
MT32EMU_EXPORT mt32emu_bit32u mt32emu_get_stereo_output_samplerate(const mt32emu_analog_output_mode analog_output_mode);
|
||||
MT32EMU_EXPORT mt32emu_bit32u MT32EMU_C_CALL mt32emu_get_stereo_output_samplerate(const mt32emu_analog_output_mode analog_output_mode);
|
||||
|
||||
/**
|
||||
* Returns the value of analog_output_mode for which the output signal may retain its full frequency spectrum
|
||||
* at the sample rate specified by the target_samplerate argument.
|
||||
* See comment for mt32emu_analog_output_mode.
|
||||
*/
|
||||
MT32EMU_EXPORT mt32emu_analog_output_mode mt32emu_get_best_analog_output_mode(const double target_samplerate);
|
||||
MT32EMU_EXPORT mt32emu_analog_output_mode MT32EMU_C_CALL mt32emu_get_best_analog_output_mode(const double target_samplerate);
|
||||
|
||||
/* === ROM handling === */
|
||||
|
||||
/**
|
||||
* Retrieves a list of identifiers (as C-strings) of supported machines. Argument machine_ids points to the array of size
|
||||
* machine_ids_size to be filled.
|
||||
* Returns the number of identifiers available for retrieval. The size of the target array to be allocated can be found
|
||||
* by passing NULL in argument machine_ids; argument machine_ids_size is ignored in this case.
|
||||
*/
|
||||
MT32EMU_EXPORT_V(2.5) size_t MT32EMU_C_CALL mt32emu_get_machine_ids(const char **machine_ids, size_t machine_ids_size);
|
||||
/**
|
||||
* Retrieves a list of identifiers (as C-strings) of supported ROM images. Argument rom_ids points to the array of size
|
||||
* rom_ids_size to be filled. Optional argument machine_id can be used to indicate a specific machine to retrieve ROM identifiers
|
||||
* for; if NULL, identifiers of all the ROM images supported by the emulation engine are retrieved.
|
||||
* Returns the number of ROM identifiers available for retrieval. The size of the target array to be allocated can be found
|
||||
* by passing NULL in argument rom_ids; argument rom_ids_size is ignored in this case. If argument machine_id contains
|
||||
* an unrecognised value, 0 is returned.
|
||||
*/
|
||||
MT32EMU_EXPORT_V(2.5) size_t MT32EMU_C_CALL mt32emu_get_rom_ids(const char **rom_ids, size_t rom_ids_size, const char *machine_id);
|
||||
|
||||
/**
|
||||
* Identifies a ROM image the provided data array contains by its SHA1 digest. Optional argument machine_id can be used to indicate
|
||||
* a specific machine to identify the ROM image for; if NULL, the ROM image is identified for any supported machine.
|
||||
* A mt32emu_rom_info structure supplied in argument rom_info is filled in accordance with the provided ROM image; unused fields
|
||||
* are filled with NULLs. If the content of the ROM image is not identified successfully (e.g. when the ROM image is incompatible
|
||||
* with the specified machine), all fields of rom_info are filled with NULLs.
|
||||
* Returns MT32EMU_RC_OK upon success or a negative error code otherwise.
|
||||
*/
|
||||
MT32EMU_EXPORT_V(2.5) mt32emu_return_code MT32EMU_C_CALL mt32emu_identify_rom_data(mt32emu_rom_info *rom_info, const mt32emu_bit8u *data, size_t data_size, const char *machine_id);
|
||||
/**
|
||||
* Loads the content of the file specified by argument filename and identifies a ROM image the file contains by its SHA1 digest.
|
||||
* Optional argument machine_id can be used to indicate a specific machine to identify the ROM image for; if NULL, the ROM image
|
||||
* is identified for any supported machine.
|
||||
* A mt32emu_rom_info structure supplied in argument rom_info is filled in accordance with the provided ROM image; unused fields
|
||||
* are filled with NULLs. If the content of the file is not identified successfully (e.g. when the ROM image is incompatible
|
||||
* with the specified machine), all fields of rom_info are filled with NULLs.
|
||||
* Returns MT32EMU_RC_OK upon success or a negative error code otherwise.
|
||||
*/
|
||||
MT32EMU_EXPORT_V(2.5) mt32emu_return_code MT32EMU_C_CALL mt32emu_identify_rom_file(mt32emu_rom_info *rom_info, const char *filename, const char *machine_id);
|
||||
|
||||
/* == Context-dependent functions == */
|
||||
|
||||
/** Initialises a new emulation context and installs custom report handler if non-NULL. */
|
||||
MT32EMU_EXPORT mt32emu_context mt32emu_create_context(mt32emu_report_handler_i report_handler, void *instance_data);
|
||||
MT32EMU_EXPORT mt32emu_context MT32EMU_C_CALL mt32emu_create_context(mt32emu_report_handler_i report_handler, void *instance_data);
|
||||
|
||||
/** Closes and destroys emulation context. */
|
||||
MT32EMU_EXPORT void mt32emu_free_context(mt32emu_context context);
|
||||
MT32EMU_EXPORT void MT32EMU_C_CALL mt32emu_free_context(mt32emu_context context);
|
||||
|
||||
/**
|
||||
* Adds new ROM identified by its SHA1 digest to the emulation context replacing previously added ROM of the same type if any.
|
||||
* Argument sha1_digest can be NULL, in this case the digest will be computed using the actual ROM data.
|
||||
* Adds a new full ROM data image identified by its SHA1 digest to the emulation context replacing previously added ROM of the same
|
||||
* type if any. Argument sha1_digest can be NULL, in this case the digest will be computed using the actual ROM data.
|
||||
* If sha1_digest is set to non-NULL, it is assumed being correct and will not be recomputed.
|
||||
* This function doesn't immediately change the state of already opened synth. Newly added ROM will take effect upon next call of mt32emu_open_synth().
|
||||
* The provided data array is NOT copied and used directly for efficiency. The caller should not deallocate it while the emulation
|
||||
* context is referring to the ROM data.
|
||||
* This function doesn't immediately change the state of already opened synth. Newly added ROM will take effect upon next call of
|
||||
* mt32emu_open_synth().
|
||||
* Returns positive value upon success.
|
||||
*/
|
||||
MT32EMU_EXPORT mt32emu_return_code mt32emu_add_rom_data(mt32emu_context context, const mt32emu_bit8u *data, size_t data_size, const mt32emu_sha1_digest *sha1_digest);
|
||||
MT32EMU_EXPORT mt32emu_return_code MT32EMU_C_CALL mt32emu_add_rom_data(mt32emu_context context, const mt32emu_bit8u *data, size_t data_size, const mt32emu_sha1_digest *sha1_digest);
|
||||
|
||||
/**
|
||||
* Loads a ROM file, identify it by SHA1 digest, and adds it to the emulation context replacing previously added ROM of the same type if any.
|
||||
* This function doesn't immediately change the state of already opened synth. Newly added ROM will take effect upon next call of mt32emu_open_synth().
|
||||
* Loads a ROM file that contains a full ROM data image, identifies it by the SHA1 digest, and adds it to the emulation context
|
||||
* replacing previously added ROM of the same type if any.
|
||||
* This function doesn't immediately change the state of already opened synth. Newly added ROM will take effect upon next call of
|
||||
* mt32emu_open_synth().
|
||||
* Returns positive value upon success.
|
||||
*/
|
||||
MT32EMU_EXPORT mt32emu_return_code mt32emu_add_rom_file(mt32emu_context context, const char *filename);
|
||||
MT32EMU_EXPORT mt32emu_return_code MT32EMU_C_CALL mt32emu_add_rom_file(mt32emu_context context, const char *filename);
|
||||
|
||||
/**
|
||||
* Merges a pair of compatible ROM data image parts into a full image and adds it to the emulation context replacing previously
|
||||
* added ROM of the same type if any. Each partial image is identified by its SHA1 digest. Arguments partN_sha1_digest can be NULL,
|
||||
* in this case the digest will be computed using the actual ROM data. If a non-NULL SHA1 value is provided, it is assumed being
|
||||
* correct and will not be recomputed. The provided data arrays may be deallocated as soon as the function completes.
|
||||
* This function doesn't immediately change the state of already opened synth. Newly added ROM will take effect upon next call of
|
||||
* mt32emu_open_synth().
|
||||
* Returns positive value upon success.
|
||||
*/
|
||||
MT32EMU_EXPORT_V(2.5) mt32emu_return_code MT32EMU_C_CALL mt32emu_merge_and_add_rom_data(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);
|
||||
|
||||
/**
|
||||
* Loads a pair of files that contains compatible parts of a full ROM image, identifies them by the SHA1 digest, merges these
|
||||
* parts into a full ROM image and adds it to the emulation context replacing previously added ROM of the same type if any.
|
||||
* This function doesn't immediately change the state of already opened synth. Newly added ROM will take effect upon next call of
|
||||
* mt32emu_open_synth().
|
||||
* Returns positive value upon success.
|
||||
*/
|
||||
MT32EMU_EXPORT_V(2.5) mt32emu_return_code MT32EMU_C_CALL mt32emu_merge_and_add_rom_files(mt32emu_context context, const char *part1_filename, const char *part2_filename);
|
||||
|
||||
/**
|
||||
* Loads a file that contains a ROM image of a specific machine, identifies it by the SHA1 digest, and adds it to the emulation
|
||||
* context. The ROM image can only be identified successfully if it is compatible with the specified machine.
|
||||
* Full and partial ROM images are supported and handled according to the following rules:
|
||||
* - a file with any compatible ROM image is added if none (of the same type) exists in the emulation context;
|
||||
* - a file with any compatible ROM image replaces any image of the same type that is incompatible with the specified machine;
|
||||
* - a file with a full ROM image replaces the previously added partial ROM of the same type;
|
||||
* - a file with a partial ROM image is merged with the previously added ROM image if pairable;
|
||||
* - otherwise, the file is ignored.
|
||||
* The described behaviour allows the caller application to traverse a directory with ROM files attempting to add each one in turn.
|
||||
* As soon as both the full control and the full PCM ROM images are added and / or merged, the iteration can be stopped.
|
||||
* This function doesn't immediately change the state of already opened synth. Newly added ROMs will take effect upon next call of
|
||||
* mt32emu_open_synth().
|
||||
* Returns a positive value in case changes have been made, MT32EMU_RC_OK if the file has been ignored or a negative error code
|
||||
* upon failure.
|
||||
*/
|
||||
MT32EMU_EXPORT_V(2.5) mt32emu_return_code MT32EMU_C_CALL mt32emu_add_machine_rom_file(mt32emu_context context, const char *machine_id, const char *filename);
|
||||
|
||||
/**
|
||||
* Fills in mt32emu_rom_info structure with identifiers and descriptions of control and PCM ROM files identified and added to the synth context.
|
||||
* If one of the ROM files is not loaded and identified yet, NULL is returned in the corresponding fields of the mt32emu_rom_info structure.
|
||||
*/
|
||||
MT32EMU_EXPORT void mt32emu_get_rom_info(mt32emu_const_context context, mt32emu_rom_info *rom_info);
|
||||
MT32EMU_EXPORT void MT32EMU_C_CALL mt32emu_get_rom_info(mt32emu_const_context context, mt32emu_rom_info *rom_info);
|
||||
|
||||
/**
|
||||
* Allows to override the default maximum number of partials playing simultaneously within the emulation session.
|
||||
* This function doesn't immediately change the state of already opened synth. Newly set value will take effect upon next call of mt32emu_open_synth().
|
||||
*/
|
||||
MT32EMU_EXPORT void mt32emu_set_partial_count(mt32emu_context context, const mt32emu_bit32u partial_count);
|
||||
MT32EMU_EXPORT void MT32EMU_C_CALL mt32emu_set_partial_count(mt32emu_context context, const mt32emu_bit32u partial_count);
|
||||
|
||||
/**
|
||||
* Allows to override the default mode for emulation of analogue circuitry of the hardware units within the emulation session.
|
||||
* This function doesn't immediately change the state of already opened synth. Newly set value will take effect upon next call of mt32emu_open_synth().
|
||||
*/
|
||||
MT32EMU_EXPORT void mt32emu_set_analog_output_mode(mt32emu_context context, const mt32emu_analog_output_mode analog_output_mode);
|
||||
MT32EMU_EXPORT void MT32EMU_C_CALL mt32emu_set_analog_output_mode(mt32emu_context context, const mt32emu_analog_output_mode analog_output_mode);
|
||||
|
||||
/**
|
||||
* Allows to convert the synthesiser output to any desired sample rate. The samplerate conversion
|
||||
@@ -131,7 +219,7 @@ MT32EMU_EXPORT void mt32emu_set_analog_output_mode(mt32emu_context context, cons
|
||||
* This function doesn't immediately change the state of already opened synth.
|
||||
* Newly set value will take effect upon next call of mt32emu_open_synth().
|
||||
*/
|
||||
MT32EMU_EXPORT void mt32emu_set_stereo_output_samplerate(mt32emu_context context, const double samplerate);
|
||||
MT32EMU_EXPORT void MT32EMU_C_CALL mt32emu_set_stereo_output_samplerate(mt32emu_context context, const double samplerate);
|
||||
|
||||
/**
|
||||
* Several samplerate conversion quality options are provided which allow to trade-off the conversion speed vs.
|
||||
@@ -140,66 +228,79 @@ MT32EMU_EXPORT void mt32emu_set_stereo_output_samplerate(mt32emu_context context
|
||||
* This function doesn't immediately change the state of already opened synth.
|
||||
* Newly set value will take effect upon next call of mt32emu_open_synth().
|
||||
*/
|
||||
MT32EMU_EXPORT void mt32emu_set_samplerate_conversion_quality(mt32emu_context context, const mt32emu_samplerate_conversion_quality quality);
|
||||
MT32EMU_EXPORT void MT32EMU_C_CALL mt32emu_set_samplerate_conversion_quality(mt32emu_context context, const mt32emu_samplerate_conversion_quality quality);
|
||||
|
||||
/**
|
||||
* Selects new type of the wave generator and renderer to be used during subsequent calls to mt32emu_open_synth().
|
||||
* By default, MT32EMU_RT_BIT16S is selected.
|
||||
* See mt32emu_renderer_type for details.
|
||||
*/
|
||||
MT32EMU_EXPORT void mt32emu_select_renderer_type(mt32emu_context context, const mt32emu_renderer_type renderer_type);
|
||||
MT32EMU_EXPORT void MT32EMU_C_CALL mt32emu_select_renderer_type(mt32emu_context context, const mt32emu_renderer_type renderer_type);
|
||||
|
||||
/**
|
||||
* Returns previously selected type of the wave generator and renderer.
|
||||
* See mt32emu_renderer_type for details.
|
||||
*/
|
||||
MT32EMU_EXPORT mt32emu_renderer_type mt32emu_get_selected_renderer_type(mt32emu_context context);
|
||||
MT32EMU_EXPORT mt32emu_renderer_type MT32EMU_C_CALL mt32emu_get_selected_renderer_type(mt32emu_context context);
|
||||
|
||||
/**
|
||||
* Prepares the emulation context to receive MIDI messages and produce output audio data using aforehand added set of ROMs,
|
||||
* and optionally set the maximum partial count and the analog output mode.
|
||||
* Returns MT32EMU_RC_OK upon success.
|
||||
*/
|
||||
MT32EMU_EXPORT mt32emu_return_code mt32emu_open_synth(mt32emu_const_context context);
|
||||
MT32EMU_EXPORT mt32emu_return_code MT32EMU_C_CALL mt32emu_open_synth(mt32emu_const_context context);
|
||||
|
||||
/** Closes the emulation context freeing allocated resources. Added ROMs remain unaffected and ready for reuse. */
|
||||
MT32EMU_EXPORT void mt32emu_close_synth(mt32emu_const_context context);
|
||||
MT32EMU_EXPORT void MT32EMU_C_CALL mt32emu_close_synth(mt32emu_const_context context);
|
||||
|
||||
/** Returns true if the synth is in completely initialized state, otherwise returns false. */
|
||||
MT32EMU_EXPORT mt32emu_boolean mt32emu_is_open(mt32emu_const_context context);
|
||||
MT32EMU_EXPORT mt32emu_boolean MT32EMU_C_CALL mt32emu_is_open(mt32emu_const_context context);
|
||||
|
||||
/**
|
||||
* Returns actual sample rate of the fully processed output stereo signal.
|
||||
* If samplerate conversion is used (i.e. when mt32emu_set_stereo_output_samplerate() has been invoked with a non-zero value),
|
||||
* the returned value is the desired output samplerate rounded down to the closest integer.
|
||||
* Otherwise, the output samplerate is choosen depending on the emulation mode of stereo analog circuitry of hardware units.
|
||||
* Otherwise, the output samplerate is chosen depending on the emulation mode of stereo analog circuitry of hardware units.
|
||||
* See comment for mt32emu_analog_output_mode for more info.
|
||||
*/
|
||||
MT32EMU_EXPORT mt32emu_bit32u mt32emu_get_actual_stereo_output_samplerate(mt32emu_const_context context);
|
||||
MT32EMU_EXPORT mt32emu_bit32u MT32EMU_C_CALL mt32emu_get_actual_stereo_output_samplerate(mt32emu_const_context context);
|
||||
|
||||
/**
|
||||
* Returns the number of samples produced at the internal synth sample rate (32000 Hz)
|
||||
* that correspond to the given number of samples at the output sample rate.
|
||||
* Intended to facilitate audio time synchronisation.
|
||||
*/
|
||||
MT32EMU_EXPORT mt32emu_bit32u mt32emu_convert_output_to_synth_timestamp(mt32emu_const_context context, mt32emu_bit32u output_timestamp);
|
||||
MT32EMU_EXPORT mt32emu_bit32u MT32EMU_C_CALL mt32emu_convert_output_to_synth_timestamp(mt32emu_const_context context, mt32emu_bit32u output_timestamp);
|
||||
|
||||
/**
|
||||
* Returns the number of samples produced at the output sample rate
|
||||
* that correspond to the given number of samples at the internal synth sample rate (32000 Hz).
|
||||
* Intended to facilitate audio time synchronisation.
|
||||
*/
|
||||
MT32EMU_EXPORT mt32emu_bit32u mt32emu_convert_synth_to_output_timestamp(mt32emu_const_context context, mt32emu_bit32u synth_timestamp);
|
||||
MT32EMU_EXPORT mt32emu_bit32u MT32EMU_C_CALL mt32emu_convert_synth_to_output_timestamp(mt32emu_const_context context, mt32emu_bit32u synth_timestamp);
|
||||
|
||||
/** All the enqueued events are processed by the synth immediately. */
|
||||
MT32EMU_EXPORT void mt32emu_flush_midi_queue(mt32emu_const_context context);
|
||||
MT32EMU_EXPORT void MT32EMU_C_CALL mt32emu_flush_midi_queue(mt32emu_const_context context);
|
||||
|
||||
/**
|
||||
* Sets size of the internal MIDI event queue. The queue size is set to the minimum power of 2 that is greater or equal to the size specified.
|
||||
* The queue is flushed before reallocation.
|
||||
* Returns the actual queue size being used.
|
||||
*/
|
||||
MT32EMU_EXPORT mt32emu_bit32u mt32emu_set_midi_event_queue_size(mt32emu_const_context context, const mt32emu_bit32u queue_size);
|
||||
MT32EMU_EXPORT mt32emu_bit32u MT32EMU_C_CALL mt32emu_set_midi_event_queue_size(mt32emu_const_context context, const mt32emu_bit32u queue_size);
|
||||
|
||||
/**
|
||||
* Configures the SysEx storage of the internal MIDI event queue.
|
||||
* Supplying 0 in the storage_buffer_size argument makes the SysEx data stored
|
||||
* in multiple dynamically allocated buffers per MIDI event. These buffers are only disposed
|
||||
* when a new MIDI event replaces the SysEx event in the queue, thus never on the rendering thread.
|
||||
* This is the default behaviour.
|
||||
* In contrast, when a positive value is specified, SysEx data will be stored in a single preallocated buffer,
|
||||
* which makes this kind of storage safe for use in a realtime thread. Additionally, the space retained
|
||||
* by a SysEx event, that has been processed and thus is no longer necessary, is disposed instantly.
|
||||
* Note, the queue is flushed and recreated in the process so that its size remains intact.
|
||||
*/
|
||||
MT32EMU_EXPORT void MT32EMU_C_CALL mt32emu_configure_midi_event_queue_sysex_storage(mt32emu_const_context context, const mt32emu_bit32u storage_buffer_size);
|
||||
|
||||
/**
|
||||
* Installs custom MIDI receiver object intended for receiving MIDI messages generated by MIDI stream parser.
|
||||
@@ -207,13 +308,13 @@ MT32EMU_EXPORT mt32emu_bit32u mt32emu_set_midi_event_queue_size(mt32emu_const_co
|
||||
* By default, parsed short MIDI messages and System Exclusive messages are sent to the synth input MIDI queue.
|
||||
* This function allows to override default behaviour. If midi_receiver argument is set to NULL, the default behaviour is restored.
|
||||
*/
|
||||
MT32EMU_EXPORT void mt32emu_set_midi_receiver(mt32emu_context context, mt32emu_midi_receiver_i midi_receiver, void *instance_data);
|
||||
MT32EMU_EXPORT void MT32EMU_C_CALL mt32emu_set_midi_receiver(mt32emu_context context, mt32emu_midi_receiver_i midi_receiver, void *instance_data);
|
||||
|
||||
/**
|
||||
* Returns current value of the global counter of samples rendered since the synth was created (at the native sample rate 32000 Hz).
|
||||
* This method helps to compute accurate timestamp of a MIDI message to use with the methods below.
|
||||
*/
|
||||
MT32EMU_EXPORT mt32emu_bit32u mt32emu_get_internal_rendered_sample_count(mt32emu_const_context context);
|
||||
MT32EMU_EXPORT mt32emu_bit32u MT32EMU_C_CALL mt32emu_get_internal_rendered_sample_count(mt32emu_const_context context);
|
||||
|
||||
/* Enqueues a MIDI event for subsequent playback.
|
||||
* The MIDI event will be processed not before the specified timestamp.
|
||||
@@ -230,7 +331,7 @@ MT32EMU_EXPORT mt32emu_bit32u mt32emu_get_internal_rendered_sample_count(mt32emu
|
||||
* When a System Realtime MIDI message is parsed, onMIDISystemRealtime callback is invoked.
|
||||
* NOTE: the total length of a SysEx message being fragmented shall not exceed MT32EMU_MAX_STREAM_BUFFER_SIZE (32768 bytes).
|
||||
*/
|
||||
MT32EMU_EXPORT void mt32emu_parse_stream(mt32emu_const_context context, const mt32emu_bit8u *stream, mt32emu_bit32u length);
|
||||
MT32EMU_EXPORT void MT32EMU_C_CALL mt32emu_parse_stream(mt32emu_const_context context, const mt32emu_bit8u *stream, mt32emu_bit32u length);
|
||||
|
||||
/**
|
||||
* Parses a block of raw MIDI bytes and enqueues parsed MIDI messages to play at specified time.
|
||||
@@ -238,31 +339,31 @@ MT32EMU_EXPORT void mt32emu_parse_stream(mt32emu_const_context context, const mt
|
||||
* When a System Realtime MIDI message is parsed, onMIDISystemRealtime callback is invoked.
|
||||
* NOTE: the total length of a SysEx message being fragmented shall not exceed MT32EMU_MAX_STREAM_BUFFER_SIZE (32768 bytes).
|
||||
*/
|
||||
MT32EMU_EXPORT void mt32emu_parse_stream_at(mt32emu_const_context context, const mt32emu_bit8u *stream, mt32emu_bit32u length, mt32emu_bit32u timestamp);
|
||||
MT32EMU_EXPORT void MT32EMU_C_CALL mt32emu_parse_stream_at(mt32emu_const_context context, const mt32emu_bit8u *stream, mt32emu_bit32u length, mt32emu_bit32u timestamp);
|
||||
|
||||
/**
|
||||
* Enqueues a single mt32emu_bit32u-encoded short MIDI message with full processing ASAP.
|
||||
* The short MIDI message may contain no status byte, the running status is used in this case.
|
||||
* When the argument is a System Realtime MIDI message, onMIDISystemRealtime callback is invoked.
|
||||
*/
|
||||
MT32EMU_EXPORT void mt32emu_play_short_message(mt32emu_const_context context, mt32emu_bit32u message);
|
||||
MT32EMU_EXPORT void MT32EMU_C_CALL mt32emu_play_short_message(mt32emu_const_context context, mt32emu_bit32u message);
|
||||
|
||||
/**
|
||||
* Enqueues a single mt32emu_bit32u-encoded short MIDI message to play at specified time with full processing.
|
||||
* The short MIDI message may contain no status byte, the running status is used in this case.
|
||||
* When the argument is a System Realtime MIDI message, onMIDISystemRealtime callback is invoked.
|
||||
*/
|
||||
MT32EMU_EXPORT void mt32emu_play_short_message_at(mt32emu_const_context context, mt32emu_bit32u message, mt32emu_bit32u timestamp);
|
||||
MT32EMU_EXPORT void MT32EMU_C_CALL mt32emu_play_short_message_at(mt32emu_const_context context, mt32emu_bit32u message, mt32emu_bit32u timestamp);
|
||||
|
||||
/** Enqueues a single short MIDI message to be processed ASAP. The message must contain a status byte. */
|
||||
MT32EMU_EXPORT mt32emu_return_code mt32emu_play_msg(mt32emu_const_context context, mt32emu_bit32u msg);
|
||||
MT32EMU_EXPORT mt32emu_return_code MT32EMU_C_CALL mt32emu_play_msg(mt32emu_const_context context, mt32emu_bit32u msg);
|
||||
/** Enqueues a single well formed System Exclusive MIDI message to be processed ASAP. */
|
||||
MT32EMU_EXPORT mt32emu_return_code mt32emu_play_sysex(mt32emu_const_context context, const mt32emu_bit8u *sysex, mt32emu_bit32u len);
|
||||
MT32EMU_EXPORT mt32emu_return_code MT32EMU_C_CALL mt32emu_play_sysex(mt32emu_const_context context, const mt32emu_bit8u *sysex, mt32emu_bit32u len);
|
||||
|
||||
/** Enqueues a single short MIDI message to play at specified time. The message must contain a status byte. */
|
||||
MT32EMU_EXPORT mt32emu_return_code mt32emu_play_msg_at(mt32emu_const_context context, mt32emu_bit32u msg, mt32emu_bit32u timestamp);
|
||||
MT32EMU_EXPORT mt32emu_return_code MT32EMU_C_CALL mt32emu_play_msg_at(mt32emu_const_context context, mt32emu_bit32u msg, mt32emu_bit32u timestamp);
|
||||
/** Enqueues a single well formed System Exclusive MIDI message to play at specified time. */
|
||||
MT32EMU_EXPORT mt32emu_return_code mt32emu_play_sysex_at(mt32emu_const_context context, const mt32emu_bit8u *sysex, mt32emu_bit32u len, mt32emu_bit32u timestamp);
|
||||
MT32EMU_EXPORT mt32emu_return_code MT32EMU_C_CALL mt32emu_play_sysex_at(mt32emu_const_context context, const mt32emu_bit8u *sysex, mt32emu_bit32u len, mt32emu_bit32u timestamp);
|
||||
|
||||
/* WARNING:
|
||||
* The methods below don't ensure minimum 1-sample delay between sequential MIDI events,
|
||||
@@ -274,66 +375,73 @@ MT32EMU_EXPORT mt32emu_return_code mt32emu_play_sysex_at(mt32emu_const_context c
|
||||
* Sends a short MIDI message to the synth for immediate playback. The message must contain a status byte.
|
||||
* See the WARNING above.
|
||||
*/
|
||||
MT32EMU_EXPORT void mt32emu_play_msg_now(mt32emu_const_context context, mt32emu_bit32u msg);
|
||||
MT32EMU_EXPORT void MT32EMU_C_CALL mt32emu_play_msg_now(mt32emu_const_context context, mt32emu_bit32u msg);
|
||||
/**
|
||||
* Sends unpacked short MIDI message to the synth for immediate playback. The message must contain a status byte.
|
||||
* See the WARNING above.
|
||||
*/
|
||||
MT32EMU_EXPORT void mt32emu_play_msg_on_part(mt32emu_const_context context, mt32emu_bit8u part, mt32emu_bit8u code, mt32emu_bit8u note, mt32emu_bit8u velocity);
|
||||
MT32EMU_EXPORT void MT32EMU_C_CALL mt32emu_play_msg_on_part(mt32emu_const_context context, mt32emu_bit8u part, mt32emu_bit8u code, mt32emu_bit8u note, mt32emu_bit8u velocity);
|
||||
|
||||
/**
|
||||
* Sends a single well formed System Exclusive MIDI message for immediate processing. The length is in bytes.
|
||||
* See the WARNING above.
|
||||
*/
|
||||
MT32EMU_EXPORT void mt32emu_play_sysex_now(mt32emu_const_context context, const mt32emu_bit8u *sysex, mt32emu_bit32u len);
|
||||
MT32EMU_EXPORT void MT32EMU_C_CALL mt32emu_play_sysex_now(mt32emu_const_context context, const mt32emu_bit8u *sysex, mt32emu_bit32u len);
|
||||
/**
|
||||
* Sends inner body of a System Exclusive MIDI message for direct processing. The length is in bytes.
|
||||
* See the WARNING above.
|
||||
*/
|
||||
MT32EMU_EXPORT void mt32emu_write_sysex(mt32emu_const_context context, mt32emu_bit8u channel, const mt32emu_bit8u *sysex, mt32emu_bit32u len);
|
||||
MT32EMU_EXPORT void MT32EMU_C_CALL mt32emu_write_sysex(mt32emu_const_context context, mt32emu_bit8u channel, const mt32emu_bit8u *sysex, mt32emu_bit32u len);
|
||||
|
||||
/** Allows to disable wet reverb output altogether. */
|
||||
MT32EMU_EXPORT void mt32emu_set_reverb_enabled(mt32emu_const_context context, const mt32emu_boolean reverb_enabled);
|
||||
MT32EMU_EXPORT void MT32EMU_C_CALL mt32emu_set_reverb_enabled(mt32emu_const_context context, const mt32emu_boolean reverb_enabled);
|
||||
/** Returns whether wet reverb output is enabled. */
|
||||
MT32EMU_EXPORT mt32emu_boolean mt32emu_is_reverb_enabled(mt32emu_const_context context);
|
||||
MT32EMU_EXPORT mt32emu_boolean MT32EMU_C_CALL mt32emu_is_reverb_enabled(mt32emu_const_context context);
|
||||
/**
|
||||
* Sets override reverb mode. In this mode, emulation ignores sysexes (or the related part of them) which control the reverb parameters.
|
||||
* This mode is in effect until it is turned off. When the synth is re-opened, the override mode is unchanged but the state
|
||||
* of the reverb model is reset to default.
|
||||
*/
|
||||
MT32EMU_EXPORT void mt32emu_set_reverb_overridden(mt32emu_const_context context, const mt32emu_boolean reverb_overridden);
|
||||
MT32EMU_EXPORT void MT32EMU_C_CALL mt32emu_set_reverb_overridden(mt32emu_const_context context, const mt32emu_boolean reverb_overridden);
|
||||
/** Returns whether reverb settings are overridden. */
|
||||
MT32EMU_EXPORT mt32emu_boolean mt32emu_is_reverb_overridden(mt32emu_const_context context);
|
||||
MT32EMU_EXPORT mt32emu_boolean MT32EMU_C_CALL mt32emu_is_reverb_overridden(mt32emu_const_context context);
|
||||
/**
|
||||
* Forces reverb model compatibility mode. By default, the compatibility mode corresponds to the used control ROM version.
|
||||
* Invoking this method with the argument set to true forces emulation of old MT-32 reverb circuit.
|
||||
* When the argument is false, emulation of the reverb circuit used in new generation of MT-32 compatible modules is enforced
|
||||
* (these include CM-32L and LAPC-I).
|
||||
*/
|
||||
MT32EMU_EXPORT void mt32emu_set_reverb_compatibility_mode(mt32emu_const_context context, const mt32emu_boolean mt32_compatible_mode);
|
||||
MT32EMU_EXPORT void MT32EMU_C_CALL mt32emu_set_reverb_compatibility_mode(mt32emu_const_context context, const mt32emu_boolean mt32_compatible_mode);
|
||||
/** Returns whether reverb is in old MT-32 compatibility mode. */
|
||||
MT32EMU_EXPORT mt32emu_boolean mt32emu_is_mt32_reverb_compatibility_mode(mt32emu_const_context context);
|
||||
MT32EMU_EXPORT mt32emu_boolean MT32EMU_C_CALL mt32emu_is_mt32_reverb_compatibility_mode(mt32emu_const_context context);
|
||||
/** Returns whether default reverb compatibility mode is the old MT-32 compatibility mode. */
|
||||
MT32EMU_EXPORT mt32emu_boolean mt32emu_is_default_reverb_mt32_compatible(mt32emu_const_context context);
|
||||
MT32EMU_EXPORT mt32emu_boolean MT32EMU_C_CALL mt32emu_is_default_reverb_mt32_compatible(mt32emu_const_context context);
|
||||
|
||||
/**
|
||||
* If enabled, reverb buffers for all modes are kept around allocated all the time to avoid memory
|
||||
* allocating/freeing in the rendering thread, which may be required for realtime operation.
|
||||
* Otherwise, reverb buffers that are not in use are deleted to save memory (the default behaviour).
|
||||
*/
|
||||
MT32EMU_EXPORT void MT32EMU_C_CALL mt32emu_preallocate_reverb_memory(mt32emu_const_context context, const mt32emu_boolean enabled);
|
||||
|
||||
/** Sets new DAC input mode. See mt32emu_dac_input_mode for details. */
|
||||
MT32EMU_EXPORT void mt32emu_set_dac_input_mode(mt32emu_const_context context, const mt32emu_dac_input_mode mode);
|
||||
MT32EMU_EXPORT void MT32EMU_C_CALL mt32emu_set_dac_input_mode(mt32emu_const_context context, const mt32emu_dac_input_mode mode);
|
||||
/** Returns current DAC input mode. See mt32emu_dac_input_mode for details. */
|
||||
MT32EMU_EXPORT mt32emu_dac_input_mode mt32emu_get_dac_input_mode(mt32emu_const_context context);
|
||||
MT32EMU_EXPORT mt32emu_dac_input_mode MT32EMU_C_CALL mt32emu_get_dac_input_mode(mt32emu_const_context context);
|
||||
|
||||
/** Sets new MIDI delay mode. See mt32emu_midi_delay_mode for details. */
|
||||
MT32EMU_EXPORT void mt32emu_set_midi_delay_mode(mt32emu_const_context context, const mt32emu_midi_delay_mode mode);
|
||||
MT32EMU_EXPORT void MT32EMU_C_CALL mt32emu_set_midi_delay_mode(mt32emu_const_context context, const mt32emu_midi_delay_mode mode);
|
||||
/** Returns current MIDI delay mode. See mt32emu_midi_delay_mode for details. */
|
||||
MT32EMU_EXPORT mt32emu_midi_delay_mode mt32emu_get_midi_delay_mode(mt32emu_const_context context);
|
||||
MT32EMU_EXPORT mt32emu_midi_delay_mode MT32EMU_C_CALL mt32emu_get_midi_delay_mode(mt32emu_const_context context);
|
||||
|
||||
/**
|
||||
* Sets output gain factor for synth output channels. Applied to all output samples and unrelated with the synth's Master volume,
|
||||
* it rather corresponds to the gain of the output analog circuitry of the hardware units. However, together with mt32emu_set_reverb_output_gain()
|
||||
* it offers to the user a capability to control the gain of reverb and non-reverb output channels independently.
|
||||
*/
|
||||
MT32EMU_EXPORT void mt32emu_set_output_gain(mt32emu_const_context context, float gain);
|
||||
MT32EMU_EXPORT void MT32EMU_C_CALL mt32emu_set_output_gain(mt32emu_const_context context, float gain);
|
||||
/** Returns current output gain factor for synth output channels. */
|
||||
MT32EMU_EXPORT float mt32emu_get_output_gain(mt32emu_const_context context);
|
||||
MT32EMU_EXPORT float MT32EMU_C_CALL mt32emu_get_output_gain(mt32emu_const_context context);
|
||||
|
||||
/**
|
||||
* Sets output gain factor for the reverb wet output channels. It rather corresponds to the gain of the output
|
||||
@@ -345,14 +453,34 @@ MT32EMU_EXPORT float mt32emu_get_output_gain(mt32emu_const_context context);
|
||||
* there is a difference in the reverb analogue circuit, and the resulting output gain is 0.68
|
||||
* of that for LA32 analogue output. This factor is applied to the reverb output gain.
|
||||
*/
|
||||
MT32EMU_EXPORT void mt32emu_set_reverb_output_gain(mt32emu_const_context context, float gain);
|
||||
MT32EMU_EXPORT void MT32EMU_C_CALL mt32emu_set_reverb_output_gain(mt32emu_const_context context, float gain);
|
||||
/** Returns current output gain factor for reverb wet output channels. */
|
||||
MT32EMU_EXPORT float mt32emu_get_reverb_output_gain(mt32emu_const_context context);
|
||||
MT32EMU_EXPORT float MT32EMU_C_CALL mt32emu_get_reverb_output_gain(mt32emu_const_context context);
|
||||
|
||||
/**
|
||||
* Sets (or removes) an override for the current volume (output level) on a specific part.
|
||||
* When the part volume is overridden, the MIDI controller Volume (7) on the MIDI channel this part is assigned to
|
||||
* has no effect on the output level of this part. Similarly, the output level value set on this part via a SysEx that
|
||||
* modifies the Patch temp structure is disregarded.
|
||||
* To enable the override mode, argument volumeOverride should be in range 0..100, setting a value outside this range
|
||||
* disables the previously set override, if any.
|
||||
* Note: Setting volumeOverride to 0 mutes the part completely, meaning no sound is generated at all.
|
||||
* This is unlike the behaviour of real devices - setting 0 volume on a part may leave it still producing
|
||||
* sound at a very low level.
|
||||
* Argument partNumber should be 0..7 for Part 1..8, or 8 for Rhythm.
|
||||
*/
|
||||
MT32EMU_EXPORT_V(2.6) void MT32EMU_C_CALL mt32emu_set_part_volume_override(mt32emu_const_context context, mt32emu_bit8u part_number, mt32emu_bit8u volume_override);
|
||||
/**
|
||||
* Returns the overridden volume previously set on a specific part; a value outside the range 0..100 means no override
|
||||
* is currently in effect.
|
||||
* Argument partNumber should be 0..7 for Part 1..8, or 8 for Rhythm.
|
||||
*/
|
||||
MT32EMU_EXPORT_V(2.6) mt32emu_bit8u MT32EMU_C_CALL mt32emu_get_part_volume_override(mt32emu_const_context context, mt32emu_bit8u part_number);
|
||||
|
||||
/** Swaps left and right output channels. */
|
||||
MT32EMU_EXPORT void mt32emu_set_reversed_stereo_enabled(mt32emu_const_context context, const mt32emu_boolean enabled);
|
||||
MT32EMU_EXPORT void MT32EMU_C_CALL mt32emu_set_reversed_stereo_enabled(mt32emu_const_context context, const mt32emu_boolean enabled);
|
||||
/** Returns whether left and right output channels are swapped. */
|
||||
MT32EMU_EXPORT mt32emu_boolean mt32emu_is_reversed_stereo_enabled(mt32emu_const_context context);
|
||||
MT32EMU_EXPORT mt32emu_boolean MT32EMU_C_CALL mt32emu_is_reversed_stereo_enabled(mt32emu_const_context context);
|
||||
|
||||
/**
|
||||
* Allows to toggle the NiceAmpRamp mode.
|
||||
@@ -362,9 +490,36 @@ MT32EMU_EXPORT mt32emu_boolean mt32emu_is_reversed_stereo_enabled(mt32emu_const_
|
||||
* We also prefer the quality improvement over the emulation accuracy,
|
||||
* so this mode is enabled by default.
|
||||
*/
|
||||
MT32EMU_EXPORT void mt32emu_set_nice_amp_ramp_enabled(mt32emu_const_context context, const mt32emu_boolean enabled);
|
||||
MT32EMU_EXPORT void MT32EMU_C_CALL mt32emu_set_nice_amp_ramp_enabled(mt32emu_const_context context, const mt32emu_boolean enabled);
|
||||
/** Returns whether NiceAmpRamp mode is enabled. */
|
||||
MT32EMU_EXPORT mt32emu_boolean mt32emu_is_nice_amp_ramp_enabled(mt32emu_const_context context);
|
||||
MT32EMU_EXPORT mt32emu_boolean MT32EMU_C_CALL mt32emu_is_nice_amp_ramp_enabled(mt32emu_const_context context);
|
||||
|
||||
/**
|
||||
* Allows to toggle the NicePanning mode.
|
||||
* Despite the Roland's manual specifies allowed panpot values in range 0-14,
|
||||
* the LA-32 only receives 3-bit pan setting in fact. In particular, this
|
||||
* makes it impossible to set the "middle" panning for a single partial.
|
||||
* In the NicePanning mode, we enlarge the pan setting accuracy to 4 bits
|
||||
* making it smoother thus sacrificing the emulation accuracy.
|
||||
* This mode is disabled by default.
|
||||
*/
|
||||
MT32EMU_EXPORT void MT32EMU_C_CALL mt32emu_set_nice_panning_enabled(mt32emu_const_context context, const mt32emu_boolean enabled);
|
||||
/** Returns whether NicePanning mode is enabled. */
|
||||
MT32EMU_EXPORT mt32emu_boolean MT32EMU_C_CALL mt32emu_is_nice_panning_enabled(mt32emu_const_context context);
|
||||
|
||||
/**
|
||||
* Allows to toggle the NicePartialMixing mode.
|
||||
* LA-32 is known to mix partials either in-phase (so that they are added)
|
||||
* or in counter-phase (so that they are subtracted instead).
|
||||
* In some cases, this quirk isn't highly desired because a pair of closely
|
||||
* sounding partials may occasionally cancel out.
|
||||
* In the NicePartialMixing mode, the mixing is always performed in-phase,
|
||||
* thus making the behaviour more predictable.
|
||||
* This mode is disabled by default.
|
||||
*/
|
||||
MT32EMU_EXPORT void MT32EMU_C_CALL mt32emu_set_nice_partial_mixing_enabled(mt32emu_const_context context, const mt32emu_boolean enabled);
|
||||
/** Returns whether NicePartialMixing mode is enabled. */
|
||||
MT32EMU_EXPORT mt32emu_boolean MT32EMU_C_CALL mt32emu_is_nice_partial_mixing_enabled(mt32emu_const_context context);
|
||||
|
||||
/**
|
||||
* Renders samples to the specified output stream as if they were sampled at the analog stereo output at the desired sample rate.
|
||||
@@ -372,9 +527,9 @@ MT32EMU_EXPORT mt32emu_boolean mt32emu_is_nice_amp_ramp_enabled(mt32emu_const_co
|
||||
* mode of analog circuitry emulation. See mt32emu_analog_output_mode.
|
||||
* The length is in frames, not bytes (in 16-bit stereo, one frame is 4 bytes). Uses NATIVE byte ordering.
|
||||
*/
|
||||
MT32EMU_EXPORT void mt32emu_render_bit16s(mt32emu_const_context context, mt32emu_bit16s *stream, mt32emu_bit32u len);
|
||||
MT32EMU_EXPORT void MT32EMU_C_CALL mt32emu_render_bit16s(mt32emu_const_context context, mt32emu_bit16s *stream, mt32emu_bit32u len);
|
||||
/** Same as above but outputs to a float stereo stream. */
|
||||
MT32EMU_EXPORT void mt32emu_render_float(mt32emu_const_context context, float *stream, mt32emu_bit32u len);
|
||||
MT32EMU_EXPORT void MT32EMU_C_CALL mt32emu_render_float(mt32emu_const_context context, float *stream, mt32emu_bit32u len);
|
||||
|
||||
/**
|
||||
* Renders samples to the specified output streams as if they appeared at the DAC entrance.
|
||||
@@ -382,25 +537,25 @@ MT32EMU_EXPORT void mt32emu_render_float(mt32emu_const_context context, float *s
|
||||
* NULL may be specified in place of any or all of the stream buffers to skip it.
|
||||
* The length is in samples, not bytes. Uses NATIVE byte ordering.
|
||||
*/
|
||||
MT32EMU_EXPORT void mt32emu_render_bit16s_streams(mt32emu_const_context context, const mt32emu_dac_output_bit16s_streams *streams, mt32emu_bit32u len);
|
||||
MT32EMU_EXPORT void MT32EMU_C_CALL mt32emu_render_bit16s_streams(mt32emu_const_context context, const mt32emu_dac_output_bit16s_streams *streams, mt32emu_bit32u len);
|
||||
/** Same as above but outputs to float streams. */
|
||||
MT32EMU_EXPORT void mt32emu_render_float_streams(mt32emu_const_context context, const mt32emu_dac_output_float_streams *streams, mt32emu_bit32u len);
|
||||
MT32EMU_EXPORT void MT32EMU_C_CALL mt32emu_render_float_streams(mt32emu_const_context context, const mt32emu_dac_output_float_streams *streams, mt32emu_bit32u len);
|
||||
|
||||
/** Returns true when there is at least one active partial, otherwise false. */
|
||||
MT32EMU_EXPORT mt32emu_boolean mt32emu_has_active_partials(mt32emu_const_context context);
|
||||
MT32EMU_EXPORT mt32emu_boolean MT32EMU_C_CALL mt32emu_has_active_partials(mt32emu_const_context context);
|
||||
|
||||
/** Returns true if mt32emu_has_active_partials() returns true, or reverb is (somewhat unreliably) detected as being active. */
|
||||
MT32EMU_EXPORT mt32emu_boolean mt32emu_is_active(mt32emu_const_context context);
|
||||
MT32EMU_EXPORT mt32emu_boolean MT32EMU_C_CALL mt32emu_is_active(mt32emu_const_context context);
|
||||
|
||||
/** Returns the maximum number of partials playing simultaneously. */
|
||||
MT32EMU_EXPORT mt32emu_bit32u mt32emu_get_partial_count(mt32emu_const_context context);
|
||||
MT32EMU_EXPORT mt32emu_bit32u MT32EMU_C_CALL mt32emu_get_partial_count(mt32emu_const_context context);
|
||||
|
||||
/**
|
||||
* Returns current states of all the parts as a bit set. The least significant bit corresponds to the state of part 1,
|
||||
* total of 9 bits hold the states of all the parts. If the returned bit for a part is set, there is at least one active
|
||||
* non-releasing partial playing on this part. This info is useful in emulating behaviour of LCD display of the hardware units.
|
||||
*/
|
||||
MT32EMU_EXPORT mt32emu_bit32u mt32emu_get_part_states(mt32emu_const_context context);
|
||||
MT32EMU_EXPORT mt32emu_bit32u MT32EMU_C_CALL mt32emu_get_part_states(mt32emu_const_context context);
|
||||
|
||||
/**
|
||||
* Fills in current states of all the partials into the array provided. Each byte in the array holds states of 4 partials
|
||||
@@ -408,7 +563,7 @@ MT32EMU_EXPORT mt32emu_bit32u mt32emu_get_part_states(mt32emu_const_context cont
|
||||
* The array must be large enough to accommodate states of all the partials.
|
||||
* @see getPartialCount()
|
||||
*/
|
||||
MT32EMU_EXPORT void mt32emu_get_partial_states(mt32emu_const_context context, mt32emu_bit8u *partial_states);
|
||||
MT32EMU_EXPORT void MT32EMU_C_CALL mt32emu_get_partial_states(mt32emu_const_context context, mt32emu_bit8u *partial_states);
|
||||
|
||||
/**
|
||||
* Fills in information about currently playing notes on the specified part into the arrays provided. The arrays must be large enough
|
||||
@@ -416,16 +571,71 @@ MT32EMU_EXPORT void mt32emu_get_partial_states(mt32emu_const_context context, mt
|
||||
* Argument partNumber should be 0..7 for Part 1..8, or 8 for Rhythm.
|
||||
* Returns the number of currently playing notes on the specified part.
|
||||
*/
|
||||
MT32EMU_EXPORT mt32emu_bit32u mt32emu_get_playing_notes(mt32emu_const_context context, mt32emu_bit8u part_number, mt32emu_bit8u *keys, mt32emu_bit8u *velocities);
|
||||
MT32EMU_EXPORT mt32emu_bit32u MT32EMU_C_CALL mt32emu_get_playing_notes(mt32emu_const_context context, mt32emu_bit8u part_number, mt32emu_bit8u *keys, mt32emu_bit8u *velocities);
|
||||
|
||||
/**
|
||||
* Returns name of the patch set on the specified part.
|
||||
* Argument partNumber should be 0..7 for Part 1..8, or 8 for Rhythm.
|
||||
* The returned value is a null-terminated string which is guaranteed to remain valid until the next call to one of functions
|
||||
* that perform sample rendering or immediate SysEx processing (e.g. mt32emu_play_sysex_now).
|
||||
*/
|
||||
MT32EMU_EXPORT const char *mt32emu_get_patch_name(mt32emu_const_context context, mt32emu_bit8u part_number);
|
||||
MT32EMU_EXPORT const char * MT32EMU_C_CALL mt32emu_get_patch_name(mt32emu_const_context context, mt32emu_bit8u part_number);
|
||||
|
||||
/**
|
||||
* Retrieves the name of the sound group the timbre identified by arguments timbre_group and timbre_number is associated with.
|
||||
* Values 0-3 of timbre_group correspond to the timbre banks GROUP A, GROUP B, MEMORY and RHYTHM.
|
||||
* For all but the RHYTHM timbre bank, allowed values of timbre_number are in range 0-63. The number of timbres
|
||||
* contained in the RHYTHM bank depends on the used control ROM version.
|
||||
* The argument sound_group_name must point to an array of at least 8 characters. The result is a null-terminated string.
|
||||
* Returns whether the specified timbre has been found and the result written in sound_group_name.
|
||||
*/
|
||||
MT32EMU_EXPORT_V(2.7) mt32emu_boolean MT32EMU_C_CALL mt32emu_get_sound_group_name(mt32emu_const_context context, char *sound_group_name, mt32emu_bit8u timbre_group, mt32emu_bit8u timbre_number);
|
||||
/**
|
||||
* Retrieves the name of the timbre identified by arguments timbre_group and timbre_number.
|
||||
* Values 0-3 of timbre_group correspond to the timbre banks GROUP A, GROUP B, MEMORY and RHYTHM.
|
||||
* For all but the RHYTHM timbre bank, allowed values of timbre_number are in range 0-63. The number of timbres
|
||||
* contained in the RHYTHM bank depends on the used control ROM version.
|
||||
* The argument sound_name must point to an array of at least 11 characters. The result is a null-terminated string.
|
||||
* Returns whether the specified timbre has been found and the result written in sound_name.
|
||||
*/
|
||||
MT32EMU_EXPORT_V(2.7) mt32emu_boolean MT32EMU_C_CALL mt32emu_get_sound_name(mt32emu_const_context context, char *sound_name, mt32emu_bit8u timbreGroup, mt32emu_bit8u timbreNumber);
|
||||
|
||||
/** Stores internal state of emulated synth into an array provided (as it would be acquired from hardware). */
|
||||
MT32EMU_EXPORT void mt32emu_read_memory(mt32emu_const_context context, mt32emu_bit32u addr, mt32emu_bit32u len, mt32emu_bit8u *data);
|
||||
MT32EMU_EXPORT void MT32EMU_C_CALL mt32emu_read_memory(mt32emu_const_context context, mt32emu_bit32u addr, mt32emu_bit32u len, mt32emu_bit8u *data);
|
||||
|
||||
/**
|
||||
* Retrieves the current state of the emulated MT-32 display facilities.
|
||||
* Typically, the state is updated during the rendering. When that happens, a related callback from mt32emu_report_handler_i_v1
|
||||
* is invoked. However, there might be no need to invoke this method after each update, e.g. when the render buffer is just
|
||||
* a few milliseconds long.
|
||||
* The argument target_buffer must point to an array of at least 21 characters. The result is a null-terminated string.
|
||||
* The argument narrow_lcd enables a condensed representation of the displayed information in some cases. This is mainly intended
|
||||
* to route the result to a hardware LCD that is only 16 characters wide. Automatic scrolling of longer strings is not supported.
|
||||
* Returns whether the MIDI MESSAGE LED is ON and fills the target_buffer parameter.
|
||||
*/
|
||||
MT32EMU_EXPORT_V(2.6) mt32emu_boolean MT32EMU_C_CALL mt32emu_get_display_state(mt32emu_const_context context, char *target_buffer, const mt32emu_boolean narrow_lcd);
|
||||
|
||||
/**
|
||||
* Resets the emulated LCD to the main mode (Master Volume). This has the same effect as pressing the Master Volume button
|
||||
* while the display shows some other message. Useful for the new-gen devices as those require a special Display Reset SysEx
|
||||
* to return to the main mode e.g. from showing a custom display message or a checksum error.
|
||||
*/
|
||||
MT32EMU_EXPORT_V(2.6) void MT32EMU_C_CALL mt32emu_set_main_display_mode(mt32emu_const_context context);
|
||||
|
||||
/**
|
||||
* Permits to select an arbitrary display emulation model that does not necessarily match the actual behaviour implemented
|
||||
* in the control ROM version being used.
|
||||
* Invoking this method with the argument set to true forces emulation of the old-gen MT-32 display features.
|
||||
* Otherwise, emulation of the new-gen devices is enforced (these include CM-32L and LAPC-I as if these were connected to an LCD).
|
||||
*/
|
||||
MT32EMU_EXPORT_V(2.6) void MT32EMU_C_CALL mt32emu_set_display_compatibility(mt32emu_const_context context, mt32emu_boolean old_mt32_compatibility_enabled);
|
||||
/** Returns whether the currently configured features of the emulated display are compatible with the old-gen MT-32 devices. */
|
||||
MT32EMU_EXPORT_V(2.6) mt32emu_boolean MT32EMU_C_CALL mt32emu_is_display_old_mt32_compatible(mt32emu_const_context context);
|
||||
/**
|
||||
* Returns whether the emulated display features configured by default depending on the actual control ROM version
|
||||
* are compatible with the old-gen MT-32 devices.
|
||||
*/
|
||||
MT32EMU_EXPORT_V(2.6) mt32emu_boolean MT32EMU_C_CALL mt32emu_is_default_display_old_mt32_compatible(mt32emu_const_context context);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* Copyright (C) 2003, 2004, 2005, 2006, 2008, 2009 Dean Beeler, Jerome Fisher
|
||||
* Copyright (C) 2011-2017 Dean Beeler, Jerome Fisher, Sergey V. Mikayev
|
||||
* Copyright (C) 2011-2022 Dean Beeler, Jerome Fisher, Sergey V. Mikayev
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
@@ -27,6 +27,12 @@
|
||||
#include "../Enumerations.h"
|
||||
#undef MT32EMU_C_ENUMERATIONS
|
||||
|
||||
#ifdef _WIN32
|
||||
# define MT32EMU_C_CALL __cdecl
|
||||
#else
|
||||
# define MT32EMU_C_CALL
|
||||
#endif
|
||||
|
||||
typedef unsigned int mt32emu_bit32u;
|
||||
typedef signed int mt32emu_bit32s;
|
||||
typedef unsigned short int mt32emu_bit16u;
|
||||
@@ -45,6 +51,8 @@ typedef enum {
|
||||
MT32EMU_RC_OK = 0,
|
||||
MT32EMU_RC_ADDED_CONTROL_ROM = 1,
|
||||
MT32EMU_RC_ADDED_PCM_ROM = 2,
|
||||
MT32EMU_RC_ADDED_PARTIAL_CONTROL_ROM = 3,
|
||||
MT32EMU_RC_ADDED_PARTIAL_PCM_ROM = 4,
|
||||
|
||||
/* Definite error occurred. */
|
||||
MT32EMU_RC_ROM_NOT_IDENTIFIED = -1,
|
||||
@@ -53,6 +61,8 @@ typedef enum {
|
||||
MT32EMU_RC_MISSING_ROMS = -4,
|
||||
MT32EMU_RC_NOT_OPENED = -5,
|
||||
MT32EMU_RC_QUEUE_FULL = -6,
|
||||
MT32EMU_RC_ROMS_NOT_PAIRABLE = -7,
|
||||
MT32EMU_RC_MACHINE_NOT_IDENTIFIED = -8,
|
||||
|
||||
/* Undefined error occurred. */
|
||||
MT32EMU_RC_FAILED = -100
|
||||
@@ -107,7 +117,8 @@ typedef struct {
|
||||
/** Report handler interface versions */
|
||||
typedef enum {
|
||||
MT32EMU_REPORT_HANDLER_VERSION_0 = 0,
|
||||
MT32EMU_REPORT_HANDLER_VERSION_CURRENT = MT32EMU_REPORT_HANDLER_VERSION_0
|
||||
MT32EMU_REPORT_HANDLER_VERSION_1 = 1,
|
||||
MT32EMU_REPORT_HANDLER_VERSION_CURRENT = MT32EMU_REPORT_HANDLER_VERSION_1
|
||||
} mt32emu_report_handler_version;
|
||||
|
||||
/** MIDI receiver interface versions */
|
||||
@@ -121,7 +132,11 @@ typedef enum {
|
||||
MT32EMU_SERVICE_VERSION_0 = 0,
|
||||
MT32EMU_SERVICE_VERSION_1 = 1,
|
||||
MT32EMU_SERVICE_VERSION_2 = 2,
|
||||
MT32EMU_SERVICE_VERSION_CURRENT = MT32EMU_SERVICE_VERSION_2
|
||||
MT32EMU_SERVICE_VERSION_3 = 3,
|
||||
MT32EMU_SERVICE_VERSION_4 = 4,
|
||||
MT32EMU_SERVICE_VERSION_5 = 5,
|
||||
MT32EMU_SERVICE_VERSION_6 = 6,
|
||||
MT32EMU_SERVICE_VERSION_CURRENT = MT32EMU_SERVICE_VERSION_6
|
||||
} mt32emu_service_version;
|
||||
|
||||
/* === Report Handler Interface === */
|
||||
@@ -129,42 +144,59 @@ typedef enum {
|
||||
typedef union mt32emu_report_handler_i mt32emu_report_handler_i;
|
||||
|
||||
/** Interface for handling reported events (initial version) */
|
||||
typedef struct {
|
||||
/** Returns the actual interface version ID */
|
||||
mt32emu_report_handler_version (*getVersionID)(mt32emu_report_handler_i i);
|
||||
|
||||
/** Callback for debug messages, in vprintf() format */
|
||||
void (*printDebug)(void *instance_data, const char *fmt, va_list list);
|
||||
/** Callbacks for reporting errors */
|
||||
void (*onErrorControlROM)(void *instance_data);
|
||||
void (*onErrorPCMROM)(void *instance_data);
|
||||
/** Callback for reporting about displaying a new custom message on LCD */
|
||||
void (*showLCDMessage)(void *instance_data, const char *message);
|
||||
/** Callback for reporting actual processing of a MIDI message */
|
||||
void (*onMIDIMessagePlayed)(void *instance_data);
|
||||
#define MT32EMU_REPORT_HANDLER_I_V0 \
|
||||
/** Returns the actual interface version ID */ \
|
||||
mt32emu_report_handler_version (MT32EMU_C_CALL *getVersionID)(mt32emu_report_handler_i i); \
|
||||
\
|
||||
/** Callback for debug messages, in vprintf() format */ \
|
||||
void (MT32EMU_C_CALL *printDebug)(void *instance_data, const char *fmt, va_list list); \
|
||||
/** Callbacks for reporting errors */ \
|
||||
void (MT32EMU_C_CALL *onErrorControlROM)(void *instance_data); \
|
||||
void (MT32EMU_C_CALL *onErrorPCMROM)(void *instance_data); \
|
||||
/** Callback for reporting about displaying a new custom message on LCD */ \
|
||||
void (MT32EMU_C_CALL *showLCDMessage)(void *instance_data, const char *message); \
|
||||
/** Callback for reporting actual processing of a MIDI message */ \
|
||||
void (MT32EMU_C_CALL *onMIDIMessagePlayed)(void *instance_data); \
|
||||
/**
|
||||
* Callback for reporting an overflow of the input MIDI queue.
|
||||
* Returns MT32EMU_BOOL_TRUE if a recovery action was taken
|
||||
* and yet another attempt to enqueue the MIDI event is desired.
|
||||
*/
|
||||
mt32emu_boolean (*onMIDIQueueOverflow)(void *instance_data);
|
||||
*/ \
|
||||
mt32emu_boolean (MT32EMU_C_CALL *onMIDIQueueOverflow)(void *instance_data); \
|
||||
/**
|
||||
* Callback invoked when a System Realtime MIDI message is detected in functions
|
||||
* mt32emu_parse_stream and mt32emu_play_short_message and the likes.
|
||||
*/
|
||||
void (*onMIDISystemRealtime)(void *instance_data, mt32emu_bit8u system_realtime);
|
||||
/** Callbacks for reporting system events */
|
||||
void (*onDeviceReset)(void *instance_data);
|
||||
void (*onDeviceReconfig)(void *instance_data);
|
||||
/** Callbacks for reporting changes of reverb settings */
|
||||
void (*onNewReverbMode)(void *instance_data, mt32emu_bit8u mode);
|
||||
void (*onNewReverbTime)(void *instance_data, mt32emu_bit8u time);
|
||||
void (*onNewReverbLevel)(void *instance_data, mt32emu_bit8u level);
|
||||
/** Callbacks for reporting various information */
|
||||
void (*onPolyStateChanged)(void *instance_data, mt32emu_bit8u part_num);
|
||||
void (*onProgramChanged)(void *instance_data, mt32emu_bit8u part_num, const char *sound_group_name, const char *patch_name);
|
||||
*/ \
|
||||
void (MT32EMU_C_CALL *onMIDISystemRealtime)(void *instance_data, mt32emu_bit8u system_realtime); \
|
||||
/** Callbacks for reporting system events */ \
|
||||
void (MT32EMU_C_CALL *onDeviceReset)(void *instance_data); \
|
||||
void (MT32EMU_C_CALL *onDeviceReconfig)(void *instance_data); \
|
||||
/** Callbacks for reporting changes of reverb settings */ \
|
||||
void (MT32EMU_C_CALL *onNewReverbMode)(void *instance_data, mt32emu_bit8u mode); \
|
||||
void (MT32EMU_C_CALL *onNewReverbTime)(void *instance_data, mt32emu_bit8u time); \
|
||||
void (MT32EMU_C_CALL *onNewReverbLevel)(void *instance_data, mt32emu_bit8u level); \
|
||||
/** Callbacks for reporting various information */ \
|
||||
void (MT32EMU_C_CALL *onPolyStateChanged)(void *instance_data, mt32emu_bit8u part_num); \
|
||||
void (MT32EMU_C_CALL *onProgramChanged)(void *instance_data, mt32emu_bit8u part_num, const char *sound_group_name, const char *patch_name);
|
||||
|
||||
#define MT32EMU_REPORT_HANDLER_I_V1 \
|
||||
/**
|
||||
* Invoked to signal about a change of the emulated LCD state. Use mt32emu_get_display_state to retrieve the actual data.
|
||||
* This callback will not be invoked on further changes, until the client retrieves the LCD state.
|
||||
*/ \
|
||||
void (MT32EMU_C_CALL *onLCDStateUpdated)(void *instance_data); \
|
||||
/** Invoked when the emulated MIDI MESSAGE LED changes state. The led_state parameter represents whether the LED is ON. */ \
|
||||
void (MT32EMU_C_CALL *onMidiMessageLEDStateUpdated)(void *instance_data, mt32emu_boolean led_state);
|
||||
|
||||
typedef struct {
|
||||
MT32EMU_REPORT_HANDLER_I_V0
|
||||
} mt32emu_report_handler_i_v0;
|
||||
|
||||
typedef struct {
|
||||
MT32EMU_REPORT_HANDLER_I_V0
|
||||
MT32EMU_REPORT_HANDLER_I_V1
|
||||
} mt32emu_report_handler_i_v1;
|
||||
|
||||
/**
|
||||
* Extensible interface for handling reported events.
|
||||
* Union intended to view an interface of any subsequent version as any parent interface not requiring a cast.
|
||||
@@ -172,8 +204,12 @@ typedef struct {
|
||||
*/
|
||||
union mt32emu_report_handler_i {
|
||||
const mt32emu_report_handler_i_v0 *v0;
|
||||
const mt32emu_report_handler_i_v1 *v1;
|
||||
};
|
||||
|
||||
#undef MT32EMU_REPORT_HANDLER_I_V0
|
||||
#undef MT32EMU_REPORT_HANDLER_I_V1
|
||||
|
||||
/* === MIDI Receiver Interface === */
|
||||
|
||||
typedef union mt32emu_midi_receiver_i mt32emu_midi_receiver_i;
|
||||
@@ -181,16 +217,16 @@ typedef union mt32emu_midi_receiver_i mt32emu_midi_receiver_i;
|
||||
/** Interface for receiving MIDI messages generated by MIDI stream parser (initial version) */
|
||||
typedef struct {
|
||||
/** Returns the actual interface version ID */
|
||||
mt32emu_midi_receiver_version (*getVersionID)(mt32emu_midi_receiver_i i);
|
||||
mt32emu_midi_receiver_version (MT32EMU_C_CALL *getVersionID)(mt32emu_midi_receiver_i i);
|
||||
|
||||
/** Invoked when a complete short MIDI message is parsed in the input MIDI stream. */
|
||||
void (*handleShortMessage)(void *instance_data, const mt32emu_bit32u message);
|
||||
void (MT32EMU_C_CALL *handleShortMessage)(void *instance_data, const mt32emu_bit32u message);
|
||||
|
||||
/** Invoked when a complete well-formed System Exclusive MIDI message is parsed in the input MIDI stream. */
|
||||
void (*handleSysex)(void *instance_data, const mt32emu_bit8u stream[], const mt32emu_bit32u length);
|
||||
void (MT32EMU_C_CALL *handleSysex)(void *instance_data, const mt32emu_bit8u stream[], const mt32emu_bit32u length);
|
||||
|
||||
/** Invoked when a System Realtime MIDI message is parsed in the input MIDI stream. */
|
||||
void (*handleSystemRealtimeMessage)(void *instance_data, const mt32emu_bit8u realtime);
|
||||
void (MT32EMU_C_CALL *handleSystemRealtimeMessage)(void *instance_data, const mt32emu_bit8u realtime);
|
||||
} mt32emu_midi_receiver_i_v0;
|
||||
|
||||
/**
|
||||
@@ -215,93 +251,124 @@ typedef union mt32emu_service_i mt32emu_service_i;
|
||||
*/
|
||||
#define MT32EMU_SERVICE_I_V0 \
|
||||
/** Returns the actual interface version ID */ \
|
||||
mt32emu_service_version (*getVersionID)(mt32emu_service_i i); \
|
||||
mt32emu_report_handler_version (*getSupportedReportHandlerVersionID)(); \
|
||||
mt32emu_midi_receiver_version (*getSupportedMIDIReceiverVersionID)(); \
|
||||
mt32emu_service_version (MT32EMU_C_CALL *getVersionID)(mt32emu_service_i i); \
|
||||
mt32emu_report_handler_version (MT32EMU_C_CALL *getSupportedReportHandlerVersionID)(void); \
|
||||
mt32emu_midi_receiver_version (MT32EMU_C_CALL *getSupportedMIDIReceiverVersionID)(void); \
|
||||
\
|
||||
mt32emu_bit32u (*getLibraryVersionInt)(); \
|
||||
const char *(*getLibraryVersionString)(); \
|
||||
mt32emu_bit32u (MT32EMU_C_CALL *getLibraryVersionInt)(void); \
|
||||
const char *(MT32EMU_C_CALL *getLibraryVersionString)(void); \
|
||||
\
|
||||
mt32emu_bit32u (*getStereoOutputSamplerate)(const mt32emu_analog_output_mode analog_output_mode); \
|
||||
mt32emu_bit32u (MT32EMU_C_CALL *getStereoOutputSamplerate)(const mt32emu_analog_output_mode analog_output_mode); \
|
||||
\
|
||||
mt32emu_context (*createContext)(mt32emu_report_handler_i report_handler, void *instance_data); \
|
||||
void (*freeContext)(mt32emu_context context); \
|
||||
mt32emu_return_code (*addROMData)(mt32emu_context context, const mt32emu_bit8u *data, size_t data_size, const mt32emu_sha1_digest *sha1_digest); \
|
||||
mt32emu_return_code (*addROMFile)(mt32emu_context context, const char *filename); \
|
||||
void (*getROMInfo)(mt32emu_const_context context, mt32emu_rom_info *rom_info); \
|
||||
void (*setPartialCount)(mt32emu_context context, const mt32emu_bit32u partial_count); \
|
||||
void (*setAnalogOutputMode)(mt32emu_context context, const mt32emu_analog_output_mode analog_output_mode); \
|
||||
mt32emu_return_code (*openSynth)(mt32emu_const_context context); \
|
||||
void (*closeSynth)(mt32emu_const_context context); \
|
||||
mt32emu_boolean (*isOpen)(mt32emu_const_context context); \
|
||||
mt32emu_bit32u (*getActualStereoOutputSamplerate)(mt32emu_const_context context); \
|
||||
void (*flushMIDIQueue)(mt32emu_const_context context); \
|
||||
mt32emu_bit32u (*setMIDIEventQueueSize)(mt32emu_const_context context, const mt32emu_bit32u queue_size); \
|
||||
void (*setMIDIReceiver)(mt32emu_context context, mt32emu_midi_receiver_i midi_receiver, void *instance_data); \
|
||||
mt32emu_context (MT32EMU_C_CALL *createContext)(mt32emu_report_handler_i report_handler, void *instance_data); \
|
||||
void (MT32EMU_C_CALL *freeContext)(mt32emu_context context); \
|
||||
mt32emu_return_code (MT32EMU_C_CALL *addROMData)(mt32emu_context context, const mt32emu_bit8u *data, size_t data_size, const mt32emu_sha1_digest *sha1_digest); \
|
||||
mt32emu_return_code (MT32EMU_C_CALL *addROMFile)(mt32emu_context context, const char *filename); \
|
||||
void (MT32EMU_C_CALL *getROMInfo)(mt32emu_const_context context, mt32emu_rom_info *rom_info); \
|
||||
void (MT32EMU_C_CALL *setPartialCount)(mt32emu_context context, const mt32emu_bit32u partial_count); \
|
||||
void (MT32EMU_C_CALL *setAnalogOutputMode)(mt32emu_context context, const mt32emu_analog_output_mode analog_output_mode); \
|
||||
mt32emu_return_code (MT32EMU_C_CALL *openSynth)(mt32emu_const_context context); \
|
||||
void (MT32EMU_C_CALL *closeSynth)(mt32emu_const_context context); \
|
||||
mt32emu_boolean (MT32EMU_C_CALL *isOpen)(mt32emu_const_context context); \
|
||||
mt32emu_bit32u (MT32EMU_C_CALL *getActualStereoOutputSamplerate)(mt32emu_const_context context); \
|
||||
void (MT32EMU_C_CALL *flushMIDIQueue)(mt32emu_const_context context); \
|
||||
mt32emu_bit32u (MT32EMU_C_CALL *setMIDIEventQueueSize)(mt32emu_const_context context, const mt32emu_bit32u queue_size); \
|
||||
void (MT32EMU_C_CALL *setMIDIReceiver)(mt32emu_context context, mt32emu_midi_receiver_i midi_receiver, void *instance_data); \
|
||||
\
|
||||
void (*parseStream)(mt32emu_const_context context, const mt32emu_bit8u *stream, mt32emu_bit32u length); \
|
||||
void (*parseStream_At)(mt32emu_const_context context, const mt32emu_bit8u *stream, mt32emu_bit32u length, mt32emu_bit32u timestamp); \
|
||||
void (*playShortMessage)(mt32emu_const_context context, mt32emu_bit32u message); \
|
||||
void (*playShortMessageAt)(mt32emu_const_context context, mt32emu_bit32u message, mt32emu_bit32u timestamp); \
|
||||
mt32emu_return_code (*playMsg)(mt32emu_const_context context, mt32emu_bit32u msg); \
|
||||
mt32emu_return_code (*playSysex)(mt32emu_const_context context, const mt32emu_bit8u *sysex, mt32emu_bit32u len); \
|
||||
mt32emu_return_code (*playMsgAt)(mt32emu_const_context context, mt32emu_bit32u msg, mt32emu_bit32u timestamp); \
|
||||
mt32emu_return_code (*playSysexAt)(mt32emu_const_context context, const mt32emu_bit8u *sysex, mt32emu_bit32u len, mt32emu_bit32u timestamp); \
|
||||
void (MT32EMU_C_CALL *parseStream)(mt32emu_const_context context, const mt32emu_bit8u *stream, mt32emu_bit32u length); \
|
||||
void (MT32EMU_C_CALL *parseStream_At)(mt32emu_const_context context, const mt32emu_bit8u *stream, mt32emu_bit32u length, mt32emu_bit32u timestamp); \
|
||||
void (MT32EMU_C_CALL *playShortMessage)(mt32emu_const_context context, mt32emu_bit32u message); \
|
||||
void (MT32EMU_C_CALL *playShortMessageAt)(mt32emu_const_context context, mt32emu_bit32u message, mt32emu_bit32u timestamp); \
|
||||
mt32emu_return_code (MT32EMU_C_CALL *playMsg)(mt32emu_const_context context, mt32emu_bit32u msg); \
|
||||
mt32emu_return_code (MT32EMU_C_CALL *playSysex)(mt32emu_const_context context, const mt32emu_bit8u *sysex, mt32emu_bit32u len); \
|
||||
mt32emu_return_code (MT32EMU_C_CALL *playMsgAt)(mt32emu_const_context context, mt32emu_bit32u msg, mt32emu_bit32u timestamp); \
|
||||
mt32emu_return_code (MT32EMU_C_CALL *playSysexAt)(mt32emu_const_context context, const mt32emu_bit8u *sysex, mt32emu_bit32u len, mt32emu_bit32u timestamp); \
|
||||
\
|
||||
void (*playMsgNow)(mt32emu_const_context context, mt32emu_bit32u msg); \
|
||||
void (*playMsgOnPart)(mt32emu_const_context context, mt32emu_bit8u part, mt32emu_bit8u code, mt32emu_bit8u note, mt32emu_bit8u velocity); \
|
||||
void (*playSysexNow)(mt32emu_const_context context, const mt32emu_bit8u *sysex, mt32emu_bit32u len); \
|
||||
void (*writeSysex)(mt32emu_const_context context, mt32emu_bit8u channel, const mt32emu_bit8u *sysex, mt32emu_bit32u len); \
|
||||
void (MT32EMU_C_CALL *playMsgNow)(mt32emu_const_context context, mt32emu_bit32u msg); \
|
||||
void (MT32EMU_C_CALL *playMsgOnPart)(mt32emu_const_context context, mt32emu_bit8u part, mt32emu_bit8u code, mt32emu_bit8u note, mt32emu_bit8u velocity); \
|
||||
void (MT32EMU_C_CALL *playSysexNow)(mt32emu_const_context context, const mt32emu_bit8u *sysex, mt32emu_bit32u len); \
|
||||
void (MT32EMU_C_CALL *writeSysex)(mt32emu_const_context context, mt32emu_bit8u channel, const mt32emu_bit8u *sysex, mt32emu_bit32u len); \
|
||||
\
|
||||
void (*setReverbEnabled)(mt32emu_const_context context, const mt32emu_boolean reverb_enabled); \
|
||||
mt32emu_boolean (*isReverbEnabled)(mt32emu_const_context context); \
|
||||
void (*setReverbOverridden)(mt32emu_const_context context, const mt32emu_boolean reverb_overridden); \
|
||||
mt32emu_boolean (*isReverbOverridden)(mt32emu_const_context context); \
|
||||
void (*setReverbCompatibilityMode)(mt32emu_const_context context, const mt32emu_boolean mt32_compatible_mode); \
|
||||
mt32emu_boolean (*isMT32ReverbCompatibilityMode)(mt32emu_const_context context); \
|
||||
mt32emu_boolean (*isDefaultReverbMT32Compatible)(mt32emu_const_context context); \
|
||||
void (MT32EMU_C_CALL *setReverbEnabled)(mt32emu_const_context context, const mt32emu_boolean reverb_enabled); \
|
||||
mt32emu_boolean (MT32EMU_C_CALL *isReverbEnabled)(mt32emu_const_context context); \
|
||||
void (MT32EMU_C_CALL *setReverbOverridden)(mt32emu_const_context context, const mt32emu_boolean reverb_overridden); \
|
||||
mt32emu_boolean (MT32EMU_C_CALL *isReverbOverridden)(mt32emu_const_context context); \
|
||||
void (MT32EMU_C_CALL *setReverbCompatibilityMode)(mt32emu_const_context context, const mt32emu_boolean mt32_compatible_mode); \
|
||||
mt32emu_boolean (MT32EMU_C_CALL *isMT32ReverbCompatibilityMode)(mt32emu_const_context context); \
|
||||
mt32emu_boolean (MT32EMU_C_CALL *isDefaultReverbMT32Compatible)(mt32emu_const_context context); \
|
||||
\
|
||||
void (*setDACInputMode)(mt32emu_const_context context, const mt32emu_dac_input_mode mode); \
|
||||
mt32emu_dac_input_mode (*getDACInputMode)(mt32emu_const_context context); \
|
||||
void (MT32EMU_C_CALL *setDACInputMode)(mt32emu_const_context context, const mt32emu_dac_input_mode mode); \
|
||||
mt32emu_dac_input_mode (MT32EMU_C_CALL *getDACInputMode)(mt32emu_const_context context); \
|
||||
\
|
||||
void (*setMIDIDelayMode)(mt32emu_const_context context, const mt32emu_midi_delay_mode mode); \
|
||||
mt32emu_midi_delay_mode (*getMIDIDelayMode)(mt32emu_const_context context); \
|
||||
void (MT32EMU_C_CALL *setMIDIDelayMode)(mt32emu_const_context context, const mt32emu_midi_delay_mode mode); \
|
||||
mt32emu_midi_delay_mode (MT32EMU_C_CALL *getMIDIDelayMode)(mt32emu_const_context context); \
|
||||
\
|
||||
void (*setOutputGain)(mt32emu_const_context context, float gain); \
|
||||
float (*getOutputGain)(mt32emu_const_context context); \
|
||||
void (*setReverbOutputGain)(mt32emu_const_context context, float gain); \
|
||||
float (*getReverbOutputGain)(mt32emu_const_context context); \
|
||||
void (MT32EMU_C_CALL *setOutputGain)(mt32emu_const_context context, float gain); \
|
||||
float (MT32EMU_C_CALL *getOutputGain)(mt32emu_const_context context); \
|
||||
void (MT32EMU_C_CALL *setReverbOutputGain)(mt32emu_const_context context, float gain); \
|
||||
float (MT32EMU_C_CALL *getReverbOutputGain)(mt32emu_const_context context); \
|
||||
\
|
||||
void (*setReversedStereoEnabled)(mt32emu_const_context context, const mt32emu_boolean enabled); \
|
||||
mt32emu_boolean (*isReversedStereoEnabled)(mt32emu_const_context context); \
|
||||
void (MT32EMU_C_CALL *setReversedStereoEnabled)(mt32emu_const_context context, const mt32emu_boolean enabled); \
|
||||
mt32emu_boolean (MT32EMU_C_CALL *isReversedStereoEnabled)(mt32emu_const_context context); \
|
||||
\
|
||||
void (*renderBit16s)(mt32emu_const_context context, mt32emu_bit16s *stream, mt32emu_bit32u len); \
|
||||
void (*renderFloat)(mt32emu_const_context context, float *stream, mt32emu_bit32u len); \
|
||||
void (*renderBit16sStreams)(mt32emu_const_context context, const mt32emu_dac_output_bit16s_streams *streams, mt32emu_bit32u len); \
|
||||
void (*renderFloatStreams)(mt32emu_const_context context, const mt32emu_dac_output_float_streams *streams, mt32emu_bit32u len); \
|
||||
void (MT32EMU_C_CALL *renderBit16s)(mt32emu_const_context context, mt32emu_bit16s *stream, mt32emu_bit32u len); \
|
||||
void (MT32EMU_C_CALL *renderFloat)(mt32emu_const_context context, float *stream, mt32emu_bit32u len); \
|
||||
void (MT32EMU_C_CALL *renderBit16sStreams)(mt32emu_const_context context, const mt32emu_dac_output_bit16s_streams *streams, mt32emu_bit32u len); \
|
||||
void (MT32EMU_C_CALL *renderFloatStreams)(mt32emu_const_context context, const mt32emu_dac_output_float_streams *streams, mt32emu_bit32u len); \
|
||||
\
|
||||
mt32emu_boolean (*hasActivePartials)(mt32emu_const_context context); \
|
||||
mt32emu_boolean (*isActive)(mt32emu_const_context context); \
|
||||
mt32emu_bit32u (*getPartialCount)(mt32emu_const_context context); \
|
||||
mt32emu_bit32u (*getPartStates)(mt32emu_const_context context); \
|
||||
void (*getPartialStates)(mt32emu_const_context context, mt32emu_bit8u *partial_states); \
|
||||
mt32emu_bit32u (*getPlayingNotes)(mt32emu_const_context context, mt32emu_bit8u part_number, mt32emu_bit8u *keys, mt32emu_bit8u *velocities); \
|
||||
const char *(*getPatchName)(mt32emu_const_context context, mt32emu_bit8u part_number); \
|
||||
void (*readMemory)(mt32emu_const_context context, mt32emu_bit32u addr, mt32emu_bit32u len, mt32emu_bit8u *data);
|
||||
mt32emu_boolean (MT32EMU_C_CALL *hasActivePartials)(mt32emu_const_context context); \
|
||||
mt32emu_boolean (MT32EMU_C_CALL *isActive)(mt32emu_const_context context); \
|
||||
mt32emu_bit32u (MT32EMU_C_CALL *getPartialCount)(mt32emu_const_context context); \
|
||||
mt32emu_bit32u (MT32EMU_C_CALL *getPartStates)(mt32emu_const_context context); \
|
||||
void (MT32EMU_C_CALL *getPartialStates)(mt32emu_const_context context, mt32emu_bit8u *partial_states); \
|
||||
mt32emu_bit32u (MT32EMU_C_CALL *getPlayingNotes)(mt32emu_const_context context, mt32emu_bit8u part_number, mt32emu_bit8u *keys, mt32emu_bit8u *velocities); \
|
||||
const char *(MT32EMU_C_CALL *getPatchName)(mt32emu_const_context context, mt32emu_bit8u part_number); \
|
||||
void (MT32EMU_C_CALL *readMemory)(mt32emu_const_context context, mt32emu_bit32u addr, mt32emu_bit32u len, mt32emu_bit8u *data);
|
||||
|
||||
#define MT32EMU_SERVICE_I_V1 \
|
||||
mt32emu_analog_output_mode (*getBestAnalogOutputMode)(const double target_samplerate); \
|
||||
void (*setStereoOutputSampleRate)(mt32emu_context context, const double samplerate); \
|
||||
void (*setSamplerateConversionQuality)(mt32emu_context context, const mt32emu_samplerate_conversion_quality quality); \
|
||||
void (*selectRendererType)(mt32emu_context context, mt32emu_renderer_type renderer_type); \
|
||||
mt32emu_renderer_type (*getSelectedRendererType)(mt32emu_context context); \
|
||||
mt32emu_bit32u (*convertOutputToSynthTimestamp)(mt32emu_const_context context, mt32emu_bit32u output_timestamp); \
|
||||
mt32emu_bit32u (*convertSynthToOutputTimestamp)(mt32emu_const_context context, mt32emu_bit32u synth_timestamp);
|
||||
mt32emu_analog_output_mode (MT32EMU_C_CALL *getBestAnalogOutputMode)(const double target_samplerate); \
|
||||
void (MT32EMU_C_CALL *setStereoOutputSampleRate)(mt32emu_context context, const double samplerate); \
|
||||
void (MT32EMU_C_CALL *setSamplerateConversionQuality)(mt32emu_context context, const mt32emu_samplerate_conversion_quality quality); \
|
||||
void (MT32EMU_C_CALL *selectRendererType)(mt32emu_context context, mt32emu_renderer_type renderer_type); \
|
||||
mt32emu_renderer_type (MT32EMU_C_CALL *getSelectedRendererType)(mt32emu_context context); \
|
||||
mt32emu_bit32u (MT32EMU_C_CALL *convertOutputToSynthTimestamp)(mt32emu_const_context context, mt32emu_bit32u output_timestamp); \
|
||||
mt32emu_bit32u (MT32EMU_C_CALL *convertSynthToOutputTimestamp)(mt32emu_const_context context, mt32emu_bit32u synth_timestamp);
|
||||
|
||||
#define MT32EMU_SERVICE_I_V2 \
|
||||
mt32emu_bit32u (*getInternalRenderedSampleCount)(mt32emu_const_context context); \
|
||||
void (*setNiceAmpRampEnabled)(mt32emu_const_context context, const mt32emu_boolean enabled); \
|
||||
mt32emu_boolean (*isNiceAmpRampEnabled)(mt32emu_const_context context);
|
||||
mt32emu_bit32u (MT32EMU_C_CALL *getInternalRenderedSampleCount)(mt32emu_const_context context); \
|
||||
void (MT32EMU_C_CALL *setNiceAmpRampEnabled)(mt32emu_const_context context, const mt32emu_boolean enabled); \
|
||||
mt32emu_boolean (MT32EMU_C_CALL *isNiceAmpRampEnabled)(mt32emu_const_context context);
|
||||
|
||||
#define MT32EMU_SERVICE_I_V3 \
|
||||
void (MT32EMU_C_CALL *setNicePanningEnabled)(mt32emu_const_context context, const mt32emu_boolean enabled); \
|
||||
mt32emu_boolean (MT32EMU_C_CALL *isNicePanningEnabled)(mt32emu_const_context context); \
|
||||
void (MT32EMU_C_CALL *setNicePartialMixingEnabled)(mt32emu_const_context context, const mt32emu_boolean enabled); \
|
||||
mt32emu_boolean (MT32EMU_C_CALL *isNicePartialMixingEnabled)(mt32emu_const_context context); \
|
||||
void (MT32EMU_C_CALL *preallocateReverbMemory)(mt32emu_const_context context, const mt32emu_boolean enabled); \
|
||||
void (MT32EMU_C_CALL *configureMIDIEventQueueSysexStorage)(mt32emu_const_context context, const mt32emu_bit32u storage_buffer_size);
|
||||
|
||||
#define MT32EMU_SERVICE_I_V4 \
|
||||
size_t (MT32EMU_C_CALL *getMachineIDs)(const char **machine_ids, size_t machine_ids_size); \
|
||||
size_t (MT32EMU_C_CALL *getROMIDs)(const char **rom_ids, size_t rom_ids_size, const char *machine_id); \
|
||||
mt32emu_return_code (MT32EMU_C_CALL *identifyROMData)(mt32emu_rom_info *rom_info, const mt32emu_bit8u *data, size_t data_size, const char *machine_id); \
|
||||
mt32emu_return_code (MT32EMU_C_CALL *identifyROMFile)(mt32emu_rom_info *rom_info, const char *filename, const char *machine_id); \
|
||||
\
|
||||
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); \
|
||||
mt32emu_return_code (MT32EMU_C_CALL *mergeAndAddROMFiles)(mt32emu_context context, const char *part1_filename, const char *part2_filename); \
|
||||
mt32emu_return_code (MT32EMU_C_CALL *addMachineROMFile)(mt32emu_context context, const char *machine_id, const char *filename);
|
||||
|
||||
#define MT32EMU_SERVICE_I_V5 \
|
||||
mt32emu_boolean (MT32EMU_C_CALL *getDisplayState)(mt32emu_const_context context, char *target_buffer, const mt32emu_boolean narrow_lcd); \
|
||||
void (MT32EMU_C_CALL *setMainDisplayMode)(mt32emu_const_context context); \
|
||||
void (MT32EMU_C_CALL *setDisplayCompatibility)(mt32emu_const_context context, mt32emu_boolean old_mt32_compatibility_enabled); \
|
||||
mt32emu_boolean (MT32EMU_C_CALL *isDisplayOldMT32Compatible)(mt32emu_const_context context); \
|
||||
mt32emu_boolean (MT32EMU_C_CALL *isDefaultDisplayOldMT32Compatible)(mt32emu_const_context context); \
|
||||
void (MT32EMU_C_CALL *setPartVolumeOverride)(mt32emu_const_context context, mt32emu_bit8u part_number, mt32emu_bit8u volume_override); \
|
||||
mt32emu_bit8u (MT32EMU_C_CALL *getPartVolumeOverride)(mt32emu_const_context context, mt32emu_bit8u part_number);
|
||||
|
||||
#define MT32EMU_SERVICE_I_V6 \
|
||||
mt32emu_boolean (MT32EMU_C_CALL *getSoundGroupName)(mt32emu_const_context context, char *sound_group_name, mt32emu_bit8u timbre_group, mt32emu_bit8u timbre_number); \
|
||||
mt32emu_boolean (MT32EMU_C_CALL *getSoundName)(mt32emu_const_context context, char *sound_name, mt32emu_bit8u timbre_group, mt32emu_bit8u timbre_number);
|
||||
|
||||
typedef struct {
|
||||
MT32EMU_SERVICE_I_V0
|
||||
@@ -318,6 +385,40 @@ typedef struct {
|
||||
MT32EMU_SERVICE_I_V2
|
||||
} mt32emu_service_i_v2;
|
||||
|
||||
typedef struct {
|
||||
MT32EMU_SERVICE_I_V0
|
||||
MT32EMU_SERVICE_I_V1
|
||||
MT32EMU_SERVICE_I_V2
|
||||
MT32EMU_SERVICE_I_V3
|
||||
} mt32emu_service_i_v3;
|
||||
|
||||
typedef struct {
|
||||
MT32EMU_SERVICE_I_V0
|
||||
MT32EMU_SERVICE_I_V1
|
||||
MT32EMU_SERVICE_I_V2
|
||||
MT32EMU_SERVICE_I_V3
|
||||
MT32EMU_SERVICE_I_V4
|
||||
} mt32emu_service_i_v4;
|
||||
|
||||
typedef struct {
|
||||
MT32EMU_SERVICE_I_V0
|
||||
MT32EMU_SERVICE_I_V1
|
||||
MT32EMU_SERVICE_I_V2
|
||||
MT32EMU_SERVICE_I_V3
|
||||
MT32EMU_SERVICE_I_V4
|
||||
MT32EMU_SERVICE_I_V5
|
||||
} mt32emu_service_i_v5;
|
||||
|
||||
typedef struct {
|
||||
MT32EMU_SERVICE_I_V0
|
||||
MT32EMU_SERVICE_I_V1
|
||||
MT32EMU_SERVICE_I_V2
|
||||
MT32EMU_SERVICE_I_V3
|
||||
MT32EMU_SERVICE_I_V4
|
||||
MT32EMU_SERVICE_I_V5
|
||||
MT32EMU_SERVICE_I_V6
|
||||
} mt32emu_service_i_v6;
|
||||
|
||||
/**
|
||||
* Extensible interface for all the library services.
|
||||
* Union intended to view an interface of any subsequent version as any parent interface not requiring a cast.
|
||||
@@ -327,10 +428,18 @@ union mt32emu_service_i {
|
||||
const mt32emu_service_i_v0 *v0;
|
||||
const mt32emu_service_i_v1 *v1;
|
||||
const mt32emu_service_i_v2 *v2;
|
||||
const mt32emu_service_i_v3 *v3;
|
||||
const mt32emu_service_i_v4 *v4;
|
||||
const mt32emu_service_i_v5 *v5;
|
||||
const mt32emu_service_i_v6 *v6;
|
||||
};
|
||||
|
||||
#undef MT32EMU_SERVICE_I_V0
|
||||
#undef MT32EMU_SERVICE_I_V1
|
||||
#undef MT32EMU_SERVICE_I_V2
|
||||
#undef MT32EMU_SERVICE_I_V3
|
||||
#undef MT32EMU_SERVICE_I_V4
|
||||
#undef MT32EMU_SERVICE_I_V5
|
||||
#undef MT32EMU_SERVICE_I_V6
|
||||
|
||||
#endif /* #ifndef MT32EMU_C_TYPES_H */
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* Copyright (C) 2003, 2004, 2005, 2006, 2008, 2009 Dean Beeler, Jerome Fisher
|
||||
* Copyright (C) 2011-2017 Dean Beeler, Jerome Fisher, Sergey V. Mikayev
|
||||
* Copyright (C) 2011-2022 Dean Beeler, Jerome Fisher, Sergey V. Mikayev
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
@@ -41,10 +41,17 @@ mt32emu_service_i mt32emu_get_service_i();
|
||||
#define mt32emu_get_library_version_string i.v0->getLibraryVersionString
|
||||
#define mt32emu_get_stereo_output_samplerate i.v0->getStereoOutputSamplerate
|
||||
#define mt32emu_get_best_analog_output_mode iV1()->getBestAnalogOutputMode
|
||||
#define mt32emu_get_machine_ids iV4()->getMachineIDs
|
||||
#define mt32emu_get_rom_ids iV4()->getROMIDs
|
||||
#define mt32emu_identify_rom_data iV4()->identifyROMData
|
||||
#define mt32emu_identify_rom_file iV4()->identifyROMFile
|
||||
#define mt32emu_create_context i.v0->createContext
|
||||
#define mt32emu_free_context i.v0->freeContext
|
||||
#define mt32emu_add_rom_data i.v0->addROMData
|
||||
#define mt32emu_add_rom_file i.v0->addROMFile
|
||||
#define mt32emu_merge_and_add_rom_data iV4()->mergeAndAddROMData
|
||||
#define mt32emu_merge_and_add_rom_files iV4()->mergeAndAddROMFiles
|
||||
#define mt32emu_add_machine_rom_file iV4()->addMachineROMFile
|
||||
#define mt32emu_get_rom_info i.v0->getROMInfo
|
||||
#define mt32emu_set_partial_count i.v0->setPartialCount
|
||||
#define mt32emu_set_analog_output_mode i.v0->setAnalogOutputMode
|
||||
@@ -60,6 +67,7 @@ mt32emu_service_i mt32emu_get_service_i();
|
||||
#define mt32emu_convert_synth_to_output_timestamp iV1()->convertSynthToOutputTimestamp
|
||||
#define mt32emu_flush_midi_queue i.v0->flushMIDIQueue
|
||||
#define mt32emu_set_midi_event_queue_size i.v0->setMIDIEventQueueSize
|
||||
#define mt32emu_configure_midi_event_queue_sysex_storage iV3()->configureMIDIEventQueueSysexStorage
|
||||
#define mt32emu_set_midi_receiver i.v0->setMIDIReceiver
|
||||
#define mt32emu_get_internal_rendered_sample_count iV2()->getInternalRenderedSampleCount
|
||||
#define mt32emu_parse_stream i.v0->parseStream
|
||||
@@ -81,6 +89,7 @@ mt32emu_service_i mt32emu_get_service_i();
|
||||
#define mt32emu_set_reverb_compatibility_mode i.v0->setReverbCompatibilityMode
|
||||
#define mt32emu_is_mt32_reverb_compatibility_mode i.v0->isMT32ReverbCompatibilityMode
|
||||
#define mt32emu_is_default_reverb_mt32_compatible i.v0->isDefaultReverbMT32Compatible
|
||||
#define mt32emu_preallocate_reverb_memory iV3()->preallocateReverbMemory
|
||||
#define mt32emu_set_dac_input_mode i.v0->setDACInputMode
|
||||
#define mt32emu_get_dac_input_mode i.v0->getDACInputMode
|
||||
#define mt32emu_set_midi_delay_mode i.v0->setMIDIDelayMode
|
||||
@@ -89,10 +98,16 @@ mt32emu_service_i mt32emu_get_service_i();
|
||||
#define mt32emu_get_output_gain i.v0->getOutputGain
|
||||
#define mt32emu_set_reverb_output_gain i.v0->setReverbOutputGain
|
||||
#define mt32emu_get_reverb_output_gain i.v0->getReverbOutputGain
|
||||
#define mt32emu_set_part_volume_override iV5()->setPartVolumeOverride
|
||||
#define mt32emu_get_part_volume_override iV5()->getPartVolumeOverride
|
||||
#define mt32emu_set_reversed_stereo_enabled i.v0->setReversedStereoEnabled
|
||||
#define mt32emu_is_reversed_stereo_enabled i.v0->isReversedStereoEnabled
|
||||
#define mt32emu_set_nice_amp_ramp_enabled iV2()->setNiceAmpRampEnabled
|
||||
#define mt32emu_is_nice_amp_ramp_enabled iV2()->isNiceAmpRampEnabled
|
||||
#define mt32emu_set_nice_panning_enabled iV3()->setNicePanningEnabled
|
||||
#define mt32emu_is_nice_panning_enabled iV3()->isNicePanningEnabled
|
||||
#define mt32emu_set_nice_partial_mixing_enabled iV3()->setNicePartialMixingEnabled
|
||||
#define mt32emu_is_nice_partial_mixing_enabled iV3()->isNicePartialMixingEnabled
|
||||
#define mt32emu_render_bit16s i.v0->renderBit16s
|
||||
#define mt32emu_render_float i.v0->renderFloat
|
||||
#define mt32emu_render_bit16s_streams i.v0->renderBit16sStreams
|
||||
@@ -104,7 +119,14 @@ mt32emu_service_i mt32emu_get_service_i();
|
||||
#define mt32emu_get_partial_states i.v0->getPartialStates
|
||||
#define mt32emu_get_playing_notes i.v0->getPlayingNotes
|
||||
#define mt32emu_get_patch_name i.v0->getPatchName
|
||||
#define mt32emu_get_sound_group_name iV6()->getSoundGroupName
|
||||
#define mt32emu_get_sound_name iV6()->getSoundName
|
||||
#define mt32emu_read_memory i.v0->readMemory
|
||||
#define mt32emu_get_display_state iV5()->getDisplayState
|
||||
#define mt32emu_set_main_display_mode iV5()->setMainDisplayMode
|
||||
#define mt32emu_set_display_compatibility iV5()->setDisplayCompatibility
|
||||
#define mt32emu_is_display_old_mt32_compatible iV5()->isDisplayOldMT32Compatible
|
||||
#define mt32emu_is_default_display_old_mt32_compatible iV5()->isDefaultDisplayOldMT32Compatible
|
||||
|
||||
#else // #if MT32EMU_API_TYPE == 2
|
||||
|
||||
@@ -117,7 +139,7 @@ namespace MT32Emu {
|
||||
namespace CppInterfaceImpl {
|
||||
|
||||
static const mt32emu_report_handler_i NULL_REPORT_HANDLER = { NULL };
|
||||
static mt32emu_report_handler_i getReportHandlerThunk();
|
||||
static mt32emu_report_handler_i getReportHandlerThunk(mt32emu_report_handler_version);
|
||||
static mt32emu_midi_receiver_i getMidiReceiverThunk();
|
||||
|
||||
}
|
||||
@@ -130,8 +152,8 @@ static mt32emu_midi_receiver_i getMidiReceiverThunk();
|
||||
* See c_types.h and c_interface.h for description of the corresponding interface methods.
|
||||
*/
|
||||
|
||||
// Defines the interface for handling reported events.
|
||||
// Corresponds to the current version of mt32emu_report_handler_i interface.
|
||||
// Defines the interface for handling reported events (initial version).
|
||||
// Corresponds to the mt32emu_report_handler_i_v0 interface.
|
||||
class IReportHandler {
|
||||
public:
|
||||
virtual void printDebug(const char *fmt, va_list list) = 0;
|
||||
@@ -153,6 +175,17 @@ protected:
|
||||
~IReportHandler() {}
|
||||
};
|
||||
|
||||
// Extends IReportHandler, so that the client may supply callbacks for reporting signals about updated display state.
|
||||
// Corresponds to the mt32emu_report_handler_i_v1 interface.
|
||||
class IReportHandlerV1 : public IReportHandler {
|
||||
public:
|
||||
virtual void onLCDStateUpdated() = 0;
|
||||
virtual void onMidiMessageLEDStateUpdated(bool ledState) = 0;
|
||||
|
||||
protected:
|
||||
~IReportHandlerV1() {}
|
||||
};
|
||||
|
||||
// Defines the interface for receiving MIDI messages generated by MIDI stream parser.
|
||||
// Corresponds to the current version of mt32emu_midi_receiver_i interface.
|
||||
class IMidiReceiver {
|
||||
@@ -190,14 +223,24 @@ public:
|
||||
Bit32u getStereoOutputSamplerate(const AnalogOutputMode analog_output_mode) { return mt32emu_get_stereo_output_samplerate(static_cast<mt32emu_analog_output_mode>(analog_output_mode)); }
|
||||
AnalogOutputMode getBestAnalogOutputMode(const double target_samplerate) { return static_cast<AnalogOutputMode>(mt32emu_get_best_analog_output_mode(target_samplerate)); }
|
||||
|
||||
size_t getMachineIDs(const char **machine_ids, size_t machine_ids_size) { return mt32emu_get_machine_ids(machine_ids, machine_ids_size); }
|
||||
size_t getROMIDs(const char **rom_ids, size_t rom_ids_size, const char *machine_id) { return mt32emu_get_rom_ids(rom_ids, rom_ids_size, machine_id); }
|
||||
mt32emu_return_code identifyROMData(mt32emu_rom_info *rom_info, const Bit8u *data, size_t data_size, const char *machine_id) { return mt32emu_identify_rom_data(rom_info, data, data_size, machine_id); }
|
||||
mt32emu_return_code identifyROMFile(mt32emu_rom_info *rom_info, const char *filename, const char *machine_id) { return mt32emu_identify_rom_file(rom_info, filename, machine_id); }
|
||||
|
||||
// Context-dependent methods
|
||||
|
||||
mt32emu_context getContext() { return c; }
|
||||
void createContext(mt32emu_report_handler_i report_handler = CppInterfaceImpl::NULL_REPORT_HANDLER, void *instance_data = NULL) { freeContext(); c = mt32emu_create_context(report_handler, instance_data); }
|
||||
void createContext(IReportHandler &report_handler) { createContext(CppInterfaceImpl::getReportHandlerThunk(), &report_handler); }
|
||||
void createContext(IReportHandler &report_handler) { createContext(CppInterfaceImpl::getReportHandlerThunk(MT32EMU_REPORT_HANDLER_VERSION_0), &report_handler); }
|
||||
void createContext(IReportHandlerV1 &report_handler) { createContext(CppInterfaceImpl::getReportHandlerThunk(MT32EMU_REPORT_HANDLER_VERSION_1), &report_handler); }
|
||||
void freeContext() { if (c != NULL) { mt32emu_free_context(c); c = NULL; } }
|
||||
mt32emu_return_code addROMData(const Bit8u *data, size_t data_size, const mt32emu_sha1_digest *sha1_digest = NULL) { return mt32emu_add_rom_data(c, data, data_size, sha1_digest); }
|
||||
mt32emu_return_code addROMFile(const char *filename) { return mt32emu_add_rom_file(c, filename); }
|
||||
mt32emu_return_code mergeAndAddROMData(const Bit8u *part1_data, size_t part1_data_size, const Bit8u *part2_data, size_t part2_data_size) { return mt32emu_merge_and_add_rom_data(c, part1_data, part1_data_size, NULL, part2_data, part2_data_size, NULL); }
|
||||
mt32emu_return_code mergeAndAddROMData(const Bit8u *part1_data, size_t part1_data_size, const mt32emu_sha1_digest *part1_sha1_digest, const Bit8u *part2_data, size_t part2_data_size, const mt32emu_sha1_digest *part2_sha1_digest) { return mt32emu_merge_and_add_rom_data(c, part1_data, part1_data_size, part1_sha1_digest, part2_data, part2_data_size, part2_sha1_digest); }
|
||||
mt32emu_return_code mergeAndAddROMFiles(const char *part1_filename, const char *part2_filename) { return mt32emu_merge_and_add_rom_files(c, part1_filename, part2_filename); }
|
||||
mt32emu_return_code addMachineROMFile(const char *machine_id, const char *filename) { return mt32emu_add_machine_rom_file(c, machine_id, filename); }
|
||||
void getROMInfo(mt32emu_rom_info *rom_info) { mt32emu_get_rom_info(c, rom_info); }
|
||||
void setPartialCount(const Bit32u partial_count) { mt32emu_set_partial_count(c, partial_count); }
|
||||
void setAnalogOutputMode(const AnalogOutputMode analog_output_mode) { mt32emu_set_analog_output_mode(c, static_cast<mt32emu_analog_output_mode>(analog_output_mode)); }
|
||||
@@ -213,6 +256,7 @@ public:
|
||||
Bit32u convertSynthToOutputTimestamp(Bit32u synth_timestamp) { return mt32emu_convert_synth_to_output_timestamp(c, synth_timestamp); }
|
||||
void flushMIDIQueue() { mt32emu_flush_midi_queue(c); }
|
||||
Bit32u setMIDIEventQueueSize(const Bit32u queue_size) { return mt32emu_set_midi_event_queue_size(c, queue_size); }
|
||||
void configureMIDIEventQueueSysexStorage(const Bit32u storage_buffer_size) { mt32emu_configure_midi_event_queue_sysex_storage(c, storage_buffer_size); }
|
||||
void setMIDIReceiver(mt32emu_midi_receiver_i midi_receiver, void *instance_data) { mt32emu_set_midi_receiver(c, midi_receiver, instance_data); }
|
||||
void setMIDIReceiver(IMidiReceiver &midi_receiver) { setMIDIReceiver(CppInterfaceImpl::getMidiReceiverThunk(), &midi_receiver); }
|
||||
|
||||
@@ -238,6 +282,7 @@ public:
|
||||
void setReverbCompatibilityMode(const bool mt32_compatible_mode) { mt32emu_set_reverb_compatibility_mode(c, mt32_compatible_mode ? MT32EMU_BOOL_TRUE : MT32EMU_BOOL_FALSE); }
|
||||
bool isMT32ReverbCompatibilityMode() { return mt32emu_is_mt32_reverb_compatibility_mode(c) != MT32EMU_BOOL_FALSE; }
|
||||
bool isDefaultReverbMT32Compatible() { return mt32emu_is_default_reverb_mt32_compatible(c) != MT32EMU_BOOL_FALSE; }
|
||||
void preallocateReverbMemory(const bool enabled) { mt32emu_preallocate_reverb_memory(c, enabled ? MT32EMU_BOOL_TRUE : MT32EMU_BOOL_FALSE); }
|
||||
|
||||
void setDACInputMode(const DACInputMode mode) { mt32emu_set_dac_input_mode(c, static_cast<mt32emu_dac_input_mode>(mode)); }
|
||||
DACInputMode getDACInputMode() { return static_cast<DACInputMode>(mt32emu_get_dac_input_mode(c)); }
|
||||
@@ -250,12 +295,21 @@ public:
|
||||
void setReverbOutputGain(float gain) { mt32emu_set_reverb_output_gain(c, gain); }
|
||||
float getReverbOutputGain() { return mt32emu_get_reverb_output_gain(c); }
|
||||
|
||||
void setPartVolumeOverride(Bit8u part_number, Bit8u volume_override) { mt32emu_set_part_volume_override(c, part_number, volume_override); }
|
||||
Bit8u getPartVolumeOverride(Bit8u part_number) { return mt32emu_get_part_volume_override(c, part_number); }
|
||||
|
||||
void setReversedStereoEnabled(const bool enabled) { mt32emu_set_reversed_stereo_enabled(c, enabled ? MT32EMU_BOOL_TRUE : MT32EMU_BOOL_FALSE); }
|
||||
bool isReversedStereoEnabled() { return mt32emu_is_reversed_stereo_enabled(c) != MT32EMU_BOOL_FALSE; }
|
||||
|
||||
void setNiceAmpRampEnabled(const bool enabled) { mt32emu_set_nice_amp_ramp_enabled(c, enabled ? MT32EMU_BOOL_TRUE : MT32EMU_BOOL_FALSE); }
|
||||
bool isNiceAmpRampEnabled() { return mt32emu_is_nice_amp_ramp_enabled(c) != MT32EMU_BOOL_FALSE; }
|
||||
|
||||
void setNicePanningEnabled(const bool enabled) { mt32emu_set_nice_panning_enabled(c, enabled ? MT32EMU_BOOL_TRUE : MT32EMU_BOOL_FALSE); }
|
||||
bool isNicePanningEnabled() { return mt32emu_is_nice_panning_enabled(c) != MT32EMU_BOOL_FALSE; }
|
||||
|
||||
void setNicePartialMixingEnabled(const bool enabled) { mt32emu_set_nice_partial_mixing_enabled(c, enabled ? MT32EMU_BOOL_TRUE : MT32EMU_BOOL_FALSE); }
|
||||
bool isNicePartialMixingEnabled() { return mt32emu_is_nice_partial_mixing_enabled(c) != MT32EMU_BOOL_FALSE; }
|
||||
|
||||
void renderBit16s(Bit16s *stream, Bit32u len) { mt32emu_render_bit16s(c, stream, len); }
|
||||
void renderFloat(float *stream, Bit32u len) { mt32emu_render_float(c, stream, len); }
|
||||
void renderBit16sStreams(const mt32emu_dac_output_bit16s_streams *streams, Bit32u len) { mt32emu_render_bit16s_streams(c, streams, len); }
|
||||
@@ -268,8 +322,17 @@ public:
|
||||
void getPartialStates(Bit8u *partial_states) { mt32emu_get_partial_states(c, partial_states); }
|
||||
Bit32u getPlayingNotes(Bit8u part_number, Bit8u *keys, Bit8u *velocities) { return mt32emu_get_playing_notes(c, part_number, keys, velocities); }
|
||||
const char *getPatchName(Bit8u part_number) { return mt32emu_get_patch_name(c, part_number); }
|
||||
bool getSoundGroupName(char *soundGroupName, Bit8u timbreGroup, Bit8u timbreNumber) { return mt32emu_get_sound_group_name(c, soundGroupName, timbreGroup, timbreNumber) != MT32EMU_BOOL_FALSE; }
|
||||
bool getSoundName(char *soundName, Bit8u timbreGroup, Bit8u timbreNumber) { return mt32emu_get_sound_name(c, soundName, timbreGroup, timbreNumber) != MT32EMU_BOOL_FALSE; }
|
||||
void readMemory(Bit32u addr, Bit32u len, Bit8u *data) { mt32emu_read_memory(c, addr, len, data); }
|
||||
|
||||
bool getDisplayState(char *target_buffer, const bool narrow_lcd) { return mt32emu_get_display_state(c, target_buffer, narrow_lcd ? MT32EMU_BOOL_TRUE : MT32EMU_BOOL_FALSE) != MT32EMU_BOOL_FALSE; }
|
||||
void setMainDisplayMode() { mt32emu_set_main_display_mode(c); }
|
||||
|
||||
void setDisplayCompatibility(const bool oldMT32CompatibilityEnabled) { mt32emu_set_display_compatibility(c, oldMT32CompatibilityEnabled ? MT32EMU_BOOL_TRUE : MT32EMU_BOOL_FALSE); }
|
||||
bool isDisplayOldMT32Compatible() { return mt32emu_is_display_old_mt32_compatible(c) != MT32EMU_BOOL_FALSE; }
|
||||
bool isDefaultDisplayOldMT32Compatible() { return mt32emu_is_default_display_old_mt32_compatible(c) != MT32EMU_BOOL_FALSE; }
|
||||
|
||||
private:
|
||||
#if MT32EMU_API_TYPE == 2
|
||||
const mt32emu_service_i i;
|
||||
@@ -279,108 +342,138 @@ private:
|
||||
#if MT32EMU_API_TYPE == 2
|
||||
const mt32emu_service_i_v1 *iV1() { return (getVersionID() < MT32EMU_SERVICE_VERSION_1) ? NULL : i.v1; }
|
||||
const mt32emu_service_i_v2 *iV2() { return (getVersionID() < MT32EMU_SERVICE_VERSION_2) ? NULL : i.v2; }
|
||||
const mt32emu_service_i_v3 *iV3() { return (getVersionID() < MT32EMU_SERVICE_VERSION_3) ? NULL : i.v3; }
|
||||
const mt32emu_service_i_v4 *iV4() { return (getVersionID() < MT32EMU_SERVICE_VERSION_4) ? NULL : i.v4; }
|
||||
const mt32emu_service_i_v5 *iV5() { return (getVersionID() < MT32EMU_SERVICE_VERSION_5) ? NULL : i.v5; }
|
||||
const mt32emu_service_i_v6 *iV6() { return (getVersionID() < MT32EMU_SERVICE_VERSION_6) ? NULL : i.v6; }
|
||||
#endif
|
||||
|
||||
Service(const Service &); // prevent copy-construction
|
||||
Service& operator=(const Service &); // prevent assignment
|
||||
};
|
||||
|
||||
namespace CppInterfaceImpl {
|
||||
|
||||
static mt32emu_report_handler_version getReportHandlerVersionID(mt32emu_report_handler_i) {
|
||||
return MT32EMU_REPORT_HANDLER_VERSION_CURRENT;
|
||||
}
|
||||
static mt32emu_report_handler_version MT32EMU_C_CALL getReportHandlerVersionID(mt32emu_report_handler_i);
|
||||
|
||||
static void printDebug(void *instance_data, const char *fmt, va_list list) {
|
||||
static void MT32EMU_C_CALL printDebug(void *instance_data, const char *fmt, va_list list) {
|
||||
static_cast<IReportHandler *>(instance_data)->printDebug(fmt, list);
|
||||
}
|
||||
|
||||
static void onErrorControlROM(void *instance_data) {
|
||||
static void MT32EMU_C_CALL onErrorControlROM(void *instance_data) {
|
||||
static_cast<IReportHandler *>(instance_data)->onErrorControlROM();
|
||||
}
|
||||
|
||||
static void onErrorPCMROM(void *instance_data) {
|
||||
static void MT32EMU_C_CALL onErrorPCMROM(void *instance_data) {
|
||||
static_cast<IReportHandler *>(instance_data)->onErrorPCMROM();
|
||||
}
|
||||
|
||||
static void showLCDMessage(void *instance_data, const char *message) {
|
||||
static void MT32EMU_C_CALL showLCDMessage(void *instance_data, const char *message) {
|
||||
static_cast<IReportHandler *>(instance_data)->showLCDMessage(message);
|
||||
}
|
||||
|
||||
static void onMIDIMessagePlayed(void *instance_data) {
|
||||
static void MT32EMU_C_CALL onMIDIMessagePlayed(void *instance_data) {
|
||||
static_cast<IReportHandler *>(instance_data)->onMIDIMessagePlayed();
|
||||
}
|
||||
|
||||
static mt32emu_boolean onMIDIQueueOverflow(void *instance_data) {
|
||||
static mt32emu_boolean MT32EMU_C_CALL onMIDIQueueOverflow(void *instance_data) {
|
||||
return static_cast<IReportHandler *>(instance_data)->onMIDIQueueOverflow() ? MT32EMU_BOOL_TRUE : MT32EMU_BOOL_FALSE;
|
||||
}
|
||||
|
||||
static void onMIDISystemRealtime(void *instance_data, mt32emu_bit8u system_realtime) {
|
||||
static void MT32EMU_C_CALL onMIDISystemRealtime(void *instance_data, mt32emu_bit8u system_realtime) {
|
||||
static_cast<IReportHandler *>(instance_data)->onMIDISystemRealtime(system_realtime);
|
||||
}
|
||||
|
||||
static void onDeviceReset(void *instance_data) {
|
||||
static void MT32EMU_C_CALL onDeviceReset(void *instance_data) {
|
||||
static_cast<IReportHandler *>(instance_data)->onDeviceReset();
|
||||
}
|
||||
|
||||
static void onDeviceReconfig(void *instance_data) {
|
||||
static void MT32EMU_C_CALL onDeviceReconfig(void *instance_data) {
|
||||
static_cast<IReportHandler *>(instance_data)->onDeviceReconfig();
|
||||
}
|
||||
|
||||
static void onNewReverbMode(void *instance_data, mt32emu_bit8u mode) {
|
||||
static void MT32EMU_C_CALL onNewReverbMode(void *instance_data, mt32emu_bit8u mode) {
|
||||
static_cast<IReportHandler *>(instance_data)->onNewReverbMode(mode);
|
||||
}
|
||||
|
||||
static void onNewReverbTime(void *instance_data, mt32emu_bit8u time) {
|
||||
static void MT32EMU_C_CALL onNewReverbTime(void *instance_data, mt32emu_bit8u time) {
|
||||
static_cast<IReportHandler *>(instance_data)->onNewReverbTime(time);
|
||||
}
|
||||
|
||||
static void onNewReverbLevel(void *instance_data, mt32emu_bit8u level) {
|
||||
static void MT32EMU_C_CALL onNewReverbLevel(void *instance_data, mt32emu_bit8u level) {
|
||||
static_cast<IReportHandler *>(instance_data)->onNewReverbLevel(level);
|
||||
}
|
||||
|
||||
static void onPolyStateChanged(void *instance_data, mt32emu_bit8u part_num) {
|
||||
static void MT32EMU_C_CALL onPolyStateChanged(void *instance_data, mt32emu_bit8u part_num) {
|
||||
static_cast<IReportHandler *>(instance_data)->onPolyStateChanged(part_num);
|
||||
}
|
||||
|
||||
static void onProgramChanged(void *instance_data, mt32emu_bit8u part_num, const char *sound_group_name, const char *patch_name) {
|
||||
static void MT32EMU_C_CALL onProgramChanged(void *instance_data, mt32emu_bit8u part_num, const char *sound_group_name, const char *patch_name) {
|
||||
static_cast<IReportHandler *>(instance_data)->onProgramChanged(part_num, sound_group_name, patch_name);
|
||||
}
|
||||
|
||||
static mt32emu_report_handler_i getReportHandlerThunk() {
|
||||
static const mt32emu_report_handler_i_v0 REPORT_HANDLER_V0_THUNK = {
|
||||
getReportHandlerVersionID,
|
||||
printDebug,
|
||||
onErrorControlROM,
|
||||
onErrorPCMROM,
|
||||
showLCDMessage,
|
||||
onMIDIMessagePlayed,
|
||||
onMIDIQueueOverflow,
|
||||
onMIDISystemRealtime,
|
||||
onDeviceReset,
|
||||
onDeviceReconfig,
|
||||
onNewReverbMode,
|
||||
onNewReverbTime,
|
||||
onNewReverbLevel,
|
||||
onPolyStateChanged,
|
||||
onProgramChanged
|
||||
};
|
||||
|
||||
static const mt32emu_report_handler_i REPORT_HANDLER_THUNK = { &REPORT_HANDLER_V0_THUNK };
|
||||
|
||||
return REPORT_HANDLER_THUNK;
|
||||
static void MT32EMU_C_CALL onLCDStateUpdated(void *instance_data) {
|
||||
static_cast<IReportHandlerV1 *>(instance_data)->onLCDStateUpdated();
|
||||
}
|
||||
|
||||
static mt32emu_midi_receiver_version getMidiReceiverVersionID(mt32emu_midi_receiver_i) {
|
||||
static void MT32EMU_C_CALL onMidiMessageLEDStateUpdated(void *instance_data, mt32emu_boolean led_state) {
|
||||
static_cast<IReportHandlerV1 *>(instance_data)->onMidiMessageLEDStateUpdated(led_state != MT32EMU_BOOL_FALSE);
|
||||
}
|
||||
|
||||
#define MT32EMU_REPORT_HANDLER_V0_THUNK \
|
||||
getReportHandlerVersionID, \
|
||||
printDebug, \
|
||||
onErrorControlROM, \
|
||||
onErrorPCMROM, \
|
||||
showLCDMessage, \
|
||||
onMIDIMessagePlayed, \
|
||||
onMIDIQueueOverflow, \
|
||||
onMIDISystemRealtime, \
|
||||
onDeviceReset, \
|
||||
onDeviceReconfig, \
|
||||
onNewReverbMode, \
|
||||
onNewReverbTime, \
|
||||
onNewReverbLevel, \
|
||||
onPolyStateChanged, \
|
||||
onProgramChanged
|
||||
|
||||
static const mt32emu_report_handler_i_v0 REPORT_HANDLER_V0_THUNK = {
|
||||
MT32EMU_REPORT_HANDLER_V0_THUNK
|
||||
};
|
||||
|
||||
static const mt32emu_report_handler_i_v1 REPORT_HANDLER_V1_THUNK = {
|
||||
MT32EMU_REPORT_HANDLER_V0_THUNK,
|
||||
onLCDStateUpdated,
|
||||
onMidiMessageLEDStateUpdated
|
||||
};
|
||||
|
||||
#undef MT32EMU_REPORT_HANDLER_THUNK_V0
|
||||
|
||||
static mt32emu_report_handler_version MT32EMU_C_CALL getReportHandlerVersionID(mt32emu_report_handler_i thunk) {
|
||||
if (thunk.v0 == &REPORT_HANDLER_V0_THUNK) return MT32EMU_REPORT_HANDLER_VERSION_0;
|
||||
return MT32EMU_REPORT_HANDLER_VERSION_CURRENT;
|
||||
}
|
||||
|
||||
static mt32emu_report_handler_i getReportHandlerThunk(mt32emu_report_handler_version versionID) {
|
||||
mt32emu_report_handler_i thunk;
|
||||
if (versionID == MT32EMU_REPORT_HANDLER_VERSION_0) thunk.v0 = &REPORT_HANDLER_V0_THUNK;
|
||||
else thunk.v1 = &REPORT_HANDLER_V1_THUNK;
|
||||
return thunk;
|
||||
}
|
||||
|
||||
static mt32emu_midi_receiver_version MT32EMU_C_CALL getMidiReceiverVersionID(mt32emu_midi_receiver_i) {
|
||||
return MT32EMU_MIDI_RECEIVER_VERSION_CURRENT;
|
||||
}
|
||||
|
||||
static void handleShortMessage(void *instance_data, const mt32emu_bit32u message) {
|
||||
static void MT32EMU_C_CALL handleShortMessage(void *instance_data, const mt32emu_bit32u message) {
|
||||
static_cast<IMidiReceiver *>(instance_data)->handleShortMessage(message);
|
||||
}
|
||||
|
||||
static void handleSysex(void *instance_data, const mt32emu_bit8u stream[], const mt32emu_bit32u length) {
|
||||
static void MT32EMU_C_CALL handleSysex(void *instance_data, const mt32emu_bit8u stream[], const mt32emu_bit32u length) {
|
||||
static_cast<IMidiReceiver *>(instance_data)->handleSysex(stream, length);
|
||||
}
|
||||
|
||||
static void handleSystemRealtimeMessage(void *instance_data, const mt32emu_bit8u realtime) {
|
||||
static void MT32EMU_C_CALL handleSystemRealtimeMessage(void *instance_data, const mt32emu_bit8u realtime) {
|
||||
static_cast<IMidiReceiver *>(instance_data)->handleSystemRealtimeMessage(realtime);
|
||||
}
|
||||
|
||||
@@ -409,10 +502,17 @@ static mt32emu_midi_receiver_i getMidiReceiverThunk() {
|
||||
#undef mt32emu_get_library_version_string
|
||||
#undef mt32emu_get_stereo_output_samplerate
|
||||
#undef mt32emu_get_best_analog_output_mode
|
||||
#undef mt32emu_get_machine_ids
|
||||
#undef mt32emu_get_rom_ids
|
||||
#undef mt32emu_identify_rom_data
|
||||
#undef mt32emu_identify_rom_file
|
||||
#undef mt32emu_create_context
|
||||
#undef mt32emu_free_context
|
||||
#undef mt32emu_add_rom_data
|
||||
#undef mt32emu_add_rom_file
|
||||
#undef mt32emu_merge_and_add_rom_data
|
||||
#undef mt32emu_merge_and_add_rom_files
|
||||
#undef mt32emu_add_machine_rom_file
|
||||
#undef mt32emu_get_rom_info
|
||||
#undef mt32emu_set_partial_count
|
||||
#undef mt32emu_set_analog_output_mode
|
||||
@@ -428,6 +528,7 @@ static mt32emu_midi_receiver_i getMidiReceiverThunk() {
|
||||
#undef mt32emu_convert_synth_to_output_timestamp
|
||||
#undef mt32emu_flush_midi_queue
|
||||
#undef mt32emu_set_midi_event_queue_size
|
||||
#undef mt32emu_configure_midi_event_queue_sysex_storage
|
||||
#undef mt32emu_set_midi_receiver
|
||||
#undef mt32emu_get_internal_rendered_sample_count
|
||||
#undef mt32emu_parse_stream
|
||||
@@ -449,6 +550,7 @@ static mt32emu_midi_receiver_i getMidiReceiverThunk() {
|
||||
#undef mt32emu_set_reverb_compatibility_mode
|
||||
#undef mt32emu_is_mt32_reverb_compatibility_mode
|
||||
#undef mt32emu_is_default_reverb_mt32_compatible
|
||||
#undef mt32emu_preallocate_reverb_memory
|
||||
#undef mt32emu_set_dac_input_mode
|
||||
#undef mt32emu_get_dac_input_mode
|
||||
#undef mt32emu_set_midi_delay_mode
|
||||
@@ -461,6 +563,10 @@ static mt32emu_midi_receiver_i getMidiReceiverThunk() {
|
||||
#undef mt32emu_is_reversed_stereo_enabled
|
||||
#undef mt32emu_set_nice_amp_ramp_enabled
|
||||
#undef mt32emu_is_nice_amp_ramp_enabled
|
||||
#undef mt32emu_set_nice_panning_enabled
|
||||
#undef mt32emu_is_nice_panning_enabled
|
||||
#undef mt32emu_set_nice_partial_mixing_enabled
|
||||
#undef mt32emu_is_nice_partial_mixing_enabled
|
||||
#undef mt32emu_render_bit16s
|
||||
#undef mt32emu_render_float
|
||||
#undef mt32emu_render_bit16s_streams
|
||||
@@ -472,7 +578,14 @@ static mt32emu_midi_receiver_i getMidiReceiverThunk() {
|
||||
#undef mt32emu_get_partial_states
|
||||
#undef mt32emu_get_playing_notes
|
||||
#undef mt32emu_get_patch_name
|
||||
#undef mt32emu_get_sound_group_name
|
||||
#undef mt32emu_get_sound_name
|
||||
#undef mt32emu_read_memory
|
||||
#undef mt32emu_get_display_state
|
||||
#undef mt32emu_set_main_display_mode
|
||||
#undef mt32emu_set_display_compatibility
|
||||
#undef mt32emu_is_display_old_mt32_compatible
|
||||
#undef mt32emu_is_default_display_old_mt32_compatible
|
||||
|
||||
#endif // #if MT32EMU_API_TYPE == 2
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* Copyright (C) 2003, 2004, 2005, 2006, 2008, 2009 Dean Beeler, Jerome Fisher
|
||||
* Copyright (C) 2011-2017 Dean Beeler, Jerome Fisher, Sergey V. Mikayev
|
||||
* Copyright (C) 2011-2022 Dean Beeler, Jerome Fisher, Sergey V. Mikayev
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
@@ -18,9 +18,9 @@
|
||||
#ifndef MT32EMU_CONFIG_H
|
||||
#define MT32EMU_CONFIG_H
|
||||
|
||||
#define MT32EMU_VERSION "2.2.0"
|
||||
#define MT32EMU_VERSION "2.7.0"
|
||||
#define MT32EMU_VERSION_MAJOR 2
|
||||
#define MT32EMU_VERSION_MINOR 2
|
||||
#define MT32EMU_VERSION_MINOR 7
|
||||
#define MT32EMU_VERSION_PATCH 0
|
||||
|
||||
/* Library Exports Configuration
|
||||
@@ -37,4 +37,9 @@
|
||||
|
||||
#define MT32EMU_API_TYPE 0
|
||||
|
||||
#define MT32EMU_WITH_LIBSOXR_RESAMPLER 0
|
||||
#define MT32EMU_WITH_LIBSAMPLERATE_RESAMPLER 0
|
||||
#define MT32EMU_WITH_INTERNAL_RESAMPLER 1
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* Copyright (C) 2003, 2004, 2005, 2006, 2008, 2009 Dean Beeler, Jerome Fisher
|
||||
* Copyright (C) 2011-2017 Dean Beeler, Jerome Fisher, Sergey V. Mikayev
|
||||
* Copyright (C) 2011-2022 Dean Beeler, Jerome Fisher, Sergey V. Mikayev
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
@@ -20,27 +20,35 @@
|
||||
|
||||
#include "config.h"
|
||||
|
||||
/* Support for compiling shared library. */
|
||||
/* Support for compiling shared library.
|
||||
* MT32EMU_SHARED and mt32emu_EXPORTS are defined when building a shared library.
|
||||
* MT32EMU_SHARED should also be defined for Windows platforms that provides for a small performance benefit,
|
||||
* and it _must_ be defined along with MT32EMU_RUNTIME_VERSION_CHECK when using MSVC.
|
||||
*/
|
||||
#ifdef MT32EMU_SHARED
|
||||
#if defined _WIN32 || defined __CYGWIN__
|
||||
#ifdef _MSC_VER
|
||||
#ifdef mt32emu_EXPORTS
|
||||
#define MT32EMU_EXPORT_ATTRIBUTE _declspec(dllexport)
|
||||
#else /* #ifdef mt32emu_EXPORTS */
|
||||
#define MT32EMU_EXPORT_ATTRIBUTE _declspec(dllimport)
|
||||
#endif /* #ifdef mt32emu_EXPORTS */
|
||||
#else /* #ifdef _MSC_VER */
|
||||
#ifdef mt32emu_EXPORTS
|
||||
#define MT32EMU_EXPORT_ATTRIBUTE __attribute__ ((dllexport))
|
||||
#else /* #ifdef mt32emu_EXPORTS */
|
||||
#define MT32EMU_EXPORT_ATTRIBUTE __attribute__ ((dllimport))
|
||||
#endif /* #ifdef mt32emu_EXPORTS */
|
||||
#endif /* #ifdef _MSC_VER */
|
||||
#else /* #if defined _WIN32 || defined __CYGWIN__ */
|
||||
#define MT32EMU_EXPORT_ATTRIBUTE __attribute__ ((visibility("default")))
|
||||
#endif /* #if defined _WIN32 || defined __CYGWIN__ */
|
||||
# if defined _WIN32 || defined __CYGWIN__ || defined __OS2__
|
||||
# ifdef _MSC_VER
|
||||
# ifdef mt32emu_EXPORTS
|
||||
# define MT32EMU_EXPORT_ATTRIBUTE _declspec(dllexport)
|
||||
# else /* #ifdef mt32emu_EXPORTS */
|
||||
# define MT32EMU_EXPORT_ATTRIBUTE _declspec(dllimport)
|
||||
# endif /* #ifdef mt32emu_EXPORTS */
|
||||
# else /* #ifdef _MSC_VER */
|
||||
# ifdef mt32emu_EXPORTS
|
||||
# define MT32EMU_EXPORT_ATTRIBUTE __attribute__ ((dllexport))
|
||||
# else /* #ifdef mt32emu_EXPORTS */
|
||||
# define MT32EMU_EXPORT_ATTRIBUTE __attribute__ ((dllimport))
|
||||
# endif /* #ifdef mt32emu_EXPORTS */
|
||||
# endif /* #ifdef _MSC_VER */
|
||||
# else /* #if defined _WIN32 || defined __CYGWIN__ || defined __OS2__ */
|
||||
# ifdef mt32emu_EXPORTS
|
||||
# define MT32EMU_EXPORT_ATTRIBUTE __attribute__ ((visibility("default")))
|
||||
# else /* #ifdef mt32emu_EXPORTS */
|
||||
# define MT32EMU_EXPORT_ATTRIBUTE
|
||||
# endif /* #ifdef mt32emu_EXPORTS */
|
||||
# endif /* #if defined _WIN32 || defined __CYGWIN__ || defined __OS2__ */
|
||||
#else /* #ifdef MT32EMU_SHARED */
|
||||
#define MT32EMU_EXPORT_ATTRIBUTE
|
||||
# define MT32EMU_EXPORT_ATTRIBUTE
|
||||
#endif /* #ifdef MT32EMU_SHARED */
|
||||
|
||||
#if MT32EMU_EXPORTS_TYPE == 1 || MT32EMU_EXPORTS_TYPE == 2
|
||||
@@ -49,6 +57,33 @@
|
||||
#define MT32EMU_EXPORT MT32EMU_EXPORT_ATTRIBUTE
|
||||
#endif
|
||||
|
||||
/* Facilitates easier tracking of the library version when an external symbol was introduced.
|
||||
* Particularly useful for shared library builds on POSIX systems that support symbol versioning,
|
||||
* so that the version map file can be generated automatically.
|
||||
*/
|
||||
#define MT32EMU_EXPORT_V(symbol_version_tag) MT32EMU_EXPORT
|
||||
|
||||
/* Helpers for compile-time version checks */
|
||||
|
||||
/* Encodes the given version components to a single integer value to simplify further checks. */
|
||||
#define MT32EMU_VERSION_INT(major, minor, patch) ((major << 16) | (minor << 8) | patch)
|
||||
|
||||
/* The version of this library build, as an integer. */
|
||||
#define MT32EMU_CURRENT_VERSION_INT MT32EMU_VERSION_INT(MT32EMU_VERSION_MAJOR, MT32EMU_VERSION_MINOR, MT32EMU_VERSION_PATCH)
|
||||
|
||||
/* Compares the current library version with the given version components. Intended for feature checks. */
|
||||
#define MT32EMU_VERSION_ATLEAST(major, minor, patch) (MT32EMU_CURRENT_VERSION_INT >= MT32EMU_VERSION_INT(major, minor, patch))
|
||||
|
||||
/* Implements a simple version check that ensures full API compatibility of this library build
|
||||
* with the application requirements. The latter can be derived from the versions of used public symbols.
|
||||
*
|
||||
* Note: This macro is intended for a quick compile-time check. To ensure compatibility of an application
|
||||
* linked with a shared library, an automatic version check can be engaged with help of the build option
|
||||
* libmt32emu_WITH_VERSION_TAGGING. For a fine-grained feature checking in run-time, see functions
|
||||
* mt32emu_get_library_version_int and Synth::getLibraryVersionInt.
|
||||
*/
|
||||
#define MT32EMU_IS_COMPATIBLE(major, minor) (MT32EMU_VERSION_MAJOR == major && MT32EMU_VERSION_MINOR >= minor)
|
||||
|
||||
/* Useful constants */
|
||||
|
||||
/* Sample rate to use in mixing. With the progress of development, we've found way too many thing dependent.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* Copyright (C) 2003, 2004, 2005, 2006, 2008, 2009 Dean Beeler, Jerome Fisher
|
||||
* Copyright (C) 2011-2017 Dean Beeler, Jerome Fisher, Sergey V. Mikayev
|
||||
* Copyright (C) 2011-2022 Dean Beeler, Jerome Fisher, Sergey V. Mikayev
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
@@ -37,28 +37,23 @@
|
||||
*/
|
||||
|
||||
#ifdef MT32EMU_API_TYPE
|
||||
#if MT32EMU_API_TYPE == 0 && (MT32EMU_EXPORTS_TYPE == 1 || MT32EMU_EXPORTS_TYPE == 2)
|
||||
#error Incompatible setting MT32EMU_API_TYPE=0
|
||||
#elif MT32EMU_API_TYPE == 1 && (MT32EMU_EXPORTS_TYPE == 0 || MT32EMU_EXPORTS_TYPE == 2)
|
||||
#error Incompatible setting MT32EMU_API_TYPE=1
|
||||
#elif MT32EMU_API_TYPE == 2 && (MT32EMU_EXPORTS_TYPE == 0)
|
||||
#error Incompatible setting MT32EMU_API_TYPE=2
|
||||
#elif MT32EMU_API_TYPE == 3 && (MT32EMU_EXPORTS_TYPE == 0 || MT32EMU_EXPORTS_TYPE == 2)
|
||||
#error Incompatible setting MT32EMU_API_TYPE=3
|
||||
#endif
|
||||
# if MT32EMU_API_TYPE == 0 && (MT32EMU_EXPORTS_TYPE == 1 || MT32EMU_EXPORTS_TYPE == 2)
|
||||
# error Incompatible setting MT32EMU_API_TYPE=0
|
||||
# elif MT32EMU_API_TYPE == 1 && (MT32EMU_EXPORTS_TYPE == 0 || MT32EMU_EXPORTS_TYPE == 2)
|
||||
# error Incompatible setting MT32EMU_API_TYPE=1
|
||||
# elif MT32EMU_API_TYPE == 2 && (MT32EMU_EXPORTS_TYPE == 0)
|
||||
# error Incompatible setting MT32EMU_API_TYPE=2
|
||||
# elif MT32EMU_API_TYPE == 3 && (MT32EMU_EXPORTS_TYPE == 0 || MT32EMU_EXPORTS_TYPE == 2)
|
||||
# error Incompatible setting MT32EMU_API_TYPE=3
|
||||
# endif
|
||||
#else /* #ifdef MT32EMU_API_TYPE */
|
||||
#if 0 < MT32EMU_EXPORTS_TYPE && MT32EMU_EXPORTS_TYPE < 3
|
||||
#define MT32EMU_API_TYPE MT32EMU_EXPORTS_TYPE
|
||||
#else
|
||||
#define MT32EMU_API_TYPE 0
|
||||
#endif
|
||||
# if 0 < MT32EMU_EXPORTS_TYPE && MT32EMU_EXPORTS_TYPE < 3
|
||||
# define MT32EMU_API_TYPE MT32EMU_EXPORTS_TYPE
|
||||
# else
|
||||
# define MT32EMU_API_TYPE 0
|
||||
# endif
|
||||
#endif /* #ifdef MT32EMU_API_TYPE */
|
||||
|
||||
/* MT32EMU_SHARED should be defined when building shared library, especially for Windows platforms. */
|
||||
/*
|
||||
#define MT32EMU_SHARED
|
||||
*/
|
||||
|
||||
#include "globals.h"
|
||||
|
||||
#if !defined(__cplusplus) || MT32EMU_API_TYPE == 1
|
||||
@@ -79,6 +74,14 @@
|
||||
#include "MidiStreamParser.h"
|
||||
#include "SampleRateConverter.h"
|
||||
|
||||
#if MT32EMU_RUNTIME_VERSION_CHECK == 1
|
||||
#include "VersionTagging.h"
|
||||
#endif
|
||||
|
||||
#endif /* #if !defined(__cplusplus) || MT32EMU_API_TYPE == 1 */
|
||||
|
||||
#if MT32EMU_RUNTIME_VERSION_CHECK == 2
|
||||
#include "VersionTagging.h"
|
||||
#endif
|
||||
|
||||
#endif /* #ifndef MT32EMU_MT32EMU_H */
|
||||
|
||||
Reference in New Issue
Block a user