Skip to content

Commit

Permalink
Fixed inadvertent MIDI modification altering mutes, add saving::none …
Browse files Browse the repository at this point in the history
…value.
  • Loading branch information
ahlstromcj committed Oct 6, 2023
1 parent bf23545 commit 7c86081
Show file tree
Hide file tree
Showing 15 changed files with 186 additions and 157 deletions.
Binary file modified doc/latex/images/tabs/mutes/mute-master-tab-3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
29 changes: 18 additions & 11 deletions doc/latex/tex/mutes.tex
Original file line number Diff line number Diff line change
Expand Up @@ -205,18 +205,25 @@ \section{Seq66 Mutes Master}
The only time one would want to read/write the mute-groups to a 'mutes' file
is when one uses standard song sets for all of one's songs.

\itempar{Trigger Mode}{mutes!trigger mode}
\itempar{Triggers}{mutes!trigger mode}
When activated, this option will enable the \textbf{Mute-Groups} buttons,
deactive them all, and turn them into standard push-buttons. When clicked
the mute-group will be actived during playback.

\itempar{Clear}{mutes!clear all mutes}
This button will clear every mute group. Use it carefully!

\itempar{Fill}{mutes!fill mutes}
This button will create a set of empty mute-groups.
Currently, this alters the current MIDI tune, forcing a prompt to save.
This action creates 32 empty mute-groups.
deactive them all, and turn them into standard push-buttons.
in the \textbf{Triggers} mode, when a button is clicked,
the corresponding mute-group will be actived.

\itempar{Zeroes}{mutes!clear all mutes}
This button will clear every mute group, and replace them with
mute-group where all patterns are off (zeroed).

There are a couple of small buttons.
The first is reserved for expansion.
The second displays an asterisk when a mute-group or mute setting
has changed.

% \itempar{Fill}{mutes!fill mutes}
% This button will create a set of empty mute-groups.
% Currently, this alters the current MIDI tune, forcing a prompt to save.
% This action creates 32 empty mute-groups.
% If a single mute-group is created in the patterns panel,
% then only that mute-group is saved.

Expand Down
6 changes: 3 additions & 3 deletions libseq66/include/play/mutegroups.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
* \library seq66 application
* \author Chris Ahlstrom
* \date 2018-12-01
* \updates 2023-10-03
* \updates 2023-10-06
* \license GNU GPLv2 or above
*
* This module is meant to support the main mute groups and the mute groups
Expand Down Expand Up @@ -105,6 +105,7 @@ class mutegroups final : public basesettings

enum class saving
{
none, /**< Added for version 0.99.10 to fix a bug. */
mutes, /**< Save mute groups to the 'mutes' file. */
midi, /**< Write mute groups only to the MIDI file. */
both, /**< Write the mute groups to both files. */
Expand Down Expand Up @@ -533,8 +534,6 @@ class mutegroups final : public basesettings
mute_group(gmute).name(n);
}

bool clear ();

