From 9a205c0b8b58158039cbf4def1bcbdba125685ed Mon Sep 17 00:00:00 2001 From: Fabian Greffrath Date: Fri, 10 Nov 2017 13:20:14 +0100 Subject: [PATCH 01/17] fix library file names when building with MinGW and CMake We have applied this patch to the mingw-w64-fluidsynth package [1] in MSYS2 to recieve the same library file names when building with CMake as we got when building with Autotools. [1] https://github.com/Alexpux/MINGW-packages/tree/master/mingw-w64-fluidsynth --- src/CMakeLists.txt | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 6ffd6fd2..3d02595f 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -268,6 +268,15 @@ elseif ( OS2 ) VERSION ${LIB_VERSION_INFO} SOVERSION ${LIB_VERSION_CURRENT} ) +elseif ( WIN32 ) + set_target_properties ( libfluidsynth + PROPERTIES + ARCHIVE_OUTPUT_NAME "fluidsynth" + PREFIX "lib" + OUTPUT_NAME "fluidsynth-${LIB_VERSION_CURRENT}" + VERSION ${LIB_VERSION_INFO} + SOVERSION ${LIB_VERSION_CURRENT} + ) else ( MACOSX_FRAMEWORK ) set_target_properties ( libfluidsynth PROPERTIES From f2c4cfb6b62bccfe6f98ac362c1d30658b173aee Mon Sep 17 00:00:00 2001 From: derselbst Date: Fri, 10 Nov 2017 20:48:37 +0100 Subject: [PATCH 02/17] remove orphaned /src/unused/ dir --- src/unused/fluid_dsp_float.c | 687 ------------ src/unused/fluid_dsp_simple.c | 120 --- src/unused/fluid_event_queue.c | 88 -- src/unused/fluid_event_queue.h | 195 ---- src/unused/fluid_rvoice_handler.c | 203 ---- src/unused/fluid_rvoice_handler.h | 80 -- src/unused/winbuild/fluidsynth.dsw | 53 - src/unused/winbuild/fluidsynth.sln | 34 - src/unused/winbuild/fluidsynth/fluidsynth.dsp | 90 -- .../winbuild/fluidsynth/fluidsynth.vcproj | 230 ---- .../fluidsynth_dll/fluidsynth_dll.dsp | 90 -- .../fluidsynth_dll/fluidsynth_dll.vcproj | 983 ------------------ .../fluidsynth_lib/fluidsynth_lib.dsp | 90 -- .../fluidsynth_lib/fluidsynth_lib.vcproj | 943 ----------------- 14 files changed, 3886 deletions(-) delete mode 100644 src/unused/fluid_dsp_float.c delete mode 100644 src/unused/fluid_dsp_simple.c delete mode 100644 src/unused/fluid_event_queue.c delete mode 100644 src/unused/fluid_event_queue.h delete mode 100644 src/unused/fluid_rvoice_handler.c delete mode 100644 src/unused/fluid_rvoice_handler.h delete mode 100644 src/unused/winbuild/fluidsynth.dsw delete mode 100755 src/unused/winbuild/fluidsynth.sln delete mode 100644 src/unused/winbuild/fluidsynth/fluidsynth.dsp delete mode 100755 src/unused/winbuild/fluidsynth/fluidsynth.vcproj delete mode 100644 src/unused/winbuild/fluidsynth_dll/fluidsynth_dll.dsp delete mode 100755 src/unused/winbuild/fluidsynth_dll/fluidsynth_dll.vcproj delete mode 100644 src/unused/winbuild/fluidsynth_lib/fluidsynth_lib.dsp delete mode 100755 src/unused/winbuild/fluidsynth_lib/fluidsynth_lib.vcproj diff --git a/src/unused/fluid_dsp_float.c b/src/unused/fluid_dsp_float.c deleted file mode 100644 index 0fd24d4d..00000000 --- a/src/unused/fluid_dsp_float.c +++ /dev/null @@ -1,687 +0,0 @@ -/* FluidSynth - A Software Synthesizer - * - * Copyright (C) 2003 Peter Hanappe and others. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public License - * as published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free - * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02110-1301, USA - */ - -#include "fluidsynth_priv.h" -#include "fluid_phase.h" - -/* Purpose: - * - * Interpolates audio data (obtains values between the samples of the original - * waveform data). - * - * Variables loaded from the voice structure (assigned in fluid_voice_write()): - * - dsp_data: Pointer to the original waveform data - * - dsp_phase: The position in the original waveform data. - * This has an integer and a fractional part (between samples). - * - dsp_phase_incr: For each output sample, the position in the original - * waveform advances by dsp_phase_incr. This also has an integer - * part and a fractional part. - * If a sample is played at root pitch (no pitch change), - * dsp_phase_incr is integer=1 and fractional=0. - * - dsp_amp: The current amplitude envelope value. - * - dsp_amp_incr: The changing rate of the amplitude envelope. - * - * A couple of variables are used internally, their results are discarded: - * - dsp_i: Index through the output buffer - * - dsp_buf: Output buffer of floating point values (FLUID_BUFSIZE in length) - */ - -#include "fluidsynth_priv.h" -#include "fluid_synth.h" -#include "fluid_voice.h" - - -/* Interpolation (find a value between two samples of the original waveform) */ - -/* Linear interpolation table (2 coefficients centered on 1st) */ -static fluid_real_t interp_coeff_linear[FLUID_INTERP_MAX][2]; - -/* 4th order (cubic) interpolation table (4 coefficients centered on 2nd) */ -static fluid_real_t interp_coeff[FLUID_INTERP_MAX][4]; - -/* 7th order interpolation (7 coefficients centered on 3rd) */ -static fluid_real_t sinc_table7[FLUID_INTERP_MAX][7]; - - -#define SINC_INTERP_ORDER 7 /* 7th order constant */ - - -/* Initializes interpolation tables */ -void fluid_dsp_float_config (void) -{ - int i, i2; - double x, v; - double i_shifted; - - /* Initialize the coefficients for the interpolation. The math comes - * from a mail, posted by Olli Niemitalo to the music-dsp mailing - * list (I found it in the music-dsp archives - * http://www.smartelectronix.com/musicdsp/). */ - - for (i = 0; i < FLUID_INTERP_MAX; i++) - { - x = (double) i / (double) FLUID_INTERP_MAX; - - interp_coeff[i][0] = (fluid_real_t)(x * (-0.5 + x * (1 - 0.5 * x))); - interp_coeff[i][1] = (fluid_real_t)(1.0 + x * x * (1.5 * x - 2.5)); - interp_coeff[i][2] = (fluid_real_t)(x * (0.5 + x * (2.0 - 1.5 * x))); - interp_coeff[i][3] = (fluid_real_t)(0.5 * x * x * (x - 1.0)); - - interp_coeff_linear[i][0] = (fluid_real_t)(1.0 - x); - interp_coeff_linear[i][1] = (fluid_real_t)x; - } - - /* i: Offset in terms of whole samples */ - for (i = 0; i < SINC_INTERP_ORDER; i++) - { /* i2: Offset in terms of fractional samples ('subsamples') */ - for (i2 = 0; i2 < FLUID_INTERP_MAX; i2++) - { - /* center on middle of table */ - i_shifted = (double)i - ((double)SINC_INTERP_ORDER / 2.0) - + (double)i2 / (double)FLUID_INTERP_MAX; - - /* sinc(0) cannot be calculated straightforward (limit needed for 0/0) */ - if (fabs (i_shifted) > 0.000001) - { - v = (fluid_real_t)sin (i_shifted * M_PI) / (M_PI * i_shifted); - /* Hamming window */ - v *= (fluid_real_t)0.5 * (1.0 + cos (2.0 * M_PI * i_shifted / (fluid_real_t)SINC_INTERP_ORDER)); - } - else v = 1.0; - - sinc_table7[FLUID_INTERP_MAX - i2 - 1][i] = v; - } - } - -#if 0 - for (i = 0; i < FLUID_INTERP_MAX; i++) - { - printf ("%d %0.3f %0.3f %0.3f %0.3f %0.3f %0.3f %0.3f\n", - i, sinc_table7[0][i], sinc_table7[1][i], sinc_table7[2][i], - sinc_table7[3][i], sinc_table7[4][i], sinc_table7[5][i], sinc_table7[6][i]); - } -#endif - - fluid_check_fpe("interpolation table calculation"); -} - - -static FLUID_INLINE int -fluid_voice_is_looping(fluid_voice_t *voice) -{ - return _SAMPLEMODE (voice) == FLUID_LOOP_DURING_RELEASE - || (_SAMPLEMODE (voice) == FLUID_LOOP_UNTIL_RELEASE - && fluid_adsr_env_get_section(&voice->volenv) < FLUID_VOICE_ENVRELEASE); -} - -/* No interpolation. Just take the sample, which is closest to - * the playback pointer. Questionable quality, but very - * efficient. */ -int -fluid_dsp_float_interpolate_none (fluid_voice_t *voice) -{ - fluid_phase_t dsp_phase = voice->phase; - fluid_phase_t dsp_phase_incr; - short int *dsp_data = voice->sample->data; - fluid_real_t *dsp_buf = voice->dsp_buf; - fluid_real_t dsp_amp = voice->amp; - fluid_real_t dsp_amp_incr = voice->amp_incr; - unsigned int dsp_i = 0; - unsigned int dsp_phase_index; - unsigned int end_index; - int looping; - - /* Convert playback "speed" floating point value to phase index/fract */ - fluid_phase_set_float (dsp_phase_incr, voice->phase_incr); - - /* voice is currently looping? */ - looping = fluid_voice_is_looping(voice); - - end_index = looping ? voice->loopend - 1 : voice->end; - - while (1) - { - dsp_phase_index = fluid_phase_index_round (dsp_phase); /* round to nearest point */ - - /* interpolate sequence of sample points */ - for ( ; dsp_i < FLUID_BUFSIZE && dsp_phase_index <= end_index; dsp_i++) - { - dsp_buf[dsp_i] = dsp_amp * dsp_data[dsp_phase_index]; - - /* increment phase and amplitude */ - fluid_phase_incr (dsp_phase, dsp_phase_incr); - dsp_phase_index = fluid_phase_index_round (dsp_phase); /* round to nearest point */ - dsp_amp += dsp_amp_incr; - } - - /* break out if not looping (buffer may not be full) */ - if (!looping) break; - - /* go back to loop start */ - if (dsp_phase_index > end_index) - { - fluid_phase_sub_int (dsp_phase, voice->loopend - voice->loopstart); - voice->has_looped = 1; - } - - /* break out if filled buffer */ - if (dsp_i >= FLUID_BUFSIZE) break; - } - - voice->phase = dsp_phase; - voice->amp = dsp_amp; - - return (dsp_i); -} - -/* Straight line interpolation. - * Returns number of samples processed (usually FLUID_BUFSIZE but could be - * smaller if end of sample occurs). - */ -int -fluid_dsp_float_interpolate_linear (fluid_voice_t *voice) -{ - fluid_phase_t dsp_phase = voice->phase; - fluid_phase_t dsp_phase_incr; - short int *dsp_data = voice->sample->data; - fluid_real_t *dsp_buf = voice->dsp_buf; - fluid_real_t dsp_amp = voice->amp; - fluid_real_t dsp_amp_incr = voice->amp_incr; - unsigned int dsp_i = 0; - unsigned int dsp_phase_index; - unsigned int end_index; - short int point; - fluid_real_t *coeffs; - int looping; - - /* Convert playback "speed" floating point value to phase index/fract */ - fluid_phase_set_float (dsp_phase_incr, voice->phase_incr); - - /* voice is currently looping? */ - looping = fluid_voice_is_looping(voice); - - /* last index before 2nd interpolation point must be specially handled */ - end_index = (looping ? voice->loopend - 1 : voice->end) - 1; - - /* 2nd interpolation point to use at end of loop or sample */ - if (looping) point = dsp_data[voice->loopstart]; /* loop start */ - else point = dsp_data[voice->end]; /* duplicate end for samples no longer looping */ - - while (1) - { - dsp_phase_index = fluid_phase_index (dsp_phase); - - /* interpolate the sequence of sample points */ - for ( ; dsp_i < FLUID_BUFSIZE && dsp_phase_index <= end_index; dsp_i++) - { - coeffs = interp_coeff_linear[fluid_phase_fract_to_tablerow (dsp_phase)]; - dsp_buf[dsp_i] = dsp_amp * (coeffs[0] * dsp_data[dsp_phase_index] - + coeffs[1] * dsp_data[dsp_phase_index+1]); - - /* increment phase and amplitude */ - fluid_phase_incr (dsp_phase, dsp_phase_incr); - dsp_phase_index = fluid_phase_index (dsp_phase); - dsp_amp += dsp_amp_incr; - } - - /* break out if buffer filled */ - if (dsp_i >= FLUID_BUFSIZE) break; - - end_index++; /* we're now interpolating the last point */ - - /* interpolate within last point */ - for (; dsp_phase_index <= end_index && dsp_i < FLUID_BUFSIZE; dsp_i++) - { - coeffs = interp_coeff_linear[fluid_phase_fract_to_tablerow (dsp_phase)]; - dsp_buf[dsp_i] = dsp_amp * (coeffs[0] * dsp_data[dsp_phase_index] - + coeffs[1] * point); - - /* increment phase and amplitude */ - fluid_phase_incr (dsp_phase, dsp_phase_incr); - dsp_phase_index = fluid_phase_index (dsp_phase); - dsp_amp += dsp_amp_incr; /* increment amplitude */ - } - - if (!looping) break; /* break out if not looping (end of sample) */ - - /* go back to loop start (if past */ - if (dsp_phase_index > end_index) - { - fluid_phase_sub_int (dsp_phase, voice->loopend - voice->loopstart); - voice->has_looped = 1; - } - - /* break out if filled buffer */ - if (dsp_i >= FLUID_BUFSIZE) break; - - end_index--; /* set end back to second to last sample point */ - } - - voice->phase = dsp_phase; - voice->amp = dsp_amp; - - return (dsp_i); -} - -/* 4th order (cubic) interpolation. - * Returns number of samples processed (usually FLUID_BUFSIZE but could be - * smaller if end of sample occurs). - */ -int -fluid_dsp_float_interpolate_4th_order (fluid_voice_t *voice) -{ - fluid_phase_t dsp_phase = voice->phase; - fluid_phase_t dsp_phase_incr; - short int *dsp_data = voice->sample->data; - fluid_real_t *dsp_buf = voice->dsp_buf; - fluid_real_t dsp_amp = voice->amp; - fluid_real_t dsp_amp_incr = voice->amp_incr; - unsigned int dsp_i = 0; - unsigned int dsp_phase_index; - unsigned int start_index, end_index; - short int start_point, end_point1, end_point2; - fluid_real_t *coeffs; - int looping; - - /* Convert playback "speed" floating point value to phase index/fract */ - fluid_phase_set_float (dsp_phase_incr, voice->phase_incr); - - /* voice is currently looping? */ - looping = fluid_voice_is_looping(voice); - - /* last index before 4th interpolation point must be specially handled */ - end_index = (looping ? voice->loopend - 1 : voice->end) - 2; - - if (voice->has_looped) /* set start_index and start point if looped or not */ - { - start_index = voice->loopstart; - start_point = dsp_data[voice->loopend - 1]; /* last point in loop (wrap around) */ - } - else - { - start_index = voice->start; - start_point = dsp_data[voice->start]; /* just duplicate the point */ - } - - /* get points off the end (loop start if looping, duplicate point if end) */ - if (looping) - { - end_point1 = dsp_data[voice->loopstart]; - end_point2 = dsp_data[voice->loopstart + 1]; - } - else - { - end_point1 = dsp_data[voice->end]; - end_point2 = end_point1; - } - - while (1) - { - dsp_phase_index = fluid_phase_index (dsp_phase); - - /* interpolate first sample point (start or loop start) if needed */ - for ( ; dsp_phase_index == start_index && dsp_i < FLUID_BUFSIZE; dsp_i++) - { - coeffs = interp_coeff[fluid_phase_fract_to_tablerow (dsp_phase)]; - dsp_buf[dsp_i] = dsp_amp * (coeffs[0] * start_point - + coeffs[1] * dsp_data[dsp_phase_index] - + coeffs[2] * dsp_data[dsp_phase_index+1] - + coeffs[3] * dsp_data[dsp_phase_index+2]); - - /* increment phase and amplitude */ - fluid_phase_incr (dsp_phase, dsp_phase_incr); - dsp_phase_index = fluid_phase_index (dsp_phase); - dsp_amp += dsp_amp_incr; - } - - /* interpolate the sequence of sample points */ - for ( ; dsp_i < FLUID_BUFSIZE && dsp_phase_index <= end_index; dsp_i++) - { - coeffs = interp_coeff[fluid_phase_fract_to_tablerow (dsp_phase)]; - dsp_buf[dsp_i] = dsp_amp * (coeffs[0] * dsp_data[dsp_phase_index-1] - + coeffs[1] * dsp_data[dsp_phase_index] - + coeffs[2] * dsp_data[dsp_phase_index+1] - + coeffs[3] * dsp_data[dsp_phase_index+2]); - - /* increment phase and amplitude */ - fluid_phase_incr (dsp_phase, dsp_phase_incr); - dsp_phase_index = fluid_phase_index (dsp_phase); - dsp_amp += dsp_amp_incr; - } - - /* break out if buffer filled */ - if (dsp_i >= FLUID_BUFSIZE) break; - - end_index++; /* we're now interpolating the 2nd to last point */ - - /* interpolate within 2nd to last point */ - for (; dsp_phase_index <= end_index && dsp_i < FLUID_BUFSIZE; dsp_i++) - { - coeffs = interp_coeff[fluid_phase_fract_to_tablerow (dsp_phase)]; - dsp_buf[dsp_i] = dsp_amp * (coeffs[0] * dsp_data[dsp_phase_index-1] - + coeffs[1] * dsp_data[dsp_phase_index] - + coeffs[2] * dsp_data[dsp_phase_index+1] - + coeffs[3] * end_point1); - - /* increment phase and amplitude */ - fluid_phase_incr (dsp_phase, dsp_phase_incr); - dsp_phase_index = fluid_phase_index (dsp_phase); - dsp_amp += dsp_amp_incr; - } - - end_index++; /* we're now interpolating the last point */ - - /* interpolate within the last point */ - for (; dsp_phase_index <= end_index && dsp_i < FLUID_BUFSIZE; dsp_i++) - { - coeffs = interp_coeff[fluid_phase_fract_to_tablerow (dsp_phase)]; - dsp_buf[dsp_i] = dsp_amp * (coeffs[0] * dsp_data[dsp_phase_index-1] - + coeffs[1] * dsp_data[dsp_phase_index] - + coeffs[2] * end_point1 - + coeffs[3] * end_point2); - - /* increment phase and amplitude */ - fluid_phase_incr (dsp_phase, dsp_phase_incr); - dsp_phase_index = fluid_phase_index (dsp_phase); - dsp_amp += dsp_amp_incr; - } - - if (!looping) break; /* break out if not looping (end of sample) */ - - /* go back to loop start */ - if (dsp_phase_index > end_index) - { - fluid_phase_sub_int (dsp_phase, voice->loopend - voice->loopstart); - - if (!voice->has_looped) - { - voice->has_looped = 1; - start_index = voice->loopstart; - start_point = dsp_data[voice->loopend - 1]; - } - } - - /* break out if filled buffer */ - if (dsp_i >= FLUID_BUFSIZE) break; - - end_index -= 2; /* set end back to third to last sample point */ - } - - voice->phase = dsp_phase; - voice->amp = dsp_amp; - - return (dsp_i); -} - -/* 7th order interpolation. - * Returns number of samples processed (usually FLUID_BUFSIZE but could be - * smaller if end of sample occurs). - */ -int -fluid_dsp_float_interpolate_7th_order (fluid_voice_t *voice) -{ - fluid_phase_t dsp_phase = voice->phase; - fluid_phase_t dsp_phase_incr; - short int *dsp_data = voice->sample->data; - fluid_real_t *dsp_buf = voice->dsp_buf; - fluid_real_t dsp_amp = voice->amp; - fluid_real_t dsp_amp_incr = voice->amp_incr; - unsigned int dsp_i = 0; - unsigned int dsp_phase_index; - unsigned int start_index, end_index; - short int start_points[3]; - short int end_points[3]; - fluid_real_t *coeffs; - int looping; - - /* Convert playback "speed" floating point value to phase index/fract */ - fluid_phase_set_float (dsp_phase_incr, voice->phase_incr); - - /* add 1/2 sample to dsp_phase since 7th order interpolation is centered on - * the 4th sample point */ - fluid_phase_incr (dsp_phase, (fluid_phase_t)0x80000000); - - /* voice is currently looping? */ - looping = fluid_voice_is_looping(voice); - - /* last index before 7th interpolation point must be specially handled */ - end_index = (looping ? voice->loopend - 1 : voice->end) - 3; - - if (voice->has_looped) /* set start_index and start point if looped or not */ - { - start_index = voice->loopstart; - start_points[0] = dsp_data[voice->loopend - 1]; - start_points[1] = dsp_data[voice->loopend - 2]; - start_points[2] = dsp_data[voice->loopend - 3]; - } - else - { - start_index = voice->start; - start_points[0] = dsp_data[voice->start]; /* just duplicate the start point */ - start_points[1] = start_points[0]; - start_points[2] = start_points[0]; - } - - /* get the 3 points off the end (loop start if looping, duplicate point if end) */ - if (looping) - { - end_points[0] = dsp_data[voice->loopstart]; - end_points[1] = dsp_data[voice->loopstart + 1]; - end_points[2] = dsp_data[voice->loopstart + 2]; - } - else - { - end_points[0] = dsp_data[voice->end]; - end_points[1] = end_points[0]; - end_points[2] = end_points[0]; - } - - while (1) - { - dsp_phase_index = fluid_phase_index (dsp_phase); - - /* interpolate first sample point (start or loop start) if needed */ - for ( ; dsp_phase_index == start_index && dsp_i < FLUID_BUFSIZE; dsp_i++) - { - coeffs = sinc_table7[fluid_phase_fract_to_tablerow (dsp_phase)]; - - dsp_buf[dsp_i] = dsp_amp - * (coeffs[0] * (fluid_real_t)start_points[2] - + coeffs[1] * (fluid_real_t)start_points[1] - + coeffs[2] * (fluid_real_t)start_points[0] - + coeffs[3] * (fluid_real_t)dsp_data[dsp_phase_index] - + coeffs[4] * (fluid_real_t)dsp_data[dsp_phase_index+1] - + coeffs[5] * (fluid_real_t)dsp_data[dsp_phase_index+2] - + coeffs[6] * (fluid_real_t)dsp_data[dsp_phase_index+3]); - - /* increment phase and amplitude */ - fluid_phase_incr (dsp_phase, dsp_phase_incr); - dsp_phase_index = fluid_phase_index (dsp_phase); - dsp_amp += dsp_amp_incr; - } - - start_index++; - - /* interpolate 2nd to first sample point (start or loop start) if needed */ - for ( ; dsp_phase_index == start_index && dsp_i < FLUID_BUFSIZE; dsp_i++) - { - coeffs = sinc_table7[fluid_phase_fract_to_tablerow (dsp_phase)]; - - dsp_buf[dsp_i] = dsp_amp - * (coeffs[0] * (fluid_real_t)start_points[1] - + coeffs[1] * (fluid_real_t)start_points[0] - + coeffs[2] * (fluid_real_t)dsp_data[dsp_phase_index-1] - + coeffs[3] * (fluid_real_t)dsp_data[dsp_phase_index] - + coeffs[4] * (fluid_real_t)dsp_data[dsp_phase_index+1] - + coeffs[5] * (fluid_real_t)dsp_data[dsp_phase_index+2] - + coeffs[6] * (fluid_real_t)dsp_data[dsp_phase_index+3]); - - /* increment phase and amplitude */ - fluid_phase_incr (dsp_phase, dsp_phase_incr); - dsp_phase_index = fluid_phase_index (dsp_phase); - dsp_amp += dsp_amp_incr; - } - - start_index++; - - /* interpolate 3rd to first sample point (start or loop start) if needed */ - for ( ; dsp_phase_index == start_index && dsp_i < FLUID_BUFSIZE; dsp_i++) - { - coeffs = sinc_table7[fluid_phase_fract_to_tablerow (dsp_phase)]; - - dsp_buf[dsp_i] = dsp_amp - * (coeffs[0] * (fluid_real_t)start_points[0] - + coeffs[1] * (fluid_real_t)dsp_data[dsp_phase_index-2] - + coeffs[2] * (fluid_real_t)dsp_data[dsp_phase_index-1] - + coeffs[3] * (fluid_real_t)dsp_data[dsp_phase_index] - + coeffs[4] * (fluid_real_t)dsp_data[dsp_phase_index+1] - + coeffs[5] * (fluid_real_t)dsp_data[dsp_phase_index+2] - + coeffs[6] * (fluid_real_t)dsp_data[dsp_phase_index+3]); - - /* increment phase and amplitude */ - fluid_phase_incr (dsp_phase, dsp_phase_incr); - dsp_phase_index = fluid_phase_index (dsp_phase); - dsp_amp += dsp_amp_incr; - } - - start_index -= 2; /* set back to original start index */ - - - /* interpolate the sequence of sample points */ - for ( ; dsp_i < FLUID_BUFSIZE && dsp_phase_index <= end_index; dsp_i++) - { - coeffs = sinc_table7[fluid_phase_fract_to_tablerow (dsp_phase)]; - - dsp_buf[dsp_i] = dsp_amp - * (coeffs[0] * (fluid_real_t)dsp_data[dsp_phase_index-3] - + coeffs[1] * (fluid_real_t)dsp_data[dsp_phase_index-2] - + coeffs[2] * (fluid_real_t)dsp_data[dsp_phase_index-1] - + coeffs[3] * (fluid_real_t)dsp_data[dsp_phase_index] - + coeffs[4] * (fluid_real_t)dsp_data[dsp_phase_index+1] - + coeffs[5] * (fluid_real_t)dsp_data[dsp_phase_index+2] - + coeffs[6] * (fluid_real_t)dsp_data[dsp_phase_index+3]); - - /* increment phase and amplitude */ - fluid_phase_incr (dsp_phase, dsp_phase_incr); - dsp_phase_index = fluid_phase_index (dsp_phase); - dsp_amp += dsp_amp_incr; - } - - /* break out if buffer filled */ - if (dsp_i >= FLUID_BUFSIZE) break; - - end_index++; /* we're now interpolating the 3rd to last point */ - - /* interpolate within 3rd to last point */ - for (; dsp_phase_index <= end_index && dsp_i < FLUID_BUFSIZE; dsp_i++) - { - coeffs = sinc_table7[fluid_phase_fract_to_tablerow (dsp_phase)]; - - dsp_buf[dsp_i] = dsp_amp - * (coeffs[0] * (fluid_real_t)dsp_data[dsp_phase_index-3] - + coeffs[1] * (fluid_real_t)dsp_data[dsp_phase_index-2] - + coeffs[2] * (fluid_real_t)dsp_data[dsp_phase_index-1] - + coeffs[3] * (fluid_real_t)dsp_data[dsp_phase_index] - + coeffs[4] * (fluid_real_t)dsp_data[dsp_phase_index+1] - + coeffs[5] * (fluid_real_t)dsp_data[dsp_phase_index+2] - + coeffs[6] * (fluid_real_t)end_points[0]); - - /* increment phase and amplitude */ - fluid_phase_incr (dsp_phase, dsp_phase_incr); - dsp_phase_index = fluid_phase_index (dsp_phase); - dsp_amp += dsp_amp_incr; - } - - end_index++; /* we're now interpolating the 2nd to last point */ - - /* interpolate within 2nd to last point */ - for (; dsp_phase_index <= end_index && dsp_i < FLUID_BUFSIZE; dsp_i++) - { - coeffs = sinc_table7[fluid_phase_fract_to_tablerow (dsp_phase)]; - - dsp_buf[dsp_i] = dsp_amp - * (coeffs[0] * (fluid_real_t)dsp_data[dsp_phase_index-3] - + coeffs[1] * (fluid_real_t)dsp_data[dsp_phase_index-2] - + coeffs[2] * (fluid_real_t)dsp_data[dsp_phase_index-1] - + coeffs[3] * (fluid_real_t)dsp_data[dsp_phase_index] - + coeffs[4] * (fluid_real_t)dsp_data[dsp_phase_index+1] - + coeffs[5] * (fluid_real_t)end_points[0] - + coeffs[6] * (fluid_real_t)end_points[1]); - - /* increment phase and amplitude */ - fluid_phase_incr (dsp_phase, dsp_phase_incr); - dsp_phase_index = fluid_phase_index (dsp_phase); - dsp_amp += dsp_amp_incr; - } - - end_index++; /* we're now interpolating the last point */ - - /* interpolate within last point */ - for (; dsp_phase_index <= end_index && dsp_i < FLUID_BUFSIZE; dsp_i++) - { - coeffs = sinc_table7[fluid_phase_fract_to_tablerow (dsp_phase)]; - - dsp_buf[dsp_i] = dsp_amp - * (coeffs[0] * (fluid_real_t)dsp_data[dsp_phase_index-3] - + coeffs[1] * (fluid_real_t)dsp_data[dsp_phase_index-2] - + coeffs[2] * (fluid_real_t)dsp_data[dsp_phase_index-1] - + coeffs[3] * (fluid_real_t)dsp_data[dsp_phase_index] - + coeffs[4] * (fluid_real_t)end_points[0] - + coeffs[5] * (fluid_real_t)end_points[1] - + coeffs[6] * (fluid_real_t)end_points[2]); - - /* increment phase and amplitude */ - fluid_phase_incr (dsp_phase, dsp_phase_incr); - dsp_phase_index = fluid_phase_index (dsp_phase); - dsp_amp += dsp_amp_incr; - } - - if (!looping) break; /* break out if not looping (end of sample) */ - - /* go back to loop start */ - if (dsp_phase_index > end_index) - { - fluid_phase_sub_int (dsp_phase, voice->loopend - voice->loopstart); - - if (!voice->has_looped) - { - voice->has_looped = 1; - start_index = voice->loopstart; - start_points[0] = dsp_data[voice->loopend - 1]; - start_points[1] = dsp_data[voice->loopend - 2]; - start_points[2] = dsp_data[voice->loopend - 3]; - } - } - - /* break out if filled buffer */ - if (dsp_i >= FLUID_BUFSIZE) break; - - end_index -= 3; /* set end back to 4th to last sample point */ - } - - /* sub 1/2 sample from dsp_phase since 7th order interpolation is centered on - * the 4th sample point (correct back to real value) */ - fluid_phase_decr (dsp_phase, (fluid_phase_t)0x80000000); - - voice->phase = dsp_phase; - voice->amp = dsp_amp; - - return (dsp_i); -} diff --git a/src/unused/fluid_dsp_simple.c b/src/unused/fluid_dsp_simple.c deleted file mode 100644 index fc90f28a..00000000 --- a/src/unused/fluid_dsp_simple.c +++ /dev/null @@ -1,120 +0,0 @@ -/* FluidSynth - A Software Synthesizer - * - * Copyright (C) 2003 Peter Hanappe and others. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public License - * as published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free - * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02110-1301, USA - */ - - -/* Purpose: - * Low-level voice processing: - * - * - interpolates (obtains values between the samples of the original waveform data) - * - filters (applies a lowpass filter with variable cutoff frequency and quality factor) - * - mixes the processed sample to left and right output using the pan setting - * - sends the processed sample to chorus and reverb - * - * - * This file does -not- generate an object file. - * Instead, it is #included in several places in fluid_voice.c. - * The motivation for this is - * - Calling it as a subroutine may be time consuming, especially with optimization off - * - The previous implementation as a macro was clumsy to handle - * - * - * Fluid_voice.c sets a couple of variables before #including this: - * - dsp_data: Pointer to the original waveform data - * - dsp_left_buf: The generated signal goes here, left channel - * - dsp_right_buf: right channel - * - dsp_reverb_buf: Send to reverb unit - * - dsp_chorus_buf: Send to chorus unit - * - dsp_start: Start processing at this output buffer index - * - dsp_end: End processing just before this output buffer index - * - dsp_a1: Coefficient for the filter - * - dsp_a2: same - * - dsp_b0: same - * - dsp_b1: same - * - dsp_b2: same - * - dsp_filter_flag: Set, the filter is needed (many sound fonts don't use - * the filter at all. If it is left at its default setting - * of roughly 20 kHz, there is no need to apply filterling.) - * - dsp_interp_method: Which interpolation method to use. - * - voice holds the voice structure - * - * Some variables are set and modified: - * - dsp_phase: The position in the original waveform data. - * This has an integer and a fractional part (between samples). - * - dsp_phase_incr: For each output sample, the position in the original - * waveform advances by dsp_phase_incr. This also has an integer - * part and a fractional part. - * If a sample is played at root pitch (no pitch change), - * dsp_phase_incr is integer=1 and fractional=0. - * - dsp_amp: The current amplitude envelope value. - * - dsp_amp_incr: The changing rate of the amplitude envelope. - * - * A couple of variables are used internally, their results are discarded: - * - dsp_i: Index through the output buffer - * - dsp_phase_fractional: The fractional part of dsp_phase - * - dsp_coeff: A table of four coefficients, depending on the fractional phase. - * Used to interpolate between samples. - * - dsp_process_buffer: Holds the processed signal between stages - * - dsp_centernode: delay line for the IIR filter - * - dsp_hist1: same - * - dsp_hist2: same - * - */ - - -/* Nonoptimized DSP loop */ -#warning "This code is meant for experiments only."; - -/* wave table interpolation */ -for (dsp_i = dsp_start; dsp_i < dsp_end; dsp_i++) { - - dsp_coeff = &interp_coeff[fluid_phase_fract_to_tablerow(dsp_phase)]; - dsp_phase_index = fluid_phase_index(dsp_phase); - dsp_sample = (dsp_amp * - (dsp_coeff->a0 * dsp_data[dsp_phase_index] - + dsp_coeff->a1 * dsp_data[dsp_phase_index+1] - + dsp_coeff->a2 * dsp_data[dsp_phase_index+2] - + dsp_coeff->a3 * dsp_data[dsp_phase_index+3])); - - /* increment phase and amplitude */ - fluid_phase_incr(dsp_phase, dsp_phase_incr); - dsp_amp += dsp_amp_incr; - - /* filter */ - /* The filter is implemented in Direct-II form. */ - dsp_centernode = dsp_sample - dsp_a1 * dsp_hist1 - dsp_a2 * dsp_hist2; - dsp_sample = dsp_b0 * dsp_centernode + dsp_b1 * dsp_hist1 + dsp_b2 * dsp_hist2; - dsp_hist2 = dsp_hist1; - dsp_hist1 = dsp_centernode; - - /* pan */ - dsp_left_buf[dsp_i] += voice->amp_left * dsp_sample; - dsp_right_buf[dsp_i] += voice->amp_right * dsp_sample; - - /* reverb */ - if (dsp_reverb_buf){ - dsp_reverb_buf[dsp_i] += voice->amp_reverb * dsp_sample; - } - - /* chorus */ - if (dsp_chorus_buf){ - dsp_chorus_buf[dsp_i] += voice->amp_chorus * dsp_sample; - } -} - diff --git a/src/unused/fluid_event_queue.c b/src/unused/fluid_event_queue.c deleted file mode 100644 index 24804ba2..00000000 --- a/src/unused/fluid_event_queue.c +++ /dev/null @@ -1,88 +0,0 @@ -/* FluidSynth - A Software Synthesizer - * - * Copyright (C) 2003 Peter Hanappe and others. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public License - * as published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free - * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02110-1301, USA - */ - -/* - * Josh Green - * 2009-05-28 - */ - -#include "fluid_event_queue.h" -#include "fluidsynth_priv.h" - - -/** - * Create a lock free queue with a fixed maximum count and size of elements. - * @param count Count of elements in queue (fixed max number of queued elements) - * @return New lock free queue or NULL if out of memory (error message logged) - * - * Lockless FIFO queues don't use any locking mechanisms and can therefore be - * advantageous in certain situations, such as passing data between a lower - * priority thread and a higher "real time" thread, without potential lock - * contention which could stall the high priority thread. Note that there may - * only be one producer thread and one consumer thread. - */ -fluid_event_queue_t * -fluid_event_queue_new (int count) -{ - fluid_event_queue_t *queue; - - fluid_return_val_if_fail (count > 0, NULL); - - queue = FLUID_NEW (fluid_event_queue_t); - - if (!queue) - { - FLUID_LOG (FLUID_ERR, "Out of memory"); - return NULL; - } - - queue->array = FLUID_ARRAY (fluid_event_queue_elem_t, count); - - if (!queue->array) - { - FLUID_FREE (queue); - FLUID_LOG (FLUID_ERR, "Out of memory"); - return NULL; - } - - /* Clear array, in case dynamic pointer reclaiming is being done */ - FLUID_MEMSET (queue->array, 0, sizeof (fluid_event_queue_elem_t) * count); - - queue->totalcount = count; - queue->count = 0; - queue->in = 0; - queue->out = 0; - - return (queue); -} - -/** - * Free an event queue. - * @param queue Lockless queue instance - * - * Care must be taken when freeing a queue, to ensure that the consumer and - * producer threads will no longer access it. - */ -void -fluid_event_queue_free (fluid_event_queue_t *queue) -{ - FLUID_FREE (queue->array); - FLUID_FREE (queue); -} diff --git a/src/unused/fluid_event_queue.h b/src/unused/fluid_event_queue.h deleted file mode 100644 index 45242d0b..00000000 --- a/src/unused/fluid_event_queue.h +++ /dev/null @@ -1,195 +0,0 @@ -/* FluidSynth - A Software Synthesizer - * - * Copyright (C) 2003 Peter Hanappe and others. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public License - * as published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free - * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02110-1301, USA - */ - -#ifndef _FLUID_EVENT_QUEUE_H -#define _FLUID_EVENT_QUEUE_H - -#include "fluid_sys.h" -#include "fluid_midi.h" -#include "fluid_ringbuffer.h" - -/** - * Type of queued event. - */ -enum fluid_event_queue_elem -{ - FLUID_EVENT_QUEUE_ELEM_MIDI, /**< MIDI event. Uses midi field of event value */ - FLUID_EVENT_QUEUE_ELEM_UPDATE_GAIN, /**< Update synthesizer gain. No payload value */ - FLUID_EVENT_QUEUE_ELEM_POLYPHONY, /**< Synth polyphony event. No payload value */ - FLUID_EVENT_QUEUE_ELEM_GEN, /**< Generator event. Uses gen field of event value */ - FLUID_EVENT_QUEUE_ELEM_PRESET, /**< Preset set event. Uses preset field of event value */ - FLUID_EVENT_QUEUE_ELEM_STOP_VOICES, /**< Stop voices event. Uses ival field of event value */ - FLUID_EVENT_QUEUE_ELEM_FREE_PRESET, /**< Free preset return event. Uses pval field of event value */ - FLUID_EVENT_QUEUE_ELEM_SET_TUNING, /**< Set tuning event. Uses set_tuning field of event value */ - FLUID_EVENT_QUEUE_ELEM_REPL_TUNING, /**< Replace tuning event. Uses repl_tuning field of event value */ - FLUID_EVENT_QUEUE_ELEM_UNREF_TUNING /**< Unref tuning return event. Uses unref_tuning field of event value */ -}; - -/** - * SoundFont generator set event structure. - */ -typedef struct -{ - int channel; /**< MIDI channel number */ - int param; /**< FluidSynth generator ID */ - float value; /**< Value for the generator (absolute or relative) */ - int absolute; /**< 1 if value is absolute, 0 if relative */ -} fluid_event_gen_t; - -/** - * Preset channel assignment event structure. - */ -typedef struct -{ - int channel; /**< MIDI channel number */ - fluid_preset_t *preset; /**< Preset to assign (synth thread owns) */ -} fluid_event_preset_t; - -/** - * Tuning assignment event structure. - */ -typedef struct -{ - char apply; /**< TRUE to set tuning in realtime */ - int channel; /**< MIDI channel number */ - fluid_tuning_t *tuning; /**< Tuning to assign */ -} fluid_event_set_tuning_t; - -/** - * Tuning replacement event structure. - */ -typedef struct -{ - char apply; /**< TRUE if tuning change should be applied in realtime */ - fluid_tuning_t *old_tuning; /**< Old tuning pointer to replace */ - fluid_tuning_t *new_tuning; /**< New tuning to assign */ -} fluid_event_repl_tuning_t; - -/** - * Tuning unref event structure. - */ -typedef struct -{ - fluid_tuning_t *tuning; /**< Tuning to unref */ - int count; /**< Number of times to unref */ -} fluid_event_unref_tuning_t; - -/** - * Structure for an integer parameter sent to a MIDI channel (bank or SoundFont ID for example). - */ -typedef struct -{ - int channel; - int val; -} fluid_event_channel_int_t; - -/** - * Event queue element structure. - */ -typedef struct -{ - char type; /**< fluid_event_queue_elem */ - - union - { - fluid_midi_event_t midi; /**< If type == FLUID_EVENT_QUEUE_ELEM_MIDI */ - fluid_event_gen_t gen; /**< If type == FLUID_EVENT_QUEUE_ELEM_GEN */ - fluid_event_preset_t preset; /**< If type == FLUID_EVENT_QUEUE_ELEM_PRESET */ - fluid_event_set_tuning_t set_tuning; /**< If type == FLUID_EVENT_QUEUE_ELEM_SET_TUNING */ - fluid_event_repl_tuning_t repl_tuning; /**< If type == FLUID_EVENT_QUEUE_ELEM_REPL_TUNING */ - fluid_event_unref_tuning_t unref_tuning; /**< If type == FLUID_EVENT_QUEUE_ELEM_UNREF_TUNING */ - double dval; /**< A floating point payload value */ - int ival; /**< An integer payload value */ - void *pval; /**< A pointer payload value */ - }; -} fluid_event_queue_elem_t; - -typedef struct _fluid_ringbuffer_t fluid_event_queue_t; - -static FLUID_INLINE fluid_event_queue_t * -fluid_event_queue_new (int count) -{ - return (fluid_event_queue_t *) new_fluid_ringbuffer(count, sizeof(fluid_event_queue_elem_t)); -} - -static FLUID_INLINE void fluid_event_queue_free (fluid_event_queue_t *queue) -{ - delete_fluid_ringbuffer(queue); -} - -/** - * Get pointer to next input array element in queue. - * @param queue Lockless queue instance - * @return Pointer to array element in queue to store data to or NULL if queue is full - * - * This function along with fluid_queue_next_inptr() form a queue "push" - * operation and is split into 2 functions to avoid an element copy. Note that - * the returned array element pointer may contain the data of a previous element - * if the queue has wrapped around. This can be used to reclaim pointers to - * allocated memory, etc. - */ -static FLUID_INLINE fluid_event_queue_elem_t * -fluid_event_queue_get_inptr (fluid_event_queue_t *queue) -{ - return (fluid_event_queue_elem_t *) fluid_ringbuffer_get_inptr(queue, 0); -} - -/** - * Advance the input queue index to complete a "push" operation. - * @param queue Lockless queue instance - * - * This function along with fluid_queue_get_inptr() form a queue "push" - * operation and is split into 2 functions to avoid element copy. - */ -static FLUID_INLINE void -fluid_event_queue_next_inptr (fluid_event_queue_t *queue) -{ - fluid_ringbuffer_next_inptr(queue, 1); -} - -/** - * Get pointer to next output array element in queue. - * @param queue Lockless queue instance - * @return Pointer to array element data in the queue or NULL if empty, can only - * be used up until fluid_queue_next_outptr() is called. - * - * This function along with fluid_queue_next_outptr() form a queue "pop" - * operation and is split into 2 functions to avoid an element copy. - */ -static FLUID_INLINE fluid_event_queue_elem_t * -fluid_event_queue_get_outptr (fluid_event_queue_t *queue) -{ - return (fluid_event_queue_elem_t *) fluid_ringbuffer_get_outptr(queue); -} - -/** - * Advance the output queue index to complete a "pop" operation. - * @param queue Lockless queue instance - * - * This function along with fluid_queue_get_outptr() form a queue "pop" - * operation and is split into 2 functions to avoid an element copy. - */ -static FLUID_INLINE void -fluid_event_queue_next_outptr (fluid_event_queue_t *queue) -{ - fluid_ringbuffer_next_outptr(queue); -} - -#endif /* _FLUID_EVENT_QUEUE_H */ diff --git a/src/unused/fluid_rvoice_handler.c b/src/unused/fluid_rvoice_handler.c deleted file mode 100644 index db0e4522..00000000 --- a/src/unused/fluid_rvoice_handler.c +++ /dev/null @@ -1,203 +0,0 @@ -/* FluidSynth - A Software Synthesizer - * - * Copyright (C) 2003 Peter Hanappe and others. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public License - * as published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free - * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02110-1301, USA - */ - - -#include "fluid_rvoice_handler.h" - - -fluid_rvoice_handler_t* new_fluid_rvoice_handler(void) -{ - fluid_rvoice_handler_t* handler; - - handler = FLUID_NEW(fluid_rvoice_handler_t); - if (handler == NULL) { - FLUID_LOG(FLUID_ERR, "Out of memory"); - return NULL; - } - FLUID_MEMSET(handler, 0, sizeof(fluid_rvoice_handler_t)); - - return handler; -} - -void delete_fluid_rvoice_handler(fluid_rvoice_handler_t* handler) -{ - fluid_return_if_fail(handler != NULL); - -#if 0 - FLUID_FREE(handler->finished_voices); -#endif - FLUID_FREE(handler->voices); - FLUID_FREE(handler); -} - - -int -fluid_rvoice_handler_add_voice(fluid_rvoice_handler_t* handler, fluid_rvoice_t* voice) -{ - if (handler->active_voices >= handler->polyphony) { - FLUID_LOG(FLUID_WARN, "Trying to exceed polyphony in fluid_rvoice_handler_add_voice"); - return FLUID_FAILED; - } - handler->voices[handler->active_voices++] = voice; - return FLUID_OK; -} - -/** - * Update polyphony - max number of voices (NOTE: not hard real-time capable) - * @return FLUID_OK or FLUID_FAILED - */ -int -fluid_rvoice_handler_set_polyphony(fluid_rvoice_handler_t* handler, int value) -{ - void* newptr; - if (handler->active_voices > value) - return FLUID_FAILED; -#if 0 - if (handler->finished_voice_count > value) - return FLUID_FAILED; -#endif - - newptr = FLUID_REALLOC(handler->voices, value * sizeof(fluid_rvoice_t*)); - if (newptr == NULL) - return FLUID_FAILED; - handler->voices = newptr; -#if 0 - newptr = FLUID_REALLOC(handler->finished_voices, value * sizeof(fluid_rvoice_t*)); - if (newptr == NULL) - return FLUID_FAILED; - handler->finished_voices = newptr; -#endif - - handler->polyphony = value; - return FLUID_OK; -} - -static void -fluid_rvoice_handler_remove_voice(fluid_rvoice_handler_t* handler, int index) -{ -#if 0 - if (handler->finished_voice_count < handler->polyphony) - handler->finished_voices[handler->finished_voice_count++] = handler->voices[index]; -#endif - - if (handler->remove_voice_callback != NULL) - handler->remove_voice_callback(handler->remove_voice_callback_userdata, - handler->voices[index]); - - handler->active_voices--; - if (index < handler->active_voices) /* Move the last voice into the "hole" */ - handler->voices[index] = handler->voices[handler->active_voices]; -} - -/** - * Synthesize one voice - * @return Number of samples written - */ -#if 0 -static FLUID_INLINE int -fluid_rvoice_handler_write_one(fluid_rvoice_handler_t* handler, int index, - fluid_real_t* buf, int blockcount) -{ - int i, result = 0; - fluid_rvoice_t* voice = handler->voices[index]; - for (i=0; i < blockcount; i++) { - int s = fluid_rvoice_write(voice, buf); - if (s == -1) { - FLUID_MEMSET(buf, 0, FLUID_BUFSIZE*sizeof(fluid_real_t)); - s = FLUID_BUFSIZE; - } - buf += s; - result += s; - } - return result; -} -#endif - -/** - * Synthesize one voice and add to buffer. - * NOTE: If return value is less than blockcount*FLUID_BUFSIZE, that means - * voice has been finished, removed and possibly replaced with another voice. - * @return Number of samples written - */ -static FLUID_INLINE int -fluid_rvoice_handler_mix_one(fluid_rvoice_handler_t* handler, int index, - fluid_real_t** bufs, unsigned int blockcount, unsigned int bufcount) -{ - unsigned int i, j=0, result = 0; - fluid_rvoice_t* voice = handler->voices[index]; - - fluid_real_t local_buf[FLUID_BUFSIZE*blockcount]; - - for (i=0; i < blockcount; i++) { - int s = fluid_rvoice_write(voice, &local_buf[FLUID_BUFSIZE*i]); - if (s == -1) { - s = FLUID_BUFSIZE; /* Voice is quiet, TODO: optimize away memset/mix */ - FLUID_MEMSET(&local_buf[FLUID_BUFSIZE*i], 0, FLUID_BUFSIZE*sizeof(fluid_real_t*)); - } - result += s; - if (s < FLUID_BUFSIZE) { - j = 1; - break; - } - } - fluid_rvoice_buffers_mix(&voice->buffers, local_buf, result, bufs, bufcount); - - if (j) - fluid_rvoice_handler_remove_voice(handler, index); - - return result; -} - -static FLUID_INLINE void -fluid_resetbufs(int blockcount, int bufcount, fluid_real_t** bufs) -{ - int i; - for (i=0; i < bufcount; i++) - FLUID_MEMSET(bufs[i], 0, blockcount * FLUID_BUFSIZE * sizeof(fluid_real_t)); -} - -/** - * Single-threaded scenario, no worker threads - */ -static FLUID_INLINE void -fluid_rvoice_handler_render_loop_simple(fluid_rvoice_handler_t* handler, - int blockcount, int bufcount, fluid_real_t** bufs) -{ - int i; - int scount = blockcount * FLUID_BUFSIZE; - for (i=0; i < handler->active_voices; i++) { - int s = fluid_rvoice_handler_mix_one(handler, i, bufs, blockcount, bufcount); - if (s < scount) i--; /* Need to render the moved voice as well */ - } -} - - -/** - * @param blockcount number of samples to render is blockcount*FLUID_BUFSIZE - * @param bufcount number of buffers to render into - * @param bufs array of bufcount buffers, each containing blockcount*FLUID_BUFSIZE samples - */ -void -fluid_rvoice_handler_render(fluid_rvoice_handler_t* handler, - int blockcount, int bufcount, fluid_real_t** bufs) -{ - fluid_resetbufs(blockcount, bufcount, bufs); - fluid_rvoice_handler_render_loop_simple(handler, blockcount, bufcount, bufs); -} diff --git a/src/unused/fluid_rvoice_handler.h b/src/unused/fluid_rvoice_handler.h deleted file mode 100644 index beda1c72..00000000 --- a/src/unused/fluid_rvoice_handler.h +++ /dev/null @@ -1,80 +0,0 @@ -/* FluidSynth - A Software Synthesizer - * - * Copyright (C) 2003 Peter Hanappe and others. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public License - * as published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free - * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02110-1301, USA - */ - - -#ifndef _FLUID_RVOICE_HANDLER_H -#define _FLUID_RVOICE_HANDLER_H - -#include "fluid_rvoice.h" -#include "fluid_sys.h" - -typedef struct _fluid_rvoice_handler_t fluid_rvoice_handler_t; - -struct _fluid_rvoice_handler_t { - fluid_rvoice_t** voices; /* Sorted so that all nulls are last */ - int polyphony; /* Length of voices array */ - int active_voices; /* Number of non-null voices */ -#if 0 - fluid_rvoice_t** finished_voices; /* List of voices who have finished */ - int finished_voice_count; -#endif - void (*remove_voice_callback)(void*, fluid_rvoice_t*); /**< Recieve this callback every time a voice is removed */ - void* remove_voice_callback_userdata; -}; - -int fluid_rvoice_handler_add_voice(fluid_rvoice_handler_t* handler, fluid_rvoice_t* voice); -int fluid_rvoice_handler_set_polyphony(fluid_rvoice_handler_t* handler, int value); - -void fluid_rvoice_handler_render(fluid_rvoice_handler_t* handler, - int blockcount, int bufcount, - fluid_real_t** bufs); - - -static FLUID_INLINE void -fluid_rvoice_handler_set_voice_callback( - fluid_rvoice_handler_t* handler, - void (*func)(void*, fluid_rvoice_t*), - void* userdata) -{ - handler->remove_voice_callback_userdata = userdata; - handler->remove_voice_callback = func; -} - -#if 0 -static FLUID_INLINE fluid_rvoice_t** -fluid_rvoice_handler_get_finished_voices(fluid_rvoice_handler_t* handler, - int* count) -{ - *count = handler->finished_voice_count; - return handler->finished_voices; -} - -static FLUID_INLINE void -fluid_rvoice_handler_clear_finished_voices(fluid_rvoice_handler_t* handler) -{ - handler->finished_voice_count = 0; -} -#endif - -fluid_rvoice_handler_t* new_fluid_rvoice_handler(void); -void delete_fluid_rvoice_handler(fluid_rvoice_handler_t* handler); - -#endif - diff --git a/src/unused/winbuild/fluidsynth.dsw b/src/unused/winbuild/fluidsynth.dsw deleted file mode 100644 index 7c91fa82..00000000 --- a/src/unused/winbuild/fluidsynth.dsw +++ /dev/null @@ -1,53 +0,0 @@ -Microsoft Developer Studio Workspace File, Format Version 6.00 -# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! - -############################################################################### - -Project: "fluidsynth"=fluidsynth\fluidsynth.dsp - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ -}}} - -############################################################################### - -Project: "fluidsynth_dll"=fluidsynth_dll\fluidsynth_dll.dsp - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ -}}} - -############################################################################### - -Project: "fluidsynth_lib"=fluidsynth_lib\fluidsynth_lib.dsp - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ -}}} - -############################################################################### - -Global: - -Package=<5> -{{{ -}}} - -Package=<3> -{{{ -}}} - -############################################################################### - diff --git a/src/unused/winbuild/fluidsynth.sln b/src/unused/winbuild/fluidsynth.sln deleted file mode 100755 index 1f9f3906..00000000 --- a/src/unused/winbuild/fluidsynth.sln +++ /dev/null @@ -1,34 +0,0 @@ -Microsoft Visual Studio Solution File, Format Version 10.00 -# Visual C++ Express 2008 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "fluidsynth", "fluidsynth\fluidsynth.vcproj", "{8150EAA4-CF92-448B-972A-01A423B3A23D}" - ProjectSection(ProjectDependencies) = postProject - {A52C4164-8C82-4E38-A70B-6D0E836D6644} = {A52C4164-8C82-4E38-A70B-6D0E836D6644} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "fluidsynth_dll", "fluidsynth_dll\fluidsynth_dll.vcproj", "{A52C4164-8C82-4E38-A70B-6D0E836D6644}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "fluidsynth_lib", "fluidsynth_lib\fluidsynth_lib.vcproj", "{CD7D1A45-9970-4958-BD8F-7F42B083093C}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Win32 = Debug|Win32 - Release|Win32 = Release|Win32 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {8150EAA4-CF92-448B-972A-01A423B3A23D}.Debug|Win32.ActiveCfg = Debug|Win32 - {8150EAA4-CF92-448B-972A-01A423B3A23D}.Debug|Win32.Build.0 = Debug|Win32 - {8150EAA4-CF92-448B-972A-01A423B3A23D}.Release|Win32.ActiveCfg = Release|Win32 - {8150EAA4-CF92-448B-972A-01A423B3A23D}.Release|Win32.Build.0 = Release|Win32 - {A52C4164-8C82-4E38-A70B-6D0E836D6644}.Debug|Win32.ActiveCfg = Debug|Win32 - {A52C4164-8C82-4E38-A70B-6D0E836D6644}.Debug|Win32.Build.0 = Debug|Win32 - {A52C4164-8C82-4E38-A70B-6D0E836D6644}.Release|Win32.ActiveCfg = Release|Win32 - {A52C4164-8C82-4E38-A70B-6D0E836D6644}.Release|Win32.Build.0 = Release|Win32 - {CD7D1A45-9970-4958-BD8F-7F42B083093C}.Debug|Win32.ActiveCfg = Debug|Win32 - {CD7D1A45-9970-4958-BD8F-7F42B083093C}.Debug|Win32.Build.0 = Debug|Win32 - {CD7D1A45-9970-4958-BD8F-7F42B083093C}.Release|Win32.ActiveCfg = Release|Win32 - {CD7D1A45-9970-4958-BD8F-7F42B083093C}.Release|Win32.Build.0 = Release|Win32 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/src/unused/winbuild/fluidsynth/fluidsynth.dsp b/src/unused/winbuild/fluidsynth/fluidsynth.dsp deleted file mode 100644 index 4939403d..00000000 --- a/src/unused/winbuild/fluidsynth/fluidsynth.dsp +++ /dev/null @@ -1,90 +0,0 @@ -# Microsoft Developer Studio Project File - Name="fluidsynth" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Console Application" 0x0103 - -CFG=fluidsynth - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "fluidsynth.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "fluidsynth.mak" CFG="fluidsynth - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "fluidsynth - Win32 Debug" (based on "Win32 (x86) Console Application") -!MESSAGE "fluidsynth - Win32 Release" (based on "Win32 (x86) Console Application") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -MTL=midl.exe -RSC=rc.exe - -!IF "$(CFG)" == "fluidsynth - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir ".\Debug" -# PROP BASE Intermediate_Dir ".\Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir ".\Debug" -# PROP Intermediate_Dir ".\Debug" -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MDd /I "..\..\include" /Zi /W3 /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /Fp".\Debug\fluidsynth.pch" /Fo".\Debug\" /Fd".\Debug\" /GZ /c -# ADD CPP /nologo /MDd /I "..\..\include" /Zi /W3 /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /Fp".\Debug\fluidsynth.pch" /Fo".\Debug\" /Fd".\Debug\" /GZ /c -# ADD BASE MTL /tlb ".\Debug/fluidsynth.tlb" /win32 -# ADD MTL /tlb ".\Debug/fluidsynth.tlb" /win32 -# ADD BASE RSC /l 1033 /d "_DEBUG" -# ADD RSC /l 1033 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 -# ADD BSC32 -LINK32=link.exe -# ADD BASE LINK32 odbc32.lib odbccp32.lib dsound.lib winmm.lib /nologo /out:"../fluidsynth_debug.exe" /incremental:no /debug /pdb:".\Debug/fluidsynth_debug.pdb" /pdbtype:sept /subsystem:console /machine:ix86 -# ADD LINK32 odbc32.lib odbccp32.lib dsound.lib winmm.lib /nologo /out:"../fluidsynth_debug.exe" /incremental:no /debug /pdb:".\Debug/fluidsynth_debug.pdb" /pdbtype:sept /subsystem:console /machine:ix86 - -!ELSEIF "$(CFG)" == "fluidsynth - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir ".\Release" -# PROP BASE Intermediate_Dir ".\Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir ".\Release" -# PROP Intermediate_Dir ".\Release" -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MD /I "..\..\include" /W3 /O2 /Ob1 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /GF /Gy /YX /Fo".\Release\" /Fd".\Release\" /c -# ADD CPP /nologo /MD /I "..\..\include" /W3 /O2 /Ob1 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /GF /Gy /YX /Fo".\Release\" /Fd".\Release\" /c -# ADD BASE MTL /tlb ".\Release/fluidsynth.tlb" /win32 -# ADD MTL /tlb ".\Release/fluidsynth.tlb" /win32 -# ADD BASE RSC /l 1033 /d "NDEBUG" -# ADD RSC /l 1033 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 -# ADD BSC32 -LINK32=link.exe -# ADD BASE LINK32 odbc32.lib odbccp32.lib dsound.lib /nologo /out:"../fluidsynth.exe" /incremental:no /pdb:".\Release/fluidsynth.pdb" /pdbtype:sept /subsystem:console /machine:ix86 -# ADD LINK32 odbc32.lib odbccp32.lib dsound.lib /nologo /out:"../fluidsynth.exe" /incremental:no /pdb:".\Release/fluidsynth.pdb" /pdbtype:sept /subsystem:console /machine:ix86 - -!ENDIF - -# Begin Target - -# Name "fluidsynth - Win32 Debug" -# Name "fluidsynth - Win32 Release" -# End Target -# End Project - diff --git a/src/unused/winbuild/fluidsynth/fluidsynth.vcproj b/src/unused/winbuild/fluidsynth/fluidsynth.vcproj deleted file mode 100755 index 0707a815..00000000 --- a/src/unused/winbuild/fluidsynth/fluidsynth.vcproj +++ /dev/null @@ -1,230 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/unused/winbuild/fluidsynth_dll/fluidsynth_dll.dsp b/src/unused/winbuild/fluidsynth_dll/fluidsynth_dll.dsp deleted file mode 100644 index 465e4ff8..00000000 --- a/src/unused/winbuild/fluidsynth_dll/fluidsynth_dll.dsp +++ /dev/null @@ -1,90 +0,0 @@ -# Microsoft Developer Studio Project File - Name="fluidsynth_dll" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 - -CFG=fluidsynth_dll - Win32 Release -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "fluidsynth_dll.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "fluidsynth_dll.mak" CFG="fluidsynth_dll - Win32 Release" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "fluidsynth_dll - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE "fluidsynth_dll - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -MTL=midl.exe -RSC=rc.exe - -!IF "$(CFG)" == "fluidsynth_dll - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir ".\Release" -# PROP BASE Intermediate_Dir ".\Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir ".\Release" -# PROP Intermediate_Dir ".\Release" -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MD /I "..\..\include" /W3 /O2 /Ob1 /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_USRDLL" /D "FLUIDSYNTH_DLL_EXPORTS" /D "FLUIDSYNTH_SEQ_DLL_EXPORTS" /D "_MBCS" /GF /Gy /YX /Fo".\Release\" /Fd".\Release\" /c -# ADD CPP /nologo /MD /I "..\..\include" /W3 /O2 /Ob1 /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_USRDLL" /D "FLUIDSYNTH_DLL_EXPORTS" /D "FLUIDSYNTH_SEQ_DLL_EXPORTS" /D "_MBCS" /GF /Gy /YX /Fo".\Release\" /Fd".\Release\" /c -# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /tlb ".\Release/fluidsynth_dll.tlb" /win32 -# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /tlb ".\Release/fluidsynth_dll.tlb" /win32 -# ADD BASE RSC /l 1033 /d "NDEBUG" -# ADD RSC /l 1033 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 -# ADD BSC32 -LINK32=link.exe -# ADD BASE LINK32 odbc32.lib odbccp32.lib dsound.lib winmm.lib /nologo /out:"../fluidsynth.dll" /incremental:no /pdb:".\Release/fluidsynth.pdb" /pdbtype:sept /subsystem:windows /implib:".\Release/fluidsynth.lib" /machine:ix86 -# ADD LINK32 odbc32.lib odbccp32.lib dsound.lib winmm.lib /nologo /out:"../fluidsynth.dll" /incremental:no /pdb:".\Release/fluidsynth.pdb" /pdbtype:sept /subsystem:windows /implib:".\Release/fluidsynth.lib" /machine:ix86 - -!ELSEIF "$(CFG)" == "fluidsynth_dll - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir ".\Debug" -# PROP BASE Intermediate_Dir ".\Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir ".\Debug" -# PROP Intermediate_Dir ".\Debug" -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MTd /I "..\..\include" /Zi /W3 /Od /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "_USRDLL" /D "FLUIDSYNTH_DLL_EXPORTS" /D "FLUIDSYNTH_SEQ_DLL_EXPORTS" /D "_MBCS" /YX /Fp".\Debug\fluidsynth_dll.pch" /Fo".\Debug\" /Fd".\Debug\" /GZ /c -# ADD CPP /nologo /MTd /I "..\..\include" /Zi /W3 /Od /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "_USRDLL" /D "FLUIDSYNTH_DLL_EXPORTS" /D "FLUIDSYNTH_SEQ_DLL_EXPORTS" /D "_MBCS" /YX /Fp".\Debug\fluidsynth_dll.pch" /Fo".\Debug\" /Fd".\Debug\" /GZ /c -# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /tlb ".\Debug/fluidsynth_dll.tlb" /win32 -# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /tlb ".\Debug/fluidsynth_dll.tlb" /win32 -# ADD BASE RSC /l 1033 /d "_DEBUG" -# ADD RSC /l 1033 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 -# ADD BSC32 -LINK32=link.exe -# ADD BASE LINK32 odbc32.lib odbccp32.lib dsound.lib winmm.lib /nologo /out:"../fluidsynth_debug.dll" /incremental:no /debug /pdb:".\Debug/fluidsynth_debug.pdb" /pdbtype:sept /subsystem:windows /implib:".\Debug/fluidsynth_debug.lib" /machine:ix86 -# ADD LINK32 odbc32.lib odbccp32.lib dsound.lib winmm.lib /nologo /out:"../fluidsynth_debug.dll" /incremental:no /debug /pdb:".\Debug/fluidsynth_debug.pdb" /pdbtype:sept /subsystem:windows /implib:".\Debug/fluidsynth_debug.lib" /machine:ix86 - -!ENDIF - -# Begin Target - -# Name "fluidsynth_dll - Win32 Release" -# Name "fluidsynth_dll - Win32 Debug" -# End Target -# End Project - diff --git a/src/unused/winbuild/fluidsynth_dll/fluidsynth_dll.vcproj b/src/unused/winbuild/fluidsynth_dll/fluidsynth_dll.vcproj deleted file mode 100755 index 789ef82f..00000000 --- a/src/unused/winbuild/fluidsynth_dll/fluidsynth_dll.vcproj +++ /dev/null @@ -1,983 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/unused/winbuild/fluidsynth_lib/fluidsynth_lib.dsp b/src/unused/winbuild/fluidsynth_lib/fluidsynth_lib.dsp deleted file mode 100644 index a6b97905..00000000 --- a/src/unused/winbuild/fluidsynth_lib/fluidsynth_lib.dsp +++ /dev/null @@ -1,90 +0,0 @@ -# Microsoft Developer Studio Project File - Name="fluidsynth_lib" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Static Library" 0x0104 - -CFG=fluidsynth_lib - Win32 Release -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "fluidsynth_lib.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "fluidsynth_lib.mak" CFG="fluidsynth_lib - Win32 Release" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "fluidsynth_lib - Win32 Release" (based on "Win32 (x86) Static Library") -!MESSAGE "fluidsynth_lib - Win32 Debug" (based on "Win32 (x86) Static Library") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -MTL=midl.exe -RSC=rc.exe - -!IF "$(CFG)" == "fluidsynth_lib - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir ".\Release" -# PROP BASE Intermediate_Dir ".\Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir ".\Release" -# PROP Intermediate_Dir ".\Release" -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MD /I "..\..\include" /W3 /O2 /Ob1 /D "NDEBUG" /D "WIN32" /D "_LIB" /D "FLUIDSYNTH_NOT_A_DLL" /D "_MBCS" /GF /Gy /YX /Fo".\Release\" /Fd".\Release\" /c -# ADD CPP /nologo /MD /I "..\..\include" /W3 /O2 /Ob1 /D "NDEBUG" /D "WIN32" /D "_LIB" /D "FLUIDSYNTH_NOT_A_DLL" /D "_MBCS" /GF /Gy /YX /Fo".\Release\" /Fd".\Release\" /c -# ADD BASE MTL /win32 -# ADD MTL /win32 -# ADD BASE RSC /l 1036 /d "NDEBUG" -# ADD RSC /l 1036 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 -# ADD BSC32 -LIB32=link.exe -lib -# ADD BASE LIB32 /nologo /out:"..\fluidsynth_lib.lib" -# ADD LIB32 /nologo /out:"..\fluidsynth_lib.lib" - -!ELSEIF "$(CFG)" == "fluidsynth_lib - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir ".\Debug" -# PROP BASE Intermediate_Dir ".\Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir ".\Debug" -# PROP Intermediate_Dir ".\Debug" -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MDd /I "..\..\include" /Zi /W3 /Od /D "_DEBUG" /D "WIN32" /D "_LIB" /D "FLUIDSYNTH_NOT_A_DLL" /D "_MBCS" /YX /Fp".\Debug\fluidsynth_lib.pch" /Fo".\Debug\" /Fd".\Debug\" /GZ /c -# ADD CPP /nologo /MDd /I "..\..\include" /Zi /W3 /Od /D "_DEBUG" /D "WIN32" /D "_LIB" /D "FLUIDSYNTH_NOT_A_DLL" /D "_MBCS" /YX /Fp".\Debug\fluidsynth_lib.pch" /Fo".\Debug\" /Fd".\Debug\" /GZ /c -# ADD BASE MTL /win32 -# ADD MTL /win32 -# ADD BASE RSC /l 1036 /d "_DEBUG" -# ADD RSC /l 1036 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 -# ADD BSC32 -LIB32=link.exe -lib -# ADD BASE LIB32 /nologo /out:"..\fluidsynth_lib_debug.lib" -# ADD LIB32 /nologo /out:"..\fluidsynth_lib_debug.lib" - -!ENDIF - -# Begin Target - -# Name "fluidsynth_lib - Win32 Release" -# Name "fluidsynth_lib - Win32 Debug" -# End Target -# End Project - diff --git a/src/unused/winbuild/fluidsynth_lib/fluidsynth_lib.vcproj b/src/unused/winbuild/fluidsynth_lib/fluidsynth_lib.vcproj deleted file mode 100755 index d67c1213..00000000 --- a/src/unused/winbuild/fluidsynth_lib/fluidsynth_lib.vcproj +++ /dev/null @@ -1,943 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - From 4571d996b3071030325efc37670c9646acfc1ac4 Mon Sep 17 00:00:00 2001 From: derselbst Date: Fri, 10 Nov 2017 20:49:06 +0100 Subject: [PATCH 03/17] remove unused forward declarations --- src/rvoice/fluid_rvoice.c | 2 +- src/synth/fluid_voice.c | 2 +- src/synth/fluid_voice.h | 7 ------- 3 files changed, 2 insertions(+), 9 deletions(-) diff --git a/src/rvoice/fluid_rvoice.c b/src/rvoice/fluid_rvoice.c index fc554c06..8cd97d5b 100644 --- a/src/rvoice/fluid_rvoice.c +++ b/src/rvoice/fluid_rvoice.c @@ -263,7 +263,7 @@ fluid_rvoice_check_sample_sanity(fluid_rvoice_t* voice) * quiet, 0 .. #FLUID_BUFSIZE-1 means voice finished.) * * Panning, reverb and chorus are processed separately. The dsp interpolation - * routine is in (fluid_dsp_float.c). + * routine is in (fluid_rvoice_dsp.c). */ int fluid_rvoice_write (fluid_rvoice_t* voice, fluid_real_t *dsp_buf) diff --git a/src/synth/fluid_voice.c b/src/synth/fluid_voice.c index bd765aef..08d69b78 100644 --- a/src/synth/fluid_voice.c +++ b/src/synth/fluid_voice.c @@ -389,7 +389,7 @@ fluid_real_t fluid_voice_gen_value(fluid_voice_t* voice, int num) * @return Count of samples written to dsp_buf (can be 0) * * Panning, reverb and chorus are processed separately. The dsp interpolation - * routine is in (fluid_dsp_float.c). + * routine is in (fluid_rvoice_dsp.c). */ int fluid_voice_write (fluid_voice_t* voice, fluid_real_t *dsp_buf) diff --git a/src/synth/fluid_voice.h b/src/synth/fluid_voice.h index 0127b173..615ab256 100644 --- a/src/synth/fluid_voice.h +++ b/src/synth/fluid_voice.h @@ -192,12 +192,5 @@ fluid_real_t fluid_voice_gen_value(fluid_voice_t* voice, int num); + (fluid_real_t)(_voice)->gen[_n].mod \ + (fluid_real_t)(_voice)->gen[_n].nrpn) -/* defined in fluid_dsp_float.c */ - -void fluid_dsp_float_config (void); -int fluid_dsp_float_interpolate_none (fluid_voice_t *voice); -int fluid_dsp_float_interpolate_linear (fluid_voice_t *voice); -int fluid_dsp_float_interpolate_4th_order (fluid_voice_t *voice); -int fluid_dsp_float_interpolate_7th_order (fluid_voice_t *voice); #endif /* _FLUID_VOICE_H */ From 12a96922116044570035249bbdf8e955d7461d8c Mon Sep 17 00:00:00 2001 From: derselbst Date: Sat, 11 Nov 2017 11:04:12 +0100 Subject: [PATCH 04/17] make fluid_settings_foreach_option_t const correct --- include/fluidsynth/settings.h | 2 +- src/bindings/fluid_cmd.c | 2 +- src/fluidsynth.c | 2 +- src/utils/fluid_settings.c | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/include/fluidsynth/settings.h b/include/fluidsynth/settings.h index a040d09b..5d1f7cb4 100644 --- a/include/fluidsynth/settings.h +++ b/include/fluidsynth/settings.h @@ -175,7 +175,7 @@ int fluid_settings_getint_range(fluid_settings_t* settings, const char *name, * @param name Setting name * @param option A string option for this setting (iterates through the list) */ -typedef void (*fluid_settings_foreach_option_t)(void *data, char *name, char *option); +typedef void (*fluid_settings_foreach_option_t)(void *data, const char *name, const char *option); FLUIDSYNTH_API void fluid_settings_foreach_option(fluid_settings_t* settings, diff --git a/src/bindings/fluid_cmd.c b/src/bindings/fluid_cmd.c index 081e4637..dcb907ab 100644 --- a/src/bindings/fluid_cmd.c +++ b/src/bindings/fluid_cmd.c @@ -1517,7 +1517,7 @@ struct _fluid_handle_option_data_t { fluid_ostream_t out; }; -void fluid_handle_print_option(void* data, char* name, char* option) +void fluid_handle_print_option(void* data, const char* name, const char* option) { struct _fluid_handle_option_data_t* d = (struct _fluid_handle_option_data_t*) data; diff --git a/src/fluidsynth.c b/src/fluidsynth.c index 47b141d2..f20e9d41 100644 --- a/src/fluidsynth.c +++ b/src/fluidsynth.c @@ -141,7 +141,7 @@ typedef struct /* Function to display each string option value */ static void -settings_option_foreach_func (void *data, char *name, char *option) +settings_option_foreach_func (void *data, const char *name, const char *option) { OptionBag *bag = data; diff --git a/src/utils/fluid_settings.c b/src/utils/fluid_settings.c index 25dc7f0a..81927b45 100644 --- a/src/utils/fluid_settings.c +++ b/src/utils/fluid_settings.c @@ -1421,7 +1421,7 @@ fluid_settings_foreach_option (fluid_settings_t* settings, const char *name, newlist = fluid_list_sort (newlist, fluid_list_str_compare_func); for (p = newlist; p; p = p->next) - (*func)(data, (char *)name, (char *)fluid_list_get (p)); + (*func)(data, name, (const char *)fluid_list_get (p)); fluid_rec_mutex_unlock (settings->mutex); /* -- unlock */ @@ -1611,7 +1611,7 @@ fluid_settings_foreach (fluid_settings_t* settings, void* data, /* Loop over names and call the callback */ for (p = bag.names; p; p = p->next) { - if (fluid_settings_get (settings, (char *)(p->data), &node) == FLUID_OK + if (fluid_settings_get (settings, (const char *)(p->data), &node) == FLUID_OK && node) (*func) (data, (char *)(p->data), node->type); FLUID_FREE (p->data); /* -- Free name */ From c7a02bd8122ab5a7e2af7df3c71e91f6a9046154 Mon Sep 17 00:00:00 2001 From: derselbst Date: Sat, 11 Nov 2017 11:09:17 +0100 Subject: [PATCH 05/17] make fluid_settings_foreach_t const correct --- include/fluidsynth/settings.h | 2 +- src/bindings/fluid_cmd.c | 4 ++-- src/fluidsynth.c | 2 +- src/utils/fluid_settings.c | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/include/fluidsynth/settings.h b/include/fluidsynth/settings.h index 5d1f7cb4..e2782da8 100644 --- a/include/fluidsynth/settings.h +++ b/include/fluidsynth/settings.h @@ -193,7 +193,7 @@ FLUIDSYNTH_API char *fluid_settings_option_concat (fluid_settings_t* settings, * @param name Setting name * @param type Setting type (#fluid_types_enum) */ -typedef void (*fluid_settings_foreach_t)(void *data, char *name, int type); +typedef void (*fluid_settings_foreach_t)(void *data, const char *name, int type); FLUIDSYNTH_API void fluid_settings_foreach(fluid_settings_t* settings, void* data, diff --git a/src/bindings/fluid_cmd.c b/src/bindings/fluid_cmd.c index dcb907ab..4dd28879 100644 --- a/src/bindings/fluid_cmd.c +++ b/src/bindings/fluid_cmd.c @@ -1444,7 +1444,7 @@ struct _fluid_handle_settings_data_t { fluid_ostream_t out; }; -static void fluid_handle_settings_iter1(void* data, char* name, int type) +static void fluid_handle_settings_iter1(void* data, const char* name, int type) { struct _fluid_handle_settings_data_t* d = (struct _fluid_handle_settings_data_t*) data; @@ -1454,7 +1454,7 @@ static void fluid_handle_settings_iter1(void* data, char* name, int type) } } -static void fluid_handle_settings_iter2(void* data, char* name, int type) +static void fluid_handle_settings_iter2(void* data, const char* name, int type) { struct _fluid_handle_settings_data_t* d = (struct _fluid_handle_settings_data_t*) data; diff --git a/src/fluidsynth.c b/src/fluidsynth.c index f20e9d41..196cc5a9 100644 --- a/src/fluidsynth.c +++ b/src/fluidsynth.c @@ -154,7 +154,7 @@ settings_option_foreach_func (void *data, const char *name, const char *option) /* fluid_settings_foreach function for displaying option help "-o help" */ static void -settings_foreach_func (void *data, char *name, int type) +settings_foreach_func (void *data, const char *name, int type) { fluid_settings_t *settings = (fluid_settings_t *)data; double dmin, dmax, ddef; diff --git a/src/utils/fluid_settings.c b/src/utils/fluid_settings.c index 81927b45..a9c320ed 100644 --- a/src/utils/fluid_settings.c +++ b/src/utils/fluid_settings.c @@ -1613,7 +1613,7 @@ fluid_settings_foreach (fluid_settings_t* settings, void* data, { if (fluid_settings_get (settings, (const char *)(p->data), &node) == FLUID_OK && node) - (*func) (data, (char *)(p->data), node->type); + (*func) (data, (const char *)(p->data), node->type); FLUID_FREE (p->data); /* -- Free name */ } From 696c736b2f79e84ca18a1381eb7bf5833b18b957 Mon Sep 17 00:00:00 2001 From: derselbst Date: Sat, 11 Nov 2017 12:14:13 +0100 Subject: [PATCH 06/17] introduce separate type for client IDs --- include/fluidsynth/event.h | 8 ++++---- include/fluidsynth/seq.h | 8 ++++---- include/fluidsynth/seqbind.h | 2 +- include/fluidsynth/types.h | 1 + src/midi/fluid_seq.c | 24 ++++++++++++------------ src/midi/fluid_seqbind.c | 9 +++++---- src/synth/fluid_event.c | 24 ++++++++++++------------ src/synth/fluid_event_priv.h | 4 ++-- 8 files changed, 41 insertions(+), 39 deletions(-) diff --git a/include/fluidsynth/event.h b/include/fluidsynth/event.h index 65e8ce20..dde0bb23 100644 --- a/include/fluidsynth/event.h +++ b/include/fluidsynth/event.h @@ -67,8 +67,8 @@ FLUIDSYNTH_API fluid_event_t* new_fluid_event(void); FLUIDSYNTH_API void delete_fluid_event(fluid_event_t* evt); /* Initializing events */ -FLUIDSYNTH_API void fluid_event_set_source(fluid_event_t* evt, short src); -FLUIDSYNTH_API void fluid_event_set_dest(fluid_event_t* evt, short dest); +FLUIDSYNTH_API void fluid_event_set_source(fluid_event_t* evt, fluid_seq_id_t src); +FLUIDSYNTH_API void fluid_event_set_dest(fluid_event_t* evt, fluid_seq_id_t dest); /* Timer events */ FLUIDSYNTH_API void fluid_event_timer(fluid_event_t* evt, void* data); @@ -115,8 +115,8 @@ FLUIDSYNTH_API void fluid_event_unregistering(fluid_event_t* evt); /* Accessing event data */ FLUIDSYNTH_API int fluid_event_get_type(fluid_event_t* evt); -FLUIDSYNTH_API short fluid_event_get_source(fluid_event_t* evt); -FLUIDSYNTH_API short fluid_event_get_dest(fluid_event_t* evt); +FLUIDSYNTH_API fluid_seq_id_t fluid_event_get_source(fluid_event_t* evt); +FLUIDSYNTH_API fluid_seq_id_t fluid_event_get_dest(fluid_event_t* evt); FLUIDSYNTH_API int fluid_event_get_channel(fluid_event_t* evt); FLUIDSYNTH_API short fluid_event_get_key(fluid_event_t* evt); FLUIDSYNTH_API short fluid_event_get_velocity(fluid_event_t* evt); diff --git a/include/fluidsynth/seq.h b/include/fluidsynth/seq.h index 0187b66d..9f0ee6c3 100644 --- a/include/fluidsynth/seq.h +++ b/include/fluidsynth/seq.h @@ -46,11 +46,11 @@ FLUIDSYNTH_API fluid_sequencer_t* new_fluid_sequencer2(int use_system_timer); FLUIDSYNTH_API void delete_fluid_sequencer(fluid_sequencer_t* seq); FLUIDSYNTH_API int fluid_sequencer_get_use_system_timer(fluid_sequencer_t* seq); FLUIDSYNTH_API -short fluid_sequencer_register_client(fluid_sequencer_t* seq, const char *name, +fluid_seq_id_t fluid_sequencer_register_client(fluid_sequencer_t* seq, const char *name, fluid_event_callback_t callback, void* data); -FLUIDSYNTH_API void fluid_sequencer_unregister_client(fluid_sequencer_t* seq, short id); +FLUIDSYNTH_API void fluid_sequencer_unregister_client(fluid_sequencer_t* seq, fluid_seq_id_t id); FLUIDSYNTH_API int fluid_sequencer_count_clients(fluid_sequencer_t* seq); -FLUIDSYNTH_API short fluid_sequencer_get_client_id(fluid_sequencer_t* seq, int index); +FLUIDSYNTH_API fluid_seq_id_t fluid_sequencer_get_client_id(fluid_sequencer_t* seq, int index); FLUIDSYNTH_API char* fluid_sequencer_get_client_name(fluid_sequencer_t* seq, int id); FLUIDSYNTH_API int fluid_sequencer_client_is_dest(fluid_sequencer_t* seq, int id); FLUIDSYNTH_API void fluid_sequencer_process(fluid_sequencer_t* seq, unsigned int msec); @@ -59,7 +59,7 @@ FLUIDSYNTH_API int fluid_sequencer_send_at(fluid_sequencer_t* seq, fluid_event_t* evt, unsigned int time, int absolute); FLUIDSYNTH_API -void fluid_sequencer_remove_events(fluid_sequencer_t* seq, short source, short dest, int type); +void fluid_sequencer_remove_events(fluid_sequencer_t* seq, fluid_seq_id_t source, fluid_seq_id_t dest, int type); FLUIDSYNTH_API unsigned int fluid_sequencer_get_tick(fluid_sequencer_t* seq); FLUIDSYNTH_API void fluid_sequencer_set_time_scale(fluid_sequencer_t* seq, double scale); FLUIDSYNTH_API double fluid_sequencer_get_time_scale(fluid_sequencer_t* seq); diff --git a/include/fluidsynth/seqbind.h b/include/fluidsynth/seqbind.h index fc46f08e..1fa707c7 100644 --- a/include/fluidsynth/seqbind.h +++ b/include/fluidsynth/seqbind.h @@ -33,7 +33,7 @@ extern "C" { */ FLUIDSYNTH_API -short fluid_sequencer_register_fluidsynth(fluid_sequencer_t* seq, fluid_synth_t* synth); +fluid_seq_id_t fluid_sequencer_register_fluidsynth(fluid_sequencer_t* seq, fluid_synth_t* synth); FLUIDSYNTH_API int fluid_sequencer_add_midi_event_to_buffer(void* data, fluid_midi_event_t* event); diff --git a/include/fluidsynth/types.h b/include/fluidsynth/types.h index 052a121f..94949b19 100644 --- a/include/fluidsynth/types.h +++ b/include/fluidsynth/types.h @@ -61,6 +61,7 @@ typedef struct _fluid_cmd_handler_t fluid_cmd_handler_t; /**< Shell Comma typedef int fluid_istream_t; /**< Input stream descriptor */ typedef int fluid_ostream_t; /**< Output stream descriptor */ +typedef short fluid_seq_id_t; /**< Type used for unique client IDs by the sequencer and #fluid_event_t */ #ifdef __cplusplus } diff --git a/src/midi/fluid_seq.c b/src/midi/fluid_seq.c index c0b5996a..60552c63 100644 --- a/src/midi/fluid_seq.c +++ b/src/midi/fluid_seq.c @@ -46,7 +46,7 @@ struct _fluid_sequencer_t { int useSystemTimer; double scale; // ticks per second fluid_list_t* clients; - short clientsID; + fluid_seq_id_t clientsID; /* for queue + heap */ fluid_evt_entry* preQueue; fluid_evt_entry* preQueueLast; @@ -67,7 +67,7 @@ struct _fluid_sequencer_t { /* Private data for clients */ typedef struct _fluid_sequencer_client_t { - short id; + fluid_seq_id_t id; char* name; fluid_event_callback_t callback; void* data; @@ -77,7 +77,7 @@ typedef struct _fluid_sequencer_client_t { static short _fluid_seq_queue_init(fluid_sequencer_t* seq, int nbEvents); static void _fluid_seq_queue_end(fluid_sequencer_t* seq); static short _fluid_seq_queue_pre_insert(fluid_sequencer_t* seq, fluid_event_t * evt); -static void _fluid_seq_queue_pre_remove(fluid_sequencer_t* seq, short src, short dest, int type); +static void _fluid_seq_queue_pre_remove(fluid_sequencer_t* seq, fluid_seq_id_t src, fluid_seq_id_t dest, int type); static int _fluid_seq_queue_process(void* data, unsigned int msec); // callback from timer static void _fluid_seq_queue_insert_entry(fluid_sequencer_t* seq, fluid_evt_entry * evtentry); static void _fluid_seq_queue_remove_entries_matching(fluid_sequencer_t* seq, fluid_evt_entry* temp); @@ -262,7 +262,7 @@ void fluid_seq_dotrace(fluid_sequencer_t* seq, char *fmt, ...) {} * Clients can be sources or destinations of events. Sources don't need to * register a callback. */ -short +fluid_seq_id_t fluid_sequencer_register_client (fluid_sequencer_t* seq, const char *name, fluid_event_callback_t callback, void* data) { @@ -300,7 +300,7 @@ fluid_sequencer_register_client (fluid_sequencer_t* seq, const char *name, * @param id Client ID as returned by fluid_sequencer_register_client(). */ void -fluid_sequencer_unregister_client (fluid_sequencer_t* seq, short id) +fluid_sequencer_unregister_client (fluid_sequencer_t* seq, fluid_seq_id_t id) { fluid_list_t *tmp; fluid_event_t* evt; @@ -355,7 +355,7 @@ fluid_sequencer_count_clients(fluid_sequencer_t* seq) * @param index Index of register client * @return Client ID or #FLUID_FAILED if not found */ -short fluid_sequencer_get_client_id (fluid_sequencer_t* seq, int index) +fluid_seq_id_t fluid_sequencer_get_client_id (fluid_sequencer_t* seq, int index) { fluid_list_t *tmp = fluid_list_nth(seq->clients, index); if (tmp == NULL) { @@ -427,7 +427,7 @@ fluid_sequencer_client_is_dest(fluid_sequencer_t* seq, int id) void fluid_sequencer_send_now(fluid_sequencer_t* seq, fluid_event_t* evt) { - short destID = fluid_event_get_dest(evt); + fluid_seq_id_t destID = fluid_event_get_dest(evt); /* find callback */ fluid_list_t *tmp = seq->clients; @@ -478,8 +478,8 @@ fluid_sequencer_send_at (fluid_sequencer_t* seq, fluid_event_t* evt, * @param type Event type to match or -1 for wildcard (#fluid_seq_event_type) */ void -fluid_sequencer_remove_events (fluid_sequencer_t* seq, short source, - short dest, int type) +fluid_sequencer_remove_events (fluid_sequencer_t* seq, fluid_seq_id_t source, + fluid_seq_id_t dest, int type) { _fluid_seq_queue_pre_remove(seq, source, dest, type); } @@ -747,7 +747,7 @@ _fluid_seq_queue_pre_insert(fluid_sequencer_t* seq, fluid_event_t * evt) * May be called from the main thread (usually) but also recursively * from the queue thread, when a callback itself does an insert... */ static void -_fluid_seq_queue_pre_remove(fluid_sequencer_t* seq, short src, short dest, int type) +_fluid_seq_queue_pre_remove(fluid_sequencer_t* seq, fluid_seq_id_t src, fluid_seq_id_t dest, int type) { fluid_evt_entry * evtentry = _fluid_seq_heap_get_free(seq->heap); if (evtentry == NULL) { @@ -979,7 +979,7 @@ _fluid_seq_queue_insert_entry(fluid_sequencer_t* seq, fluid_evt_entry * evtentry } static int -_fluid_seq_queue_matchevent(fluid_event_t* evt, int templType, short templSrc, short templDest) +_fluid_seq_queue_matchevent(fluid_event_t* evt, int templType, fluid_seq_id_t templSrc, fluid_seq_id_t templDest) { int eventType; @@ -1016,7 +1016,7 @@ _fluid_seq_queue_remove_entries_matching(fluid_sequencer_t* seq, fluid_evt_entry { /* we walk everything : this is slow, but that is life */ int i, type; - short src, dest; + fluid_seq_id_t src, dest; src = templ->evt.src; dest = templ->evt.dest; diff --git a/src/midi/fluid_seqbind.c b/src/midi/fluid_seqbind.c index b94872d2..233423d0 100644 --- a/src/midi/fluid_seqbind.c +++ b/src/midi/fluid_seqbind.c @@ -41,7 +41,7 @@ struct _fluid_seqbind_t { fluid_synth_t* synth; fluid_sequencer_t* seq; fluid_sample_timer_t* sample_timer; - short client_id; + fluid_seq_id_t client_id; }; typedef struct _fluid_seqbind_t fluid_seqbind_t; @@ -75,7 +75,7 @@ delete_fluid_seqbind(fluid_seqbind_t* seqbind) * @param synth Synthesizer instance * @returns Sequencer client ID, or #FLUID_FAILED on error. */ -short +fluid_seq_id_t fluid_sequencer_register_fluidsynth (fluid_sequencer_t* seq, fluid_synth_t* synth) { fluid_seqbind_t* seqbind; @@ -243,9 +243,10 @@ fluid_seq_fluidsynth_callback(unsigned int time, fluid_event_t* evt, fluid_seque } } -static int get_fluidsynth_dest(fluid_sequencer_t* seq) +static fluid_seq_id_t get_fluidsynth_dest(fluid_sequencer_t* seq) { - int i, id; + int i; + fluid_seq_id_t id; char* name; int j = fluid_sequencer_count_clients(seq); for (i = 0; i < j; i++) { diff --git a/src/synth/fluid_event.c b/src/synth/fluid_event.c index 28a54d8d..5bc99adc 100644 --- a/src/synth/fluid_event.c +++ b/src/synth/fluid_event.c @@ -93,23 +93,23 @@ fluid_event_set_time(fluid_event_t* evt, unsigned int time) } /** - * Set source of a sequencer event (DOCME). + * Set source of a sequencer event. \c src must be a unique sequencer ID or -1 if not set. * @param evt Sequencer event structure - * @param src DOCME + * @param src Unique sequencer ID */ void -fluid_event_set_source(fluid_event_t* evt, short src) +fluid_event_set_source(fluid_event_t* evt, fluid_seq_id_t src) { evt->src = src; } /** - * Set destination of a sequencer event (DOCME). + * Set destination of this sequencer event, i.e. the sequencer client this event will be sent to. \c dest must be a unique sequencer ID. * @param evt Sequencer event structure - * @param dest DOCME + * @param dest The destination unique sequencer ID */ void -fluid_event_set_dest(fluid_event_t* evt, short dest) +fluid_event_set_dest(fluid_event_t* evt, fluid_seq_id_t dest) { evt->dest = dest; } @@ -488,21 +488,21 @@ unsigned int fluid_event_get_time(fluid_event_t* evt) } /** - * Get the source field from a sequencer event structure. + * Get the source sequencer client from a sequencer event structure. * @param evt Sequencer event structure - * @return DOCME + * @return source field of the sequencer event */ -short fluid_event_get_source(fluid_event_t* evt) +fluid_seq_id_t fluid_event_get_source(fluid_event_t* evt) { return evt->src; } /** - * Get the dest field from a sequencer event structure. + * Get the dest sequencer client from a sequencer event structure. * @param evt Sequencer event structure - * @return DOCME + * @return dest field of the sequencer event */ -short fluid_event_get_dest(fluid_event_t* evt) +fluid_seq_id_t fluid_event_get_dest(fluid_event_t* evt) { return evt->dest; } diff --git a/src/synth/fluid_event_priv.h b/src/synth/fluid_event_priv.h index f1fbb919..87a0d755 100644 --- a/src/synth/fluid_event_priv.h +++ b/src/synth/fluid_event_priv.h @@ -30,8 +30,8 @@ struct _fluid_event_t { unsigned int time; int type; - short src; - short dest; + fluid_seq_id_t src; + fluid_seq_id_t dest; int channel; short key; short vel; From 52b892c534372eb5e25a011e5e11f54f61674e3a Mon Sep 17 00:00:00 2001 From: derselbst Date: Sat, 11 Nov 2017 12:18:09 +0100 Subject: [PATCH 07/17] consistently use fluid_seq_id_t for new API ABI breaking change --- include/fluidsynth/seq.h | 4 ++-- src/midi/fluid_seq.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/include/fluidsynth/seq.h b/include/fluidsynth/seq.h index 9f0ee6c3..69056fc9 100644 --- a/include/fluidsynth/seq.h +++ b/include/fluidsynth/seq.h @@ -51,8 +51,8 @@ fluid_seq_id_t fluid_sequencer_register_client(fluid_sequencer_t* seq, const cha FLUIDSYNTH_API void fluid_sequencer_unregister_client(fluid_sequencer_t* seq, fluid_seq_id_t id); FLUIDSYNTH_API int fluid_sequencer_count_clients(fluid_sequencer_t* seq); FLUIDSYNTH_API fluid_seq_id_t fluid_sequencer_get_client_id(fluid_sequencer_t* seq, int index); -FLUIDSYNTH_API char* fluid_sequencer_get_client_name(fluid_sequencer_t* seq, int id); -FLUIDSYNTH_API int fluid_sequencer_client_is_dest(fluid_sequencer_t* seq, int id); +FLUIDSYNTH_API char* fluid_sequencer_get_client_name(fluid_sequencer_t* seq, fluid_seq_id_t id); +FLUIDSYNTH_API int fluid_sequencer_client_is_dest(fluid_sequencer_t* seq, fluid_seq_id_t id); FLUIDSYNTH_API void fluid_sequencer_process(fluid_sequencer_t* seq, unsigned int msec); FLUIDSYNTH_API void fluid_sequencer_send_now(fluid_sequencer_t* seq, fluid_event_t* evt); FLUIDSYNTH_API diff --git a/src/midi/fluid_seq.c b/src/midi/fluid_seq.c index 60552c63..e2c6d99c 100644 --- a/src/midi/fluid_seq.c +++ b/src/midi/fluid_seq.c @@ -374,7 +374,7 @@ fluid_seq_id_t fluid_sequencer_get_client_id (fluid_sequencer_t* seq, int index) * be modified or freed. */ char * -fluid_sequencer_get_client_name(fluid_sequencer_t* seq, int id) +fluid_sequencer_get_client_name(fluid_sequencer_t* seq, fluid_seq_id_t id) { fluid_list_t *tmp; @@ -400,7 +400,7 @@ fluid_sequencer_get_client_name(fluid_sequencer_t* seq, int id) * @return TRUE if client is a destination client, FALSE otherwise or if not found */ int -fluid_sequencer_client_is_dest(fluid_sequencer_t* seq, int id) +fluid_sequencer_client_is_dest(fluid_sequencer_t* seq, fluid_seq_id_t id) { fluid_list_t *tmp; From d4b86051ba4b0a97d42d96b38fee5223cca1fe56 Mon Sep 17 00:00:00 2001 From: derselbst Date: Sat, 11 Nov 2017 14:45:06 +0100 Subject: [PATCH 08/17] update doc for fluid_seq_id_t --- include/fluidsynth/types.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/fluidsynth/types.h b/include/fluidsynth/types.h index 94949b19..0903a95f 100644 --- a/include/fluidsynth/types.h +++ b/include/fluidsynth/types.h @@ -61,7 +61,7 @@ typedef struct _fluid_cmd_handler_t fluid_cmd_handler_t; /**< Shell Comma typedef int fluid_istream_t; /**< Input stream descriptor */ typedef int fluid_ostream_t; /**< Output stream descriptor */ -typedef short fluid_seq_id_t; /**< Type used for unique client IDs by the sequencer and #fluid_event_t */ +typedef short fluid_seq_id_t; /**< Unique client IDs use by the sequencer and #fluid_event_t, obtained by fluid_sequencer_register_client() and fluid_sequencer_register_fluidsynth() */ #ifdef __cplusplus } From 227814e7017161f2d868a1a3a3e35d376216d754 Mon Sep 17 00:00:00 2001 From: Tom M Date: Sat, 11 Nov 2017 16:55:36 +0100 Subject: [PATCH 09/17] Update issue_template.md -friendliness --- .github/issue_template.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/issue_template.md b/.github/issue_template.md index 94a6222e..f44778bc 100644 --- a/.github/issue_template.md +++ b/.github/issue_template.md @@ -3,7 +3,7 @@ Before submitting an issue, consider looking into our wiki ( https://github.com/FluidSynth/fluidsynth/wiki ) or the developer resources ( http://www.fluidsynth.org/api/ ) -Please do not submit support requests or "How to" questions here. Instead, please use FluidSynth's +Please do not submit support requests or "How to" questions here. Instead, use FluidSynth's mailing list: https://lists.nongnu.org/mailman/listinfo/fluid-dev Below is a form that shall help getting relevant information for bugs and feature requests together. From 3908917aabe4cfc0a563251715b1bedddd9f3e50 Mon Sep 17 00:00:00 2001 From: loki666 Date: Mon, 13 Nov 2017 15:21:30 +0100 Subject: [PATCH 10/17] return FLUID_FAIL when sampletype is OGG but not compiled with LIBSNDFILE_SUPPORT --- src/sfloader/fluid_defsfont.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/sfloader/fluid_defsfont.c b/src/sfloader/fluid_defsfont.c index 016aa9b7..55c9d95f 100644 --- a/src/sfloader/fluid_defsfont.c +++ b/src/sfloader/fluid_defsfont.c @@ -1976,6 +1976,8 @@ fluid_sample_import_sfont(fluid_sample_t* sample, SFSample* sfsample, fluid_defs { FLUID_LOG (FLUID_WARN, _("Vorbis sample '%s' has invalid loop points"), sample->name); } +#else + return FLUID_FAILED; #endif } From 7a6961a74050848b2c8f0d840df16145173a2a9b Mon Sep 17 00:00:00 2001 From: derselbst Date: Mon, 13 Nov 2017 16:05:49 +0100 Subject: [PATCH 11/17] add .appveyor.yml for automated windows builds addressing #276 --- .appveyor.yml | 62 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 .appveyor.yml diff --git a/.appveyor.yml b/.appveyor.yml new file mode 100644 index 00000000..f229917b --- /dev/null +++ b/.appveyor.yml @@ -0,0 +1,62 @@ +os: + - Visual Studio 2015 + +build: + verbosity: detailed + +configuration: + - Release + +branches: + only: + - av-test + +environment: + matrix: + - platform: x86 + generator: Visual Studio 14 2015 + glib-url: http://ftp.gnome.org/pub/gnome/binaries/win32/glib/2.28/glib_2.28.8-1_win32.zip + glib-dev-url: http://ftp.gnome.org/pub/gnome/binaries/win32/glib/2.28/glib-dev_2.28.8-1_win32.zip + pkg-config-url: http://ftp.gnome.org/pub/gnome/binaries/win32/dependencies/pkg-config_0.26-1_win32.zip + gettext-url: http://ftp.gnome.org/pub/gnome/binaries/win32/dependencies/gettext-runtime_0.18.1.1-2_win32.zip + proxy-libintl-dev-url: http://ftp.gnome.org/pub/gnome/binaries/win32/dependencies/proxy-libintl-dev_20100902_win32.zip + + - platform: x64 + generator: Visual Studio 14 2015 Win64 + glib-url: http://ftp.gnome.org/pub/gnome/binaries/win64/glib/2.26/glib_2.26.1-1_win64.zip + glib-dev-url: http://ftp.gnome.org/pub/gnome/binaries/win64/glib/2.26/glib-dev_2.26.1-1_win64.zip + pkg-config-url: http://ftp.gnome.org/pub/gnome/binaries/win64/dependencies/pkg-config_0.23-2_win64.zip + gettext-url: http://ftp.gnome.org/pub/gnome/binaries/win64/dependencies/gettext-runtime_0.18.1.1-2_win64.zip + proxy-libintl-dev-url: http://ftp.gnome.org/pub/gnome/binaries/win64/dependencies/proxy-libintl-dev_20100902_win64.zip + + +install: + - mkdir c:\deps + - cd c:\deps + - curl -fsS -o glib.zip %glib-url% + - curl -fsS -o glib-dev.zip %glib-dev-url% + - curl -fsS -o pkg-config.zip %pkg-config-url% + - curl -fsS -o gettext.zip %gettext-url% + - curl -fsS -o libintl-dev.zip %proxy-libintl-dev-url% + - 7z x glib.zip > NUL + - 7z x glib-dev.zip > NUL + - 7z x pkg-config.zip > NUL + - 7z x gettext.zip > NUL + - 7z x libintl-dev.zip > NUL + - SET PATH=C:\deps\bin;%PATH% + +build_script: +# - call "C:\Program Files\Microsoft SDKs\Windows\v7.1\Bin\SetEnv.cmd" /x64 +# - call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" x86_amd64 + - cd C:\projects\fluidsynth + - mkdir build + - cd build + - cmake -G "%generator%" .. + - cmake --build . --config Release + +after_build: + - 7z a fluidsynth.zip %APPVEYOR_BUILD_FOLDER%\build\src\Release\* c:\deps\bin\libglib*.dll c:\deps\bin\libgthread*.dll c:\deps\bin\*intl*.dll + +artifacts: + - path: build/fluidsynth.zip + name: FluidSynth From 247a0b9e550b47bb6055ce7203a0b46203a6a209 Mon Sep 17 00:00:00 2001 From: derselbst Date: Mon, 13 Nov 2017 16:27:50 +0100 Subject: [PATCH 12/17] empty commit to trigger appveyor --- .appveyor.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.appveyor.yml b/.appveyor.yml index f229917b..dd0a2a64 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -1,6 +1,6 @@ os: - Visual Studio 2015 - + build: verbosity: detailed From c61c64e921aeb9654fae7b579c9479c0dc8ab946 Mon Sep 17 00:00:00 2001 From: derselbst Date: Mon, 13 Nov 2017 16:36:11 +0100 Subject: [PATCH 13/17] trigger appveyor --- .appveyor.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.appveyor.yml b/.appveyor.yml index dd0a2a64..f229917b 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -1,6 +1,6 @@ os: - Visual Studio 2015 - + build: verbosity: detailed From 33227cde47bf041f534758a14b590eb7eb3aa9ff Mon Sep 17 00:00:00 2001 From: derselbst Date: Mon, 13 Nov 2017 16:51:39 +0100 Subject: [PATCH 14/17] add appveyor badge to README --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 7758d71d..1d18437f 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,5 @@ -[![Build Status](https://travis-ci.org/FluidSynth/fluidsynth.svg?branch=master)](https://travis-ci.org/FluidSynth/fluidsynth) +[![Build Status Travis](https://travis-ci.org/FluidSynth/fluidsynth.svg?branch=master)](https://travis-ci.org/FluidSynth/fluidsynth) +[![Build status Appveyor](https://ci.appveyor.com/api/projects/status/n24ybk0dmttjwdk2?svg=true)](https://ci.appveyor.com/project/derselbst/fluidsynth) # Introduction From 16b86e2100712796ab5154d2109c53021467fc8a Mon Sep 17 00:00:00 2001 From: derselbst Date: Mon, 13 Nov 2017 17:05:23 +0100 Subject: [PATCH 15/17] ensure appveyor builds all branches --- .appveyor.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.appveyor.yml b/.appveyor.yml index f229917b..b00b3372 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -6,10 +6,6 @@ build: configuration: - Release - -branches: - only: - - av-test environment: matrix: From 85b3aed9b052db0d33eab99319413f650eab382c Mon Sep 17 00:00:00 2001 From: derselbst Date: Mon, 13 Nov 2017 17:09:19 +0100 Subject: [PATCH 16/17] appveyor badge only for master branch --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 1d18437f..6046d8ee 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ [![Build Status Travis](https://travis-ci.org/FluidSynth/fluidsynth.svg?branch=master)](https://travis-ci.org/FluidSynth/fluidsynth) -[![Build status Appveyor](https://ci.appveyor.com/api/projects/status/n24ybk0dmttjwdk2?svg=true)](https://ci.appveyor.com/project/derselbst/fluidsynth) +[![Build status Appveyor](https://ci.appveyor.com/api/projects/status/n24ybk0dmttjwdk2/branch/master?svg=true)](https://ci.appveyor.com/project/derselbst/fluidsynth) # Introduction From ecdd6e2a8a3d97abe0efc2feb977dad15e7949eb Mon Sep 17 00:00:00 2001 From: derselbst Date: Mon, 13 Nov 2017 20:32:02 +0100 Subject: [PATCH 17/17] avoid pointless MSVC warnings return value in void function --- src/utils/fluid_sys.h | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/utils/fluid_sys.h b/src/utils/fluid_sys.h index 1ede8162..9a025eb5 100644 --- a/src/utils/fluid_sys.h +++ b/src/utils/fluid_sys.h @@ -69,13 +69,15 @@ void fluid_time_config(void); #define FLUID_LE16TOH(x) GINT16_FROM_LE(x) -#define fluid_return_val_if_fail(cond, val) \ +#define fluid_return_if_fail(cond) \ if(cond) \ ; \ else \ - return val - -#define fluid_return_if_fail(cond) fluid_return_val_if_fail(cond, ((void)(0))) + return + +#define fluid_return_val_if_fail(cond, val) \ + fluid_return_if_fail(cond) (val) + /* * Utility functions