Closed Dicklessgreat closed 2 months ago
Current error: looper.rs line 104
defmt::unwrap!(spawner.spawn(join(interface.start(), audio_callback_fut)));
mismatched types
expected struct `embassy_executor::SpawnToken<_>`
found struct `embassy_futures::join::Join<impl core::future::Future<Output = !>, {async block@examples/looper.rs:56:30: 92:6}>`
One solution is to create an embassy_executor::task
function that takes Interface
as an argument, but it fails because the ZeroCopy
field in Interface
prevent to Send
it to the task. Therefore, the audio callback mechanism must be re-implement.
Now I added impl FnMut(&[u32], &mut [u32])
as an argument to the Interface::start()
.
So we can start audio callback like:
interface
.start(|input, output| {
output.copy_from_slice(input);
})
.await;
(from passthrough example)
All examples works fine.
@kalkyl How do you think this audio callback interfaces?
Another idea I have is to make methods like fn get_stereo(&mut self, buffer: &mut [u32])
and fn set_stereo(&mut self, buffer: &[u32])
in Interface
.
I merged this pull request as I want to move on to the next changes, but if anyone has any ideas regarding the audio callback, please feel free to comment here at any time. I'd love to hear your thoughts.
From https://github.com/Dicklessgreat/daisy_embassy/pull/10#issuecomment-2268528418
The recorder example stuck because of the problems with the SD card implementation, so let's just try the
InterruptExecutor
with looper example here.