meta-openembedded/meta-multimedia/recipes-multimedia/fluidsynth/fluidsynth/0002-fluid_synth_nwrite_float-Allow-zero-pointer-for-left.patch
Andreas Müller f186377359 fluidsynth: upgrade 2.1.7 -> 2.2.0
The only fallout by API/ABI changes in my world build was meta-games/scummvm.
Fix was sent [1]

fluidsynth 2.2.0
This release breaks ABI compatibility! Refer to the API docs for details.
A C++98 compliant compiler is now required to build fluidsynth (mailing list thread)

New features

    Support loading SoundFonts >2GiB on Windows (#629)
    Major overhaul of the sequencer and its event queue (#604)
        Overlapping notes can be handled (#637)
        Performance improvement, since the event queue no longer blocks the rendering thread
        Time scale is not limited to 1000 anymore and can therefore be used for tempo changes
    The following audio drivers have gained multi-channel support
        DSound (#667, thanks to @jjceresa)
        WaveOut (#667, thanks to @jjceresa)
    The WinMIDI driver supports multiple devices (#677, thanks to @jjceresa)
    Handle GS DT1 SysEx messages for setting whether a channel is used for rhythm part (#708, thanks to @chirs241097)
    Support use of UTF-8 filenames under Windows (#718, thanks to @getraid-gg)
    Improved support for overriding tempo of the MIDI player (#711, #713, thanks to @jjceresa)
    Handle settings-related commands in user command file before initializing other objects (#739)
    SoundFont loading has been parallelized (#746, #812, requires openMP)
    The Oboe driver has gained a lower latency and other updates (#740, #741, #747)
    WASAPI driver has been added (#754, thanks to @chirs241097)

General

    Fix race condition in fluid_player_callback (#783, thanks to @arcln)
    Improvements to LADSPA subsystem (#795, thanks to @mawe42)

[1] https://github.com/cazfi/meta-games/pull/58

Signed-off-by: Andreas Müller <schnitzeltony@gmail.com>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
2021-04-13 08:09:17 -07:00

179 lines
8.0 KiB
Diff

From 300977537b6056bdbbba9df9100fa6e891ca1f44 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Andreas=20M=C3=BCller?= <schnitzeltony@gmail.com>
Date: Mon, 17 Dec 2018 14:08:45 +0100
Subject: [PATCH 2/2] fluid_synth_nwrite_float: Allow zero pointer for
left/right and zero pointer in arrays
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
With this modification a client can define exactly what it wants to get into
buffers to avoid useless copying of data. On weak machines this leads to measurable
performance wins.
Upstream-Status: Submitted [1]
[1] https://github.com/FluidSynth/fluidsynth/pull/490
Signed-off-by: Andreas Müller <schnitzeltony@gmail.com>
---
src/synth/fluid_synth.c | 69 ++++++++++++++++++++++++++++-------------
1 file changed, 48 insertions(+), 21 deletions(-)
diff --git a/src/synth/fluid_synth.c b/src/synth/fluid_synth.c
index 1eb5d737..6c876efa 100644
--- a/src/synth/fluid_synth.c
+++ b/src/synth/fluid_synth.c
@@ -3628,10 +3628,10 @@ fluid_synth_program_reset(fluid_synth_t *synth)
*
* @param synth FluidSynth instance
* @param len Count of audio frames to synthesize
- * @param left Array of float buffers to store left channel of planar audio (as many as \c synth.audio-channels buffers, each of \c len in size)
- * @param right Array of float buffers to store right channel of planar audio (size: dito)
- * @param fx_left Since 1.1.7: If not \c NULL, array of float buffers to store left effect channels (as many as \c synth.effects-channels buffers, each of \c len in size)
- * @param fx_right Since 1.1.7: If not \c NULL, array of float buffers to store right effect channels (size: dito)
+ * @param left Array of float buffers to store left channel of planar audio (as many as \c synth.audio-channels buffers, each of \c len in size). Since 2.0.3: NULL allowed / NULL allowed for array entry
+ * @param right Array of float buffers to store right channel of planar audio (size: dito). Since 2.0.3: NULL allowed / NULL allowed for array entry
+ * @param fx_left Since 1.1.7: If not \c NULL, array of float buffers to store left effect channels (as many as \c synth.effects-channels buffers, each of \c len in size). Since 2.0.3: NULL allowed for array entry
+ * @param fx_right Since 1.1.7: If not \c NULL, array of float buffers to store right effect channels (size: dito). Since 2.0.3: NULL allowed for array entry
* @return #FLUID_OK on success, #FLUID_FAILED otherwise
*
* First effect channel used by reverb, second for chorus.
@@ -3719,15 +3719,27 @@ fluid_synth_nwrite_float(fluid_synth_t *synth, int len,
for(i = 0; i < synth->audio_channels; i++)
{
#ifdef WITH_FLOAT
- FLUID_MEMCPY(left[i], &left_in[i * FLUID_BUFSIZE * FLUID_MIXER_MAX_BUFFERS_DEFAULT + synth->cur], bytes);
- FLUID_MEMCPY(right[i], &right_in[i * FLUID_BUFSIZE * FLUID_MIXER_MAX_BUFFERS_DEFAULT + synth->cur], bytes);
+ if(left != NULL && left[i] != NULL)
+ {
+ FLUID_MEMCPY(left[i], &left_in[i * FLUID_BUFSIZE * FLUID_MIXER_MAX_BUFFERS_DEFAULT + synth->cur], bytes);
+ }
+ if(right != NULL && right[i] != NULL)
+ {
+ FLUID_MEMCPY(right[i], &right_in[i * FLUID_BUFSIZE * FLUID_MIXER_MAX_BUFFERS_DEFAULT + synth->cur], bytes);
+ }
#else //WITH_FLOAT
int j;
for(j = 0; j < num; j++)
{
- left[i][j] = (float) left_in[i * FLUID_BUFSIZE * FLUID_MIXER_MAX_BUFFERS_DEFAULT + j + synth->cur];
- right[i][j] = (float) right_in[i * FLUID_BUFSIZE * FLUID_MIXER_MAX_BUFFERS_DEFAULT + j + synth->cur];
+ if(left != NULL && left[i] != NULL)
+ {
+ left[i][j] = (float) left_in[i * FLUID_BUFSIZE * FLUID_MIXER_MAX_BUFFERS_DEFAULT + j + synth->cur];
+ }
+ if(right != NULL && right[i] != NULL)
+ {
+ right[i][j] = (float) right_in[i * FLUID_BUFSIZE * FLUID_MIXER_MAX_BUFFERS_DEFAULT + j + synth->cur];
+ }
}
#endif //WITH_FLOAT
@@ -3737,12 +3749,12 @@ fluid_synth_nwrite_float(fluid_synth_t *synth, int len,
{
#ifdef WITH_FLOAT
- if(fx_left != NULL)
+ if(fx_left != NULL && fx_left[i] != NULL)
{
FLUID_MEMCPY(fx_left[i], &fx_left_in[i * FLUID_BUFSIZE * FLUID_MIXER_MAX_BUFFERS_DEFAULT + synth->cur], bytes);
}
- if(fx_right != NULL)
+ if(fx_right != NULL && fx_right[i] != NULL)
{
FLUID_MEMCPY(fx_right[i], &fx_right_in[i * FLUID_BUFSIZE * FLUID_MIXER_MAX_BUFFERS_DEFAULT + synth->cur], bytes);
}
@@ -3750,7 +3762,7 @@ fluid_synth_nwrite_float(fluid_synth_t *synth, int len,
#else //WITH_FLOAT
int j;
- if(fx_left != NULL)
+ if(fx_left != NULL && fx_left[i] != NULL)
{
for(j = 0; j < num; j++)
{
@@ -3758,7 +3770,7 @@ fluid_synth_nwrite_float(fluid_synth_t *synth, int len,
}
}
- if(fx_right != NULL)
+ if(fx_right != NULL && fx_right[i] != NULL)
{
for(j = 0; j < num; j++)
{
@@ -3789,15 +3801,30 @@ fluid_synth_nwrite_float(fluid_synth_t *synth, int len,
for(i = 0; i < synth->audio_channels; i++)
{
#ifdef WITH_FLOAT
- FLUID_MEMCPY(left[i] + count, &left_in[i * FLUID_BUFSIZE * FLUID_MIXER_MAX_BUFFERS_DEFAULT], bytes);
- FLUID_MEMCPY(right[i] + count, &right_in[i * FLUID_BUFSIZE * FLUID_MIXER_MAX_BUFFERS_DEFAULT], bytes);
+ if(left != NULL && left[i] != NULL)
+ {
+ FLUID_MEMCPY(left[i] + count, &left_in[i * FLUID_BUFSIZE * FLUID_MIXER_MAX_BUFFERS_DEFAULT], bytes);
+ }
+ if(right != NULL && right[i] != NULL)
+ {
+ FLUID_MEMCPY(right[i] + count, &right_in[i * FLUID_BUFSIZE * FLUID_MIXER_MAX_BUFFERS_DEFAULT], bytes);
+ }
#else //WITH_FLOAT
int j;
- for(j = 0; j < num; j++)
+ if(left != NULL && left[i] != NULL)
+ {
+ for(j = 0; j < num; j++)
+ {
+ left[i][j + count] = (float) left_in[i * FLUID_BUFSIZE * FLUID_MIXER_MAX_BUFFERS_DEFAULT + j];
+ }
+ }
+ if(right != NULL && right[i] != NULL)
{
- left[i][j + count] = (float) left_in[i * FLUID_BUFSIZE * FLUID_MIXER_MAX_BUFFERS_DEFAULT + j];
- right[i][j + count] = (float) right_in[i * FLUID_BUFSIZE * FLUID_MIXER_MAX_BUFFERS_DEFAULT + j];
+ for(j = 0; j < num; j++)
+ {
+ right[i][j + count] = (float) right_in[i * FLUID_BUFSIZE * FLUID_MIXER_MAX_BUFFERS_DEFAULT + j];
+ }
}
#endif //WITH_FLOAT
@@ -3807,12 +3834,12 @@ fluid_synth_nwrite_float(fluid_synth_t *synth, int len,
{
#ifdef WITH_FLOAT
- if(fx_left != NULL)
+ if(fx_left != NULL && fx_left[i] != NULL)
{
FLUID_MEMCPY(fx_left[i] + count, &fx_left_in[i * FLUID_BUFSIZE * FLUID_MIXER_MAX_BUFFERS_DEFAULT], bytes);
}
- if(fx_right != NULL)
+ if(fx_right != NULL && fx_right[i] != NULL)
{
FLUID_MEMCPY(fx_right[i] + count, &fx_right_in[i * FLUID_BUFSIZE * FLUID_MIXER_MAX_BUFFERS_DEFAULT], bytes);
}
@@ -3820,7 +3847,7 @@ fluid_synth_nwrite_float(fluid_synth_t *synth, int len,
#else //WITH_FLOAT
int j;
- if(fx_left != NULL)
+ if(fx_left != NULL && fx_left[i] != NULL)
{
for(j = 0; j < num; j++)
{
@@ -3828,7 +3855,7 @@ fluid_synth_nwrite_float(fluid_synth_t *synth, int len,
}
}
- if(fx_right != NULL)
+ if(fx_right != NULL && fx_right[i] != NULL)
{
for(j = 0; j < num; j++)
{
--
2.14.5