buffer size configurable + SHADERS WORK EVERYWHERE! 0.5.0 release!!!
This commit is contained in:
parent
5d4b313140
commit
23193db644
6 changed files with 24 additions and 10 deletions
6
Cargo.lock
generated
6
Cargo.lock
generated
|
@ -1242,7 +1242,7 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "gb-emu"
|
||||
version = "0.4.0"
|
||||
version = "0.5.0"
|
||||
dependencies = [
|
||||
"bytemuck",
|
||||
"chrono",
|
||||
|
@ -1263,7 +1263,7 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "gb-emu-lib"
|
||||
version = "0.4.0"
|
||||
version = "0.5.0"
|
||||
dependencies = [
|
||||
"ash",
|
||||
"ash-molten",
|
||||
|
@ -3432,7 +3432,7 @@ checksum = "49d64318d8311fc2668e48b63969f4343e0a85c4a109aa8460d6672e364b8bd1"
|
|||
|
||||
[[package]]
|
||||
name = "twinc_emu_vst"
|
||||
version = "0.4.0"
|
||||
version = "0.5.0"
|
||||
dependencies = [
|
||||
"async-ringbuf",
|
||||
"baseview",
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
[package]
|
||||
name = "gb-emu"
|
||||
version = "0.4.0"
|
||||
version = "0.5.0"
|
||||
edition = "2021"
|
||||
description = "TWINC Game Boy (CGB/DMG) emulator"
|
||||
|
||||
|
|
|
@ -5,8 +5,8 @@ use cpal::{
|
|||
use futures::executor;
|
||||
use gb_emu_lib::connect::{AudioOutput, DownsampleType};
|
||||
|
||||
const BUFFERS_PER_FRAME: usize = 5;
|
||||
const DEFAULT_BUFFER_SIZE: u32 = 64;
|
||||
use crate::access_config;
|
||||
|
||||
const DOWNSAMPLE_TYPE: DownsampleType = DownsampleType::ZeroOrderHold;
|
||||
|
||||
pub fn create_output(muted: bool) -> (AudioOutput, Stream) {
|
||||
|
@ -20,16 +20,26 @@ pub fn create_output(muted: bool) -> (AudioOutput, Stream) {
|
|||
.default_output_config()
|
||||
.expect("Couldn't get default config for audio output");
|
||||
|
||||
let (buffers_per_frame, default_buffer_size) = {
|
||||
let configs = access_config();
|
||||
(
|
||||
configs.standalone_config.buffers_per_frame,
|
||||
configs.standalone_config.output_buffer_size,
|
||||
)
|
||||
};
|
||||
|
||||
let sample_rate = config.sample_rate().0;
|
||||
|
||||
let mut stream_config = config.config();
|
||||
|
||||
if let cpal::SupportedBufferSize::Range { min, max } = config.buffer_size() {
|
||||
stream_config.buffer_size =
|
||||
cpal::BufferSize::Fixed(DEFAULT_BUFFER_SIZE.min(*max).max(*min));
|
||||
cpal::BufferSize::Fixed(default_buffer_size.min(*max).max(*min));
|
||||
}
|
||||
|
||||
let (output, mut rx) = AudioOutput::new(sample_rate as f32, BUFFERS_PER_FRAME, DOWNSAMPLE_TYPE);
|
||||
println!("Using buffer size {:?}", stream_config.buffer_size);
|
||||
|
||||
let (output, mut rx) = AudioOutput::new(sample_rate as f32, buffers_per_frame, DOWNSAMPLE_TYPE);
|
||||
|
||||
let stream = if muted {
|
||||
device
|
||||
|
|
|
@ -120,6 +120,8 @@ enum ConfigType {
|
|||
pub struct StandaloneConfig {
|
||||
scale_factor: usize,
|
||||
group_screenshots_by_rom: bool,
|
||||
buffers_per_frame: usize,
|
||||
output_buffer_size: u32,
|
||||
}
|
||||
|
||||
impl Default for StandaloneConfig {
|
||||
|
@ -127,6 +129,8 @@ impl Default for StandaloneConfig {
|
|||
Self {
|
||||
scale_factor: 3,
|
||||
group_screenshots_by_rom: true,
|
||||
buffers_per_frame: 5,
|
||||
output_buffer_size: 64,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
[package]
|
||||
name = "twinc_emu_vst"
|
||||
version = "0.4.0"
|
||||
version = "0.5.0"
|
||||
edition = "2021"
|
||||
|
||||
[lib]
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
[package]
|
||||
name = "gb-emu-lib"
|
||||
version = "0.4.0"
|
||||
version = "0.5.0"
|
||||
edition = "2021"
|
||||
|
||||
[features]
|
||||
|
|
Loading…
Add table
Reference in a new issue