libvisual  0.5.0
lv_libvisual.h
1 /* Libvisual - The audio visualisation framework.
2  *
3  * Copyright (C) 2012 Libvisual team
4  * 2004-2006 Dennis Smit
5  *
6  * Authors: Chong Kai Xiong <kaixiong@codeleft.sg>
7  * Dennis Smit <ds@nerds-incorporated.org>
8  *
9  * This program is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU Lesser General Public License as
11  * published by the Free Software Foundation; either version 2.1
12  * of the License, or (at your option) any later version.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  * GNU Lesser General Public License for more details.
18  *
19  * You should have received a copy of the GNU Lesser General Public License
20  * along with this program; if not, write to the Free Software
21  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22  */
23 
24 #ifndef _LV_LIBVISUAL_H
25 #define _LV_LIBVISUAL_H
26 
27 #include <libvisual/lv_param.h>
28 #include <libvisual/lv_random.h>
29 
35 #ifdef __cplusplus
36 
37 #include <libvisual/lv_singleton.hpp>
38 #include <memory>
39 #include <string>
40 
42 namespace LV {
43 
44  class LV_API System
45  : public Singleton<System>
46  {
47  public:
48 
55  static void init (int& argc, char**& argv);
56 
57  System (System const&) = delete;
58 
59  virtual ~System ();
60 
66  std::string get_version () const;
67 
73  int get_api_version () const;
74 
80  ParamList& get_params () const;
81 
85  RandomContext& get_rng () const;
86 
92  void set_rng_seed (RandomSeed seed);
93 
94  private:
95 
96  class Impl;
97 
98  const std::unique_ptr<Impl> m_impl;
99 
100  System (int& argc, char**& argv);
101  };
102 
103  // FIXME: Move this into lv_random.h
110  inline uint32_t rand ()
111  {
112  return System::instance()->get_rng ().get_int ();
113  }
114 
115 } // LV namespace
116 
117 #endif // __cplusplus
118 
119 
120 LV_BEGIN_DECLS
121 
122 LV_API void visual_init (int *argc, char ***argv);
123 
124 LV_API int visual_is_initialized (void);
125 
126 LV_API void visual_quit (void);
127 
128 LV_API const char *visual_get_version (void);
129 
130 LV_API int visual_get_api_version (void);
131 
132 LV_API VisParamList *visual_get_params (void);
133 
134 LV_API void visual_set_rng_seed (VisRandomSeed seed);
135 
136 LV_API VisRandomContext *visual_get_rng (void);
137 
138 // FIXME: Move this into lv_random.h
139 static inline uint32_t visual_rand (void)
140 {
141  return visual_random_context_int (visual_get_rng ());
142 }
143 
144 LV_END_DECLS
145 
150 #endif /* _LV_LIBVISUAL_H */