Mema
Memory Matrix — multi-channel audio matrix monitor and router
Loading...
Searching...
No Matches
Mema::HeadlessCLIMenu Class Reference

Interactive, numbered-menu CLI for configuring Mema when running with –headless. More...

#include <HeadlessCLIMenu.h>

+ Inheritance diagram for Mema::HeadlessCLIMenu:
+ Collaboration diagram for Mema::HeadlessCLIMenu:

Public Member Functions

 HeadlessCLIMenu (MemaProcessor &processor)
 Constructs the menu and stores a reference to the processor.
 
 ~HeadlessCLIMenu () override
 Destructor — stops the background thread (up to 3 s timeout).
 
void run () override
 Thread entry point — shows the main menu in a loop until the user quits.
 

Detailed Description

Interactive, numbered-menu CLI for configuring Mema when running with –headless.

When Mema is launched with the –headless command-line flag, no graphical UI is created. HeadlessCLIMenu fills that gap by offering a plain stdin/stdout menu system that guides the user through all relevant configuration areas without requiring any memorisation of commands.

Menu structure

Main
├── 1 Input mutes toggle per-channel mute state
├── 2 Output mutes toggle per-channel mute state
├── 3 Matrix gains enable/disable crosspoints, set gain in dB
├── 4 Audio device select device, sample rate, buffer size
├── 5 Plugin enable/disable processing, pre/post, parameter remote control
├── 6 Load config prompt for a file path; no GUI file chooser
├── 7 Save config prompt for a file path; no GUI file chooser
└── q Quit requests application shutdown

Threading

HeadlessCLIMenu runs on a dedicated background thread (juce::Thread) so that blocking stdin reads never stall the JUCE message loop. All mutations to the processor are dispatched back to the message thread via callOnMessageThread(), which uses a juce::WaitableEvent to block the CLI thread until the mutation completes.

Platform notes

  • macOS / Linux: stdin and stdout work out of the box for console processes.
  • Windows: A SUBSYSTEM:WINDOWS executable (which all JUCE GUI apps are) has no console attached by default. The caller (MemaApplication::initialise) must call AttachConsole() / AllocConsole() and reopen the standard streams before constructing this object.
See also
MemaProcessor The processor whose state is read and mutated by this menu.
MemaApplication The application class that owns and starts this menu thread.

Definition at line 66 of file HeadlessCLIMenu.h.

Constructor & Destructor Documentation

◆ HeadlessCLIMenu()

Mema::HeadlessCLIMenu::HeadlessCLIMenu ( MemaProcessor processor)
explicit

Constructs the menu and stores a reference to the processor.

Parameters
processorThe MemaProcessor instance whose state the menu will read and modify. The processor must outlive this object.

Definition at line 42 of file HeadlessCLIMenu.cpp.

◆ ~HeadlessCLIMenu()

Mema::HeadlessCLIMenu::~HeadlessCLIMenu ( )
override

Destructor — stops the background thread (up to 3 s timeout).

If the thread is currently blocked in a stdin read, the timeout will expire and the thread will be force-terminated by juce::Thread::stopThread().

Definition at line 47 of file HeadlessCLIMenu.cpp.

Member Function Documentation

◆ run()

void Mema::HeadlessCLIMenu::run ( )
override

Thread entry point — shows the main menu in a loop until the user quits.

Waits briefly for the processor to finish initialising, then enters the main menu loop. The loop continues until the user presses 'q', stdin closes (EOF), or threadShouldExit() returns true.

Definition at line 56 of file HeadlessCLIMenu.cpp.


The documentation for this class was generated from the following files: