mirror of
https://github.com/italicsjenga/agb.git
synced 2024-12-23 16:21:33 +11:00
Add support for 18157Hz
This commit is contained in:
parent
26620e850e
commit
c6e7827e34
|
@ -17,6 +17,9 @@ debug = true
|
|||
[lib]
|
||||
proc-macro = true
|
||||
|
||||
[features]
|
||||
freq18157 = []
|
||||
|
||||
[dependencies]
|
||||
hound = "3.4.0"
|
||||
syn = "1.0.73"
|
||||
|
|
|
@ -12,6 +12,11 @@ use std::{
|
|||
};
|
||||
use syn::parse_macro_input;
|
||||
|
||||
#[cfg(not(feature = "freq18157"))]
|
||||
const FREQUENCY: u32 = 10512;
|
||||
#[cfg(feature = "freq18157")]
|
||||
const FREQUENCY: u32 = 18157;
|
||||
|
||||
#[proc_macro]
|
||||
pub fn include_wav(input: TokenStream) -> TokenStream {
|
||||
let input = parse_macro_input!(input as syn::LitStr);
|
||||
|
@ -43,8 +48,9 @@ pub fn include_wav(input: TokenStream) -> TokenStream {
|
|||
|
||||
assert_eq!(
|
||||
wav_reader.spec().sample_rate,
|
||||
10512,
|
||||
"agb currently only supports sample rate of 10512Hz"
|
||||
FREQUENCY,
|
||||
"agb currently only supports sample rate of {}Hz",
|
||||
FREQUENCY
|
||||
);
|
||||
|
||||
let samples = samples_from_reader(wav_reader);
|
||||
|
|
|
@ -17,6 +17,7 @@ debug = true
|
|||
[features]
|
||||
default = ["alloc"]
|
||||
alloc = []
|
||||
freq18157 = ["agb_sound_converter/freq18157"]
|
||||
|
||||
[dependencies]
|
||||
bitflags = "1.2"
|
||||
|
|
|
@ -91,9 +91,16 @@ impl Mixer {
|
|||
|
||||
// I've picked one frequency that works nicely. But there are others that work nicely
|
||||
// which we may want to consider in the future: http://deku.gbadev.org/program/sound1.html
|
||||
#[cfg(not(feature = "freq18157"))]
|
||||
const SOUND_FREQUENCY: i32 = 10512;
|
||||
#[cfg(not(feature = "freq18157"))]
|
||||
const SOUND_BUFFER_SIZE: usize = 176;
|
||||
|
||||
#[cfg(feature = "freq18157")]
|
||||
const SOUND_FREQUENCY: i32 = 18157;
|
||||
#[cfg(feature = "freq18157")]
|
||||
const SOUND_BUFFER_SIZE: usize = 304;
|
||||
|
||||
fn set_asm_buffer_size() {
|
||||
extern "C" {
|
||||
static mut agb_rs__buffer_size: usize;
|
||||
|
|
Loading…
Reference in a new issue