Pulp 1.88.0
Cross-platform audio plugin framework
Loading...
Searching...
No Matches
panic.hpp File Reference

Processor-level MIDI panic: a request any thread can raise, serviced on the audio thread at the start of the next block. More...

#include <pulp/midi/buffer.hpp>
#include <pulp/midi/keyboard_state.hpp>
#include <pulp/midi/panic.hpp>
#include <array>
#include <atomic>
#include <cstddef>
#include <cstdint>

Go to the source code of this file.

Classes

struct  pulp::format::PanicCapabilities
 What a panic request can do in the current host. More...
struct  pulp::format::PanicOutcome
 What service_panic() did. More...
class  pulp::format::PanicState
 Lock-free panic request and output-note state for one Processor. More...

Namespaces

namespace  pulp
namespace  pulp::format
 What the product grants a device: the quota table indexed by capability tier and live thermal state.

Enumerations

enum class  pulp::format::PanicMode : std::uint8_t { pulp::format::immediate = 2 , pulp::format::release = 1 }
 How hard a panic stops the plug-in. More...

Functions

template<typename Proc>
PanicOutcome pulp::format::service_panic (Proc &processor, PanicState &state, midi::MidiBuffer &midi_out, std::int32_t sample_offset=0) noexcept
 Service a pending panic request (audio thread, before process()).

Detailed Description

Processor-level MIDI panic: a request any thread can raise, serviced on the audio thread at the start of the next block.

Processor::request_panic() raises the request. A host adapter that wants to honour it calls service_panic() before Processor::process(), and PanicState::observe_midi_out() after, so the panic can end exactly the notes the plug-in has sent downstream. The request is serviced by:

  1. calling Processor::on_panic(mode) so the plug-in stops its own voices (midi::Synthesiser::panic() is the one-line implementation), and
  2. where the adapter has MIDI output, writing note-offs for the notes the plug-in left held plus the channel panic messages from pulp/midi/panic.hpp.

Nothing here knows about any user interface: a button, a menu item or a script calls request_panic() and reads panic_capabilities().