Phase 12: Improve audio transitions and verify sample-accurate timing
This commit is contained in:
parent
461689dd44
commit
05140c2e93
29 changed files with 795 additions and 33 deletions
|
|
@ -55,6 +55,10 @@ xtc_result xtc_audio_plan_create(const xtc_project *project, unsigned int rate,
|
|||
* @param plan Preloaded arrangement plan.
|
||||
*/
|
||||
void xtc_audio_plan_destroy(xtc_audio_plan *plan);
|
||||
/* Control thread before publication only. Zero (default) preserves raw samples;
|
||||
* 1..65536 applies linear fades to each audible region's actual media bounds.
|
||||
* Rendering remains stateless, including seeks and variable block partitions. */
|
||||
xtc_result xtc_audio_plan_set_fade_frames(xtc_audio_plan *plan, size_t frames);
|
||||
/**
|
||||
* @brief Returns the number of asset issues and optionally the first affected path.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -33,6 +33,7 @@ typedef struct {
|
|||
uint64_t sample_position; /* Successful callback frames; retained across stop/submit. */
|
||||
unsigned int submitted_revision, active_revision;
|
||||
int running;
|
||||
int stopping; /* Graceful stop requested; collect completes deactivation. */
|
||||
int server_lost;
|
||||
int sample_rate_changed; /* Sticky: close/reopen and resubmit to recover. */
|
||||
xtc_result process_result;
|
||||
|
|
@ -75,6 +76,16 @@ xtc_result xtc_backend_start(xtc_backend *backend);
|
|||
* @return XTC_OK on success, or an error code describing the failure.
|
||||
*/
|
||||
xtc_result xtc_backend_stop(xtc_backend *backend);
|
||||
/* Configure while stopped, before preparing a project. Default zero preserves
|
||||
* raw rendering/immediate stop. GUI uses 5 ms (rate/200). Frames <=65536.
|
||||
* Applies source-boundary fades and a master start/stop gain ramp. */
|
||||
xtc_result xtc_backend_set_transition_frames(xtc_backend *backend, size_t frames);
|
||||
/* Non-blocking graceful stop request; not callback quiescence. Repeated calls
|
||||
* are idempotent. Process finishes the ramp, then emits silence/holds position.
|
||||
* Poll/collect on the control thread to deactivate. Recorder must be detached.
|
||||
* Immediate stop/close remain the escape path if callbacks cease or errors occur. */
|
||||
xtc_result xtc_backend_request_stop(xtc_backend *backend);
|
||||
|
||||
/* Stopped only; changes transport clock, not oscillator phase. */
|
||||
/**
|
||||
* @brief Changes the stopped backend's sample position and resets MIDI voices.
|
||||
|
|
@ -140,7 +151,7 @@ xtc_result xtc_backend_midi_port_name(const xtc_backend *backend, const char **o
|
|||
*/
|
||||
xtc_result xtc_backend_set_recorder(xtc_backend *backend, xtc_recorder *recorder);
|
||||
/**
|
||||
* @brief Reclaims retired realtime plans on the control thread.
|
||||
* @brief Completes acknowledged fades and reclaims retired plans on the control thread.
|
||||
*
|
||||
* @param backend Backend handle.
|
||||
*/
|
||||
|
|
|
|||
20
include/xtc/xtc_dsp.h
Normal file
20
include/xtc/xtc_dsp.h
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
#ifndef XTC_DSP_H
|
||||
#define XTC_DSP_H
|
||||
#include "xtc_types.h"
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
/* Single processing owner (or quiescent control thread). No allocation or I/O.
|
||||
* Initialize with reset before target/process.
|
||||
* Linear ramps reach the target on the Nth sample, independent of block size. */
|
||||
typedef struct { float current, target; size_t remaining; } xtc_gain_ramp;
|
||||
xtc_result xtc_gain_ramp_reset(xtc_gain_ramp *ramp, float value);
|
||||
xtc_result xtc_gain_ramp_target(xtc_gain_ramp *ramp, float target, size_t frames);
|
||||
xtc_result xtc_gain_ramp_process(xtc_gain_ramp *ramp, float *left, float *right, size_t frames);
|
||||
/* Canonical silence for NaN, infinity and float subnormals; finite overloads
|
||||
* are retained for mixing/headroom. This does not change CPU-wide FP flags. */
|
||||
float xtc_dsp_finite(float sample);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
|
@ -129,6 +129,10 @@ xtc_result xtc_midi_plan_create(const xtc_project *project, unsigned int sample_
|
|||
* @param plan Instrument plan and its single-owner runtime state.
|
||||
*/
|
||||
void xtc_midi_plan_destroy(xtc_midi_plan *plan);
|
||||
/* Set before publication, while quiescent. Zero preserves raw scheduled notes.
|
||||
* Linear boundary envelopes do not delay note scheduling; live note-offs and
|
||||
* panic remain immediate. Max 65536 frames. */
|
||||
xtc_result xtc_midi_plan_set_fade_frames(xtc_midi_plan *plan, size_t frames);
|
||||
/* Audio owner or stopped only. Reset clears live notes and panic suppression.
|
||||
* Panic silences live notes and scheduled notes already started at position;
|
||||
* later scheduled notes can start. MIDI CC120/123 affects its own channel. */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue