Commit graph

97 commits

Author SHA1 Message Date
Joachim Schmitz
6523abc0b6 fix compiler warnings with MinGW 64bit 2018-09-27 17:38:20 +02:00
Joachim Schmitz
b27817fe19 fix more MSVC warnings
* The one C4100
* The one C4189
* The two C4457
* The two C4701
* The 475 C4267, changing to size_t were easily possible, casting to
int elsewhere
* Fix GCC warnings reg. wrong printf format for a size_t, reg. unused
variables and reg. ambigous else branch, seen on Travis CI
2018-09-11 16:56:50 +02:00
anatoly-os
ab9bf85bb5 fix #275544: popping noise
Use the copy of the `activeVoices` array for proper output audio processing.
2018-09-05 15:27:31 +02:00
anatoly-os
9443b37e10 Optimize fluid code
Improve calculation performance in Fluid::Voice::effects by avoiding excessive calls to std::vector::operator[]
Remove not used Tuning class from Fluid sources
Add fluid headers to CMakeLists
2018-09-05 15:27:27 +02:00
anatoly-os
f50c7778ab fix loading soundfonts to synth
Fix mutex locking
Fix progress bar drawing
2018-09-04 21:52:05 +02:00
anatoly-os
c5feea62ca lock synth mutex when closing MuseScore to prevent writing samples to deleted data structures
Optimize using raw pointer arrays - replace them with std::vector.
2018-08-30 20:44:07 +02:00
alexandr
df114f189c Compile under MSVC: this commit caontais all changes to run MSVC build
1) fix some bugs which appear in runtime:  replace QString::tostdstring() to Foo.toUtf8().constData().

2) Enable start center online community. To use it you need download webengine in your QT lib. see instruction https://musescore.org/en/handbook/developers-handbook/compilation/compile-instructions-windows-visual-studio-2017-wip

3) update install steps. Add additional dlls for webEngine. Add copying dlls and musescore.exe to /msvc.install/bin folder. Run project will work with the "$(ProjectDir)\..\..\msvc.install\bin\MuseScore.exe" specified in Debugging field in mscore project

4) Moving AppVeyor from MinGW to MSVC. Exclude ALL MSVC project from INSTALL project. Exclude ALL from PACKAGE. Remove migw-cmake in script build, add .bat instead. Remove xcopy from 7z archive step

5) Fix warning : Warning C4703 potentially uninitialized local pointer variable '' used; Warning C4456 declaration of '' hides previous local declaration; Warning C4458 declaration of '' hides class member

6) Change path to 11 version wix toolset which created .msi installer package
2018-08-04 12:17:31 +02:00
Andres Fernandez de Prado
33dff96a20 This commit contains changes required for MuseScore to compile under MSVC with no warnings.
This commit contains changes required for MuseScore to compile under MSVC with no warnings.

MuseScore is being compiled with the /W4 setting (warning level 4), which is similar to -wall -wextra on clang. This generates lots of warnings on MSVC, mainly for non-standard constructs and for constructs which might be bugs or might lead to bugs.

