Skip to content

**Bug: Linux/ALSA audio thread discards all samples due to missing clip() call (comma operator misuse)** #427

Description

@MichailTalReborn

On Linux, the ALSA audio thread in olcPGEX_Sound.h produces no meaningful audio output. All samples are silently discarded and replaced with a constant maximum value (32767), resulting in a DC signal being sent to the audio device. The symptom is complete silence or very faint intermittent artifacts, regardless of what the user synth function returns.

To fix that issue, in olcPGEX_Sound.h, replace:

nNewSample =
(short)(GetMixerOutput(c, m_fGlobalTime + fTimeStep * (float)n,
fTimeStep),
1.0) *
fMaxSample;

with:

nNewSample =
(short)(clip(GetMixerOutput(c, m_fGlobalTime + fTimeStep * (float)n,
fTimeStep),
1.0) *
fMaxSample);

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions