Merge branch 'master' into sm24

This commit is contained in:
Tom M 2017-12-13 20:12:47 +01:00 committed by GitHub
commit a82ddb8d08
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 121 additions and 28 deletions

View file

@ -103,8 +103,8 @@ Changes in FluidSynth 2.0.0 concerning developers:
- use unique device names for the "audio.portaudio.device" setting
- rename fluid_mod_new() and fluid_mod_delete() to match naming conventions: new_fluid_mod() and delete_fluid_mod()
<br /><br />
- add "synth.volenv" a setting for volume envelope processing
- add "midi.autoconnect" a setting for automatically connecting fluidsynth to available MIDI input ports
- add <a href="fluidsettings.xml#synth.volenv">"synth.volenv"</a> a setting for volume envelope processing
- add <a href="fluidsettings.xml#midi.autoconnect">"midi.autoconnect"</a> a setting for automatically connecting fluidsynth to available MIDI input ports
- add support for polyphonic key pressure events, see fluid_event_key_pressure() and fluid_synth_key_pressure()
- add fluid_synth_add_default_mod() and fluid_synth_remove_default_mod() for manipulating default modulators
- add individual reverb setters: fluid_synth_set_reverb_roomsize(), fluid_synth_set_reverb_damp(), fluid_synth_set_reverb_width(), fluid_synth_set_reverb_level()
@ -113,6 +113,7 @@ Changes in FluidSynth 2.0.0 concerning developers:
- add file callback struct to _fluid_sfloader_t and expose new_fluid_defsfloader() to enable soundfont loading from memory ( see fluid_sfload_mem.c )
- add seek support to midi-player, see fluid_player_seek()
- expose functions to manipulate the ladspa effects unit (see ladspa.h)
- add support for text and lyrics midi events, see fluid_midi_event_set_lyrics() and fluid_midi_event_set_text()
- add 24 bit sample support, see _fluid_sample_t::data24
\section NewIn1_1_9 Whats new in 1.1.9?

View file

