Commit graph

23 commits

Author SHA1 Message Date
Eric Fontaine
4d0b8c4211 help allow build without PortMidi 2018-04-03 09:51:59 +02: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
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
Bernhard Landauer
2c96e2f9d5 mark fallthrough instances as intentional
- quieting warnings of newer compilers
2017-06-15 15:27:25 +02:00
Eric Fontaine
4e4693003e fix #5163 Add PortAudio Midi Output 2017-05-26 08:36:37 -04:00
Peter Jonas
8c74814da3
Option to enable PortMidi on Linux 2016-08-08 23:25:42 +01:00
lasconic
bc9bc93c46 use local encoding for Portaudio device and api 2016-03-16 17:35:34 +04:00
AntonioBL
2ea45c807e fix crash if Portaudio is not properly initialized 2015-05-19 18:33:02 +02:00
ws
5730db9c06 NewWizard: remove explicit template/from scratch choice 2014-12-11 12:01:51 +01:00
Igevorse
15ba0b184a Jack hot plug fix, restrict user to uncheck all drivers, fix remembering connections 2014-07-30 22:40:39 +05:00
Igevorse
8c946f7e66 Bug fixes 2014-07-16 23:03:30 +05:00
Igevorse
701d86d3a8 JACK restoring audio connections 2014-07-13 20:13:19 +05:00
Igevorse
ef0d9c451d JACK driver: change preferences without unload 2014-07-13 20:13:19 +05:00
Joachim Schmitz
e8e0478b53 convert unnamed enum into global enum class Transport 2014-06-24 14:47:07 +02:00
lasconic
94bf79a669 fix #24794: Crash on startup if previous PortAudio output device not available 2014-02-22 12:24:20 +01:00
lasconic
86d1c18ce9 change suggestedLateny back to 100ms on windows 2013-10-01 21:56:38 +02:00
lasconic
fcce1dbff0 change PortAudio suggested latency to 20ms, potentially fix #21897, no harm on windows 2013-09-21 14:34:44 +02:00
ws
0e1987c1ba retrieve and use actual sr from pa driver 2013-06-27 12:07:21 +02:00
ws
013b2db9dd use device default sample rate in pa driver 2013-06-27 11:57:43 +02:00
ws
9ebabcc2e5 add namespace Ms 2013-05-13 19:43:59 +02:00
ws
110fb17ef2 fix small gui bugs for synthesizer 2013-04-03 20:20:36 +02:00
ws
8ffe7531d9 add new sfz sample player: zerberus 2013-03-26 20:00:19 +01:00
Werner Schweer
412ca45401 Initial commit 2012-05-26 14:49:10 +02:00