3 Copyright (C) 2012 celeron55, Perttu Ahola <celeron55@gmail.com>
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License along
16 with this program; if not, write to the Free Software Foundation, Inc.,
17 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20 #include "quicktune.h"
22 #include <jmutexautolock.h>
24 static std::map<std::string, QuicktuneValue> g_values;
25 static std::vector<std::string> g_names;
26 JMutex *g_mutex = NULL;
28 static void makeMutex()
31 g_mutex = new JMutex();
36 std::vector<std::string> getQuicktuneNames()
41 /*std::map<std::string, QuicktuneValue> getQuicktuneValues()
44 JMutexAutoLock lock(*g_mutex);
48 QuicktuneValue getQuicktuneValue(const std::string &name)
51 JMutexAutoLock lock(*g_mutex);
52 std::map<std::string, QuicktuneValue>::iterator i = g_values.find(name);
53 if(i == g_values.end()){
55 val.type = QUICKTUNE_NONE;
61 void setQuicktuneValue(const std::string &name, const QuicktuneValue &val)
64 JMutexAutoLock lock(*g_mutex);
68 void updateQuicktuneValue(const std::string &name, QuicktuneValue &val)
71 JMutexAutoLock lock(*g_mutex);
72 std::map<std::string, QuicktuneValue>::iterator i = g_values.find(name);
73 if(i == g_values.end()){
75 g_names.push_back(name);
78 QuicktuneValue &ref = i->second;
83 val.value_float.current = ref.value_float.current;