Most warnings are in the following categories:
- Name hiding: a variable hides a variable with the same name on a larger scope (or a field, or a function parameter). This can easily lead to bugs, and it is a best practice to avoid hiding variable names (see recommendation ES.12 in the C++ Core Guidelines by Stroustrop & Sutter (http://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#Res-reuse : ES.12: Do not reuse names in nested scopes)
- Narrowing conversion: a numeric conversion results in loss of significant digits (for example, double -> float). The general recommendation is to use a cast to indicate this is designed behaviour.
- Unreachable code: in several instances, there is unreachable code. The unreachable code is commented out.
- (Potentially) uninitialized local variable. Just initialized the vars.
- foreach(,) -> for(:): this does not generate a warning per-se (only a few of these generate warnings due to name hiding), but changed in keeping with "MuseScore Coding Rules" (https://musescore.org/en/handbook/musescore-coding-rules#Loops), which tells explicitly "Use C++11's "for" instead of Qt's "foreach":" ... "If you happen to be fixing some code and see a "foreach", please change that loop into a "for"."

Most changes are in the categories indicated above. The next listing shows detailed changes for files which are *not* of the aforementioned types.

- all.h: Disable warning C4127 (conditional expression is constant - generated in Qt header file qvector.h)
- awl/aslider.h: unreachable code.
- awl/knob.cpp: name hiding
- awl/mslider.cpp: name hiding
- awl/slider.cpp: name hiding
- bww2mxml/parser.cpp: name hiding
- effects/compressor/compressor.cpp: narrowing conversion
- effects/zita1/zitagui.cpp: name hiding
- fluid/fluid.cpp: foreach replacement. Name hiding.
- fluid/mod.cpp: name hiding.
- fluid/sfont.cpp: foreach replacement. Name hiding. Initialize vars.
- fluid/voice.cpp: Name hiding.
- libmscore/accidental.cpp: Name hiding.
- libmscore/ambitus.cpp: Initialize vars.
- libmscore/barline.cpp: Name hiding. Unreachable code.
- libmscore/beam.cpp: Name hiding.
- libmscore/chordrest.cpp: Unreachable code.
- libmscore/scorefile.cpp: Name hiding.
- manual/genManual.cpp: Name hiding. foreach replacement.
- midi/midifile.cpp: Name hiding. Unreachable code.
- omr/importpdf.cpp: Name hiding. foreach replacement.
- omr/omr.cpp: Name hiding. foreach replacement.
- omr/omrpage.cpp: Name hiding. foreach replacement.
- omr/omrview.cpp: Name hiding. foreach replacement.
- synthesizer/event.cpp: Unreachable code.
- zerberus\channel.cpp: Narrowing conversion.
- zerberus\instrument.cpp: Name hiding.
- zerberus\sfz.cpp: Name hiding.
- zerberus\voice.h: Suppress warning C4201: "nonstandard extension used: nameless struct/union"
- zerberus\zerberus.cpp: Name hiding. Unreferenced parameter.
- zerberus\zerberusgui.cpp: Name hiding.
2018-08-03 09:15:42 +02:00
Andres Fernandez de Prado
3acc363498 Solved all compilation errors on MSVC
This commit contains changes required for MuseScore to compile under MSVC with no errors.

There are several general categories of problems that resulted in errors with the compilation. Main issues:
- Variable Length Arrays (VLA). This is a non-standard extension to C++, supported by clang toolchains, but not by MSVC. The initial workaround is to use std::vector<> instead of VLAs, eventually (if needed) with the original variable pointing to the beginning of the allocated array. More efficient alternatives are possible if profiling shows any code using VLAs to be timing-critical.
- Floating-point constants not suffixed with "f" are doubles by default; in some instances, this leads to narrowing conversion errors (in other instances, just warnings).
- MSVC does not support "or"/"and"/"not" in lieu of "||"/"&&"/"!". Changed unconditionally to use standard C++ symbols.
- MSVC does not support the "__builtin_unreachable()" compiler hint. A similar, albeit not exactly equal, alternative is "__assume(0)", which is MSVC-specific.
- MSVC does not support ranges in case statements. Replaced with list of cases instead of range (non-conditionally)

Detailed changes, with per-file comments:

- all.h: opt-in to deprecated features, include <io.h> and <process.h> instead of POSIX <unistd.h>, undefine "STRING_NONE" and "small", which Microsoft defines as macros, which result in compilation errors.
- effects/compressor/zita.cpp: eliminated narrowing conversion error by appending "f" to float constants.
- fluid/voice.cpp: appended "f" to float constants to eliminate narrowing conversion errors/warnings
- libmscore/beam.cpp: conditionally replaced VLA
- libmscore/edit.cpp: conditionally replaced VLA
- libmscore/element.cpp: appended "f" to float constant
- libmscore/fret.cpp: changed or -> ||
- libmscore/layout.cpp: conditionally replaced VLA
- libmscore/mscore.cpp: conditionally replaced "__builtin_unreachable()" with "__assume(0)" for MSVC
- libmscore/scorefile.coo: use correct char representation conversion for MSVC
- libmscore/stringdata.cpp: conditionally replaced VLA
- libmscore/system.cpp: conditionally replaced VLA
- libmscroe/text.cpp: replaced range in case statement.
- manual/genManual.cpp: use getopt() replacement.
- midi/midifile.cpp: conditionally replaced VLA. This does not use the default replacement.
- mscore/bb.cpp: replaced range in case statement.
- mscore/capella.cpp: conditionally replaced VLA. Changed and -> &&
- mscore/driver:cpp: preclude errors due to macro redefinitions.
- mscore/editstyle.cpp: conditionally replaced "__builtin_unreachable()" with "__assume(0)" for MSVC
- mscore/importgtp-gp6.cpp: conditionally replaced VLA.
- mscore/instrwidget.cpp: conditionally replaced VLA.
- mscore/jackaudio.cpp: conditionally replaced VLA. Preclude errors due to macro redefinitions.
- mscore/jackweakapi.cpp: Preclude errors due to macro redefinitions. Replacement for __atribute__((constructor)) through static object construction for MSVC. Force use of LoadLibraryA instead of LoadLibrary.
- mscore/mididriver.h: Changed not -> !
- mscore/musescore.cpp: Changed not -> !. Conditionally replaced VLA.
- mscore/resourceManager.cpp: conditionally replaced VLA.
- mscore/timeline.cpp: conditionally replaced VLA.
- omr/omrpage.cpp: conditionally replaced VLA.
- synthesizer/msynthesizer.cpp: replaced UNIX sleep(1) method with MSVC Sleep(1000) (equivalent, but in ms instead of seconds)
- synthesizer/msynthsizer.h: appended "f" to float constant
- thirdparty/poppler/config.h: set defines for MSVC to preclude the use of inexistent libraries.
- thirdparty/poppler/poppler/poppler-config.h: set defines for MSVC to preclude the use of inexistent libraries. Eliminated #defines for fmin and fmax which where causing problems.
- thirdparty/poppler/poppler/PSOutputDev.cc: added #include <algorithm> for  std::min() and std::max(). Note this is required per-C++ standard.
- thirdparty/portmidi/pm_win/pmwinmm.c: undefined UNICODE to use char-based library functions.
- thirdparty/qzip/qzip.cpp: changed or -> ||
- thirdparty/rtf2html/rtf_keyword.h: file format changed from Apple to UNIX, as MSVC does not supported the former.

(NOT error related, just improvement on previous commit; manual/getopt/README.md: added link to source article)
2018-08-03 09:15:42 +02:00
Andres Fernandez de Prado
188386ba2e This commit contains all the changes to the CMake build system required to generate a valid Visual Studio 2017 solution and projects for MuseScore.
In detail, changes are as follows:
- Changed .gitignore to ignore VS-specific files and directories.
- VS uses a global settings file for the CMake build process: CMakeSettings.json. This is a text file, which is conceptually equivalent to the Makefile used to invoke CMake through Make. This file might need to be changed on an individual user basis, if dependencies are not installed in default paths.
- New cmake macros to copy files in build\CopyFilesMacros.cmake. The code is from https://cmake.org/pipermail/cmake/2009-March/027892.html
- Pre-compiled headers: Visual Studio requires to create pre-compiled headers per-project (a general per-solution PCH file, although possible, is extremely problematic and not recommended). Therefore, the  new macro vstudio_pch in CreatePrecompiledHeader.cmake was created to add the pre-compiled header creation step to an existing target (similar to what is done for XCode). The existing macro precompiled_header was modified to set the values for a group of variables. As part of this, the empty file all.cpp was added to the root of the source tree, as VS requires a source file to create pre-compiled headers (the header file alone can not be compiled).
- all.h is not copied to binary dir for MSVC, as I could determine no need to do this. Because of this, and the differences in PCH handling, the pseudo-targets mops1 and mops2 are not created for MSVC.
- Revised all steps conditional on toolchain, and added MSVC paths as needed. In many instances, the MSVC path is the same as the MINGW path, but not always.
- The manual (genManual) target used the getopt() functionality defined in POSIX libraries, which is not available on Windows. An LGPL'd port of getopt() for Windows was added in manual\getopt. The original source is in GitHub: nanoporetech/getopt-win32, based on a CodeProject article: https://www.codeproject.com/KB/cpp/getopt4win.aspx?msg=3987371. The corresponding CMakeLists.txt file was modified to include this files when compiling with MSVC.
- Changes in CMakeLists.txt files to create valid MSVC targets. The changes, always conditional on the MSVC toolchain, consist of:
     x Setting target properties for MSVC
     x Using all.h in source dir
     x Adding pre-compiled headers to target
     x Removing dependency from mops1 and mops2

Notes:
- The INSTALL target has NOT BEEN UPDATED for MSVC.
2018-08-03 09:15:42 +02:00
anatoly-os
bcf64ccefd
Merge pull request #3789 from handrok/Fluid-and-zerberus-option
fix #167161 Make Fluid and Zerberus GUI the same
2018-07-16 12:37:05 +02:00
lasconic
94d5442272 fix #273032: Provide an easy way to install soundfont, templates, etc.
Add workspace support in extension.
Use constants instead of magic strings for extension directories
2018-07-09 18:59:08 +02:00
lasconic
f71c339094 fix #273032: Provide an easy way to install soundfont, templates and instruments.xml
Introduce extensions files aka .muxt. These files are archives with additional data to extend MuseScore with soundfonts, templates, custom workspaces, etc.

Update qzip to fix bug with symlink.
Add extensions management to resource manager.
2018-07-09 18:59:08 +02:00
alexandr
923b8dbf7d fix #167161 Make Fluid and Zerberus options the same
Make unification for Zerberus and Fluid GUI
Make logic for 'up' and 'down' arrows in Zerberus

Logic of adding SF in fluid are the same as zerberus
Create Progress Bar in Fluid
2018-07-06 15:53:35 +02:00
anatoly-os
6c54a9653e Fix start/end loop opcodes size int-> long long
According to sfz documentation, offset, loop start/end are [0, 4Gb] in size
2018-06-01 10:30:24 +02:00
lasconic
b92a6e0525 fix crash reported in #270748 2018-03-30 22:53:51 +02:00
anatoly-os
0aa2511f3f fix #270803 messed playback for specific sounds
The reason was not updated minimal frames count and desync between different voices in playback as a result.
2018-03-29 13:48:27 +02:00
lasconic
5f100af6c5 fix #269937: implement proper preset fallback when using instruments on banks > 0 2018-03-10 10:44:01 +01:00
anatoly-os
cae320ecb0 Implemented caching signals to prevent not generated sound in case of framesBuff from PortAudio is too small
If we don't specify framesPerBuffer parameter in Pa_OpenStream, PortAudio will choose optimal value for particular callback call. It can vary from run to run even on the same hardware depending on available system resources.

While generating signal, interpolating and applying effects, we assume that framesBuffer contains more than minimal number of frames to generate envelope. BTW, it is not true. If framesBuffer is smaller, algos cannot generate correct sound and just keep silence.

I've implemented cache which keeps generated values from dsp algorithms and applies it step-by-step to buffer values from pa_callback. Cache is filled each time algos generate dsp values. If buffer frames are not enough to generate envelope, algos generate values for further calls and keep it in cache.

Required number of frames has been selected as a number of frames for one phase multiplying by number of phases. Actually, smaller numbers of this value generates good results, but it is better to keep it as max as possible to provide perfect sound.

Code changes:
 - Replaced C-like variables with std containers for comfortable debugging and better usage
 - Extracted similar code calls to separate methods
 - Implemented cache as std constainers, so also implemented convertion from std::vector to C-like float* to fill the pa buffer
 - Changed the logic of applying effects and interpolation, it is now possible to use them separately. This is required to fill effects several times after calculating the interpolation is finished.

Removed std::vector<float> to keep cache - process buff values on the fly. Performance is better, but still glitches on https://musescore.com/user/166080/scores/175421. BuffSize = 64 with my wired headphones.
2018-03-07 16:51:59 +02:00
lasconic
3517971a21 fix #87066: Incorrect Pitch When Alternate Values Used for 'Scale Tune' 2018-02-21 21:05:34 +01:00
lasconic
ebd3eaee88 fix #268991: Regression: Fluid: Envelopes are not behaving correctly. Workaround: skip mod envelope delay and attack phases if they are each less than 100 samples long 2018-02-21 12:18:27 +01:00
luz.paz
443be63167 Misc. typos
Found via `codespell -i 3 -w --skip="./thirdparty,./share/locale,./fonts" -I ../musescore-whitelist.txt`
Whitelist:
```
clas
nd
ot
pres
strack
tage
te
```
2018-02-13 12:06:05 -05:00
Nicolas Froment
191c1e7dc3
Merge pull request #3454 from lasconic/fix-269044
fix #269044: fluid: default velocity-to-filter cutoff modulator should be disabled
2018-02-08 17:21:06 +01:00
Dag Henning Liodden Sørbø
2b6cb8b432 Change to new preferences model
The old Preferences struct holding all preferences are removed in favor of a
new Preferences class which acts as a proxy for QSettings. The settings stored
in QSettings are accessed directly through access methods like getBool(key),
getInt(key), etc. and changed with setPreference(key, value).

Since we are using QSettings directly the preferences are stored automatically
without the need for a custom write() and read() method like before.

The preferences.cpp/.h and prefdialog.cpp/h are refactored to have fewer
responsibilities than before. The Preferences class are all about storing and
retrieving preferences - it should not contain any code to handle any other
aspect of MuseScore.

Testing:
The Preferences class can be used in tests. All preferences are initialized with
default values in mtest. If a test requires that a preference has a specific
value it can be changed using setPreference() for that single test. In the tests
the preferences are stored in memory only.

The Preference class is supposed to be used as a singleton. In preferences.h an
'extern Preferences preferences' is set and it is defined in preferences.cpp. All
files which includes preferences.h have access to the 'preferences' singleton
and should use this to get and set preferences.
2018-02-08 16:59:10 +01:00
lasconic
bbd814cc44 fix #269044: fluid: default velocity-to-filter cutoff modulator should be disabled 2018-02-08 16:21:44 +01:00
lasconic
ca181481c9 improve some strings based on translator feedback 2018-01-23 10:37:07 +01:00
Joachim Schmitz
5e116fe595 Fixing issues found in static code analysis by PVS-Studion
See https://musescore.org/en/node/255156
2017-12-20 16:26:23 +01:00
lasconic
acc6fadf8c fix #197131: Regression: Bass synthesizer and bass guitar create popping sounds 2017-07-21 18:22:39 +02:00
Eric Fontaine
4e4693003e fix #5163 Add PortAudio Midi Output 2017-05-26 08:36:37 -04:00
lasconic
fce99944db Don't look for soundfonts in hidden directories 2017-03-15 15:07:01 +01:00
Johannes Wegener
65caf3cd22 fix #120061: fix clicking sound in playback due to filter init 2016-08-03 10:57:18 +02:00
werner
d4cc062763 updates for hairpins, dynamics 2016-08-02 17:06:35 +02:00
Johannes Wegener
65fad51543 fix #119731: fluidsynth optimizations 2016-07-28 13:48:05 +02:00
Johannes Wegener
494011bb76 fix #119446: calculate envelope for first point of new envelope right, fix divison by zero in amp increment calculation 2016-07-26 18:19:24 +02:00
Johannes Wegener
d3871a403b fix #119016: fluidsynth distorted because of wrong amp_increment 2016-07-22 11:21:33 +02:00
Nicolas Froment
a9188d13d3 Merge pull request #2638 from hpfmn/fix-113416
Fix #113416 - Fluidsynth sample based volume
2016-07-20 19:50:50 +02:00
Johannes Wegener
5e1baf1dfc fix #112556 fix #113416 Sample based Volume for envelopes and modlfo 2016-07-19 12:37:12 +02:00
Fyrult
0810805707 fix memory leaks 2016-07-19 01:00:57 -04:00
Joachim Schmitz
cc19cb4bc3 use icons from resource in ui files rather than use setIcon()
so the dialogs look closer to reality in QtCreator, also reduce strings
to translate
2016-06-20 15:48:53 +02:00
Joachim Schmitz
ad860c000e cleanup reg. notr="true" in some .ui files 2016-06-17 15:09:50 +02:00
Eric Fontaine
ff749fd292 fix #99236 remove mscoreGlobalShare/sound from soundfont path
Preferences::sfPath is renamed "mySoundfontsPath", which adheres to same naming scheme for myPluginsPath and myTemplatesPath, and now only stores the user-specified soundfont folders (no longer stores mscoreGlobalShare/sound).  Any synthesizers loading soundfonts must make sure to look in mscoreGLobalShare/sound in addition to mySoundfontsPath.  Removing mscoreGlobalShare/sound from the stored path fixes a bug with portable AppImages, which use a different temporary directory for mscoreGlobalShare on every execution.
2016-02-25 05:28:43 -05:00
lasconic
cd6dd3edd7 fix a couple of warnings on Mac OSX 2016-02-15 12:33:54 +04:00
lasconic
59b72e646f fix #85901: Replace Up/Down buttons by arrows 2015-11-03 23:05:59 +01:00
ws
fe29c614de make synthcontrol and mixer persistent 2015-09-08 17:14:02 +02:00
lasconic
25fcf3f27b fix #72091: sf2 volume discrepancies caused by attenuation handling, thanks @jimbo1qaz for the investigation in PR #2152 2015-08-05 21:34:59 +02:00
igevorse
78ad4bbc71 Export bends to midi 2015-06-03 20:34:09 +05:00
igevorse
ed6fe07d61 Feature: bend playback 2015-06-03 20:34:09 +05:00
lasconic
9bd96cbbd5 fix #57976: MuseScore doesn't support soundfonts with 24 bit samples 2015-04-28 14:42:49 +02:00
lasconic
10a03445c0 implement fallback to default configuration in export audio if one of the soundfont cannot be loading 2015-04-15 19:19:16 +02:00
lasconic
c73eb49581 ignore absolute path when loading soundfont. Fix #55416 Fix #21592 Fix #34286 2015-04-11 17:34:22 +02:00