HEnquist / camilladsp

A flexible cross-platform IIR and FIR engine for crossovers, room correction etc.
https://henquist.github.io/
GNU General Public License v3.0
505 stars 48 forks source link

Add armv6 build #298

Closed benjmarshall closed 9 months ago

benjmarshall commented 11 months ago

This Pull Request adds a build for ARMv6 for use on Raspberry Pi Zero , Zero 2 etc.

I have this running on a Zero W board here and it seems to be stable. It's also passing your tests using the CI Test workflow.

I hope you will consider merging this to add ARMv6 builds as part of your standard release, thanks!

benjmarshall commented 11 months ago

I have made this a draft pending further conversation on #294.

HEnquist commented 11 months ago

This is a useful addition, but these things in master branch are quite outdated and uses the unmaintained actions-rs . I'm not planning any further releases of the 1.x series. Instead I have updated the actions in the next20 branch, which is for the upcoming v2.0 release. Would you consider updating this the same way, and make the PR to that branch instead?

benjmarshall commented 9 months ago

Hi @HEnquist, I have updated this PR to point to the next20 branch and have rebased my commits against that branch. Initial tests show the addition of the ARMv6 build is still OK.

I have been testing this a little locally and have seen an issue though. I don't think this is ARMv6 specific but it would be god to confirm that. I first built a version against the next20 branch I had from a previous git clone. This will have been a month out of date but builds to give me a version of 2.0.0-alpha1. This executable seem to work fine on my test system which uses alsa_cdsp. I then updated with the latest changes from next20 which builds to a version of 2.0.0-alpha2. This executable seems to not work for rate changes. I can play audio through it as long as the rate of the audio matches the starting rate of camilladsp but if i then try to change the input stream to a different rate I can see from the logs that cammilladsp restarts in a loop, each time thinking it has hit the end of the input file (see logs below). Did something change between alpha1 and alpha 2 which might cause this?

