libvisual  0.5.0
lv_bin.h
1 /* Libvisual - The audio visualisation framework.
2  *
3  * Copyright (C) 2012 Libvisual team
4  * 2004-2006 Dennis Smit
5  *
6  * Authors: Dennis Smit <ds@nerds-incorporated.org>
7  * Chong Kai Xiong <kaixiong@codeleft.sg>
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_BIN_H
25 #define _LV_BIN_H
26 
27 #include <libvisual/lv_actor.h>
28 #include <libvisual/lv_input.h>
29 #include <libvisual/lv_morph.h>
30 #include <libvisual/lv_video.h>
31 #include <libvisual/lv_time.h>
32 
38 typedef enum {
39  VISUAL_BIN_DEPTH_LOWEST,
40  VISUAL_BIN_DEPTH_HIGHEST
41 } VisBinDepth;
42 
43 #ifdef __cplusplus
44 
45 #include <memory>
46 #include <string>
47 
48 namespace LV {
49 
50  class LV_API Bin
51  {
52  public:
53 
54  Bin ();
55 
56  Bin (Bin const&) = delete;
57 
58  ~Bin ();
59 
60  Bin& operator= (Bin const&) = delete;
61 
62  void realize ();
63 
64  ActorPtr const& get_actor () const;
65  InputPtr const& get_input () const;
66  MorphPtr const& get_morph () const;
67 
68  void set_morph (std::string const& morph_name);
69 
70  bool connect (std::string const& actor_name, std::string const& input_name);
71 
72  void sync (bool noevent);
73 
74  void set_video (VideoPtr const& video);
75 
76  void set_supported_depth (VisVideoDepth depthflag);
77 
78  VisVideoDepth get_supported_depth () const;
79 
80  void set_preferred_depth (VisBinDepth depthpreferred);
81 
82  void set_depth (VisVideoDepth depth);
83 
84  VisVideoDepth get_depth () const;
85 
86  bool depth_changed ();
87 
88  Palette const& get_palette () const;
89 
90  void switch_actor (std::string const& actname);
91 
92  void switch_finalize ();
93 
94  void use_morph (bool use);
95 
96  void switch_set_time (Time const& time);
97 
98  void run ();
99 
100  private:
101 
102  class Impl;
103 
104  const std::unique_ptr<Impl> m_impl;
105 
106  // FIXME: Remove
107  bool connect (ActorPtr const& actor, InputPtr const& input);
108  void switch_actor (ActorPtr const& actor);
109  };
110 
111 } // LV namespace
112 
113 #endif /* __cplusplus */
114 
115 #ifdef __cplusplus
116 typedef LV::Bin VisBin;
117 #else
118 typedef struct _VisBin VisBin;
119 struct _VisBin;
120 #endif
121 
122 LV_BEGIN_DECLS
123 
124 LV_API VisBin *visual_bin_new (void);
125 LV_API void visual_bin_free (VisBin *bin);
126 
127 LV_API void visual_bin_realize (VisBin *bin);
128 
129 LV_API VisActor *visual_bin_get_actor (VisBin *bin);
130 LV_API VisInput *visual_bin_get_input (VisBin *bin);
131 
132 LV_API void visual_bin_set_morph (VisBin *bin, const char *morphname);
133 LV_API VisMorph *visual_bin_get_morph (VisBin *bin);
134 
135 LV_API void visual_bin_connect (VisBin *bin, const char *actname, const char *inname);
136 
137 LV_API void visual_bin_sync (VisBin *bin, int noevent);
138 
139 LV_API void visual_bin_set_video (VisBin *bin, VisVideo *video);
140 
141 LV_API void visual_bin_set_supported_depth (VisBin *bin, VisVideoDepth depthflag);
142 LV_API VisVideoDepth visual_bin_get_supported_depth (VisBin *bin);
143 LV_API void visual_bin_set_preferred_depth (VisBin *bin, VisBinDepth depthpreferred);
144 LV_API void visual_bin_set_depth (VisBin *bin, int depth);
145 LV_API VisVideoDepth visual_bin_get_depth (VisBin *bin);
146 
147 LV_API int visual_bin_depth_changed (VisBin *bin);
148 
149 LV_API const VisPalette* visual_bin_get_palette (VisBin *bin);
150 
151 LV_API void visual_bin_switch_actor (VisBin *bin, const char *name);
152 LV_API void visual_bin_switch_finalize (VisBin *bin);
153 LV_API void visual_bin_switch_set_time (VisBin *bin, long sec, long usec);
154 
155 LV_API void visual_bin_run (VisBin *bin);
156 
157 LV_END_DECLS
158 
163 #endif /* _LV_BIN_H */