use std::path::PathBuf;
use anyhow::{Result, bail};
mod eager;
#[cfg(feature = "burn")]
mod burn;
#[cfg(feature = "rlx")]
mod rlx;
pub use eager::{
ENCODER_DEFAULT_INPUT_SAMPLES, ENCODER_SAMPLE_RATE, ENCODER_SAMPLES_PER_TOKEN, NeuCodecDecoder,
NeuCodecEncoder, SAMPLE_RATE, SAMPLES_PER_TOKEN,
};
pub use crate::features::{burn_feature_enabled, rlx_feature_enabled, wgpu_feature_enabled};
pub fn decoder_weights_path() -> Result<PathBuf> {
let path = std::env::var("NEUTTS_DECODER_PATH")
.ok()
.filter(|p| !p.is_empty())
.map(PathBuf::from)
.ok_or_else(|| {
anyhow::anyhow!(
"NEUTTS_DECODER_PATH is not set (NeuCodec weights are not bundled in rlx-neutts)"
)
})?;
if !path.exists() {
bail!("NEUTTS_DECODER_PATH does not exist: {}", path.display());
}
Ok(path)
}
pub fn decoder_weights_path_if_available() -> Option<PathBuf> {
let path = std::env::var("NEUTTS_DECODER_PATH")
.ok()
.filter(|p| !p.is_empty())
.map(PathBuf::from)?;
if path.exists() { Some(path) } else { None }
}