Merge branch 'master' into sf3-fonts

This commit is contained in:
Tom M 2017-08-11 13:40:56 +02:00 committed by GitHub
commit 70311192aa
8 changed files with 244 additions and 35 deletions

178
.travis.yml Normal file
View file

@ -0,0 +1,178 @@
language: c
#sudo: required
dist: trusty
env:
- CMAKE_FLAGS="-Denable-profiling=1"
- CMAKE_FLAGS="-Denable-floats=1 -Denable-profiling=1"
- CMAKE_FLAGS="-Denable-trap-on-fpe=1"
- CMAKE_FLAGS="-Denable-fpe-check=1"
- CMAKE_FLAGS="-Denable-debug=1"
matrix:
include:
- os: linux
addons:
apt:
sources:
- ubuntu-toolchain-r-test
packages:
- g++-4.8
- cmake-data
- cmake
- libglib2.0-0
- libsndfile-dev
- libasound2-dev
- libjack-dev
- portaudio19-dev
- libpulse-dev
- libdbus-glib-1-dev
env:
- MATRIX_EVAL="CC=gcc-4.8 && CXX=g++-4.8"
- CMAKE_FLAGS="-Denable-floats=1"
- os: linux
addons:
apt:
sources:
- ubuntu-toolchain-r-test
packages:
- g++-4.8
- cmake-data
- cmake
- libglib2.0-0
- libsndfile-dev
- libasound2-dev
- libjack-dev
- portaudio19-dev
- libpulse-dev
- libdbus-glib-1-dev
env:
- MATRIX_EVAL="CC=gcc-4.8 && CXX=g++-4.8"
- CMAKE_FLAGS="-Denable-floats=0"
- os: linux
addons:
apt:
sources:
- ubuntu-toolchain-r-test
packages:
- g++-4.9
- cmake-data
- cmake
- libglib2.0-0
env:
- MATRIX_EVAL="CC=gcc-4.9 && CXX=g++-4.9"
# works on Precise and Trusty
- os: linux
addons:
apt:
sources:
- ubuntu-toolchain-r-test
packages:
- g++-5
- cmake-data
- cmake
- libglib2.0-0
env:
- MATRIX_EVAL="CC=gcc-5 && CXX=g++-5"
# works on Precise and Trusty
- os: linux
addons:
apt:
sources:
- ubuntu-toolchain-r-test
packages:
- g++-6
- cmake-data
- cmake
- libglib2.0-0
env:
- MATRIX_EVAL="CC=gcc-6 && CXX=g++-6"
# works on Precise and Trusty
- os: linux
addons:
apt:
sources:
- ubuntu-toolchain-r-test
- llvm-toolchain-precise-3.8
- george-edison55-precise-backports
packages:
- clang-3.8
- cmake-data
- cmake
- libglib2.0-0
env:
- MATRIX_EVAL="CC=clang-3.8 && CXX=clang++-3.8"
# works on Trusty
- os: linux
addons:
apt:
sources:
- llvm-toolchain-trusty-3.9
- george-edison55-precise-backports
packages:
- clang-3.9
- cmake-data
- cmake
- libglib2.0-0
env:
- MATRIX_EVAL="CC=clang-3.9 && CXX=clang++-3.9"
# works on Trusty
- os: linux
addons:
apt:
sources:
- llvm-toolchain-trusty-4.0
- george-edison55-precise-backports
packages:
- clang-4.0
- cmake-data
- cmake
- libglib2.0-0
env:
- MATRIX_EVAL="CC=clang-4.0 && CXX=clang++-4.0"
## works on Trusty
#- os: linux
#addons:
#apt:
#sources:
#- llvm-toolchain-trusty
#- george-edison55-precise-backports
#packages:
#- clang-5.0
#- cmake-data
#- cmake
#- libglib2.0-0
#env:
#- MATRIX_EVAL="CC=clang-5.0 && CXX=clang++-5.0"
#- os: osx
#osx_image: xcode8
#env:
#- MATRIX_EVAL="CC=gcc-4.9 && CXX=g++-4.9"
#- os: osx
#osx_image: xcode8
#env:
#- MATRIX_EVAL="brew install gcc5 && CC=gcc-5 && CXX=g++-5"
#- os: osx
#osx_image: xcode8
#env:
#- MATRIX_EVAL="brew install gcc && CC=gcc-6 && CXX=g++-6"
before_install:
- eval "${MATRIX_EVAL}"
before_script:
- cd fluidsynth
- mkdir build && cd build
script:
- cmake ${CMAKE_FLAGS} "-DCMAKE_BUILD_TYPE=RelWithDebInfo" ..
- make -j4

