Commit graph

26 commits

Author SHA1 Message Date
ws
ec3be9a99a Replacd integer midi tick values by fractions.
- tick names a position on the time axis
- tick is always a Fraction()
- only Measure() and Segment() (and Tuplet?) have a tick value
- tick() for an generic element return only a sensible value if isMeasure() or isSegment() or isSegment(parent())

- "ticks" names a duration stored in a Fraction()
- the tick value for an Segment is relative to its measure

- rename "duration" to "ticks"
- rename afrac() to tick()
- rename rfrac() to rtick()
- rename some variables, changing "fraction" into "tick"
  (example: actualFraction() into actualTicks())

- Lyrics ticks are written as Fraction, on read if xmlreader sees a "/" it reads a fraction
  else midi ticks for backwards compatibility
2019-02-18 11:46:05 +01: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
Joachim Schmitz
18b86cf23a Fix #271103: Add 7-string Guitar and Cavaquinho (4-string Guitar)
also tablature for both, the former needs a 7-string tablature type, so
appended that, also inserted missing 5-string types to the StaffTypes
enum and appended a 8-string tablature, as GuitarPro has that too.

See also https://musescore.org/en/node/271096

Don't show presets for more strings than the instrument is set up for

esp. counting only fretted strings, i.e. non-open strings
2018-06-24 10:32:44 +02:00
ws
33d1cd7fb4 rename StyleIdx -> Sid and P_ID -> Pid 2018-03-27 15:36:00 +02:00
Werner Schweer
f26ebf688f fix #268110 2018-01-04 12:41:42 +01:00
Werner Schweer
1943bd1ff1 replace most static_cast in libmscore 2017-12-20 16:49:58 +01:00
Werner Schweer
867f2582f6 move Segment::Type into SegmentType 2017-03-08 13:12:26 +01:00
Werner Schweer
1d4c6b2f21 move Element::type() to ScoreElement 2017-01-18 14:16:33 +01:00
Werner Schweer
c5f46bb208 rename Xml() -> XmlWriter() 2016-11-19 11:51:21 +01:00
Marc Sabatella
f144d7c978 fix #9352: instrument change transposition 2015-09-25 08:35:55 -06:00
ws
8282094dd6 code cleanups; rename instr() to instrument() 2015-03-26 13:11:46 +01:00
Maurizio M. Gavioli
3f483c8ed3 Rebase and fix GTP import tests.
Note: GTP import seems to have some issues; tests have been 'fixed' to accommodate the new support for transposing TAB's, but the results are possibly wrong anyway, if the underlying import is not correct. I'll file appropriate issues in the issue tracker.
2015-02-18 11:31:03 +01:00
Maurizio M. Gavioli
23f3348405 TAB: Make tabs aware of staff transpositions.
Feature has been requested and discussed at length in the forum thread: http://musescore.org/en/node/31016

To implement this, the fret-to-pitch relation has been made dependent of the staff, as each staff may have an individual transposition value in addition to the string data. And -- in addition -- on tick, in preparation of dealing with ottavas and capos.
2015-02-18 10:11:58 +01:00
Marc Sabatella
4c1ad5246a fix #47621: crash on copy tab note to non-existing string 2015-02-14 11:58:49 -07:00
Maurizio M. Gavioli
8b47515343 Fix #32396 : Bugs in TAB note inputs.
Several inconsistencies accumulated in TAB note input during recent updates.

The main point is that currently the pitch, fret and string of a note -- if all are known -- must be changed in a single step; otherwise, the fretting algorithm intervening after each step notices they are inconsistent and refrets (potentially) the whole chord, which leads to loosing the fretting entered by the user.

A specific `undoChangeFretting()` function has been added, to be used with TAB's instead of `undoChangePitch()` when all the new fretting data (pitch, fret and string) are known in advance.

Also, the fretting algorithm has been changed to be more conservative, i.e. to keep the current note fretting (potentially entered by the user) as much as possible.
2014-09-07 10:59:12 +02:00
Maurizio M. Gavioli
5b9d34943c Improve TAB fretting algorithm.
An attempt to improve the current implementation to better deal with the case in forum post #29876 and possibly even with less specialized cases.

Changes:
- when a note changes of pitch, its fretting is discarded before any fretting
- each note not yet fretted is sorted for fretting as belonging to the string most convenient for it. This affects the order in which notes are evaluated during fretting.

Note: the algorithm can still be fooled by casual note entry and by changing note pitches by large intervals (octave), but it seems anyway better than before.
2014-08-18 14:03:09 +02:00
Maurizio M. Gavioli
99c8dc0de8 Open strings in StringData.
Allows to mark strings as open (non-fretted).
Defaults to fretted, keeping backward-compatibility with existing scores.
Adds an attribute `open="1"` in score (and instruments.xml) string data (defaults to "0").

Benefits:
- allows future support (also in TAB's) for string instruments with non-fretted strings (mainly but, I think, not only the lute family)
- gives correct fretting for non-fretted strings
- instrument range can more easily and automatically linked to actual string tuning
- as this will be eventually needed for better TAB support, the score reading/writing will be already able to manage it.
2014-08-15 02:15:24 +02:00
Joachim Schmitz
75623c53dc move ElementType to Element::Type
needed to make it available to the Plugin framework
2014-06-26 11:57:35 +02:00
ws
e8be73f41b fix transposition when changing instrument 2014-06-04 10:40:26 +02:00
Joachim Schmitz
7f1b612615 convert enum P_ID into enum class 2014-05-26 18:18:01 +02:00
Joachim Schmitz
931e837c5e convert enum ElementType into enum class 2014-05-23 10:35:27 +02:00
Maurizio M. Gavioli
1e047709cb In staff type dlg box, only displays staff types from groups relevant to staff instrument.
Also removes the default guitar string data, which does not make sense for non-stringed instruments (stringed instruments are assumed to have proper string data in instruments.xml anyway)
2014-05-16 12:25:01 +02:00
ws
436c116b01 add default string table 2014-05-13 17:15:43 +02:00
ws
d3a66ab1ba refactoring StaffType 2014-04-30 13:39:16 +02:00
Joachim Schmitz
adbd92d812 fix warnings due to -Wunused-function 2014-01-19 15:41:06 +01:00
Maurizio M. Gavioli
2acd24ba1c Finish renaming of Tablature class to StringData
Renames also the files hoding the class itself:
- libmscore/tablature.cpp => stringdata.cpp
- libmscore/tablature.h => stringdata.h

No actual change in the code, only updated references to stringdata.h in #include's.
2013-12-05 21:37:28 +01:00
Renamed from libmscore/tablature.cpp (Browse further)