Compare commits

...

2 Commits

Author SHA1 Message Date
Yara
a566f34a0d fmt 2025-12-16 18:24:47 +01:00
Yara
aa3a9f11a8 add logging for size of rodio<->livekit buffer 2025-12-16 18:19:05 +01:00
4 changed files with 35 additions and 14 deletions

22
Cargo.lock generated
View File

@@ -4925,7 +4925,7 @@ dependencies = [
"libc",
"option-ext",
"redox_users 0.5.2",
"windows-sys 0.61.2",
"windows-sys 0.59.0",
]
[[package]]
@@ -5636,7 +5636,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb"
dependencies = [
"libc",
"windows-sys 0.61.2",
"windows-sys 0.59.0",
]
[[package]]
@@ -8181,7 +8181,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4b0f83760fb341a774ed326568e19f5a863af4a952def8c39f9ab92fd95b88e5"
dependencies = [
"equivalent",
"hashbrown 0.16.1",
"hashbrown 0.15.5",
"serde",
"serde_core",
]
@@ -10030,7 +10030,7 @@ version = "0.6.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "536bfad37a309d62069485248eeaba1e8d9853aaf951caaeaed0585a95346f08"
dependencies = [
"windows-sys 0.61.2",
"windows-sys 0.60.2",
]
[[package]]
@@ -10440,7 +10440,7 @@ version = "0.50.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7957b9740744892f114936ab4a57b3f487491bbeafaf8083688b16841a4240e5"
dependencies = [
"windows-sys 0.61.2",
"windows-sys 0.59.0",
]
[[package]]
@@ -13726,12 +13726,14 @@ dependencies = [
[[package]]
name = "rodio"
version = "0.21.1"
source = "git+https://github.com/RustAudio/rodio?rev=e2074c6c2acf07b57cf717e076bdda7a9ac6e70b#e2074c6c2acf07b57cf717e076bdda7a9ac6e70b"
source = "git+https://github.com/zed-industries/rodio#34cafdbd7df402539e490057882f7b09fcc05c2a"
dependencies = [
"cpal",
"dasp_sample",
"hound",
"num-rational",
"rand 0.9.2",
"rand_distr",
"rtrb",
"symphonia",
"thiserror 2.0.17",
@@ -13990,7 +13992,7 @@ dependencies = [
"errno 0.3.14",
"libc",
"linux-raw-sys 0.11.0",
"windows-sys 0.61.2",
"windows-sys 0.59.0",
]
[[package]]
@@ -16373,7 +16375,7 @@ dependencies = [
"getrandom 0.3.4",
"once_cell",
"rustix 1.1.2",
"windows-sys 0.61.2",
"windows-sys 0.59.0",
]
[[package]]
@@ -17284,7 +17286,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2fb391ac70462b3097a755618fbf9c8f95ecc1eb379a414f7b46f202ed10db1f"
dependencies = [
"cc",
"windows-targets 0.52.6",
"windows-targets 0.48.5",
]
[[package]]
@@ -19114,7 +19116,7 @@ version = "0.1.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c2a7b1c03c876122aa43f3020e6c3c3ee5c05081c9a00739faf7503aeba10d22"
dependencies = [
"windows-sys 0.61.2",
"windows-sys 0.48.0",
]
[[package]]

View File

@@ -370,7 +370,8 @@ remote = { path = "crates/remote" }
remote_server = { path = "crates/remote_server" }
repl = { path = "crates/repl" }
reqwest_client = { path = "crates/reqwest_client" }
rodio = { git = "https://github.com/RustAudio/rodio", rev ="e2074c6c2acf07b57cf717e076bdda7a9ac6e70b", features = ["wav", "playback", "wav_output", "recording"] }
# rodio = { git = "https://github.com/RustAudio/rodio", rev ="e2074c6c2acf07b57cf717e076bdda7a9ac6e70b", features = ["wav", "playback", "wav_output", "recording"] }
rodio = { git = "https://github.com/zed-industries/rodio", features = ["wav", "playback", "wav_output", "recording"] }
rope = { path = "crates/rope" }
rpc = { path = "crates/rpc" }
rules_library = { path = "crates/rules_library" }

View File

@@ -204,7 +204,12 @@ impl Audio {
})
.denoise()
.context("Could not set up denoiser")?
.automatic_gain_control(0.90, 1.0, 0.0, 5.0)
.automatic_gain_control(rodio::source::AutomaticGainControlSettings {
target_level: 0.9,
attack_time: Duration::from_secs(1),
release_time: Duration::ZERO,
absolute_max_gain: 5.0,
})
.periodic_access(Duration::from_millis(100), move |agc_source| {
agc_source
.set_enabled(LIVE_SETTINGS.auto_microphone_volume.load(Ordering::Relaxed));
@@ -234,7 +239,12 @@ impl Audio {
) -> anyhow::Result<()> {
let (replay_source, source) = source
.constant_params(CHANNEL_COUNT, SAMPLE_RATE)
.automatic_gain_control(0.90, 1.0, 0.0, 5.0)
.automatic_gain_control(rodio::source::AutomaticGainControlSettings {
target_level: 0.9,
attack_time: Duration::from_secs(1),
release_time: Duration::ZERO,
absolute_max_gain: 5.0,
})
.periodic_access(Duration::from_millis(100), move |agc_source| {
agc_source.set_enabled(LIVE_SETTINGS.auto_speaker_volume.load(Ordering::Relaxed));
})

View File

@@ -51,9 +51,17 @@ impl LiveKitStream {
gpui::Priority::Realtime(gpui::RealtimePriority::Audio),
{
async move {
let mut last_print = std::time::Instant::now();
while let Some(frame) = stream.next().await {
let samples = frame_to_samplesbuffer(frame);
queue_input.append(samples);
let queued = queue_input.append(samples);
if queued > 10 && last_print.elapsed().as_secs() > 5 {
log::warn!(
"More then 10 audio frames queued in the input, total: {queued}"
);
last_print = std::time::Instant::now();
}
}
}
},