Commit bf456dd
committed
refactor: Centralize and improve audio processing and sample format conversions
Centralizes audio input and output processing into a single `ProcessAudio` method, addressing redundant logic and significantly improving the handling of various audio sample formats for both playback and capture.
- Introduced a `ProcessingDirection` enum to guide the central `ProcessAudio` method.
- Centralized buffer management and format conversion dispatch within `ProcessAudio`, leveraging `ArrayPool` for temporary buffers.
- Replaced previous format-specific conversion methods with generic `ConvertFloatTo<T>` and `ConvertFrom<T>` for common integer PCM (U8, S16, S32).
- Added specific `ConvertFloatToS24` and `ConvertFromS24` methods for 24-bit PCM.
- Added dithering to unsigned 8-bit (U8) input conversions for improved quality.
- Full support for converting various PCM formats (S16, S24, S32, U8) to/from internal float buffers for both audio input (capture) and output (playback).1 parent 3c7d8d2 commit bf456dd
1 file changed
Lines changed: 211 additions & 156 deletions
0 commit comments