26 f.setSampleRate(ep->sampleRate);
30 auto qrcFile = std::make_unique<QFile>(u
':' +
url.
path());
48 memset(
buf, 0, channels * nframes *
sizeof(
float));
70 qDebug() <<
"underrun" << frames <<
"frames when loading" <<
url;
71 memset(ff, 0, frames * channels *
sizeof(
float));
72 ff += frames * channels;
90void QAmbientSoundPrivate::bufferReady()
100void QAmbientSoundPrivate::finished()
201 if (oldLoops !=
loops)
261 ep->removeStereoSound(
this);
268 ep->addStereoSound(
this);
283#include "moc_qambientsound.cpp"
std::unique_ptr< QAudioDecoder > decoder
QAtomicInteger< bool > m_playing
QAtomicInteger< bool > m_autoPlay
void getBuffer(float *buf, int frames, int channels)
std::unique_ptr< QFile > sourceDeviceFile
void setAutoPlay(bool autoPlay)
QAmbientSound(QAudioEngine *engine)
Creates a stereo sound source for engine.
void pause()
Pauses sound playback.
void play()
Starts playing back the sound.
QAudioEngine * engine() const
Returns the engine associated with this sound.
int loops
Determines how many times the sound is played before the player stops.
float volume
Defines the volume of the sound.
bool autoPlay
Determines whether the sound should automatically start playing when a source gets specified.
void setSource(const QUrl &url)
QUrl source
The source file for the sound to be played.
void stop()
Stops sound playback and resets the current position and current loop count to 0.
void setVolume(float volume)
const T * constData() const
Returns a pointer to this buffer's data.
The QAudioDecoder class implements decoding audio.
void bufferReady()
Signals that a new decoded audio buffer is available to be read.
void finished()
Signals that the decoding has finished successfully.
static QAudioEnginePrivate * get(QAudioEngine *engine)
T fetchAndStoreRelaxed(T newValue) noexcept
T loadRelaxed() const noexcept
static QMetaObject::Connection connect(const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection)
\threadsafe
int compare(const QString &s, Qt::CaseSensitivity cs=Qt::CaseSensitive) const noexcept
QString scheme() const
Returns the scheme of the URL.
QString path(ComponentFormattingOptions options=FullyDecoded) const
Returns the path of the URL.
Combined button and popup list for selecting options.
constexpr const T & qMin(const T &a, const T &b)
GLboolean GLboolean GLboolean b
GLuint const GLuint * buffers
GLenum GLuint GLenum GLsizei const GLchar * buf
QUrl url("example.com")
[constructor-url-reference]