container & list ()
{
return m_container;
Expand Down Expand Up @@ -681,6 +680,7 @@ class mutegroups final : public basesettings

private:

bool clear ();
void create_empty_mutes ();
bool add (mutegroup::number gmute, const mutegroup & m);

Expand Down
13 changes: 1 addition & 12 deletions libseq66/include/play/performer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1168,18 +1168,12 @@ class performer
* This setter only sets the modified-flag to true.
* The setter that can falsify it, unmodify(), is private. No one
* but performer and its friends should falsify this flag.
* For issue #90, do not use the (silly) m_needs_update flag.
*/

void modify ()
{
m_is_modified = true;

/*
* Relating to the fix for issue #90, do not use this (silly) flag.
* Needs testing!
*
* m_needs_update = true;
*/
}

/*
Expand Down Expand Up @@ -3426,11 +3420,6 @@ class performer
* Start of mute-groups accessors.
*/

bool mutegroup_reset ()
{
return mutes().reset_defaults();
}

int mutegroup_count () const
{
return mutes().count();
Expand Down
6 changes: 5 additions & 1 deletion libseq66/include/play/setmapper.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
* \library seq66 application
* \author Chris Ahlstrom
* \date 2019-02-12
* \updates 2023-04-24
* \updates 2023-10-05
* \license GNU GPLv2 or above
*
* This module also creates a small structure for managing sequence
Expand Down Expand Up @@ -904,7 +904,11 @@ class setmapper
bool toggle_mutes (mutegroup::number gmute);
bool toggle_active_mutes (mutegroup::number gmute);
bool learn_mutes (bool learnmode, mutegroup::number gmute);

#if 0 // unused
bool clear_mutes ();
#endif

void select_and_mute_group (mutegroup::number group);
void mute_group_tracks ();
void sequence_playing_change
Expand Down
6 changes: 3 additions & 3 deletions libseq66/src/cfg/mutegroupsfile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
* \library seq66 application
* \author Seq24 team; modifications by Chris Ahlstrom
* \date 2018-11-13
* \updates 2022-06-28
* \updates 2023-10-05
* \license GNU GPLv2 or above
*
*/
Expand Down Expand Up @@ -182,7 +182,7 @@ mutegroupsfile::parse_stream (std::ifstream & file)
if (! load)
internal_mutegroups() = mutes();

mutestorage.clear();
(void) mutestorage.reset_defaults();
if (good)
{
bool ok = true;
Expand Down Expand Up @@ -221,7 +221,7 @@ mutegroupsfile::parse_stream (std::ifstream & file)
}
else
{
mutestorage.reset_defaults();
(void) mutestorage.reset_defaults();
mutestorage.loaded_from_mutes(false);
}
return result;
Expand Down
6 changes: 4 additions & 2 deletions libseq66/src/ctrl/midicontrolout.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,16 @@
* Automation buttons (uiactions): This is a TO DO, to follow these rules.
*
* panic: Always red.
* stop: Always red. Making it green when pressed is confusing.
* stop: Always red. Making it green when pressed is
* confusing.
* pause: Red normally, amber when paused.
* play: Red normally, green when playing.
* toggle_mutes: Always green (for "enabled")?
* song_record: Green when on, red when off.
* slot_shift: Green when on, red when done.
* free: Unused, always red.
* queue: Always green? Can we do momentary coloring via thread?
* queue: Always green? Can we do momentary coloring via
* thread?
* oneshot: Ditto?
* replace: Need to investigate.
* snapshot: Green while held, red while released.
Expand Down
4 changes: 2 additions & 2 deletions libseq66/src/midi/midifile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
* \library seq66 application
* \author Chris Ahlstrom
* \date 2015-07-24
* \updates 2023-09-18
* \updates 2023-10-05
* \license GNU GPLv2 or above
*
* For a quick guide to the MIDI format, see, for example:
Expand Down Expand Up @@ -2048,7 +2048,7 @@ midifile::parse_c_mutegroups (performer & p)
if (len > 0)
{
bool legacyformat = len == c_legacy_mute_group;
p.mutes().clear(); /* makes it empty */
(void) p.mutes().reset_defaults(); /* makes it empty */
if (legacyformat)
{
result = parse_c_mutegroups_legacy(p, groupcount, groupsize);
Expand Down
15 changes: 12 additions & 3 deletions libseq66/src/play/mutegroups.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
* \library seq66 application
* \author Chris Ahlstrom
* \date 2018-12-01
* \updates 2023-10-04
* \updates 2023-10-06
* \license GNU GPLv2 or above
*
* The mutegroups object contains the mute-group data read from a mute-group
Expand Down Expand Up @@ -573,7 +573,7 @@ mutegroups::group_learn (bool flag)
bool
mutegroups::group_save (saving mgh)
{
if (mgh >= saving::mutes && mgh < saving::max)
if (mgh < saving::max)
{
m_group_save = mgh;
return true;
Expand All @@ -592,6 +592,12 @@ mutegroups::group_save (const std::string & v)
return false;
}

/**
* The performer class uses this. It can "modify()". We want to
* return true if we affect MIDI. That is, with a status of saving::both
* or saving::midi.
*/

bool
mutegroups::group_save (bool midi, bool mutes)
{
Expand All @@ -602,7 +608,10 @@ mutegroups::group_save (bool midi, bool mutes)
else if (midi)
return group_save(saving::midi);
else
{
(void) group_save(saving::none); /* new for version 0.99.10 */
return false;
}
}

/**
Expand Down Expand Up @@ -718,7 +727,7 @@ mutegroups::clear ()
bool
mutegroups::reset_defaults ()
{
clear(); /* remove all mutegroups */
(void) clear();
return true;
}

Expand Down
16 changes: 9 additions & 7 deletions libseq66/src/play/performer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
* \library seq66 application
* \author Chris Ahlstrom and others
* \date 2018-11-12
* \updates 2023-09-30
* \updates 2023-10-06
* \license GNU GPLv2 or above
*
* Also read the comments in the Seq64 version of this module, perform.
Expand Down Expand Up @@ -7334,8 +7334,8 @@ performer::group_name (mutegroup::number gmute, const std::string & n)
* Commented out to avoid load issues. The on-change callback should
* cause a modify().
*
if (result)
modify();
* if (result)
* modify();
*/

return result;
Expand All @@ -7354,10 +7354,12 @@ bool
performer::group_save (bool bmidi, bool bmutes)
{
bool result = bmidi != group_save_to_midi();
mutes().group_save(bmidi, bmutes);
if (result)
modify();

{
bool changed = mutes().group_save(bmidi, bmutes);
if (changed && bmidi)
modify();
}
return result;
}

Expand Down Expand Up @@ -7447,7 +7449,7 @@ performer::clear_mutes ()
bool
performer::clear_mute_groups ()
{
bool result = mutes().clear(); /* clears mutes container */
bool result = mutes().reset_defaults();
if (result)
modify();

Expand Down
6 changes: 5 additions & 1 deletion libseq66/src/play/setmapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
* \library seq66 application
* \author Chris Ahlstrom
* \date 2019-02-12
* \updates 2023-04-13
* \updates 2023-10-05
* \license GNU GPLv2 or above
*
* Implements three classes: seq, screenset, and setmapper, which replace a
Expand Down Expand Up @@ -1202,6 +1202,8 @@ setmapper::select_and_mute_group (mutegroup::number group)
mute_group_tracks();
}

#if 0 // unused

/**
* Clears all the group-mute items, whether they came from the "rc" file
* or from the most recently-loaded Seq66 MIDI file.
Expand All @@ -1225,6 +1227,8 @@ setmapper::clear_mutes ()
return result;
}

#endif

std::string
setmapper::name (screenset::number setno) const
{
Expand Down
Loading

0 comments on commit 7c86081

Please sign in to comment.