Add a sound recorder that writes several devices to one Opus file

nonemm-recorder is a separate program (src/Nonemm.Recorder.App) over a
library (src/Nonemm.Recorder). Each row in its list is one channel of one
device, and each row becomes one channel in an Ogg Opus file: 60 ms frames,
complexity 9, 32 kbps per channel by default.

- A device that is not connected keeps its row, in red, and writes silence.
  It is recorded from the moment it returns, also during a recording.
- Output devices are recorded as loopback: WASAPI on Windows, the
  "Monitor of" sources on PulseAudio and PipeWire.
- A headphone button plays one channel, in mono, on the default device.
- The rows, bitrate and folder are saved when the window closes.

SoundFlow 1.4.2 numbers its backend enum one higher than the miniaudio it
ships, so asking for PulseAudio gave ALSA and Wasapi gave DirectSound.
SoundFlowBackend lowers the value by one and checks which backend started.

Output devices and live capture are not tested on real hardware. The
tests use a fake sound system and decode the written file.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-23 23:47:45 +00:00
co-authored by Claude Sonnet 5.5
parent c18d79ba5a
commit c01032a2cc
35 changed files with 2278 additions and 0 deletions
@@ -0,0 +1,24 @@
namespace Nonemm.Recorder.Tests;
public class ChannelSourceTests
{
[Theory]
[InlineData("Microphone", false, 0, 1, "Microphone")]
[InlineData("Line In", false, 0, 2, "Line In L")]
[InlineData("Line In", false, 1, 2, "Line In R")]
[InlineData("Interface", false, 2, 8, "Interface 3")]
[InlineData("Speakers", true, 1, 2, "Speakers (output) R")]
public void The_label_names_the_device_and_the_channel(string device, bool isOutput, int channel, int count, string label)
{
Assert.Equal(label, new ChannelSource(device, isOutput, channel, count).Label);
}
[Fact]
public void An_input_and_an_output_with_the_same_name_are_different_channels()
{
ChannelSource input = new("USB", false, 0, 2);
ChannelSource output = new("USB", true, 0, 2);
Assert.False(input.IsSameChannel(output));
}
}