Skip to content

Bug roundup, audio + file logging#127

Merged
TroyNeubauer merged 16 commits into
masterfrom
tjn/file-log
Jun 23, 2025
Merged

Bug roundup, audio + file logging#127
TroyNeubauer merged 16 commits into
masterfrom
tjn/file-log

Conversation

@TroyNeubauer

@TroyNeubauer TroyNeubauer commented Jun 19, 2025

Copy link
Copy Markdown
Contributor

PR Description

  • Fixes the freeze seen by James in the last release
    • Onboards AudioSource and AudioSink since the implementations in futuresdr panicked and were subpar
    • Allows the user to pick the audio device to use
  • Logging:
    • Adds a tracing_subscriber that writes to a file (json format).
    • Ive found jless to be a solid command line json log viewer thats fast and has good search features.
  • Allows blocks to opt into rendering additional things, controlled through #[block(skip)] (via the Block derive macro)
  • Shows a low-level message box if creating the application fails (opengl drivers, headless, etc.)
  • Adds a ByteBuf abstration that can be used to combine multiple writes into a fixed size (e.g for a fixed size audio hardware buffer)

Related issues

Fixes #117
Fixes #130



How was this PR tested?

Android

N/A

Desktop (dsp-runner)

Macos

examples/audio-source3.fx Works

Windows

examples/audio-source3.fx Works

Linux (audio):

examples/audio-source3.fx Works

Linux (logging):

troy@battlestation ~/f/foxhunter (tjn/tracing)> cargo r -- --log-path log.json
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.19s
     Running `target/debug/dsp-studio --log-path log.json`
2025-06-19T22:56:14.081117Z  INFO main dsp_core::logging: Writing verbose logs to "log.json"
2025-06-19T22:56:14.081202Z  INFO main dsp_studio: Running DSP Studio version: version: 0.0.1, save_format: 0.1.0, commit_hash: 5b4ea4b8b85ee64ecc7b97fae89838b20489b40e-dirty
2025-06-19T22:56:14.094167Z  WARN main winit::platform_impl::linux::x11::xdisplay: error setting XSETTINGS; Xft options won't reload automatically
2025-06-19T22:56:14.146802Z  INFO main winit::platform_impl::linux::x11::window: Guessed window scale factor: 1.6666666666666667
2025-06-19T22:56:15.239007Z  INFO main dsp_studio: Exiting!
troy@battlestation ~/f/foxhunter (tjn/tracing)> cat log.json
{"timestamp":"2025-06-19T22:56:14.081057Z","level":"INFO","message":"Writing verbose logs to \"log.json\"","target":"dsp_core::logging"}
{"timestamp":"2025-06-19T22:56:14.081188Z","level":"INFO","message":"Running DSP Studio version: version: 0.0.1, save_format: 0.1.0, commit_hash: 5b4ea4b8b85ee64ecc7b97fae89838b20489b40e-dirty","target":"dsp_studio"}
{"timestamp":"2025-06-19T22:56:14.094144Z","level":"WARN","message":"error setting XSETTINGS; Xft options won't reload automatically","target":"winit::platform_impl::linux::x11::xdisplay"}
{"timestamp":"2025-06-19T22:56:14.146774Z","level":"INFO","message":"Guessed window scale factor: 1.6666666666666667","target":"winit::platform_impl::linux::x11::window"}
{"timestamp":"2025-06-19T22:56:14.146830Z","level":"DEBUG","message":"Calculated physical dimensions: 2400x1350","target":"winit::platform_impl::linux::x11::window"}
{"timestamp":"2025-06-19T22:56:14.226471Z","level":"DEBUG","message":"Failed to get owner of org.a11y.Bus: org.freedesktop.DBus.Error.NameHasNoOwner: Could not get owner of name 'org.a11y.Bus': no such name","target":"zbus::proxy"}
{"timestamp":"2025-06-19T22:56:14.227365Z","level":"DEBUG","message":"logger already initialized","target":"futuresdr::runtime::logging"}
{"timestamp":"2025-06-19T22:56:14.228696Z","level":"DEBUG","message":"Listening on 127.0.0.1:1337","target":"futuresdr::runtime::ctrl_port"}
{"timestamp":"2025-06-19T22:56:15.235378Z","level":"DEBUG","message":"Runtime dropped","target":"futuresdr::runtime::runtime"}
{"timestamp":"2025-06-19T22:56:15.238988Z","level":"INFO","message":"Exiting!","target":"dsp_studio"}

Also will write to temp dir if --log-path is unspecified:

troy@battlestation ~/f/foxhunter (tjn/file-log)> cargo r
   Compiling dsp-studio v0.0.1 (/home/troy/foxhunter/foxhunter/studio)
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 1.18s
     Running `target/debug/dsp-studio`
2025-06-19T23:01:56.256242Z  INFO main dsp_core::logging: Writing verbose logs to "/tmp/nix-shell.gpeFA6/nix-shell-201721-0/dsp-studio-log_2025-06-19_16:01:56.json"

Also handles the case where the user specifies a directory as the log file path (we create a file inside the dir):

troy@battlestation ~/f/foxhunter (tjn/file-log)> eza target/
CACHEDIR.TAG  debug  doc  release  semver-checks
troy@battlestation ~/f/foxhunter (tjn/file-log)> cargo r -- --log-path target
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.19s
     Running `target/debug/dsp-studio --log-path target`
2025-06-19T23:02:37.395487Z  INFO main dsp_core::logging: Writing verbose logs to "target/dsp-studio-log_2025-06-19_16:02:37.json"



Sanity check

  • Self-review?
  • Unit tests?
  • Docs / sufficient comments?

@TroyNeubauer
TroyNeubauer requested a review from dgramop June 19, 2025 23:03

@dgramop dgramop left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needs testing on windows. Also we should list default log paths for each operating system in the README - anyone supporting a user will need this information

Comment thread dsp-core/src/logging.rs Outdated
fn log_file_name() -> String {
chrono::Local::now()
.naive_local()
.format("dsp-studio-log_%Y-%m-%d_%H:%M:%S.txt")

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
.format("dsp-studio-log_%Y-%m-%d_%H:%M:%S.txt")
.format("foxhunter-studio-log_%Y-%m-%d_%H:%M:%S.txt")

@TroyNeubauer TroyNeubauer changed the title File logging File logging + bug roundup Jun 20, 2025
Comment thread blocks/src/blocks/fm.rs
#[block(range = { initial: 2MHz, range: 50kHz..=60MHz })]
sample_rate: FloatValue,
#[block(default = "F64Picker::with_supported_fn(supported_audio_rates)")]
#[block(default = "F64Picker::new(vec![24000.0, 44100.0, 48000.0, 96000.0])")]

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

are these hard-coded default rates going to be a problem/is this just a short term workaround until we get a sample rate solver?

@TroyNeubauer TroyNeubauer Jun 23, 2025

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They shouldnt since these are very much agreed upon. I would say 99% of audio rates used by devices or stored in files are one of these four

Comment thread macros/src/lib.rs Outdated
.collect();

if block_attrs.len() != 1 {
let Some(block_attr) = block_attrs.get(0) else {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cool! let else! very interesting

@dgramop
dgramop self-requested a review June 22, 2025 18:53
@TroyNeubauer TroyNeubauer changed the title File logging + bug roundup Bug roundup, audio + file logging Jun 23, 2025
@TroyNeubauer
TroyNeubauer merged commit 17dcab1 into master Jun 23, 2025
3 of 4 checks passed
@TroyNeubauer
TroyNeubauer deleted the tjn/file-log branch June 23, 2025 02:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fix audio related crash on windows Log-to-file

2 participants