File indexing completed on 2022-09-27 14:35:06

0001 /*
0002  * KMix -- KDE's full featured mini mixer
0003  *
0004  * Copyright (C) 2021 Jonathan Marten <jjm@keelhaul.me.uk>
0005  *
0006  * This program is free software; you can redistribute it and/or
0007  * modify it under the terms of the GNU Library General Public
0008  * License as published by the Free Software Foundation; either
0009  * version 2 of the License, or (at your option) any later version.
0010  *
0011  * This program is distributed in the hope that it will be useful,
0012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
0013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0014  * Library General Public License for more details.
0015  *
0016  * You should have received a copy of the GNU Library General Public
0017  * License along with this program; if not, see
0018  * <https://www.gnu.org/licenses>.
0019  */
0020 
0021 #ifndef VOLUMEFEEDBACK_H
0022 #define VOLUMEFEEDBACK_H
0023 
0024 
0025 #include <qobject.h>
0026 
0027 #include "core/ControlManager.h"
0028 
0029 
0030 class QTimer;
0031 class ca_context;
0032 
0033 
0034 class VolumeFeedback : public QObject
0035 {
0036     Q_OBJECT
0037 
0038 public:
0039     static VolumeFeedback *instance();
0040     void init();
0041 
0042 public Q_SLOTS:
0043     void controlsChange(ControlManager::ChangeType changeType);
0044 
0045 private:
0046     VolumeFeedback();
0047     virtual ~VolumeFeedback();
0048 
0049     void volumeChanged();
0050     void masterChanged();
0051 
0052 private Q_SLOTS:
0053     void slotPlayFeedback();
0054 
0055 private:
0056     QString m_currentMaster;
0057     int m_currentVolume;
0058     QTimer *m_feedbackTimer;
0059     bool m_veryFirstTime;
0060 
0061     ca_context *m_ccontext;
0062 };
0063 
0064 #endif                          // VOLUMEFEEDBACK_H