Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

qtaudio: Add Qt 6 support #170

Merged
merged 2 commits into from
Sep 20, 2024

Conversation

radioactiveman
Copy link
Member

Draft status, still missing:

  • periodSize() is not available in Qt 6. What can we use instead?
  • How do we need to convert the audio data for signed/unsigned formats and endianess?

Qmmp uses:

#if Q_BYTE_ORDER == Q_BIG_ENDIAN
    if(format == Qmmp::PCM_S16LE)
        format = Qmmp::PCM_S16BE;
    else if(format == Qmmp::PCM_S32LE)
        format = Qmmp::PCM_S32BE;
#endif

From https://doc.qt.io/qt-6/qaudioformat.html#SampleFormat-enum:

Qt will always expect and use samples in the endianness of the host platform. When processing audio data from external sources yourself, ensure you convert them to the correct endianness before writing them to a QAudioSink or QAudioBuffer.

@jlindgren90, @kaniini: Could you please support here?

@jlindgren90
Copy link
Member

How do we need to convert the audio data for signed/unsigned formats and endianess?

I don't think the plugin needs to do any conversions. Just make open_audio return false for the non-native (byte-swapped) formats. Audacious core already tries to use the native formats IIRC.

Not sure about the period size thing. Generally I don't think Audacious core cares about the period size as long as period_wait works.

src/qtaudio/qtaudio.cc Outdated Show resolved Hide resolved
src/qtaudio/qtaudio.cc Outdated Show resolved Hide resolved
pthread_cond_timedwait() expects an absolute time.
@radioactiveman radioactiveman force-pushed the master branch 2 times, most recently from 05f5587 to f6eda3f Compare September 18, 2024 04:38
- Rename class to avoid namespace clash
- Remove usage of periodSize() which is Qt 5 specific
- Use NE formats, Qt 6 always uses the endianess of the host platform
@radioactiveman radioactiveman marked this pull request as ready for review September 19, 2024 21:22
@jlindgren90
Copy link
Member

Looks good. Thanks!

@jlindgren90 jlindgren90 merged commit d5b804c into audacious-media-player:master Sep 20, 2024
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants