Skip to content

Commit

Permalink
Merge pull request #172 from cecilios/changes
Browse files Browse the repository at this point in the history
Visual effects for score playback
  • Loading branch information
cecilios authored Jun 29, 2018
2 parents 57fe916 + 69661e7 commit 3f0e7ea
Show file tree
Hide file tree
Showing 65 changed files with 3,855 additions and 1,474 deletions.
35 changes: 32 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# Lomse Library. Log of changes


[Since last version] 0.24.0
[Since last version] 0.25.0
=============================

##### BACKWARDS INCOMPATIBLE CHANGES WITH 0.24.0
##### BACKWARDS INCOMPATIBLE CHANGES WITH 0.25.0

- None.

Expand All @@ -14,6 +14,34 @@



Version [0.25.0] (29/Jun/2018)
=============================

##### BACKWARDS INCOMPATIBLE CHANGES WITH 0.24.0

* Until now all visual tracking effects were named score highlight effects due to the fact that highlighting notes/rests was the first programmed visual effect. But, currently, Lomse supports more visual tracking effects and, for coherence and to use more descriptive names, all references to score highlight effects have been changed, when appropriate, to 'visual tracking' effects. In particular, the more important changes that will affect your code are:
- Class `EventScoreHighlight` changed to `EventVisualTracking`.
- Type `SpEventcoreHighlight` changed to `SpEventVisualTracking`.
- Enum item `k_highlight_event` changed to `k_tracking_event`.
- Method `Interactor::on_visual_highlight` changed to `Interactor::on_visual_tracking`.
- Enum item `k_end_of_higlight` changed to `k_end_of_visual_tracking`.
- Enum item `k_advance_tempo_line` changed to `k_move_tempo_line`.
- Enum item `k_highlight_event` changed to `k_tracking_event`.


##### COMPATIBLE CHANGES

* Added method `Interactor::set_visual_tracking_mode(int mode)` for selecting the visual trackin effect to use. A new enum `EVisualTrackingMode` defines valid modes.
* Changes to allow extension '.musicxml' for uncompressed MusicXML files.
* Added some initial code to deal with `global` elements in experimental MNX importer.
* Changes to allow compilers other than GCC and MSVC.
* Several fixes to make Lomse buildable in macOS with clang compiler.
* Several changes for trying to reduce or eliminate dependencies from other libraries. In particular:
- PR #144 Replaced boost::format with standard functions
- PR #146 Replaced boost::variant with union class



Version [0.24.0] (4/Mar/2018)
=============================

Expand Down Expand Up @@ -628,7 +656,8 @@ Version 0.10.b1
- Initial public release, used in Phonascus 5.0 beta for Linux.


