swift
src
sound
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
14
#include "
misc/audio/notificationsounds.h
"
15
#include "
sound/swiftsoundexport.h
"
16
17
namespace
swift::sound
18
{
20
class
SWIFT_SOUND_EXPORT
CNotificationPlayer
:
public
QObject
21
{
22
Q_OBJECT
23
24
public
:
26
CNotificationPlayer
(QObject *parent =
nullptr
);
27
29
virtual
~CNotificationPlayer
()
override
{}
30
32
void
play(
swift::misc::audio::CNotificationSounds::NotificationFlag
notification,
int
volume = 100);
33
35
void
updateDirectory(
const
QString &directory);
36
37
private
:
38
QHash<swift::misc::audio::CNotificationSounds::NotificationFlag, QSoundEffect *>
m_effects;
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
QHash< swift::misc::audio::CNotificationSounds::NotificationFlag, QSoundEffect * >
swift::sound::CNotificationPlayer
Player for notification sounds.
Definition:
notificationplayer.h:21
swift::sound::CNotificationPlayer::~CNotificationPlayer
virtual ~CNotificationPlayer()
Destructor.
Definition:
notificationplayer.h:29
notificationsounds.h
swift::misc::audio::CNotificationSounds::NotificationFlag
NotificationFlag
Play notification.
Definition:
notificationsounds.h:24
swiftsoundexport.h
SWIFT_SOUND_EXPORT
#define SWIFT_SOUND_EXPORT
Export a class or function from the library.
Definition:
swiftsoundexport.h:20
Generated on Mon Mar 24 2025 16:42:23 for swift by
1.9.1