Skip to content

Commit

Permalink
Working out config-file issues with normal and NSM usage.
Browse files Browse the repository at this point in the history
  • Loading branch information
ahlstromcj committed May 11, 2023
1 parent cfd8420 commit efc8db2
Show file tree
Hide file tree
Showing 12 changed files with 124 additions and 94 deletions.
20 changes: 15 additions & 5 deletions INSTALL
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
INSTALL for Seq66 v. 0.99.5 and above
Chris Ahlstrom
2015-09-10 to 2023-05-06
2015-09-10 to 2023-05-10

Getting Seq66 requires building the code or going to "sequencer64-packages/seq66"
on GitHub to get an installation package. The bootstrap setup is primarily
Expand Down Expand Up @@ -518,10 +518,20 @@ DEPENDENCIES:

Raspberry Pi:

A few notes while trying to get Seq66 built on a Raspberry Pi 3 Model
B+. The Raspian on this board, installed via NOOB, could ultimately not
load some Qt dependences. Ended up installing OpenSUSE, and installed
Qt Creator to save time.
A few notes while trying to get Seq66 built on a Raspberry Pi 3 Model
B+. The Raspian on this board, installed via NOOB, could ultimately
not load some Qt dependences. Ended up installing OpenSUSE, and
installed Qt Creator to save time.

Windows Installer:

One can build the Windows installer under Linux (see the "nsis"
sub-directory). To build it on Windows, install the NSIS 3
program, available at

https://sourceforge.net/projects/nsis/files/NSIS%203/3.08/nsis-3.08-setup.exe/download

Be sure to add the location of makensis.exe to the Windows PATH.

Runtime:

Expand Down
4 changes: 2 additions & 2 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ dnl \file configure.ac
dnl \library Seq66
dnl \author Chris Ahlstrom
dnl \date 2018-11-09
dnl \update 2023-04-30
dnl \update 2023-05-11
dnl \version $Revision$
dnl \license $XPC_SUITE_GPL_LICENSE$
dnl
Expand Down Expand Up @@ -480,7 +480,7 @@ dnl automatically for us.

AH_TOP(

#define VERSION_DATE_SHORT "2023-04-30"
#define VERSION_DATE_SHORT "2023-05-11"
#define API_VERSION "0.99"
#define VERSION "0.99.5"

Expand Down
2 changes: 1 addition & 1 deletion include/config.h.in
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* include/config.h.in. Generated from configure.ac by autoheader. */

#define VERSION_DATE_SHORT "2023-04-30"
#define VERSION_DATE_SHORT "2023-05-11"
#define API_VERSION "0.99"
#define VERSION "0.99.5"

Expand Down
3 changes: 2 additions & 1 deletion libseq66/include/cfg/rcsettings.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,8 @@ class rcsettings final : public basesettings

/**
* An optional appendage to the base configuration directory. It is
* appended to the default session/configuration path. It is set only
* appended to the default session/configuration path. The setter,
* config_subdirectory, is meant to work only once. It is set only
* by the --home option. The boolean makes sure the appending is done only
* once (due to processing command-line options multiple times, :-(.)
*/
Expand Down
4 changes: 2 additions & 2 deletions libseq66/include/sessions/smanager.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
* \library seq66 application
* \author Chris Ahlstrom
* \date 2020-05-30
* \updates 2023-04-17
* \updates 2023-05-11
* \license GNU GPLv2 or above
*
* This class provides a process for starting, running, restarting, and
Expand Down Expand Up @@ -182,7 +182,7 @@ class smanager
const std::string & path,
std::string & outcfgpath,
std::string & outmidipath,
const std::string & midisubdir = ""
const std::string & midisubdir = "midi"
);
bool import_into_session
(
Expand Down
2 changes: 1 addition & 1 deletion libseq66/src/cfg/cmdlineopts.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ static const std::string s_help_1b =
" -B, --buss b Covers the 'bus' versus 'buss' confusion.\n"
" -l, --client-name label Use this name instead of 'seq66'. Overridden by a\n"
" session manager.\n"
" -q, --ppqn qn Specify default PPQN to replace 192. The MIDI file\n"
" -q, --ppqn qn Specify default PPQN to replace 192. The MIDI file\n"
" can specify its own PPQN.\n"
" -p, --priority Run high priority, FIFO scheduler (needs root).\n"
" -P, --pass-sysex Passes incoming SysEx messages to all outputs.\n"
Expand Down
13 changes: 6 additions & 7 deletions libseq66/src/cfg/midicontrolfile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
* \library seq66 application
* \author Chris Ahlstrom
* \date 2018-11-13
* \updates 2023-04-17
* \updates 2023-05-11
* \license GNU GPLv2 or above
*
* This class handles the 'ctrl' file.
Expand Down Expand Up @@ -422,8 +422,11 @@ midicontrolfile::parse ()
result = false;
}
else
{
result = parse_stream(file);

if (! result)
file_error("Read failed", name());
}
return result;
}

