How Ecasound Interactive Mode Handles Ctrl+C
Ecasound’s interactive mode intercepts user keyboard interrupts like
Ctrl+C to ensure non-destructive session handling and
uninterrupted audio control. Instead of killing the application outright
as it would in standard terminal operations, interactive mode traps the
interrupt signal, halts any active audio processing or playback, and
safely returns control to the interactive prompt.
Signal Interception via SIGINT
When running Ecasound in interactive mode (EIAM), the software
installs a dedicated signal handler for SIGINT (the POSIX
signal triggered by Ctrl+C). Under standard command-line
execution, a SIGINT forces Ecasound to immediately flush
buffers, close open files, and terminate the process. In interactive
mode, this signal is caught and repurposed to manage the engine state
rather than terminating the runtime environment.
Behavior During Engine Execution
If an audio chain setup is actively processing, recording, or playing
back, pressing Ctrl+C executes an engine-stop routine:
- Engine Halting: Ecasound stops the audio processing
engine immediately, mimicking the internal
stopcommand. - Driver and Buffer Release: Real-time audio streams are paused or closed cleanly, releasing hardware locks on drivers such as ALSA, OSS, or JACK.
- State Preservation: The active chainsetup, connected inputs, outputs, and assigned effect controllers remain loaded in memory.
- Prompt Recovery: Control is returned directly to
the
ecasound ('h' for help) >prompt, allowing the user to modify parameters, reposition the playback cursor, or restart processing.
Behavior at the Idle Prompt
If the engine is stopped and the user is sitting at the interactive prompt:
- Pressing
Ctrl+Cdoes not exit the program. - The current line buffer is cleared, discarding any partially typed commands.
- A fresh prompt is displayed on a new line.
Exiting Interactive Mode
Because Ctrl+C is reserved for stopping processing and
clearing input, terminating Ecasound requires intentional exit routines.
Users must type quit, q, or send an
End-Of-File signal (Ctrl+D) at an empty prompt. This design
prevents accidental session loss during complex multi-track
configurations and live performance scenarios.