Skip to content

Commit

Permalink
Safety check-in for issue #131 fix.
Browse files Browse the repository at this point in the history
  • Loading branch information
ahlstromcj committed Nov 6, 2024
1 parent d7faf81 commit 7d36fc8
Show file tree
Hide file tree
Showing 9 changed files with 67 additions and 50 deletions.
6 changes: 1 addition & 5 deletions Seq66qt5/seq66qt5.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -103,11 +103,7 @@ main (int argc, char * argv [])
#endif

QApplication app(argc, argv); /* main application object */
#if defined USE_NEW_CODE
seq66::smanager::app_info(argv[0], true);
#else
seq66::set_app_path(argv[0]); /* log for future usage */
#endif
seq66::smanager::app_info(argv[0]); /* instead of set_app_path() */

#if defined USE_RING_BUFFER_TEST && defined SEQ66_PLATFORM_DEBUG
if (! seq66::run_ring_test())
Expand Down
4 changes: 2 additions & 2 deletions libseq66/include/seq66_features.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-11-24
* \updates 2023-11-05
* \updates 2023-11-06
* \license GNU GPLv2 or above
*
* Provides some useful functions for displaying information about the
Expand All @@ -52,7 +52,7 @@
* *undefined*.
*/

#define SEQ66_IMMEDIATE_LOG_FILE
#undef SEQ66_IMMEDIATE_LOG_FILE

/*
* This is the main namespace of Seq66. Do not attempt to
Expand Down
6 changes: 4 additions & 2 deletions libseq66/include/sessions/clinsmanager.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
* \library clinsmanager application
* \author Chris Ahlstrom
* \date 2020-08-31
* \updates 2023-03-28
* \updates 2024-11-06
* \license GNU GPLv2 or above
*
* Provides a base class that can be used to manage the command-line version
Expand Down Expand Up @@ -102,7 +102,9 @@ class clinsmanager : public smanager
public:

clinsmanager (const std::string & caps = c_cli_nsm_capabilities);
virtual ~clinsmanager ();
clinsmanager (const clinsmanager &) = delete;
clinsmanager & operator = (const clinsmanager &) = delete;
virtual ~clinsmanager () = default;

#if defined SEQ66_NSM_SUPPORT
nsmclient * nsm_client ()
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-11-05
* \updates 2024-11-06
* \license GNU GPLv2 or above
*
* This class provides a process for starting, running, restarting, and
Expand Down Expand Up @@ -135,7 +135,7 @@ class smanager

smanager (const std::string & caps = "");
smanager (const smanager &) = delete;
smanager & operator =(const smanager &) = delete;
smanager & operator = (const smanager &) = delete;
virtual ~smanager ();

static void app_info (const std::string arg0, bool is_cli = false);
Expand Down
7 changes: 1 addition & 6 deletions libseq66/src/sessions/clinsmanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
* \library clinsmanager application
* \author Chris Ahlstrom
* \date 2020-08-31
* \updates 2023-08-29
* \updates 2024-11-06
* \license GNU GPLv2 or above
*
* This object also works if there is no session manager in the build. It
Expand Down Expand Up @@ -105,11 +105,6 @@ clinsmanager::clinsmanager (const std::string & caps) :
get_and_set_build_issue();
}

clinsmanager::~clinsmanager ()
{
// no code
}

/**
* Detects if the 'usr' file defines usage of NSM and a valid URL for the
* nsmd daemon, or, if not, is there an NSM URL in the environment. Also, if
Expand Down
10 changes: 9 additions & 1 deletion libseq66/src/sessions/smanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,8 @@ void
smanager::app_info (const std::string arg0, bool is_cli)
{
set_app_name(SEQ66_APP_NAME); /* set at ./configure time */
set_app_path(arg0); /* log for future usage */
set_arg_0(arg0); /* issue #131 */
if (is_cli)
{
/*
Expand All @@ -174,7 +176,6 @@ smanager::app_info (const std::string arg0, bool is_cli)
* seq66::usr().app_is_headless(true); // conflated with cli
*/

seq66::set_app_path(arg0); /* log for future usage */
set_app_cli(true); /* the default is false */
set_app_type(SEQ66_APP_TYPE); /* e.g. "qt5" vs "cli" */
set_client_name("seq66cli"); /* change from configure */
Expand Down Expand Up @@ -284,13 +285,16 @@ smanager::main_settings (int argc, char * argv [])
{
int optionindex = (-1);
bool sessionmodified = false;
if (rc().alt_session()) // issue #131
{

/*
* Check for a session, either defined by the environment variable
* "SEQ66_SESSION_TAG" or by the "--session-tag tag" option. The
* latter can override the first.
*/

#if 0 // commented out for issue #131
if (! rc().alt_session())
{
std::string sesstag = cmdlineopts::env_session_tag();
Expand All @@ -299,6 +303,7 @@ smanager::main_settings (int argc, char * argv [])
}
if (rc().alt_session())
{
#endif
/*
* The name 'sessions.rc' is a bit more accurate.
*/
Expand Down Expand Up @@ -328,6 +333,9 @@ smanager::main_settings (int argc, char * argv [])
return false;
}
}
#if 0 // comment out for issue #131
}
#endif
}

