Qt Quick provides the SoundEffect type to play short sound effects with minimum latency. This is especially good for things such as button click sounds, virtual keyboard sounds, and alert tones as part of a rich and engaging multimedia experience. Using it is straightforward; you provide the type with a source field and call its play method to start the playback, as follows:
import QtQuick 2.12
import QtQuick.Window 2.12
import QtMultimedia 5.12
Window {
visible: true
width: 320
height: 240
title: qsTr("Play Sound")
Text {
text: "Click Me!";
font.pointSize: 24;
width: 150; height: 50;
SoundEffect {
id: playSound
source: "soundeffect.wav"
}
MouseArea {
id: playArea
anchors.fill: parent
onPressed: { playSound...