Main Page · Modules · All Classes · Class Hierarchy
MASoundDatabase.hpp
1 /*
2  * This file is part of the AiBO+ project
3  *
4  * Copyright (C) 2005-2016 Csaba Kertész (csaba.kertesz@gmail.com)
5  *
6  * AiBO+ is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * AiBO+ is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Street #330, Boston, MA 02111-1307, USA.
19  *
20  */
21 
22 #pragma once
23 
24 #include "core/MACoreTypes.hpp"
25 #include "MASoundBase.hpp"
26 
27 #include <MCDefs.hpp>
28 #include <MCThreadLocalData.hpp>
29 
30 class MASoundDatabase;
31 
37 namespace MA
38 {
40 extern MCThreadLocalData<MASoundDatabase> SoundDatabase;
41 
43 typedef std::pair<int, int> SoundFileInfo;
44 
46 typedef std::map<std::string, SoundFileInfo> SoundFileMap;
47 
49 extern std::string SoundProfileConfigName;
50 }
51 
55 // cppcheck-suppress noConstructor
57 {
59 
61 public:
62  ~MASoundDatabase();
63 
69  void SwitchProfile();
70 
78  std::string GetProfileName() const;
79 
87  void SetProfileName(const std::string& profile_name);
88 
98  std::string GetSoundFileName(const std::string& sound_name);
99 
110  MA::SoundBaseSPtr GetSoundFile(const std::string& sound_name, bool caching);
111 
123  static bool SaveToFile(const std::string& file_name, const MC::StringList& sound_file_names,
124  const MA::BinaryDataSPtrList& sounds);
125 
135  static MASoundDatabase* LoadFromFile(const std::string& file_name);
136 
137 private:
141  MA::SoundFileMap Files;
143  std::string SoundProfile;
144 };
145 
Sound database class.
std::string SoundProfile
Current sound profile.
#define MC_DISABLE_COPY(class_name)
Helper macro to disable the copy constructor and assignment operator of a class (object copying) ...
Definition: MCDefs.hpp:604
MA::SoundFileMap Files
Sound files.
A wrapper class to cover boost::thread_specific_ptr/folly::ThreadLocal API on certain targets...
FILE * DatabaseFileHandler
Sound database handler.