@ -54,7 +54,7 @@ enum fluid_seq_event_type {
FLUID_SEQ_REVERBSEND, /**< Reverb send set event */
FLUID_SEQ_CHORUSSEND, /**< Chorus send set event */
FLUID_SEQ_TIMER, /**< Timer event (useful for giving a callback at a certain time) */
FLUID_SEQ_ANYCONTROLCHANGE, /**< DOCME (used for remove_events only) */
FLUID_SEQ_ANYCONTROLCHANGE, /**< Any control change message (only internally used for remove_events) */
FLUID_SEQ_CHANNELPRESSURE, /**< Channel aftertouch event @since 1.1.0 */
FLUID_SEQ_KEYPRESSURE, /**< Polyphonic aftertouch event @since 2.0.0 */
FLUID_SEQ_SYSTEMRESET, /**< System reset event @since 1.1.0 */

View file

@ -51,6 +51,10 @@ FLUIDSYNTH_API int fluid_midi_event_get_pitch(fluid_midi_event_t* evt);
FLUIDSYNTH_API int fluid_midi_event_set_pitch(fluid_midi_event_t* evt, int val);
FLUIDSYNTH_API int fluid_midi_event_set_sysex(fluid_midi_event_t* evt, void *data,
int size, int dynamic);
FLUIDSYNTH_API int fluid_midi_event_set_text(fluid_midi_event_t *evt,
void *data, int size, int dynamic);
FLUIDSYNTH_API int fluid_midi_event_set_lyrics(fluid_midi_event_t *evt,
void *data, int size, int dynamic);
/**
* MIDI router rule type.

View file

@ -190,9 +190,6 @@
/* Define to enable SIGFPE assertions */
#cmakedefine TRAP_ON_FPE @TRAP_ON_FPE@
/* Version number of package */
#cmakedefine VERSION @FLUIDSYNTH_VERSION@
/* Define to do all DSP in single floating point precision */
#cmakedefine WITH_FLOAT @WITH_FLOAT@

View file

@ -30,9 +30,6 @@
#if DART_SUPPORT
/* To avoid name conflict */
#undef VERSION
#define INCL_DOS
#include <os2.h>

View file

@ -48,6 +48,7 @@
void print_usage(void);
void print_help(fluid_settings_t *settings);
void print_welcome(void);
void print_configure(void);
/*
* the globals
@ -504,7 +505,7 @@ int main(int argc, char** argv)
else fluid_settings_setstr(settings, "audio.file.type", optarg);
break;
case 'V':
printf("FluidSynth %s\n", VERSION);
print_configure();
exit (0);
break;
case 'v':
@ -810,6 +811,17 @@ print_welcome()
FLUIDSYNTH_VERSION);
}
void print_configure()
{
puts("Sample type="
#ifdef WITH_FLOAT
"float"
#else
"double"
#endif
);
}
/*
* print_help
*/

View file

@ -32,6 +32,7 @@ static int fluid_midi_event_length(unsigned char event);
* Returns NULL if there was an error reading or allocating memory.
*/
static char* fluid_file_read_full(fluid_file fp, size_t* length);
static void fluid_midi_event_set_sysex_LOCAL(fluid_midi_event_t *evt, int type, void *data, int size, int dynamic);
#define READ_FULL_INITIAL_BUFLEN 1024
@ -576,6 +577,35 @@ fluid_midi_file_read_event(fluid_midi_file *mf, fluid_track_t *track)
break;
case MIDI_LYRIC:
case MIDI_TEXT:
{
void* tmp;
int size = mf->varlen+1;
/* NULL terminate strings for safety */
metadata[size-1] = '\0';
evt = new_fluid_midi_event();
if (evt == NULL) {
FLUID_LOG(FLUID_ERR, "Out of memory");
result = FLUID_FAILED;
break;
}
evt->dtime = mf->dtime;
tmp = FLUID_MALLOC(size);
if (tmp == NULL)
{
FLUID_LOG(FLUID_PANIC, "Out of memory");
result = FLUID_FAILED;
break;
}
FLUID_MEMCPY(tmp, metadata, size);
fluid_midi_event_set_sysex_LOCAL(evt, type, tmp, size, TRUE);
fluid_track_add_event(track, evt);
mf->dtime = 0;
}
break;
case MIDI_MARKER:
@ -808,9 +838,10 @@ delete_fluid_midi_event(fluid_midi_event_t *evt)
temp = evt->next;
/* Dynamic SYSEX event? - free (param2 indicates if dynamic) */
if (evt->type == MIDI_SYSEX && evt->paramptr && evt->param2)
if ((evt->type == MIDI_SYSEX || (evt-> type == MIDI_TEXT) || (evt->type == MIDI_LYRIC)) &&
evt->paramptr && evt->param2)
FLUID_FREE (evt->paramptr);
FLUID_FREE(evt);
evt = temp;
}
@ -1012,7 +1043,7 @@ fluid_midi_event_set_pitch(fluid_midi_event_t *evt, int val)
* Assign sysex data to a MIDI event structure.
* @param evt MIDI event structure
* @param data Pointer to SYSEX data
* @param size Size of SYSEX data
* @param size Size of SYSEX data in bytes
* @param dynamic TRUE if the SYSEX data has been dynamically allocated and
* should be freed when the event is freed (only applies if event gets destroyed
* with delete_fluid_midi_event())
@ -1023,11 +1054,54 @@ fluid_midi_event_set_pitch(fluid_midi_event_t *evt, int val)
int
fluid_midi_event_set_sysex(fluid_midi_event_t *evt, void *data, int size, int dynamic)
{
evt->type = MIDI_SYSEX;
fluid_midi_event_set_sysex_LOCAL(evt, MIDI_SYSEX, data, size, dynamic);
return FLUID_OK;
}
/**
* Assign text data to a MIDI event structure.
* @param evt MIDI event structure
* @param data Pointer to text data
* @param size Size of text data in bytes
* @param dynamic TRUE if the data has been dynamically allocated and
* should be freed when the event is freed via delete_fluid_midi_event()
* @return Always returns #FLUID_OK
*
* @since 2.0.0
* @note Unlike the other event assignment functions, this one sets evt->type.
*/
int
fluid_midi_event_set_text(fluid_midi_event_t *evt, void *data, int size, int dynamic)
{
fluid_midi_event_set_sysex_LOCAL(evt, MIDI_TEXT, data, size, dynamic);
return FLUID_OK;
}
/**
* Assign lyric data to a MIDI event structure.
* @param evt MIDI event structure
* @param data Pointer to lyric data
* @param size Size of lyric data in bytes
* @param dynamic TRUE if the data has been dynamically allocated and
* should be freed when the event is freed via delete_fluid_midi_event()
* @return Always returns #FLUID_OK
*
* @since 2.0.0
* @note Unlike the other event assignment functions, this one sets evt->type.
*/
int
fluid_midi_event_set_lyrics(fluid_midi_event_t *evt, void *data, int size, int dynamic)
{
fluid_midi_event_set_sysex_LOCAL(evt, MIDI_LYRIC, data, size, dynamic);
return FLUID_OK;
}
static void fluid_midi_event_set_sysex_LOCAL(fluid_midi_event_t *evt, int type, void *data, int size, int dynamic)
{
evt->type = type;
evt->paramptr = data;
evt->param1 = size;
evt->param2 = dynamic;
return FLUID_OK;
}
/******************************************************
@ -1189,9 +1263,6 @@ fluid_track_send_events(fluid_track_t *track,
if (!player || event->type == MIDI_EOT) {
}
else if (event->type == MIDI_SET_TEMPO) {
fluid_player_set_midi_tempo(player, event->param1);
}
else if (seeking && (event->type == NOTE_ON || event->type == NOTE_OFF)) {
/* skip on/off messages */
}
@ -1199,6 +1270,11 @@ fluid_track_send_events(fluid_track_t *track,
if (player->playback_callback)
player->playback_callback(player->playback_userdata, event);
}
if (event->type == MIDI_SET_TEMPO)
{
fluid_player_set_midi_tempo(player, event->param1);
}
fluid_track_next_event(track);
@ -1245,7 +1321,6 @@ new_fluid_player(fluid_synth_t *synth)
player->cur_ticks = 0;
player->seek_ticks = -1;
fluid_player_set_playback_callback(player, fluid_synth_handle_midi_event, synth);
player->use_system_timer = fluid_settings_str_equal(synth->settings,
"player.timing-source", "system");
@ -1478,6 +1553,7 @@ fluid_player_load(fluid_player_t *player, fluid_playlist_item *item)
if (buffer_owned) {
FLUID_FREE(buffer);
}
return FLUID_OK;
}

