[Interest] Qt6 porting guidance: QSound? QAudioFormat: endian, codec?

Doris Verria doris.verria at qt.io
Wed Jul 7 22:17:26 CEST 2021


Hi, 

You can play sounds using QSoundEffect, which replaces QSound. If low-latency is not important, you can always use QMediaPlayer.
QSoundEffect currently supports PCM audio only, more specifically, the WAV format.

QAudioFormat now always expects samples in the host endianness, so you will need to convert the samples if they are in a 
different byte order than that of the host platform. 

QAudioFormat supports PCM audio formats only, so there's no need to 
set the codec. You can still specify the channel count, sample rate, and the sample format (it supports 8bit unsigned, 16 and 32bit 
signed Int, as well as floating point formats).

For an overview of Multimedia in Qt6, have a look at this blog post from Lars:
https://www.qt.io/blog/qt-multimedia-in-qt-6


Best regards,
Doris



On 7.7.21, 9:26 PM, "Interest on behalf of David M. Cotter" <interest-bounces at qt-project.org on behalf of dave at kjams.com> wrote:

    requires mac/windows solution (no need for ios/android/linux)

    how do i "just play a sound" ? 
    seems QSound is gone?

    how does one specify endian format of a PCM stream?
    format.setByteOrder() is gone?

    how does one specify that the stream is in fact PCM?
    format.setCodec() is gone?


    _______________________________________________
    Interest mailing list
    Interest at qt-project.org
    https://lists.qt-project.org/listinfo/interest



More information about the Interest mailing list