From 73d6dc448f8532ea3a1b79ac069749f565d6151b Mon Sep 17 00:00:00 2001 From: Gwilym Kuiper Date: Sat, 11 Jun 2022 13:05:30 +0100 Subject: [PATCH] Add new frequency option --- agb-sound-converter/Cargo.toml | 1 + agb-sound-converter/src/lib.rs | 6 +++++- agb/Cargo.toml | 1 + 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/agb-sound-converter/Cargo.toml b/agb-sound-converter/Cargo.toml index fa82c038..1a221e16 100644 --- a/agb-sound-converter/Cargo.toml +++ b/agb-sound-converter/Cargo.toml @@ -19,6 +19,7 @@ proc-macro = true [features] freq18157 = [] +freq32768 = [] [dependencies] hound = "3.4" diff --git a/agb-sound-converter/src/lib.rs b/agb-sound-converter/src/lib.rs index ea2117f2..368e74dd 100644 --- a/agb-sound-converter/src/lib.rs +++ b/agb-sound-converter/src/lib.rs @@ -12,10 +12,14 @@ use std::{ }; use syn::parse_macro_input; -#[cfg(not(feature = "freq18157"))] +#[cfg(all(not(feature = "freq18157"), not(feature = "freq32768")))] const FREQUENCY: u32 = 10512; #[cfg(feature = "freq18157")] const FREQUENCY: u32 = 18157; +#[cfg(feature = "freq32768")] +const FREQUENCY: u32 = 32768; +#[cfg(all(feature = "freq18157", feature = "freq32768"))] +compile_error!("Must have at most one of freq18157 or freq32768 features enabled"); #[proc_macro] pub fn include_wav(input: TokenStream) -> TokenStream { diff --git a/agb/Cargo.toml b/agb/Cargo.toml index 013447f7..248b5bd6 100644 --- a/agb/Cargo.toml +++ b/agb/Cargo.toml @@ -17,6 +17,7 @@ debug = true [features] default = [] freq18157 = ["agb_sound_converter/freq18157"] +freq32768 = ["agb_sound_converter/freq32768"] [dependencies] bitflags = "1"