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 |
|
205 |
andreas |
55 |
std::vector<std::string>& getAllSingleBeep() { return mSinglePeeps; }
|
|
|
56 |
std::vector<std::string>& getAllDoubleBeep() { return mDoubleBeeps; }
|
|
|
57 |
|
71 |
andreas |
58 |
std::string getFirstSingleBeep();
|
|
|
59 |
std::string getNextSingleBeep();
|
|
|
60 |
std::string getFirstDoubleBeep();
|
|
|
61 |
std::string getNextDoubleBeep();
|
|
|
62 |
std::string& getTestSound() { return mTestSound; }
|
|
|
63 |
std::string& getDockSound() { return mDocked; }
|
|
|
64 |
std::string& getRingBackSound() { return mRingBack; }
|
|
|
65 |
std::string& getRingToneSound() { return mRingTone; }
|
|
|
66 |
|
|
|
67 |
void setPath(const std::string& path);
|
|
|
68 |
void setFile(const std::string& file);
|
|
|
69 |
|
|
|
70 |
protected:
|
|
|
71 |
bool readAllSystemSounds();
|
|
|
72 |
|
|
|
73 |
private:
|
204 |
andreas |
74 |
void filterSounds();
|
|
|
75 |
|
71 |
andreas |
76 |
std::string mPath; // The path to the system sounds
|
|
|
77 |
std::string mFile; // File name of touch sound file
|
|
|
78 |
bool mValid{false}; // TRUE = valid path was set
|
|
|
79 |
std::vector<std::string> mSinglePeeps;
|
|
|
80 |
std::vector<std::string> mDoubleBeeps;
|
|
|
81 |
std::string mTestSound;
|
|
|
82 |
std::string mDocked;
|
|
|
83 |
std::string mRingBack;
|
|
|
84 |
std::string mRingTone;
|
|
|
85 |
size_t mSinglePos{0};
|
|
|
86 |
size_t mDoublePos{0};
|
|
|
87 |
};
|
|
|
88 |
|
|
|
89 |
#endif
|