diff options
| author | jacqueline <me@jacqueline.id.au> | 2023-06-06 10:20:46 +1000 |
|---|---|---|
| committer | jacqueline <me@jacqueline.id.au> | 2023-06-06 10:20:46 +1000 |
| commit | 8a2a2d226558d099243eea0aa9ae22b2791e0e0e (patch) | |
| tree | 16c3defdb167ea7f452e5ce96118b165acf6602f /src/audio/audio_fsm.cpp | |
| parent | ee5f662f9bb150138545ca35ef5c4896eb74daea (diff) | |
| download | tangara-fw-8a2a2d226558d099243eea0aa9ae22b2791e0e0e.tar.gz | |
Get basic audio playback going again
Diffstat (limited to 'src/audio/audio_fsm.cpp')
| -rw-r--r-- | src/audio/audio_fsm.cpp | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/src/audio/audio_fsm.cpp b/src/audio/audio_fsm.cpp index a1bb956f..9c7af6fe 100644 --- a/src/audio/audio_fsm.cpp +++ b/src/audio/audio_fsm.cpp @@ -29,29 +29,29 @@ auto AudioState::Init(drivers::GpioExpander* gpio_expander, sGpioExpander = gpio_expander; sDac = dac; sDatabase = database; -} -namespace states { + sFileSource.reset(new FatfsAudioInput()); + sI2SOutput.reset(new I2SAudioOutput(sGpioExpander, sDac)); -void Uninitialised::react(const system_fsm::BootComplete&) { - transit<Standby>([&]() { - sFileSource.reset(new FatfsAudioInput()); - sI2SOutput.reset(new I2SAudioOutput(sGpioExpander, sDac)); + // Perform initial pipeline configuration. + // TODO(jacqueline): Factor this out once we have any kind of dynamic + // reconfiguration. + AudioDecoder* codec = new AudioDecoder(); + sPipeline.emplace_back(codec); - // Perform initial pipeline configuration. - // TODO(jacqueline): Factor this out once we have any kind of dynamic - // reconfiguration. - AudioDecoder* codec = new AudioDecoder(); - sPipeline.emplace_back(codec); + Pipeline* pipeline = new Pipeline(sPipeline.front().get()); + pipeline->AddInput(sFileSource.get()); - Pipeline* pipeline = new Pipeline(sPipeline.front().get()); - pipeline->AddInput(sFileSource.get()); + task::StartPipeline(pipeline, sI2SOutput.get()); +} - task::StartPipeline(pipeline, sI2SOutput.get()); - }); +namespace states { + +void Uninitialised::react(const system_fsm::BootComplete&) { + transit<Standby>(); } -void Standby::react(const PlayFile &ev) { +void Standby::react(const PlayFile& ev) { if (sFileSource->OpenFile(ev.filename)) { transit<Playback>(); } |