View file

@ -1,3 +1,5 @@
[![Build Status](https://travis-ci.org/FluidSynth/fluidsynth.svg?branch=master)](https://travis-ci.org/FluidSynth/fluidsynth)
Introduction
============

View file

@ -482,7 +482,6 @@ The following table provides details on all the settings used by the synthesizer
<li>xg: CC32 becomes the bank number, CC0 is ignored.</li>
<li>mma: bank is calculated as CC0*128+CC32.</li>
</ul>
Note: Drum channels are initialized to \c DRUM_INST_BANK (==128). Since 1.1.7 mma mode also allows the bank of drum channels to be changed the same way as for melodic channels.
</td>
</tr>

View file

@ -108,7 +108,7 @@ enum fluid_midi_channel_type
CHANNEL_TYPE_DRUM = 1
};
int fluid_synth_set_channel_type(fluid_synth_t* synth, int chan, int type);
FLUIDSYNTH_API int fluid_synth_set_channel_type(fluid_synth_t* synth, int chan, int type);
/* Low level access */

View file

@ -1046,7 +1046,7 @@ fluid_defpreset_import_sfont(fluid_defpreset_t* preset,
if (FLUID_STRLEN(sfpreset->name) > 0) {
FLUID_STRCPY(preset->name, sfpreset->name);
} else {
FLUID_SPRINTF(preset->name, "Bank%d,Preset%d", sfpreset->bank, sfpreset->prenum);
FLUID_SPRINTF(preset->name, "Bank%d,Pre%d", sfpreset->bank, sfpreset->prenum);
}
preset->bank = sfpreset->bank;
preset->num = sfpreset->prenum;
@ -2303,7 +2303,7 @@ process_info (int size, SFData * sf, FILE * fd)
else if (sf->version.major > 2) {
FLUID_LOG (FLUID_WARN,
_("Sound font version is %d.%d which is newer than"
" what this version of FLUID Synth was designed for (v2.0x)"),
" what this version of fluidsynth was designed for (v2.0x)"),
sf->version.major,
sf->version.minor);
return (FAIL);
@ -3302,43 +3302,69 @@ fixup_sample (SFData * sf)
{
fluid_list_t *p;
SFSample *sam;
int invalid_loops=FALSE;
int invalid_loopstart;
int invalid_loopend, loopend_end_mismatch;
p = sf->sample;
while (p)
{
sam = (SFSample *) (p->data);
/* The SoundFont 2.4 spec defines the loop start index as the first sample point of the loop */
invalid_loopstart = (sam->loopstart < sam->start) || (sam->loopstart >= sam->loopend);
/* while loop end is the first point AFTER the last sample of the loop.
* this is as it should be. however we cannot be sure whether any of sam.loopend or sam.end
* is correct. hours of thinking through this have concluded, that it would be best practice
* to mangle with loops as little as necessary by only making sure loopend is within
* sdtachunk_size. incorrect soundfont shall preferably fail loudly. */
invalid_loopend = (sam->loopend > sdtachunk_size) || (sam->loopstart >= sam->loopend);
loopend_end_mismatch = (sam->loopend > sam->end);
/* if sample is not a ROM sample and end is over the sample data chunk
or sam start is greater than 4 less than the end (at least 4 samples) */
if ((!(sam->sampletype & FLUID_SAMPLETYPE_ROM)
&& sam->end > sdtachunk_size) || sam->start > (sam->end - 4))
{
FLUID_LOG (FLUID_WARN, _("Sample '%s' start/end file positions are invalid,"
" disabling and will not be saved"), sam->name);
if ((!(sam->sampletype & FLUID_SAMPLETYPE_ROM) && sam->end > sdtachunk_size)
|| sam->start > (sam->end - 4))
{
FLUID_LOG (FLUID_WARN, _("Sample '%s' start/end file positions are invalid,"
" disabling and will not be saved"), sam->name);
/* disable sample by setting all sample markers to 0 */
sam->start = sam->end = sam->loopstart = sam->loopend = 0;
/* disable sample by setting all sample markers to 0 */
sam->start = sam->end = sam->loopstart = sam->loopend = 0;
return (OK);
}
return (OK);
}
/* compressed samples get fixed up after decompression */
else if (sam->sampletype & FLUID_SAMPLETYPE_OGG_VORBIS)
{}
else if (sam->loopend > sam->end || sam->loopstart >= sam->loopend
|| sam->loopstart <= sam->start)
{ /* loop is fowled?? (cluck cluck :) */
/* can pad loop by 8 samples and ensure at least 4 for loop (2*8+4) */
if ((sam->end - sam->start) >= 20)
{}
else if (invalid_loopstart || invalid_loopend || loopend_end_mismatch)
{
sam->loopstart = sam->start + 8;
sam->loopend = sam->end - 8;
/* loop is fowled?? (cluck cluck :) */
invalid_loops |= TRUE;
/* force incorrect loop points into the sample range, ignore padding */
if(invalid_loopstart)
{
FLUID_LOG (FLUID_DBG, _("Sample '%s' has unusable loop start '%d',"
" setting to sample start at '%d'+1"), sam->name, sam->loopstart, sam->start);
sam->loopstart = sam->start + 1;
}
if(invalid_loopend)
{
FLUID_LOG (FLUID_DBG, _("Sample '%s' has unusable loop stop '%d',"
" setting to sample stop at '%d'-1"), sam->name, sam->loopend, sam->end);
/* since sam->end points after valid sample data, set loopend to last sample available */
sam->loopend = sam->end - 1;
}
if(loopend_end_mismatch)
{
FLUID_LOG (FLUID_DBG, _("Sample '%s' has invalid loop stop '%d',"
" sample stop at '%d', using it anyway"), sam->name, sam->loopend, sam->end);
}
}
else
{ /* loop is fowled, sample is tiny (can't pad 8 samples) */
sam->loopstart = sam->start + 1;
sam->loopend = sam->end - 1;
}
}
/* convert sample end, loopstart, loopend to offsets from sam->start */
sam->end -= sam->start + 1; /* marks last sample, contrary to SF spec. */
@ -3348,6 +3374,11 @@ fixup_sample (SFData * sf)
p = fluid_list_next (p);
}
if(invalid_loops)
{
FLUID_LOG (FLUID_WARN, _("Found samples with invalid loops, audible glitches possible."));
}
return (OK);
}

View file

@ -435,7 +435,7 @@ struct _fluid_defpreset_t
{
fluid_defpreset_t* next;
fluid_defsfont_t* sfont; /* the soundfont this preset belongs to */
char name[22]; /* the name of the preset */
char name[21]; /* the name of the preset */
unsigned int bank; /* the bank number */
unsigned int num; /* the preset number */
fluid_preset_zone_t* global_zone; /* the global zone of the preset */

View file

@ -264,7 +264,7 @@ fluid_channel_set_bank_msb(fluid_channel_t* chan, int bankmsb)
}
if (style == FLUID_BANK_STYLE_GM ||
(chan->channel_type == CHANNEL_TYPE_DRUM && style != FLUID_BANK_STYLE_MMA))
chan->channel_type == CHANNEL_TYPE_DRUM)
return; /* ignored */
oldval = chan->sfont_bank_prog;

View file

@ -1137,9 +1137,9 @@ fluid_synth_cc_LOCAL (fluid_synth_t* synth, int channum, int num)
fluid_synth_update_pitch_wheel_sens_LOCAL (synth, channum); /* Update bend range */
/* FIXME - Handle LSB? (Fine bend range in cents) */
break;
case RPN_CHANNEL_FINE_TUNE: /* Fine tune is 14 bit over 1 semitone (+/- 50 cents, 8192 = center) */
case RPN_CHANNEL_FINE_TUNE: /* Fine tune is 14 bit over +/-1 semitone (+/- 100 cents, 8192 = center) */
fluid_synth_set_gen_LOCAL (synth, channum, GEN_FINETUNE,
(data - 8192) / 8192.0 * 50.0, FALSE);
(data - 8192) / 8192.0 * 100.0, FALSE);
break;
case RPN_CHANNEL_COARSE_TUNE: /* Coarse tune is 7 bit and in semitones (64 is center) */
fluid_synth_set_gen_LOCAL (synth, channum, GEN_COARSETUNE,
@ -1945,8 +1945,7 @@ fluid_synth_program_change(fluid_synth_t* synth, int chan, int prognum)
FLUID_API_ENTRY_CHAN(FLUID_FAILED);
channel = synth->channel[chan];
if (channel->channel_type == CHANNEL_TYPE_DRUM &&
synth->bank_select != FLUID_BANK_STYLE_MMA)
if (channel->channel_type == CHANNEL_TYPE_DRUM)
banknum = DRUM_INST_BANK;
else
fluid_channel_get_sfont_bank_prog(channel, NULL, &banknum, NULL);