[Since last version]: https://github.com/lenmus/lomse/compare/0.24.0...HEAD
[Since last version]: https://github.com/lenmus/lomse/compare/0.25.0...HEAD
[0.25.0]: https://github.com/lenmus/lomse/compare/0.24.0...0.25.0
[0.24.0]: https://github.com/lenmus/lomse/compare/0.23.0...0.24.0
[0.23.0]: https://github.com/lenmus/lomse/compare/0.22.0...0.23.0
[0.22.0]: https://github.com/lenmus/lomse/compare/0.21.0...0.22.0
Expand Down
7 changes: 5 additions & 2 deletions add-sources.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ set(GRAPHIC_MODEL_FILES
${LOMSE_SRC_DIR}/graphic_model/lomse_shapes.cpp
${LOMSE_SRC_DIR}/graphic_model/lomse_shapes_storage.cpp
${LOMSE_SRC_DIR}/graphic_model/lomse_sizers.cpp
${LOMSE_SRC_DIR}/graphic_model/lomse_tempo_line.cpp
${LOMSE_SRC_DIR}/graphic_model/lomse_time_grid.cpp
${LOMSE_SRC_DIR}/graphic_model/lomse_timegrid_table.cpp
${LOMSE_SRC_DIR}/graphic_model/lomse_visual_effect.cpp
Expand Down Expand Up @@ -131,7 +132,11 @@ set(INTERNAL_MODEL_FILES
${LOMSE_SRC_DIR}/internal_model/lomse_im_figured_bass.cpp
${LOMSE_SRC_DIR}/internal_model/lomse_im_note.cpp
${LOMSE_SRC_DIR}/internal_model/lomse_internal_model.cpp
${LOMSE_SRC_DIR}/internal_model/lomse_measures_table.cpp
${LOMSE_SRC_DIR}/internal_model/lomse_model_builder.cpp
${LOMSE_SRC_DIR}/internal_model/lomse_score_algorithms.cpp
${LOMSE_SRC_DIR}/internal_model/lomse_score_utilities.cpp
${LOMSE_SRC_DIR}/internal_model/lomse_staffobjs_table.cpp
)

set(MODULE_FILES
Expand Down Expand Up @@ -161,9 +166,7 @@ set(PARSER_FILES
${LOMSE_SRC_DIR}/parser/lomse_ldp_elements.cpp
${LOMSE_SRC_DIR}/parser/lomse_ldp_factory.cpp
${LOMSE_SRC_DIR}/parser/lomse_linker.cpp
${LOMSE_SRC_DIR}/parser/lomse_model_builder.cpp
${LOMSE_SRC_DIR}/parser/lomse_reader.cpp
${LOMSE_SRC_DIR}/parser/lomse_staffobjs_table.cpp
${LOMSE_SRC_DIR}/parser/lomse_tokenizer.cpp
${LOMSE_SRC_DIR}/parser/lomse_xml_parser.cpp

Expand Down
2 changes: 1 addition & 1 deletion build-version.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#-------------------------------------------------------------------------------------

set( LOMSE_VERSION_MAJOR 0 )
set( LOMSE_VERSION_MINOR 23 )
set( LOMSE_VERSION_MINOR 25 )
set( LOMSE_VERSION_PATCH 0 )

# build version string for installer name
Expand Down
4 changes: 2 additions & 2 deletions debian/changelog
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
lomse (0.23.0) stable; urgency=low
lomse (0.25.0) stable; urgency=low

* Latest release

-- Cecilio Salmeron <[email protected]> Sat, 24 Feb 2018 17:45:01 +0100
-- Cecilio Salmeron <[email protected]> Thu, 28 Jun 2018 19:18:39 +0200

3 changes: 2 additions & 1 deletion docs/api/doxyfile
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

DOXYFILE_ENCODING = UTF-8
PROJECT_NAME = "Lomse library. API documentation"
PROJECT_NUMBER = 0.24.0
PROJECT_NUMBER = 0.25.0
PROJECT_BRIEF =
PROJECT_LOGO = ./images/logo_100x195.png
OUTPUT_DIRECTORY = ../../../api-docs
Expand Down Expand Up @@ -650,6 +650,7 @@ INPUT = mainpages \
../../include/lomse_pitch.h \
../../include/lomse_pixel_formats.h \
../../include/lomse_presenter.h \
../../include/lomse_score_player.h \
../../include/lomse_view.h \
examples \
groups
Expand Down
30 changes: 18 additions & 12 deletions docs/api/mainpages/sound-generation.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ From Lomse internal point of view, playing back an score involves, basically, tw
- The sound model is then traversed and three kind of events are generated:
-# Sound events, for generating sounds.
-# Highlight events, for adding visual tracking effects to the displayed score. For instance, highlighting notes as they are being played or displaying a vertical line at current beat position.
-# Visual tracking events, for adding visual tracking effects to the displayed score during playback. For instance, highlighting notes as they are being played or displaying a vertical line at current beat position.
-# End of playback events, oriented to facilitate GUI controls synchronization and housekeeping.
It is responsibility of your application to handle these events and do whatever is necessary. But for visual effects, lomse provides an implementation for generating them so, if desired, your application can delegate in lomse for this task.
Expand All @@ -32,7 +32,7 @@ For playing back an score your application has to:
See @ref how-to-play-score.
- Deal with @a highlight events. All @a highlight events will be sent to the standard callback for events. For processing them, your application could delegate in Lomse by invoking method Interactor::on_highlight_event(). See @ref handling-highlight-events.
- Deal with @a visual @a tracking events. All @a visual @a tracking events will be sent to the standard callback for events. For processing them, your application could delegate in Lomse by invoking method Interactor::on_visual_tracking_event(). See @ref handling-visual-tracking-events.
- Optionally, you should create a class derived from "PlayerGui". This will allow you to link your application playback controls to lomse, so that lomse can collect current settings when needed. See @ref implementing-player-gui.
Expand Down Expand Up @@ -72,7 +72,7 @@ This can be done only once if your application saves the ScorePlayer instance in
Once you have the ScorePlayer instance, playback is just loading the score to play (by invoking ScorePlayer::load_score() method) and invoking the appropriate methods, such as ScorePlayer::play() or ScorePlayer::stop() or ScorePlayer::pause();
The only tricky issue, when starting to learn how to use lomse, is that method ScorePlayer::load_score() requires a pointer to the score to play. How to do get this pointer depends on your application, but a simple way of doing it is by using the Document methods for traversing the document and accessing its components. One of these methods is Document::get_content_item() that takes as argument the index to the desired content item. For instance:
The only tricky issue, when starting to learn how to use lomse, is that method ScorePlayer::load_score() requires a pointer to the score to play. How to get this pointer depends on your application, but a simple way of doing it is by using the Document methods for traversing the document and accessing its components. One of these methods is Document::get_content_item() that takes as argument the index to the desired content item. For instance:
@code
Expand Down Expand Up @@ -102,30 +102,36 @@ The only tricky issue, when starting to learn how to use lomse, is that method S
//settings for playback. Probably you would get settings from GUI controls
bool fVisualTracking = true; //generate visual tracking effects
bool fCountOff = false //no count off before start play
long nMM = 60; //beats per minute
Interactor* pInteractor = ... //get the interactor for this document
//select desired visual tracking effect
pInteractor->set_visual_tracking_mode(k_tracking_tempo_line);
//start playback
pPlayer->play(fVisualTracking, fCountOff, k_play_normal_instrument, nMM, pInteractor);
pPlayer->play(fVisualTracking, nMM, pInteractor);
}
@endcode
@todo Check example code: pPlayer->play(fVisualTracking, fCountOff, k_play_normal_instrument, nMM, pInteractor);
@section handling-highlight-events Handling highlight events
@section handling-visual-tracking-events Handling visual tracking events
Apart from generating sound events, lomse also generates @a highlight events, that is, events to add visual tracking effects, synchronized with sound, on the displayed score.
Apart from generating sound events, lomse also generates @a visual @a tracking events, that is, events to add visual tracking effects, synchronized with sound, on the displayed score.
For generating visual effects you have two options, either do it yourself by modifying the lomse graphical model as desired or, simpler, delegate in lomse for generating standard visual effects. Lomse offers two type of visual effects:
- Coloring notes as they are being played. This is currently fully operational.
- Displaying a vertical colored tempo line across the system, positioned at current beat. This is not yet finished and, therefore, is not yet available.
- Highlighting notes as they are being played.
- Displaying a vertical colored tempo line across the system, positioned at current beat.
The type of visual tracking event to generate is controlled by method Interactor::set_visual_tracking_mode(). Valid values for visual tracking effects are defined in enum EVisualTrackingMode. By default, if method Interactor::set_visual_tracking_mode() is not invoked, Lomse will highlight_notes and rests as they are played back. Several visual effects can be used simultaneously by combining values with the OR ('|') operator. For example:
@code
spInteractor->set_visual_tracking_mode(k_tracking_tempo_line | k_tracking_highlight_notes);
@endcode
@a Highlight events are sent to your application via the event handling callback, that you set up at Lomse initialization. When handling a @a highlight event, if your application would like to delegate in Lomse for visual effects generation, the only thing to do is to pass the event to the interactor:
@a Visual @a tracking events are sent to your application via the event handling callback, that you set up at Lomse initialization. When handling a @a visual @a tracking event, if your application would like to delegate in Lomse for visual effects generation, the only thing to do is to pass the event to the interactor:
@code
pInteractor->handle_event(pEvent);
Expand Down
6 changes: 3 additions & 3 deletions docs/html/tutorial-3-wx.htm
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<html>
<!-- $Updated: 2018/01/11 -->
<!-- $Updated: 2018/06/28 -->

<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
Expand Down Expand Up @@ -845,7 +845,7 @@ <h2><a name="mycanvas">10. Other modifications in MyCanvas</h2></a>
</p>
<pre class="code">
Document* pDoc = m_pPresenter->get_document_raw_ptr();
ImoScore* pScore = dynamic_cast<ImoScore*>( pDoc->get_imodoc()->get_content_item(0) );
ImoScore* pScore = dynamic_cast<ImoScore*>( pDoc->get_im_root()->get_content_item(0) );
</pre>

<p>
Expand All @@ -863,7 +863,7 @@ <h2><a name="mycanvas">10. Other modifications in MyCanvas</h2></a>
//the score to play is the first element in the document.
//In a real application, as the document could contain texts, images and many
//scores, you shoud get the pointer to the score to play in a suitable way.
ImoScore* pScore = static_cast<ImoScore*>( pDoc->get_imodoc()->get_content_item(0) );
ImoScore* pScore = static_cast<ImoScore*>( pDoc->get_im_root()->get_content_item(0) );

if (pScore)
{
Expand Down
Loading

0 comments on commit 3f0e7ea

Please sign in to comment.