swift
Loading...
Searching...
No Matches
notificationplayer.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (C) 2019 swift Project Community / Contributors
2// SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-swift-pilot-client-1
3
5
6#ifndef SWIFT_SOUND_NOTIFICATIONPLAYER_H
7#define SWIFT_SOUND_NOTIFICATIONPLAYER_H
8
9#include <QHash>
10#include <QObject>
11#include <QPointer>
12#include <QSoundEffect>
13
16
17namespace swift::sound
18{
21 {
23
24 public:
27
29 ~CNotificationPlayer() override = default;
30
32 void play(swift::misc::audio::CNotificationSounds::NotificationFlag notification, int volume = 100);
33
35 void updateDirectory(const QString &directory);
36
37 private:
39 QString m_directory;
40 QPointer<QSoundEffect> m_playingEffect;
41 int m_playingEffectCounter = 0;
42
44 void onPlayingChanged();
45
47 void updateEffect(swift::misc::audio::CNotificationSounds::NotificationFlag f, const QString &directory,
48 const QString &name);
49 };
50} // namespace swift::sound
51
52#endif // SWIFT_SOUND_NOTIFICATIONPLAYER_H
~CNotificationPlayer()=default
Destructor.
CNotificationPlayer(QObject *parent=nullptr)
Constructor.
void updateDirectory(const QString &directory)
Update the directory.
void play(swift::misc::audio::CNotificationSounds::NotificationFlag notification, int volume=100)
Play notification sound.
QObject(QObject *parent)
Q_OBJECTQ_OBJECT
QObject * parent() const const
#define SWIFT_SOUND_EXPORT
Export a class or function from the library.