Skip to content

Conversation

@finger563
Copy link
Contributor

@finger563 finger563 commented Oct 28, 2025

Description

  • Don't block in play_audio
  • Use proper storage type when applying volume scaling
  • Remove audio callbacks for now
  • Always play the full buffer, even if we received less than a full buffer

Motivation and Context

Improves the audio quality and throughput, and allows you to trigger audio to play while audio is playing - overriding the rest of the currently playing audio

How has this been tested?

Build and run t-deck/example on a t-deck and ensure the audio clicks play (better) now when touching the screen

Screenshots (if appropriate, e.g. schematic, board, console logs, lab pictures):

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation Update
  • Hardware (schematic, board, system design) change
  • Software change

Checklist:

  • My change requires a change to the documentation.
  • I have added / updated the documentation related to this change via either README or WIKI

Software

  • I have added tests to cover my changes.
  • I have updated the .github/workflows/build.yml file to add my new test to the automated cloud build github action.
  • All new and existing tests passed.
  • My code follows the code style of this project.

Copilot AI review requested due to automatic review settings October 28, 2025 13:59
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR refactors the audio handling system for the T-Deck component by removing callback-based synchronization in favor of a simpler streaming approach, and improves audio volume scaling to prevent overflow.

Key changes:

  • Removed ISR-based callback mechanism and task notification synchronization for audio playback
  • Fixed potential integer overflow in volume scaling by using int32_t intermediate calculation and clamping
  • Simplified the audio transmission by writing the full buffer size instead of variable available bytes

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
components/t-deck/src/audio.cpp Removed callback registration, task notification logic, and improved volume scaling with overflow protection
components/t-deck/include/t-deck.hpp Removed unused callback structure and atomic has_sound flag from class members

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@finger563 finger563 self-assigned this Oct 28, 2025
@finger563 finger563 added enhancement New feature or request t-deck audio labels Oct 28, 2025
@github-actions
Copy link

✅Static analysis result - no issues found! ✅

@finger563 finger563 merged commit 9c4532e into main Oct 28, 2025
98 of 100 checks passed
@finger563 finger563 deleted the feat/t-deck-audio-improvements branch October 28, 2025 15:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

audio enhancement New feature or request t-deck

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants