replace TARGET_AUDIO_SPEC with separate constants for freq and channels
This commit is contained in:
parent
94922caf71
commit
9e8727c02b
|
@ -1,6 +1,6 @@
|
|||
use std::ops::{Index, IndexMut};
|
||||
|
||||
use sdl2::audio::{AudioCallback, AudioFormat, AudioSpecDesired};
|
||||
use sdl2::audio::{AudioCallback, AudioFormat, AudioFormatNum, AudioSpecDesired};
|
||||
use sdl2::AudioSubsystem;
|
||||
use thiserror::Error;
|
||||
|
||||
|
@ -14,13 +14,10 @@ pub const AUDIO_FREQUENCY_44KHZ: u32 = 44100;
|
|||
pub const AUDIO_FREQUENCY_22KHZ: u32 = 22050;
|
||||
pub const AUDIO_FREQUENCY_11KHZ: u32 = 11025;
|
||||
|
||||
pub const SILENCE: u8 = sdl2::audio::AudioFormatNum::SILENCE;
|
||||
pub const SILENCE: u8 = AudioFormatNum::SILENCE;
|
||||
|
||||
pub const TARGET_AUDIO_SPEC: AudioSpec = AudioSpec {
|
||||
frequency: AUDIO_FREQUENCY_22KHZ,
|
||||
channels: 1,
|
||||
format: AudioFormat::U8,
|
||||
};
|
||||
pub const TARGET_AUDIO_FREQUENCY: u32 = AUDIO_FREQUENCY_22KHZ;
|
||||
pub const TARGET_AUDIO_CHANNELS: u8 = 1;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
|
|
@ -246,8 +246,8 @@ impl SystemBuilder {
|
|||
};
|
||||
|
||||
let audio_spec = AudioSpecDesired {
|
||||
freq: Some(TARGET_AUDIO_SPEC.frequency() as i32),
|
||||
channels: Some(TARGET_AUDIO_SPEC.channels()),
|
||||
freq: Some(TARGET_AUDIO_FREQUENCY as i32),
|
||||
channels: Some(TARGET_AUDIO_CHANNELS),
|
||||
samples: None,
|
||||
};
|
||||
let mut audio = Audio::new(audio_spec, &sdl_audio_subsystem)?;
|
||||
|
|
Loading…
Reference in a new issue