/*
Expand Down
66 changes: 39 additions & 27 deletions libsessions/src/nsm/nsmbase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
* \library seq66 application
* \author Chris Ahlstrom
* \date 2020-03-07
* \updates 2024-11-05
* \updates 2024-11-06
* \license GNU GPLv2 or above
*
* nsmbase is an Non Session Manager (NSM) OSC client helper. The NSM API
Expand Down Expand Up @@ -127,26 +127,38 @@ static lo_timetag s_lo_timetag = { 0, 1 };
#include "nsm/nsmbase.hpp" /* seq66::nsmbase class */
#include "nsm/nsmmessagesex.hpp" /* seq66::nsm new message functions */

#define NSM_API_VERSION_MAJOR 1
#define NSM_API_VERSION_MINOR 0

/*
* Do not document a namespace; it breaks Doxygen.
*/

namespace seq66
{

/*
* Define in seq66_features.hpp only for trouble-shooting, especially under a
* session manager.
*/

#if defined SEQ66_IMMEDIATE_LOG_FILE
#define FORCE_VERBOSE true
#else
#define FORCE_VERBOSE false
#endif

#define NSM_API_VERSION_MAJOR 1
#define NSM_API_VERSION_MINOR 0
bool
verbose_send ()
{
return true;
}

/*
* Do not document a namespace; it breaks Doxygen.
*/
#else

namespace seq66
bool
verbose_send ()
{
return rc().verbose();
}

#endif

/**
* A handler for the /reply message.
Expand Down Expand Up @@ -1016,24 +1028,33 @@ nsmbase::send_from
)
{
int result = (-1);
if (s3.empty())
if (s1.empty())
{
result = lo_send_from
(
m_lo_address, m_lo_server, LO_TT_IMMEDIATE_2,
message.c_str(), pattern.c_str()
);
}
else
{
if (s2.empty())
{
result = lo_send_from /* e.g. "/nsm/client/is_clean" "" */
result = lo_send_from
(
m_lo_address, m_lo_server, LO_TT_IMMEDIATE_2,
message.c_str(), pattern.c_str(), s1.c_str()
);
}
else
{
if (s1.empty())
if (s3.empty())
{
result = lo_send_from
(
m_lo_address, m_lo_server, LO_TT_IMMEDIATE_2,
message.c_str(), pattern.c_str()
message.c_str(), pattern.c_str(),
s1.c_str(), s2.c_str()
);
}
else
Expand All @@ -1042,23 +1063,14 @@ nsmbase::send_from
(
m_lo_address, m_lo_server, LO_TT_IMMEDIATE_2,
message.c_str(), pattern.c_str(),
s1.c_str(), s2.c_str()
s1.c_str(), s2.c_str(), s3.c_str()
);
}
}
}
else
{
result = lo_send_from
(
m_lo_address, m_lo_server, LO_TT_IMMEDIATE_2,
message.c_str(), pattern.c_str(),
s1.c_str(), s2.c_str(), s3.c_str()
);
}
if (result != (-1))
{
if (rc().verbose() || FORCE_VERBOSE)
if (verbose_send())
{
std::string msg = "OSC message sent " + message + pattern;
session_message(msg);
Expand Down Expand Up @@ -1264,7 +1276,7 @@ outgoing_msg
const std::string & data
)
{
if (rc().verbose() || FORCE_VERBOSE)
if (verbose_send())
{
std::string text = msgsnprintf
(
Expand Down
5 changes: 4 additions & 1 deletion seq_qt5/include/qt5nsmanager.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
* \library qt5nsmanager application
* \author Chris Ahlstrom
* \date 2020-03-15
* \updates 2023-05-31
* \updates 2024-11-06
* \license GNU GPLv2 or above
*
* This is an attempt to change from the hoary old (or, as H.P. Lovecraft
Expand Down Expand Up @@ -70,12 +70,15 @@ class qt5nsmanager : public QObject, public clinsmanager

public:

qt5nsmanager () = delete;
qt5nsmanager
(
QApplication & app,
QObject * parent = nullptr,
const std::string & caps = c_qt5_nsm_capabilities
);
qt5nsmanager (const qt5nsmanager &) = delete;
qt5nsmanager & operator = (const qt5nsmanager &) = delete;
virtual ~qt5nsmanager ();

virtual bool close_session (std::string & msg, bool ok = true) override;
Expand Down
9 changes: 5 additions & 4 deletions seq_qt5/src/qt5nsmanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
* \library qt5nsmanager application
* \author Chris Ahlstrom
* \date 2020-03-15
* \updates 2023-11-05
* \updates 2023-11-06
* \license GNU GPLv2 or above
*
* Duty now for the future! Join the Smart Patrol!
Expand Down Expand Up @@ -210,7 +210,9 @@ qt5nsmanager::create_window ()
clid += rc().jack_session(); /* UUID alone */
}
}
#if 0 // see version 0.99.7
else /* 2023-11-05 */
#endif
{
if (rc().alt_session())
{
Expand All @@ -219,13 +221,11 @@ qt5nsmanager::create_window ()
tag += "]";
session_manager_name(tag);
}
#if 0 // this seems wwrong, test it!!!
if (have_uuid)
if (have_uuid) /* wrong ??? */
{
clid += "/";
clid += rc().jack_session(); /* UUID alone */
}
#endif
}
}
m_window->session_manager(manager_name());
Expand Down Expand Up @@ -305,6 +305,7 @@ qt5nsmanager::run ()
if (session_setup(restart)) /* need an early exit? */
{
int exit_status = m_application.exec(); /* run main window loop */
status_message("Early exit flagged by session setup");
return exit_status == EXIT_SUCCESS;
}
else
Expand Down

0 comments on commit 7d36fc8

Please sign in to comment.