#ifndef BEATRAT_EXPORT_H
#define BEATRAT_EXPORT_H

#include <stddef.h>
#include <stdint.h>

/* HAVE_FLAC / HAVE_LAME are set by the Makefile only when the
 * corresponding dev library was actually found at build time -- code
 * (here and in main.c) that references EXPORT_FORMAT_FLAC/MP3 must be
 * wrapped in the matching #ifdef, since the enum values simply don't
 * exist otherwise. This is how a missing optional dependency becomes
 * "the feature isn't compiled in" rather than a runtime crash. */
typedef enum {
    EXPORT_FORMAT_WAV,
#ifdef HAVE_FLAC
    EXPORT_FORMAT_FLAC,
#endif
#ifdef HAVE_LAME
    EXPORT_FORMAT_MP3,
#endif
} ExportFormat;

/* Encodes mono `samples` at `rate` Hz to `path` in the given format.
 * Returns 0 on success. */
int export_write(const char *path, ExportFormat format,
                  const int16_t *samples, size_t num_samples, uint32_t rate);

/* File extension (no dot) for a format, e.g. "wav", "flac", "mp3". */
const char *export_extension(ExportFormat format);

#endif
