audio sample rate hacks. todo: review which ones are actually needed
This commit is contained in:
parent
439e575982
commit
c119c5eacd
|
@ -125,6 +125,9 @@ impl MyEmulator {
|
|||
av_info.geometry.base_height = 480;
|
||||
av_info.geometry.aspect_ratio = 4.33;
|
||||
}
|
||||
if av_info.timing.sample_rate == 0.0 {
|
||||
av_info.timing.sample_rate = 32040.0;
|
||||
}
|
||||
video_encoder.set_width(av_info.geometry.base_width);
|
||||
video_encoder.set_height(av_info.geometry.base_height);
|
||||
//video_encoder.set_aspect_ratio(av_info.geometry.aspect_ratio as f64);
|
||||
|
@ -136,7 +139,8 @@ impl MyEmulator {
|
|||
let audio_filter = audio_filter(&audio_encoder, av_info.timing.sample_rate).unwrap();
|
||||
|
||||
let video_encoder = video_encoder.open().unwrap();
|
||||
let audio_encoder = audio_encoder.open().unwrap();
|
||||
let mut audio_encoder = audio_encoder.open().unwrap();
|
||||
audio_encoder.set_rate(av_info.timing.sample_rate.round() as i32);
|
||||
|
||||
let emu = MyEmulator {
|
||||
retro,
|
||||
|
@ -169,6 +173,7 @@ impl MyEmulator {
|
|||
self.audio_buf.len(),
|
||||
ChannelLayout::STEREO
|
||||
);
|
||||
aframe.set_rate(32040);
|
||||
let aplane: &mut [(i16, i16)] = aframe.plane_mut(0);
|
||||
aplane.copy_from_slice(self.audio_buf.as_ref());
|
||||
self.audio_buf.clear();
|
||||
|
|
Loading…
Reference in New Issue