Skip to content

Commit

Permalink
Add new API to release a voice: fluid_synth_release_voice.
Browse files Browse the repository at this point in the history
Signed-off-by: Stefan Westerfeld <stefan@space.twc.de>
  • Loading branch information
swesterfeld committed Oct 21, 2019
1 parent 1f2c301 commit e2963c9
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
1 change: 1 addition & 0 deletions include/fluidsynth/synth.h
Expand Up @@ -280,6 +280,7 @@ FLUIDSYNTH_API fluid_voice_t *fluid_synth_alloc_voice(fluid_synth_t *synth,
fluid_sample_t *sample,
int channum, int key, int vel);
FLUIDSYNTH_API void fluid_synth_start_voice(fluid_synth_t *synth, fluid_voice_t *voice);
FLUIDSYNTH_API void fluid_synth_release_voice(fluid_synth_t *synth, fluid_voice_t *voice);
FLUIDSYNTH_API void fluid_synth_get_voicelist(fluid_synth_t *synth,
fluid_voice_t *buf[], int bufsize, int ID);
FLUIDSYNTH_API int fluid_synth_handle_midi_event(void *data, fluid_midi_event_t *event);
Expand Down
12 changes: 12 additions & 0 deletions src/synth/fluid_synth.c
Expand Up @@ -4456,6 +4456,18 @@ fluid_synth_start_voice(fluid_synth_t *synth, fluid_voice_t *voice)
fluid_synth_api_exit(synth);
}

void
fluid_synth_release_voice(fluid_synth_t *synth, fluid_voice_t *voice)
{
fluid_return_if_fail(synth != NULL);
fluid_return_if_fail(voice != NULL);
// fluid_return_if_fail (fluid_synth_is_synth_thread (synth));
fluid_synth_api_enter(synth);

fluid_voice_release(voice);
fluid_synth_api_exit(synth);
}

/**
* Add a SoundFont loader to the synth. This function takes ownership of \c loader
* and frees it automatically upon \c synth destruction.
Expand Down

0 comments on commit e2963c9

Please sign in to comment.