Subversion Repositories tpanel

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
71 andreas 1
/*
2
 * Copyright (C) 2020, 2021 by Andreas Theofilu <andreas@theosys.at>
3
 *
4
 * This program is free software; you can redistribute it and/or modify
5
 * it under the terms of the GNU General Public License as published by
6
 * the Free Software Foundation; either version 3 of the License, or
7
 * (at your option) any later version.
8
 *
9
 * This program is distributed in the hope that it will be useful,
10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12
 * GNU General Public License for more details.
13
 *
14
 * You should have received a copy of the GNU General Public License
15
 * along with this program; if not, write to the Free Software Foundation,
16
 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA
17
 */
18
 
19
#ifndef __TSYSTEMSOUND_H__
20
#define __TSYSTEMSOUND_H__
21
 
22
#include <string>
23
#include <vector>
24
 
25
class TSystemSound
26
{
27
    public:
28
        TSystemSound(const std::string& path);
29
        ~TSystemSound();
30
 
31
        /**
32
         * Determines the currently set sound for touch feedback and returns
33
         * the path and name of the soundfile to play.
34
         *
35
         * The precondition for this function is a prevously set path to the
36
         * directory containing the system sounds.
37
         *
38
         * @return On success the path and name of the sound file is returned.
39
         * Otherwise an empty string is returned.
40
         */
41
        std::string getTouchFeedbackSound();
42
        /**
43
         * Determines whether the system sounds are activated or not and
44
         * returns the result.
45
         *
46
         * The precondition for this function is a prevously set path to the
47
         * directory containing the system sounds.
48
         *
49
         * @return If the system sounds are activated, it returns TRUE.
50
         * If there is no valid path to the system sounds set, then it returns
51
         * FALSE.
52
         */
53
        bool getSystemSoundState();
54
 
55
        std::string getFirstSingleBeep();
56
        std::string getNextSingleBeep();
57
        std::string getFirstDoubleBeep();
58
        std::string getNextDoubleBeep();
59
        std::string& getTestSound() { return mTestSound; }
60
        std::string& getDockSound() { return mDocked; }
61
        std::string& getRingBackSound() { return mRingBack; }
62
        std::string& getRingToneSound() { return mRingTone; }
63
 
64
        void setPath(const std::string& path);
65
        void setFile(const std::string& file);
66
 
67
    protected:
68
        bool readAllSystemSounds();
69
 
70
    private:
71
        std::string mPath;      // The path to the system sounds
72
        std::string mFile;      // File name of touch sound file
73
        bool mValid{false};     // TRUE = valid path was set
74
        std::vector<std::string> mSinglePeeps;
75
        std::vector<std::string> mDoubleBeeps;
76
        std::string mTestSound;
77
        std::string mDocked;
78
        std::string mRingBack;
79
        std::string mRingTone;
80
        size_t mSinglePos{0};
81
        size_t mDoublePos{0};
82
};
83
 
84
#endif