View file

@ -155,6 +155,7 @@ enum midi_rpn_event {
};
enum midi_meta_event {
MIDI_TEXT = 0x01,
MIDI_COPYRIGHT = 0x02,
MIDI_TRACK_NAME = 0x03,
MIDI_INST_NAME = 0x04,

View file

@ -117,7 +117,7 @@ fluid_event_set_dest(fluid_event_t* evt, fluid_seq_id_t dest)
/**
* Set a sequencer event to be a timer event.
* @param evt Sequencer event structure
* @param data DOCME
* @param data User supplied data pointer
*/
void
fluid_event_timer(fluid_event_t* evt, void* data)
@ -162,7 +162,7 @@ fluid_event_noteoff(fluid_event_t* evt, int channel, short key)
* @param channel MIDI channel number
* @param key MIDI note number (0-127)
* @param vel MIDI velocity value (0-127)
* @param duration Duration of note (DOCME units?)
* @param duration Duration of note in the time scale used by the sequencer (by default milliseconds)
*/
void
fluid_event_note(fluid_event_t* evt, int channel, short key, short vel, unsigned int duration)
@ -246,10 +246,9 @@ fluid_event_program_select(fluid_event_t* evt, int channel,
}
/**
* Set a sequencer event to be an any control change event.
* Set a sequencer event to be an any control change event (for internal use).
* @param evt Sequencer event structure
* @param channel MIDI channel number
* DOCME
*/
void
fluid_event_any_control_change(fluid_event_t* evt, int channel)
@ -278,7 +277,7 @@ fluid_event_pitch_bend(fluid_event_t* evt, int channel, int pitch)
* Set a sequencer event to be a pitch wheel sensitivity event.
* @param evt Sequencer event structure
* @param channel MIDI channel number
* @param value MIDI pitch wheel sensitivity value (DOCME units?)
* @param value MIDI pitch wheel sensitivity value in semitones
*/
void
fluid_event_pitch_wheelsens(fluid_event_t* evt, int channel, short value)
@ -325,7 +324,7 @@ fluid_event_sustain(fluid_event_t* evt, int channel, short val)
* @param evt Sequencer event structure
* @param channel MIDI channel number
* @param control MIDI control number (0-127)
* @param val MIDI control value (0-16383 DOCME is that true?)
* @param val MIDI control value (0-127)
*/
void
fluid_event_control_change(fluid_event_t* evt, int channel, short control, short val)
@ -478,9 +477,10 @@ int fluid_event_get_type(fluid_event_t* evt)
}
/**
* @internal
* Get the time field from a sequencer event structure.
* @param evt Sequencer event structure
* @return Time value (DOCME units?)
* @return Time value
*/
unsigned int fluid_event_get_time(fluid_event_t* evt)
{
@ -510,7 +510,7 @@ fluid_seq_id_t fluid_event_get_dest(fluid_event_t* evt)
/**
* Get the MIDI channel field from a sequencer event structure.
* @param evt Sequencer event structure
* @return MIDI channel number (DOCME 0-15 or more?)
* @return MIDI zero-based channel number
*/
int fluid_event_get_channel(fluid_event_t* evt)
{
@ -579,7 +579,7 @@ void* fluid_event_get_data(fluid_event_t* evt)
/**
* Get the duration field from a sequencer event structure.
* @param evt Sequencer event structure
* @return Note duration value (DOCME units?)
* @return Note duration value in the time scale used by the sequencer (by default milliseconds)
*
* Used by the #FLUID_SEQ_NOTE event type.
*/

View file

@ -4970,6 +4970,11 @@ fluid_synth_handle_midi_event(void* data, fluid_midi_event_t* event)
return fluid_synth_system_reset(synth);
case MIDI_SYSEX:
return fluid_synth_sysex (synth, event->paramptr, event->param1, NULL, NULL, NULL, FALSE);
case MIDI_TEXT:
case MIDI_LYRIC:
case MIDI_SET_TEMPO:
return FLUID_OK;
}
return FLUID_FAILED;
}