Skip to content

armgit / nota

Public Imported from GitHub
0

Nota — a free DAW for macOS, Windows and Linux. No subscription, no account — just open it and make music.

(feat) Sample rate and buffer size in the status bar (#373) (#400)

Chris Laupama80177b28c400
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 12292794..c2b76b8d 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -23,6 +23,10 @@ Entry categories: `Added`, `Changed`, `Fixed`, `Removed`.
## [Unreleased]
### Added
+- **Sample rate and buffer size in the status bar** (#373): the lower right corner now reads
+ "48 kHz · 256". Click it to pick another buffer size — Device default or 64 to 2048 frames,
+ each with its latency — or to open Settings → Audio. Playback carries on across the change.
+ Under ASIO the menu offers the driver's settings instead, since the driver sets the buffer.
- **Track inspector** (#186): a new tab at the bottom of the browser's left rail shows the
selected track's settings in one place — name, Mute / Solo / Arm, record input and input
monitoring or MIDI from, colour, row height and the freeze commands — so they no longer
diff --git a/FEATURES.md b/FEATURES.md
index 3dfdb4c1..4fbc61b7 100644
--- a/FEATURES.md
+++ b/FEATURES.md
@@ -1258,6 +1258,11 @@ audio effects after it keep running and keep their settings; saved with the proj
release's sha256). **Restart now** installs it and relaunches, and **Later** installs it on
quit. This covers the macOS .app, the Windows installer (run silently) and the Linux
AppImage. Other copies fall back to a link to the release page.
+- **Sample rate and buffer size in the status bar** ("48 kHz · 256", beside the version). A
+ click opens the buffer menu: Device default or 64–2048 frames, each with its latency, and
+ Audio settings…; picking a size restarts the device and playback carries on. Under ASIO
+ the menu offers Driver settings… instead (the driver owns the buffer); in WASAPI exclusive
+ mode it says the device's own buffer is used.
- **About** — the app and engine versions, the copyright notice, and a pointer to the
third-party attribution notices (`LICENSES/THIRD-PARTY-NOTICES.md`).
- **Settings** — a larger window with a sidebar grouped into Devices, Plug-ins and General
diff --git a/specs/061-status-bar-buffer/plan.md b/specs/061-status-bar-buffer/plan.md
new file mode 100644
index 00000000..de94a3aa
--- /dev/null
+++ b/specs/061-status-bar-buffer/plan.md
@@ -0,0 +1,43 @@
+# Implementation Plan: Sample rate and buffer size in the status bar
+
+**Branch**: `061-status-bar-buffer` | **Date**: 2026-10-30 | **Spec**: [spec.md](spec.md)
+
+## Summary
+
+Turn the status bar's sample-rate text into a ghost button reading "48 kHz · 256" and give
+it a MenuKit flyout of buffer sizes. Picking one goes through a new
+`MainWindowViewModel.SetAudioBufferFrames`, which stages the size, runs the existing
+`ApplyAudioSettings` restart, resumes playback and raises `AudioDeviceRestarted` so an open
+Settings → Audio pane rebuilds.
+
+## Technical Context
+
+**Language/Version**: C# / .NET 10, Avalonia.
+
+**Primary Dependencies**: none new.
+
+**Audio-Thread Impact**: None. The readout reads negotiated values on the UI thread; a
+buffer change uses the same backend restart Settings already uses (polling suspended
+around `ApplyAudio`).
+
+**Testing**: `tests/Nota.SmokeTest/AudioFormatStatusTests.cs` (text, latency, size list,
+buffer owner); the design checks (labels, menus) scan the new view code; manual check in
+the running app.
+
+## Design
+
+- `Nota.Presentation/ViewModels/AudioFormatStatus.cs` — pure helpers: `Text(rate, frames)`,
+ `Latency(rate, frames)`, the shared `BufferSizes` list (Settings uses it too) and
+ `Owner(asioRunning, exclusiveRunning)` → `BufferOwner { Nota, Driver, Device }`.
+- `MainWindowViewModel` — `EngineInfo` built by `UpdateEngineInfo()` at start and after each
+ apply; `BufferOwner` from the active audio system and exclusive state;
+ `SetAudioBufferFrames(int)`.
+- `MainWindow.axaml` — `AudioFormatButton` (ghost, caption mono text bound to `EngineInfo`,
+ tooltip), beside `VersionButton`.
+- `MainWindow.AudioFormat.cs` — builds the flyout per click: caption, then sizes (radio,
+ latency as trailing value, disabled while recording) or the ASIO / exclusive alternative,
+ separator, Audio settings… (`ShowPreferencesPage("Audio")`).
+
+## Constitution Check
+
+UI-only, no engine change, no dependency, MenuKit conventions, sentence-case labels.
diff --git a/specs/061-status-bar-buffer/spec.md b/specs/061-status-bar-buffer/spec.md
new file mode 100644
index 00000000..dac72e0a
--- /dev/null
+++ b/specs/061-status-bar-buffer/spec.md
@@ -0,0 +1,120 @@
+# Feature Specification: Sample rate and buffer size in the status bar
+
+**Feature Branch**: `061-status-bar-buffer`
+
+**Created**: 2026-10-30
+
+**Status**: Implemented
+
+**Input**: GitHub issue nota-daw/nota#373: "See the current buffer size at a glance and
+easily change it if needed. Display the current sample rate and buffer size next to each
+other in the lower right status area. Make the indicator clickable, ideally showing a
+dropdown menu for changing the buffer size directly. Alternatively, clicking it could open
+the relevant audio settings section."
+
+## Nota Context
+
+**Feature area**:
+
+- [ ] Engine (C++, `src/native/nota.engine`)
+- [x] Managed app (C#, `src/managed/*`) — presentation view model
+- [x] UI (Avalonia) — follow `DESIGN.md` (Studio)
+- [ ] Plugin hosting
+- [ ] Build / packaging / CI
+- [ ] Docs only
+
+**Nota docs to keep in mind**: [`ARCHITECTURE.md`](../../ARCHITECTURE.md),
+[`CONTRIBUTING.md`](../../CONTRIBUTING.md), [`DESIGN.md`](../../DESIGN.md),
+[`FEATURES.md`](../../FEATURES.md).
+
+**Existing behaviour this builds on**: the status bar's right side shows the sample rate
+("48000 Hz") followed by the version button. Settings → Audio has a Buffer size combo
+(Device default, 64–2048 frames) that stages the size and restarts the backend through
+`MainWindowViewModel.ApplyAudioSettings`. Under ASIO the buffer is the driver's own setting
+(specs/049, FR-008); in WASAPI exclusive mode the device's native period is used.
+
+## User Scenarios & Testing
+
+### User Story 1 - See the audio format at a glance (Priority: P1)
+
+A producer wants to know what buffer the device runs at without opening Settings. The
+lower right corner reads "48 kHz · 256".
+
+**Independent Test**: Start Nota with a device running; the status bar shows the
+negotiated rate and buffer. Change the buffer in Settings → Audio; the readout follows.
+
+**Acceptance Scenarios**:
+
+1. **Given** a running device at 48 kHz and 256 frames, **Then** the status bar reads
+ "48 kHz · 256" beside the version.
+2. **Given** the buffer changes (Settings, the status bar menu, or the ASIO driver's own
+ panel), **Then** the readout shows the newly negotiated values.
+3. **Given** no audio output could be opened, **Then** the readout shows the rate alone.
+
+### User Story 2 - Change the buffer from the status bar (Priority: P1)
+
+While tracking, the producer hears crackles and wants a bigger buffer, or wants a smaller
+one for lower latency. A click on the readout opens a menu of buffer sizes.
+
+**Independent Test**: Click the readout, pick 512; the device restarts at 512, the readout
+shows it, and an open Settings → Audio pane shows 512 too.
+
+**Acceptance Scenarios**:
+
+1. **Given** shared-mode audio, **When** the user clicks the readout, **Then** a menu lists
+ Device default and 64, 128, 256, 512, 1024, 2048 — the staged one ticked, each size with
+ its latency at the current rate — and Audio settings… under them.
+2. **When** the user picks a size, **Then** it is saved as the audio setting, the backend
+ restarts on it and, if the transport was playing, playback continues from the same spot.
+3. **When** the user picks Audio settings…, **Then** Settings opens on the Audio page.
+4. **Given** the transport is recording, **Then** the sizes are disabled with a note to stop
+ recording first (a restart would end the take).
+
+### Edge Cases
+
+- **ASIO running**: the driver owns the buffer. The menu offers Driver settings… (its own
+ panel) instead of sizes; a change made there comes back as a reset and the readout updates.
+- **WASAPI exclusive mode**: the device's own buffer is used; the menu says so instead of
+ offering sizes.
+- **ASIO chosen but fallen back to WASAPI**: the sizes are offered (shared WASAPI runs).
+- **Picking the size already staged**: nothing restarts.
+
+## Requirements
+
+### Functional Requirements
+
+- **FR-001**: The status bar MUST show the negotiated sample rate and buffer size side by
+ side ("48 kHz · 256"), in the lower right, before the version.
+- **FR-002**: The readout MUST update whenever the audio backend is (re)applied.
+- **FR-003**: Clicking the readout MUST open a menu of the buffer sizes Settings → Audio
+ offers (one shared list), with the staged choice ticked and each size's latency.
+- **FR-004**: Picking a size MUST stage and persist it exactly as Settings does, apply it,
+ keep playback going, and refresh an open Settings → Audio pane.
+- **FR-005**: The menu MUST include Audio settings…, opening Settings on the Audio page.
+- **FR-006**: Under a running ASIO driver the menu MUST NOT offer sizes; it offers the
+ driver's settings panel. In WASAPI exclusive mode it MUST NOT offer sizes and says the
+ device's buffer is used.
+- **FR-007**: The menu MUST follow the Studio menu conventions (MenuKit, sentence case).
+
+## Success Criteria
+
+- **SC-001**: The buffer size is visible without opening any window.
+- **SC-002**: Changing the buffer takes two clicks (readout, size) instead of four or more
+ (menu, Settings, Audio, combo, choice).
+
+## Assumptions
+
+- Sample rate is shown but changed only in Settings; the issue asks for buffer changes.
+- The readout uses kHz with one optional decimal ("44.1 kHz") and the buffer in frames,
+ unitless; the tooltip names both.
+- No engine or C ABI change: the existing audio-config calls are reused.
+
+## Nota Compliance Checklist
+
+- [x] Every new source file carries the AGPL-3.0-only SPDX header
+- [x] No new dependency
+- [x] Audio-thread impact: none — UI and the existing apply path on the UI thread
+- [x] No new managed/native crossings
+- [x] Smoke-test impact: pure formatting/ownership logic covered by `AudioFormatStatusTests`
+- [x] User-visible change → `CHANGELOG.md` `[Unreleased]` entry and FEATURES.md
+- [x] UI change → follows `DESIGN.md` (ghost button like the version beside it, MenuKit menu)
diff --git a/specs/061-status-bar-buffer/tasks.md b/specs/061-status-bar-buffer/tasks.md
new file mode 100644
index 00000000..f57dd6b2
--- /dev/null
+++ b/specs/061-status-bar-buffer/tasks.md
@@ -0,0 +1,24 @@
+# Tasks: Sample rate and buffer size in the status bar
+
+**Input**: [spec.md](spec.md), [plan.md](plan.md)
+
+## Phase 1: Foundation
+
+- [x] T001 Add `AudioFormatStatus` (text, latency, shared buffer sizes, owner) in `src/managed/Nota.Presentation/ViewModels/AudioFormatStatus.cs`
+- [x] T002 Settings → Audio uses `AudioFormatStatus.BufferSizes` in `src/managed/Nota.App/PreferencesWindow.cs`
+
+## Phase 2: User Story 1 — see the audio format (P1)
+
+- [x] T003 `EngineInfo` reads "48 kHz · 256" at start and after every apply in `src/managed/Nota.Presentation/ViewModels/MainWindowViewModel.cs` (FR-001, FR-002)
+
+## Phase 3: User Story 2 — change the buffer (P1)
+
+- [x] T004 `BufferOwner` and `SetAudioBufferFrames` (stage, apply, resume playback, notify Settings) in `MainWindowViewModel.cs` (FR-004, FR-006)
+- [x] T005 Ghost `AudioFormatButton` with tooltip in `src/managed/Nota.App/MainWindow.axaml` (FR-001)
+- [x] T006 Buffer flyout in `src/managed/Nota.App/MainWindow.AudioFormat.cs`, wired in `MainWindow.axaml.cs` (FR-003, FR-005, FR-006, FR-007)
+
+## Phase 4: Polish
+
+- [x] T007 Smoke test `tests/Nota.SmokeTest/AudioFormatStatusTests.cs`, registered in `Program.cs`
+- [x] T008 `CHANGELOG.md` `[Unreleased]` and `FEATURES.md` entries
+- [x] T009 `scripts/build-linux.sh` passes (engine, managed, smoke test incl. design checks)
diff --git a/src/managed/Nota.App/MainWindow.AudioFormat.cs b/src/managed/Nota.App/MainWindow.AudioFormat.cs
new file mode 100644
index 00000000..173cbb2d
--- /dev/null
+++ b/src/managed/Nota.App/MainWindow.AudioFormat.cs
@@ -0,0 +1,63 @@
+// SPDX-License-Identifier: AGPL-3.0-only
+// Copyright (c) 2026 Egor Khindikaynen (Nota). See LICENSES/ for license terms.
+//
+// The status bar's sample rate · buffer size readout (#373, specs/061). A click opens the
+// buffer menu: the sizes Settings → Audio offers, each with its block latency, and Audio
+// settings… under them. Under ASIO the driver owns the buffer and WASAPI exclusive uses the
+// device's own period, so there the menu says so instead of offering sizes.
+
+using System.Collections.Generic;
+using Avalonia.Controls;
+using Nota.Presentation;
+
+namespace Nota.App;
+
+public partial class MainWindow
+{
+ private void SetUpAudioFormatButton()
+ {
+ AudioFormatButton.Click += (_, _) =>
+ {
+ if (_vm is null) return;
+ var flyout = new MenuFlyout { Placement = PlacementMode.TopEdgeAlignedRight };
+ foreach (var item in AudioFormatMenu(_vm)) flyout.Items.Add(item);
+ flyout.ShowAt(AudioFormatButton);
+ };
+ }
+
+ private Control[] AudioFormatMenu(MainWindowViewModel vm)
+ {
+ var engine = vm.Engine;
+ var items = new List<Control> { MenuKit.Caption("Buffer size") };
+ switch (vm.BufferOwner)
+ {
+ case BufferOwner.Driver:
+ items.Add(MenuKit.Item("Driver settings…", click: () => engine.OpenAsioControlPanel()));
+ items.Add(MenuKit.Caption("Set in the ASIO driver's settings"));
+ break;
+ case BufferOwner.Device:
+ items.Add(MenuKit.Caption("Exclusive mode uses the device's buffer"));
+ break;
+ default:
+ double rate = engine.NegotiatedSampleRate > 0 ? engine.NegotiatedSampleRate : engine.SampleRate;
+ int staged = engine.GetAudioConfig().BufferFrames;
+ bool recording = engine.IsRecording;
+ foreach (int frames in AudioFormatStatus.BufferSizes)
+ {
+ int size = frames;
+ var mi = MenuKit.Item(size == 0 ? "Device default" : size.ToString(),
+ click: () => { if (size != engine.GetAudioConfig().BufferFrames) vm.SetAudioBufferFrames(size); },
+ enabled: !recording);
+ mi.ToggleType = MenuItemToggleType.Radio;
+ mi.IsChecked = size == staged;
+ MenuKit.SetTrailing(mi, AudioFormatStatus.Latency(rate, size));
+ items.Add(mi);
+ }
+ if (recording) items.Add(MenuKit.Caption("Stop recording to change it"));
+ break;
+ }
+ items.Add(new Separator());
+ items.Add(MenuKit.Item("Audio settings…", GlyphKind.Levels, () => ShowPreferencesPage("Audio")));
+ return items.ToArray();
+ }
+}
diff --git a/src/managed/Nota.App/MainWindow.axaml b/src/managed/Nota.App/MainWindow.axaml
index 4ea2361b..8e02faa7 100644
--- a/src/managed/Nota.App/MainWindow.axaml
+++ b/src/managed/Nota.App/MainWindow.axaml
@@ -425,11 +425,15 @@
</StackPanel>
<!-- A newer Nota release: available / downloading / ready to install (MainWindow.Updates.cs). -->
<Panel x:Name="UpdateHost" Grid.Column="3" VerticalAlignment="Center"/>
- <TextBlock Grid.Column="4" Classes="Caption Mono"
- VerticalAlignment="Center" Text="{Binding EngineInfo}"/>
+ <!-- Sample rate · buffer size: opens the buffer menu (MainWindow.AudioFormat.cs, #373). -->
+ <Button x:Name="AudioFormatButton" Grid.Column="4" Classes="ghost"
+ VerticalAlignment="Center" Margin="0" Padding="6,1" MinHeight="0" Cursor="Hand"
+ ToolTip.Tip="Sample rate and buffer size. Click to change the buffer size">
+ <TextBlock Classes="Caption Mono" Text="{Binding EngineInfo}"/>
+ </Button>
<!-- The installed version: opens its release notes (What's New), never an update (#127). -->
<Button x:Name="VersionButton" Grid.Column="5" Classes="ghost"
- VerticalAlignment="Center" Margin="6,0,-6,0" Padding="6,1" MinHeight="0"
+ VerticalAlignment="Center" Margin="0,0,-6,0" Padding="6,1" MinHeight="0"
Cursor="Hand" ToolTip.Tip="View release notes">
<TextBlock x:Name="VersionText" Classes="Caption Mono"/>
</Button>
diff --git a/src/managed/Nota.App/MainWindow.axaml.cs b/src/managed/Nota.App/MainWindow.axaml.cs
index 94673f6e..d16160fe 100644
--- a/src/managed/Nota.App/MainWindow.axaml.cs
+++ b/src/managed/Nota.App/MainWindow.axaml.cs
@@ -550,6 +550,7 @@ public partial class MainWindow : Window
// Status bar: the installed version opens its release notes (#127).
VersionText.Text = $"v{AppInfo.Version}";
VersionButton.Click += (_, _) => ShowWhatsNew();
+ SetUpAudioFormatButton();
Closed += (_, _) => vm.Dispose();
SetUpCpuTip(vm.Engine);
diff --git a/src/managed/Nota.App/PreferencesWindow.cs b/src/managed/Nota.App/PreferencesWindow.cs
index 9a0c80b4..c7c887a7 100644
--- a/src/managed/Nota.App/PreferencesWindow.cs
+++ b/src/managed/Nota.App/PreferencesWindow.cs
@@ -91,7 +91,7 @@ public sealed partial class PreferencesWindow : NotaWindow
private readonly IGamepadService _gamepads = App.Services.GetRequiredService<IGamepadService>();
private static readonly double[] SampleRates = { 0, 44100, 48000, 88200, 96000 };
- private static readonly int[] BufferSizes = { 0, 64, 128, 256, 512, 1024, 2048 };
+ private static int[] BufferSizes => AudioFormatStatus.BufferSizes;
private readonly List<string> _outputUids = new();
private readonly List<string> _inputUids = new();
diff --git a/src/managed/Nota.Presentation/ViewModels/AudioFormatStatus.cs b/src/managed/Nota.Presentation/ViewModels/AudioFormatStatus.cs
new file mode 100644
index 00000000..105cf579
--- /dev/null
+++ b/src/managed/Nota.Presentation/ViewModels/AudioFormatStatus.cs
@@ -0,0 +1,51 @@
+// SPDX-License-Identifier: AGPL-3.0-only
+// Copyright (c) 2026 Egor Khindikaynen (Nota). See LICENSES/ for license terms.
+//
+// The status bar's audio format readout and buffer menu (#373, specs/061): "48 kHz · 256",
+// the buffer sizes Nota offers (shared with Settings → Audio), and who decides the buffer.
+
+using System.Globalization;
+
+namespace Nota.Presentation;
+
+/// <summary>Who sets the buffer size of the running device.</summary>
+public enum BufferOwner
+{
+ /// <summary>Nota asks for it (shared WASAPI, Core Audio, PulseAudio / ALSA).</summary>
+ Nota,
+ /// <summary>The ASIO driver, in its own settings panel.</summary>
+ Driver,
+ /// <summary>The device's native period (WASAPI exclusive mode).</summary>
+ Device,
+}
+
+public static class AudioFormatStatus
+{
+ /// <summary>Buffer sizes in frames; 0 is "device default".</summary>
+ public static readonly int[] BufferSizes = { 0, 64, 128, 256, 512, 1024, 2048 };
+
+ private const string Thin = "\u2009";
+
+ /// <summary>"48 kHz · 256" — the negotiated rate and block; just the rate while no
+ /// block is known (no device running).</summary>
+ public static string Text(double sampleRate, int bufferFrames)
+ {
+ string rate = (sampleRate / 1000).ToString("0.#", CultureInfo.InvariantCulture) + Thin + "kHz";
+ return bufferFrames > 0 ? $"{rate} · {bufferFrames}" : rate;
+ }
+
+ /// <summary>One block's latency, "5.3 ms"; empty when the rate is unknown.</summary>
+ public static string Latency(double sampleRate, int frames)
+ => sampleRate > 0 && frames > 0
+ ? (frames / sampleRate * 1000).ToString("0.0", CultureInfo.InvariantCulture) + Thin + "ms"
+ : "";
+
+ public static BufferOwner Owner(bool asioRunning, bool exclusiveRunning)
+ => asioRunning ? BufferOwner.Driver : exclusiveRunning ? BufferOwner.Device : BufferOwner.Nota;
+
+ /// <summary>WASAPI exclusive is what actually opened. A saved exclusive flag does not count
+ /// while ASIO is chosen (its fallback runs shared WASAPI) or after exclusive was refused.</summary>
+ public static bool ExclusiveIsRunning(bool windows, bool asioChosen, bool asioRunning,
+ bool exclusiveRequested, bool exclusiveRefused)
+ => windows && !asioChosen && !asioRunning && exclusiveRequested && !exclusiveRefused;
+}
diff --git a/src/managed/Nota.Presentation/ViewModels/MainWindowViewModel.cs b/src/managed/Nota.Presentation/ViewModels/MainWindowViewModel.cs
index e0fde1db..de8cc81f 100644
--- a/src/managed/Nota.Presentation/ViewModels/MainWindowViewModel.cs
+++ b/src/managed/Nota.Presentation/ViewModels/MainWindowViewModel.cs
@@ -32,8 +32,9 @@ public sealed partial class MainWindowViewModel : ObservableObject, IDisposable
/// <summary>Version history was just turned off in Settings: the window erases the open
/// project's history.</summary>
public event Action? VersionHistoryTurnedOff;
- /// <summary>The audio driver restarted (or fell back) on its own, after a device event:
- /// an open Settings ▸ Audio pane re-reads the driver's buffer, latency and channels.</summary>
+ /// <summary>The audio driver restarted (or fell back) on its own, after a device event, or
+ /// the status bar changed the buffer: an open Settings ▸ Audio pane re-reads the driver's
+ /// buffer, latency and channels.</summary>
public event Action? AudioDeviceRestarted;
/// <summary>Turns version history on or off and persists it. Turning it off (the caller has
@@ -82,7 +83,7 @@ public sealed partial class MainWindowViewModel : ObservableObject, IDisposable
catch (NotaEngineException ex) { _log.Error("The audio engine couldn't start", ex); }
Engine.SetBpm(120);
Engine.SetTimeSignature(4, 4);
- EngineInfo = $"{Engine.SampleRate:0}\u2009Hz";
+ UpdateEngineInfo();
_log.Info($"Engine started · {Engine.SampleRate:0}\u2009Hz");
if (NoAudioOutput is { } why) { _log.Warn(why); StatusText = why; }
else if (AsioFallbackStatus() is { } asio) { _log.Warn(asio); StatusText = asio; }
@@ -201,7 +202,7 @@ public sealed partial class MainWindowViewModel : ObservableObject, IDisposable
// it here, so Settings can say why — also when the apply waited for the driver's panel.
RefusedSampleRate = askedRate > 0 && Engine.ActiveAudioSystem == AudioSystem.Asio
&& Engine.GetAudioConfig().SampleRate == 0 ? askedRate : 0;
- EngineInfo = $"{Engine.SampleRate:0}\u2009Hz"; // the version sits beside it, as its own button (#127)
+ UpdateEngineInfo();
int buf = Engine.NegotiatedBufferFrames;
_log.Info($"Audio applied · {Engine.NegotiatedSampleRate:0}\u2009Hz · {buf} frames");
if (NoAudioOutput is { } why)
@@ -234,6 +235,44 @@ public sealed partial class MainWindowViewModel : ObservableObject, IDisposable
return StatusText;
}
+ private void UpdateEngineInfo()
+ {
+ double sr = Engine.NegotiatedSampleRate > 0 ? Engine.NegotiatedSampleRate : Engine.SampleRate;
+ // The silent stand-in (no output opened) is "running" but negotiated nothing.
+ EngineInfo = AudioFormatStatus.Text(sr, Engine.IsRunning && !Engine.AudioSilentFallback ? Engine.NegotiatedBufferFrames : 0);
+ }
+
+ /// <summary>Who sets the running device's buffer: Nota, the ASIO driver, or the device
+ /// itself in WASAPI exclusive mode. An ASIO start that fell back to WASAPI is shared mode,
+ /// even when exclusive is still saved.</summary>
+ public BufferOwner BufferOwner => AudioFormatStatus.Owner(
+ Engine.ActiveAudioSystem == AudioSystem.Asio,
+ AudioFormatStatus.ExclusiveIsRunning(
+ OperatingSystem.IsWindows(),
+ Engine.AudioSystem == AudioSystem.Asio,
+ Engine.ActiveAudioSystem == AudioSystem.Asio,
+ Engine.GetAudioConfig().WasapiExclusive,
+ Engine.AudioExclusiveFallback));
+
+ /// <summary>The status bar's buffer menu (#373): stage the size (0 = device default), restart
+ /// the backend on it, carry on playing from the same spot, and let an open Settings ▸ Audio
+ /// pane re-read it. A no-op while recording — the menu disables the sizes, and this guards a
+ /// take that started from elsewhere while the menu stayed open.</summary>
+ public void SetAudioBufferFrames(int frames)
+ {
+ if (Engine.IsRecording) return;
+ bool wasPlaying = Engine.IsPlaying;
+ double position = Engine.PositionBeats;
+ Engine.SetAudioBufferFrames(frames);
+ ApplyAudioSettings();
+ if (wasPlaying && Engine.IsRunning)
+ {
+ Engine.Seek(position);
+ Engine.Play();
+ }
+ AudioDeviceRestarted?.Invoke();
+ }
+
/// <summary>The ASIO driver chosen in Settings couldn't start and WASAPI runs instead
/// (FR-011): the status line naming the driver and the reason, else null.</summary>
public string? AsioFallbackStatus()
diff --git a/tests/Nota.SmokeTest/AudioFormatStatusTests.cs b/tests/Nota.SmokeTest/AudioFormatStatusTests.cs
new file mode 100644
index 00000000..c9ce30c2
--- /dev/null
+++ b/tests/Nota.SmokeTest/AudioFormatStatusTests.cs
@@ -0,0 +1,41 @@
+// SPDX-License-Identifier: AGPL-3.0-only
+// Copyright (c) 2026 Egor Khindikaynen (Nota). See LICENSES/ for license terms.
+//
+// Status bar audio format (#373, specs/061): the "48 kHz · 256" readout, the block latency
+// each buffer menu item shows, and who owns the buffer (Nota, the ASIO driver, or the device
+// in WASAPI exclusive mode).
+
+using Nota.Presentation;
+
+namespace Nota.SmokeTest;
+
+internal static class AudioFormatStatusTests
+{
+ public static IEnumerable<(bool Ok, string Label)> Run()
+ {
+ yield return (AudioFormatStatus.Text(48000, 256) == "48\u2009kHz · 256", "48 kHz at 256 frames reads \"48 kHz · 256\"");
+ yield return (AudioFormatStatus.Text(44100, 512) == "44.1\u2009kHz · 512", "44.1 kHz keeps its decimal");
+ yield return (AudioFormatStatus.Text(96000, 0) == "96\u2009kHz", "no running block shows the rate alone");
+
+ yield return (AudioFormatStatus.Latency(48000, 256) == "5.3\u2009ms", "256 frames at 48 kHz is 5.3 ms");
+ yield return (AudioFormatStatus.Latency(44100, 0) == "" && AudioFormatStatus.Latency(0, 256) == "",
+ "device default or an unknown rate shows no latency");
+
+ var sizes = AudioFormatStatus.BufferSizes;
+ yield return (sizes[0] == 0 && sizes.Skip(1).SequenceEqual(new[] { 64, 128, 256, 512, 1024, 2048 }),
+ "the menu offers device default, then 64 to 2048 frames");
+
+ yield return (AudioFormatStatus.Owner(false, false) == BufferOwner.Nota, "shared mode: Nota sets the buffer");
+ yield return (AudioFormatStatus.Owner(true, false) == BufferOwner.Driver, "ASIO: the driver sets the buffer");
+ yield return (AudioFormatStatus.Owner(false, true) == BufferOwner.Device, "WASAPI exclusive: the device sets the buffer");
+
+ yield return (AudioFormatStatus.ExclusiveIsRunning(true, false, false, true, false),
+ "WASAPI exclusive is running when it was requested and opened");
+ yield return (!AudioFormatStatus.ExclusiveIsRunning(true, true, false, true, false),
+ "an ASIO fallback to shared WASAPI is not exclusive, even if exclusive is saved");
+ yield return (!AudioFormatStatus.ExclusiveIsRunning(true, false, false, true, true),
+ "exclusive that the device refused is shared mode");
+ yield return (!AudioFormatStatus.ExclusiveIsRunning(false, false, false, true, false),
+ "exclusive mode does not exist off Windows");
+ }
+}
diff --git a/tests/Nota.SmokeTest/Program.cs b/tests/Nota.SmokeTest/Program.cs
index 92338131..d79a3baf 100644
--- a/tests/Nota.SmokeTest/Program.cs
+++ b/tests/Nota.SmokeTest/Program.cs
@@ -15260,6 +15260,9 @@ foreach (var (ok, label) in RenderPoolTests.Run()) Check(ok, label);
Console.WriteLine("-- tap tempo --");
foreach (var (ok, label) in TapTempoTests.Run()) Check(ok, label);
+Console.WriteLine("-- status bar audio format --");
+foreach (var (ok, label) in AudioFormatStatusTests.Run()) Check(ok, label);
+
Console.WriteLine("-- process cpu --");
foreach (var (ok, label) in ProcessCpuTests.Run()) Check(ok, label);