Expand Down Expand Up @@ -1206,11 +1209,7 @@ read_midi_control_file
)
{
midicontrolfile mcf(fname, rcs);
bool result = mcf.parse();
if (! result)
file_error("Read failed", fname);

return result;
return mcf.parse();
}

/**
Expand Down
110 changes: 67 additions & 43 deletions libseq66/src/cfg/rcsettings.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 2015-09-22
* \updates 2023-05-10
* \updates 2023-05-11
* \license GNU GPLv2 or above
*
* Note that this module also sets the legacy global variables, so that
Expand Down Expand Up @@ -86,7 +86,7 @@ rcsettings::rcsettings () :
m_with_jack_master (false),
m_with_jack_master_cond (false),
#if defined SEQ66_RTMIDI_SUPPORT
m_with_jack_midi (true),
m_with_jack_midi (true), /* hmmmmmmmmmm */
#else
m_with_jack_midi (false),
#endif
Expand Down Expand Up @@ -144,6 +144,7 @@ rcsettings::rcsettings () :
m_playlist_filename += ".playlist";
m_notemap_filename += ".drums";
m_palette_filename += ".palette";
set_config_files(seq_config_name()); /* ca 2023-05-11 */
}

/**
Expand All @@ -162,6 +163,15 @@ rcsettings::rcsettings () :
void
rcsettings::set_defaults ()
{
/*
* basesettings
* m_clocks
* m_inputs
* m_keycontainer
* m_midi_control_in
* m_midi_control_out
*/

m_metro_settings.set_defaults();
m_mute_group_save = mutegroups::saving::midi;
m_drop_empty_in_controls = false;
Expand All @@ -182,7 +192,7 @@ rcsettings::set_defaults ()
m_with_jack_master = false;
m_with_jack_master_cond = false;
#if defined SEQ66_RTMIDI_SUPPORT
m_with_jack_midi = true;
m_with_jack_midi = true; /* hmmmmmmmmmm */
#else
m_with_jack_midi = false;
#endif
Expand All @@ -207,9 +217,8 @@ rcsettings::set_defaults ()
m_last_used_dir.clear(); /* double_quotes() */
m_session_directory = user_session(seq_client_name());
m_config_subdirectory_set = false;
m_config_subdirectory.clear(),
m_config_subdirectory.clear();
m_config_filename = seq_config_name();
m_config_filename += ".rc";
m_full_config_directory.clear();
m_user_file_active = true;
m_user_filename = seq_config_name();
Expand Down Expand Up @@ -475,16 +484,15 @@ rcsettings::home_config_directory () const
{
std::string home = default_session_path();
std::string result = home;
if (! home.empty())
if (home.empty())
{
if (! m_config_subdirectory.empty())
{
if (! m_config_subdirectory_set)
{
result = filename_concatenate(result, m_config_subdirectory);
m_config_subdirectory_set = true;
}
}
std::string temp = "Cannot find HOME!";
result = set_error_message(temp);
}
else
{
if (m_config_subdirectory_set)
result = pathname_concatenate(result, m_config_subdirectory);

bool ok = make_directory_path(result);
if (ok)
Expand All @@ -501,15 +509,10 @@ rcsettings::home_config_directory () const
result.clear();
}
}
else
{
std::string temp = "Cannot find HOME!";
result = set_error_message(temp);
}
return result;
}
else
return os_normalize_path(m_full_config_directory);
return normalize_path(m_full_config_directory); /* ca 2023-05-11 */
}

/**
Expand Down Expand Up @@ -1056,14 +1059,26 @@ rcsettings::session_directory (const std::string & value)
*
* \param value
* The value to use to make the setting. This should be a relative path.
* If empty (should be a rare use case), then the config subdirectory
* is cleared.
*/

