xtc/include/xtc/xtc_sample.h

26 lines
1.3 KiB
C

#ifndef XTC_SAMPLE_H
#define XTC_SAMPLE_H
#include "xtc_audio.h"
#ifdef __cplusplus
extern "C" {
#endif
/* Control-thread sample editor snapshots. Same WAV mono downmix as playback.
* <=4194304 source frames. No file writes or realtime use. Ranges are half-open,
* nonempty native source frames; failures preserve outputs. */
#define XTC_SAMPLE_MAX_FRAMES 4194304U
typedef struct xtc_sample xtc_sample;
typedef struct { float minimum,maximum; double mean,rms; } xtc_sample_stats;
xtc_result xtc_sample_load(const char *path,xtc_sample **out);
void xtc_sample_destroy(xtc_sample *sample);
xtc_result xtc_sample_info(const xtc_sample *sample,unsigned int *rate,size_t *frames);
xtc_result xtc_sample_read(const xtc_sample *sample,size_t frame,float *out);
xtc_result xtc_sample_analyze(const xtc_sample *sample,size_t begin,size_t end,xtc_sample_stats *out);
/* Select native source frame bounds inside the clip's current audible trim.
* Start rounds up to a tick; end rounds down. Sub-tick empty ranges reject.
* Timeline placement follows the removed leading source, preserving alignment.
* No media I/O, source content or fade changes; caller supplies source rate. */
xtc_result xtc_project_trim_source_frames(xtc_project *project,uint64_t clip,unsigned int rate,size_t begin,size_t end);
#ifdef __cplusplus
}
#endif
#endif