...
Sep 13 09:39:42 Office-sb squeezelite[7318]: 2023-09-13 08:39:40.638129 DEBUG [src/bin.rs:1044] Restarting with new config
Sep 13 09:39:42 Office-sb squeezelite[7318]: 2023-09-13 08:39:40.638393 DEBUG [src/bin.rs:990] Wait for config
Sep 13 09:39:42 Office-sb squeezelite[7318]: 2023-09-13 08:39:40.638661 DEBUG [src/bin.rs:995] New config is available and there are no queued commands, continuing
Sep 13 09:39:42 Office-sb squeezelite[7318]: 2023-09-13 08:39:40.638927 DEBUG [src/bin.rs:1028] Config ready, start processing
Sep 13 09:39:42 Office-sb squeezelite[7318]: 2023-09-13 08:39:40.639588 DEBUG [src/bin.rs:169] Using channels [true, true]
Sep 13 09:39:42 Office-sb squeezelite[7318]: 2023-09-13 08:39:40.640608 DEBUG [src/filters.rs:464] Build new pipeline
Sep 13 09:39:42 Office-sb squeezelite[7318]: 2023-09-13 08:39:40.640910 DEBUG [src/processing.rs:19] build filters, waiting to start processing loop
Sep 13 09:39:42 Office-sb squeezelite[7318]: 2023-09-13 08:39:40.735226 DEBUG [src/alsadevice.rs:334] Available Playback devices: [("hw:DSD256,0,0", "E1DA #9038D PCM32/384 DSD256, USB Audio, subdevice #0"), ("null", "Discard all samples (playback) or generate zero samples (capture)"), ("hw:CARD=DSD256,DEV=0", "E1DA #9038D PCM32/384 DSD256, USB Audio\nDirect hardware device without any conversions"), ("plughw:CARD=DSD256,DEV=0", "E1DA #9038D PCM32/384 DSD256, USB Audio\nHardware device with all software conversions"), ("sysdefault:CARD=DSD256", "E1DA #9038D PCM32/384 DSD256, USB Audio\nDefault Audio Device"), ("front:CARD=DSD256,DEV=0", "E1DA #9038D PCM32/384 DSD256, USB Audio\nFront output / input"), ("surround21:CARD=DSD256,DEV=0", "E1DA #9038D PCM32/384 DSD256, USB Audio\n2.1 Surround output to Front and Subwoofer speakers"), ("surround40:CARD=DSD256,DEV=0", "E1DA #9038D PCM32/384 DSD256, USB Audio\n4.0 Surround output to Front and Rear speakers"), ("surround41:CARD=DSD256,DEV=0", "E1DA #9038D PCM32/384 DSD256, USB Audio\n4.1 Surround output to Front, Rear and Subwoofer speakers"), ("surround50:CARD=DSD256,DEV=0", "E1DA #9038D PCM32/384 DSD256, USB Audio\n5.0 Surround output to Front, Center and Rear speakers"), ("surround51:CARD=DSD256,DEV=0", "E1DA #9038D PCM32/384 DSD256, USB Audio\n5.1 Surround output to Front, Center, Rear and Subwoofer speakers"), ("surround71:CARD=DSD256,DEV=0", "E1DA #9038D PCM32/384 DSD256, USB Audio\n7.1 Surround output to Front, Center, Side, Rear and Woofer speakers"), ("iec958:CARD=DSD256,DEV=0", "E1DA #9038D PCM32/384 DSD256, USB Audio\nIEC958 (S/PDIF) Digital Audio Output"), ("dmix:CARD=DSD256,DEV=0", "E1DA #9038D PCM32/384 DSD256, USB Audio\nDirect sample mixing device")]
Sep 13 09:39:42 Office-sb squeezelite[7318]: 2023-09-13 08:39:40.739723 DEBUG [src/alsadevice.rs:352] Playback: supported channels, min: 2, max: 2, list: [2]
Sep 13 09:39:42 Office-sb squeezelite[7318]: 2023-09-13 08:39:40.740038 DEBUG [src/alsadevice.rs:353] Playback: setting channels to 2
Sep 13 09:39:42 Office-sb squeezelite[7318]: 2023-09-13 08:39:40.740682 DEBUG [src/alsadevice.rs:357] Playback: supported samplerates: Discrete([44100, 48000, 88200, 96000, 176400, 192000, 352800, 384000])
Sep 13 09:39:42 Office-sb squeezelite[7318]: 2023-09-13 08:39:40.740965 DEBUG [src/alsadevice.rs:358] Playback: setting rate to 96000
Sep 13 09:39:42 Office-sb squeezelite[7318]: 2023-09-13 08:39:40.741355 DEBUG [src/alsadevice.rs:362] Playback: supported sample formats: [S16LE, S24LE3, S32LE]
Sep 13 09:39:42 Office-sb squeezelite[7318]: 2023-09-13 08:39:40.741645 DEBUG [src/alsadevice.rs:363] Playback: setting format to S32LE
Sep 13 09:39:42 Office-sb squeezelite[7318]: 2023-09-13 08:39:40.742030 DEBUG [src/alsadevice_buffermanager.rs:43] Setting buffer size to 4096 frames
Sep 13 09:39:42 Office-sb squeezelite[7318]: 2023-09-13 08:39:40.742414 DEBUG [src/alsadevice_buffermanager.rs:57] Device is using a buffer size of 4096 frames
Sep 13 09:39:42 Office-sb squeezelite[7318]: 2023-09-13 08:39:40.742705 DEBUG [src/alsadevice_buffermanager.rs:65] Setting period size to 512 frames
Sep 13 09:39:42 Office-sb squeezelite[7318]: 2023-09-13 08:39:40.745527 DEBUG [src/alsadevice.rs:387] Opening Playback device "hw:CARD=DSD256,DEV=0" with parameters: HwParams { channels: Ok(2), rate: "Ok(96000) Hz", format: Ok(S32LE), access: Ok(RWInterleaved), period_size: "Ok(512) frames", buffer_size: "Ok(4096) frames" }, SwParams(avail_min: Ok(2048) frames, start_threshold: Ok(1) frames, stop_threshold: Ok(4096) frames)
Sep 13 09:39:42 Office-sb squeezelite[7318]: 2023-09-13 08:39:40.745978 DEBUG [src/alsadevice.rs:392] Playback device "hw:CARD=DSD256,DEV=0" successfully opened
Sep 13 09:39:42 Office-sb squeezelite[7318]: 2023-09-13 08:39:40.746656 DEBUG [src/bin.rs:277] Playback thread ready to start
Sep 13 09:39:42 Office-sb squeezelite[7318]: 2023-09-13 08:39:40.746972 DEBUG [src/bin.rs:287] Capture thread ready to start
Sep 13 09:39:42 Office-sb squeezelite[7318]: 2023-09-13 08:39:40.747253 DEBUG [src/bin.rs:290] Both capture and playback ready, release barrier
Sep 13 09:39:42 Office-sb squeezelite[7318]: 2023-09-13 08:39:40.747558 DEBUG [src/bin.rs:292] Supervisor loop starts now!
Sep 13 09:39:42 Office-sb squeezelite[7318]: 2023-09-13 08:39:40.748206 DEBUG [src/processing.rs:21] Processing loop starts now!
Sep 13 09:39:42 Office-sb squeezelite[7318]: 2023-09-13 08:39:40.748585 DEBUG [src/alsadevice.rs:951] Starting playback loop
Sep 13 09:39:42 Office-sb squeezelite[7318]: 2023-09-13 08:39:40.748883 DEBUG [src/alsadevice.rs:415] Playback loop uses a buffer of 2048 frames
Sep 13 09:39:42 Office-sb squeezelite[7318]: 2023-09-13 08:39:40.749902 DEBUG [src/filedevice.rs:641] starting captureloop
Sep 13 09:39:42 Office-sb squeezelite[7318]: 2023-09-13 08:39:40.750208 DEBUG [src/filedevice.rs:261] starting captureloop
Sep 13 09:39:42 Office-sb squeezelite[7318]: 2023-09-13 08:39:40.750605 DEBUG [src/filedevice.rs:361] Reached end of file
Sep 13 09:39:42 Office-sb squeezelite[7318]: 2023-09-13 08:39:40.751303 INFO [src/bin.rs:390] Capture finished
Sep 13 09:39:42 Office-sb squeezelite[7318]: 2023-09-13 08:39:40.753170 INFO [src/bin.rs:378] Playback finished
Sep 13 09:39:42 Office-sb squeezelite[7318]: 2023-09-13 08:39:40.753536 DEBUG [src/bin.rs:1030] Processing ended with status Ok(Restart)
... Restart loop here ...
Sep 13 09:39:42 Office-sb squeezelite[7318]: 2023-09-13 08:39:40.753823 DEBUG [src/bin.rs:1044] Restarting with new config
Sep 13 09:39:42 Office-sb squeezelite[7318]: 2023-09-13 08:39:40.754090 DEBUG [src/bin.rs:990] Wait for config
Sep 13 09:39:42 Office-sb squeezelite[7318]: 2023-09-13 08:39:40.754360 DEBUG [src/bin.rs:995] New config is available and there are no queued commands, continuing
Sep 13 09:39:42 Office-sb squeezelite[7318]: 2023-09-13 08:39:40.754624 DEBUG [src/bin.rs:1028] Config ready, start processing
Sep 13 09:39:42 Office-sb squeezelite[7318]: 2023-09-13 08:39:40.755278 DEBUG [src/bin.rs:169] Using channels [true, true]
... continues ...

Config for reference:

devices:
  samplerate: 44100
  chunksize: 1024
  enable_rate_adjust: false
  queuelimit: 1
  capture:
    type: Stdin
    channels: 2
    format: S32LE
    extra_samples: 8192
  playback:
    type: ALSA
    channels: 2
    device: "hw:CARD=DSD256,DEV=0"
    format: S32LE
HEnquist commented 9 months ago

There have been some large changes in the config reloading mechanism. You previous alpha1 was probably from before that. I'll check to make sure it still behaves as it should when reaching EOF, that might not have been tested until now.

HEnquist commented 9 months ago

The looping at the end was fixed by fc2fcf4afe62cd364593cc37f598542d3743f030

I found a small thing to fix (see comment) but apart from that I think this is ready. Do you agree? Then just remove the draft status :)

benjmarshall commented 9 months ago

I will try and test locally with your latest changes. Assuming the looping is gone and all seems stable running in my system then I'll remove the draft status and I think it will be ready.

benjmarshall commented 9 months ago

Found some time to test this straight away and the fix is working perfectly. Running beautifully on my RPi Zero W right now. Will remove the daft status and I'm happy for you to merge when you like.

HEnquist commented 9 months ago

Thanks for updating, and for testing the looping fix!