void
rcsettings::config_subdirectory (const std::string & value)
{
bool can_do = ! value.empty() && m_config_subdirectory.empty();
if (can_do)
m_config_subdirectory = value;
if (value.empty())
{
m_config_subdirectory_set = false;
m_config_subdirectory.clear();
}
else
{
if (! m_config_subdirectory_set)
{
m_config_subdirectory_set = true;
m_config_subdirectory = value;
}
}
}

/**
Expand All @@ -1088,9 +1103,13 @@ rcsettings::set_config_directory (const std::string & value)
/**
* \setter m_full_config_directory
*
* Provides an alternate value to be returned by the
* home_config_directory() function. Please note that all configuration
* locates are relative to home.
* Provides an alternate value to be returned by the
* home_config_directory() function. Please note that all configuration
* locates are relative to home.
*
* This causes double concatenation. But we need to call it just
* once in the case where NSM has changed the default configuration
* directory.
*
* \param value
* Provides the directory name, which should be an actual full path.
Expand All @@ -1099,30 +1118,30 @@ rcsettings::set_config_directory (const std::string & value)
void
rcsettings::full_config_directory (const::std::string & value)
{
std::string tv = value;
if (! m_config_subdirectory.empty())
if (! value.empty())
{
if (! m_config_subdirectory_set)
std::string tv = value;
if (m_config_subdirectory_set) /* see the banner note */
{
tv = pathname_concatenate(tv, m_config_subdirectory);
m_config_subdirectory_set = true;
m_config_subdirectory_set = false;
m_full_config_directory = normalize_path(tv, true, true);
}
}
m_full_config_directory = normalize_path(tv, true, true);

std::string homedir = rc().home_config_directory();
if (make_directory_path(homedir)) // REDUNDANT
{
/*
* This setting will convert the relative session directory
* to a full path.
*/
std::string homedir = rc().home_config_directory();
if (make_directory_path(homedir)) // REDUNDANT
{
/*
* This setting will convert the relative session directory
* to a full path.
*/

file_message("Config directory", homedir);
session_directory(homedir);
file_message("Config directory", homedir);
session_directory(homedir);
}
else
file_error("Could not create", homedir);
}
else
file_error("Could not create", homedir);
}

/**
Expand All @@ -1131,9 +1150,14 @@ rcsettings::full_config_directory (const::std::string & value)
* Implements the --config option to change both configuration files
* ("rc" and "usr") with one option.
*
* What about the "ctrl", "playlist", "mutes", "notemap", and "palette"
* files? They are defined in the "rc" file.
*
* \param value
* The value to use to make the setting, if the string is not empty.
* If the value has an extension, it is stripped first.
*
* TODO: use value = file_extension_set(value);
*/

void
Expand Down
3 changes: 1 addition & 2 deletions libseq66/src/cfg/usrfile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -900,8 +900,7 @@ usrfile::write ()
"# (Non/New Session Manager), or 'jack'. 'url' can be set to the value set by\n"
"# nsmd when run by command-line. Set 'url' if running nsmd stand-alone; use\n"
"# the --osc-port number. Seq66 detects if started in NSM. The visibility flag\n"
"# is used only by NSM to restore visibility. 'copy-config' indicates if the\n"
"# existing home configuration is copied to a new NSM session.\n"
"# is used only by NSM to restore visibility.\n"
"\n[user-session]\n\n"
;
write_string(file, "session", usr().session_manager_name());
Expand Down
6 changes: 3 additions & 3 deletions libseq66/src/sessions/clinsmanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ clinsmanager::create_session (int argc, char * argv [])
{
std::string nsmfile = "dummy/file";
std::string nsmext = nsm::default_ext();
rc().config_subdirectory("config"); /* NEW 2023-03-31 */
rc().config_subdirectory("config"); /* appended to NSM path */
m_nsm_client.reset(create_nsmclient(*this, url, nsmfile, nsmext));
bool result = bool(m_nsm_client);
if (result)
Expand All @@ -174,8 +174,8 @@ clinsmanager::create_session (int argc, char * argv [])
* Use the same name as provided when opening the JACK client.
*/

std::string appname = seq_client_name(); /* "seq66" */
std::string exename = seq_arg_0(); /* "qseq66" */
std::string appname = seq_client_name(); /* "seq66", -l labl */
std::string exename = seq_arg_0(); /* "qseq66", etc. */
result = m_nsm_client->announce(appname, exename, capabilities());
if (result)
{
Expand Down
Loading

0 comments on commit efc8db2

Please sign in to comment.