Beast - Music Synthesizer and Composer  0.11.1+10.g2da35
gslcommon.hh
Go to the documentation of this file.
1  // Licensed GNU LGPL v2.1 or later: http://www.gnu.org/licenses/lgpl.html
2 #ifndef __GSL_COMMON_H__
3 #define __GSL_COMMON_H__
4 #include <bse/gsldefs.hh>
5 #include <bse/bseenums.hh>
6 /* --- initialization --- */
7 void gsl_init (void);
8 
9 /* --- misc --- */
10 const gchar* gsl_byte_order_to_string (guint byte_order);
11 guint gsl_byte_order_from_string (const gchar *string);
12 Bse::Error gsl_error_from_errno (gint sys_errno,
13  Bse::Error fallback);
14 Bse::Error gsl_error_select (guint n_errors,
15  Bse::Error first_error,
16  ...);
17 Bse::Error gsl_file_check (const std::string &file_name, const std::string &mode);
18 
19 
20 /* --- progress notification --- */
21 typedef struct _GslProgressState GslProgressState;
22 typedef guint (*GslProgressFunc) (gpointer data,
23  gfloat pval, /* -1, 0..100 */
24  const gchar *detail,
25  GslProgressState *pstate);
27 {
28  uint wipe_length;
29  int precision;
30  gfloat pval, epsilon;
31  gpointer pdata;
32  GslProgressFunc pfunc;
33 };
34 GslProgressState gsl_progress_state (gpointer data,
35  GslProgressFunc pfunc,
36  guint precision);
37 void gsl_progress_notify (GslProgressState *pstate,
38  gfloat pval,
39  const gchar *detail_format,
40  ...);
41 void gsl_progress_wipe (GslProgressState *pstate);
42 guint gsl_progress_printerr (gpointer message,
43  gfloat pval,
44  const gchar *detail,
45  GslProgressState *pstate);
46 
47 
48 /* --- implementation details --- */
49 void _gsl_init_fd_pool (void);
50 void _gsl_init_data_caches (void);
51 void _gsl_init_loader_gslwave (void);
52 void _gsl_init_loader_aiff (void);
53 void _gsl_init_loader_wav (void);
54 void _gsl_init_loader_oggvorbis (void);
55 void _gsl_init_loader_mad (void);
56 void bse_init_loader_gus_patch (void);
57 void bse_init_loader_flac (void);
58 #define GSL_N_IO_RETRIES (5)
59 
60 namespace Bse {
61 
62 // == TickStamp ==
63 class TickStamp {
64  static std::atomic<uint64> global_tick_stamp;
65 protected:
66  static void _init_forgsl ();
67 public:
68  class Wakeup : public std::enable_shared_from_this<Wakeup> {
69  std::function<void()> wakeup_;
70  uint64 awake_stamp_;
71  protected:
72  explicit Wakeup (const std::function<void()> &wakeup);
73  static void _emit_wakeups (uint64 wakeup_stamp);
74  public:
75  void awake_after (uint64 stamp);
76  void awake_before (uint64 stamp);
77  };
79  struct Update {
80  uint64 tick_stamp;
81  uint64 system_time;
82  };
83  static Update get_last ();
84  static WakeupP create_wakeup (const std::function<void()> &wakeup);
85  static inline uint64 current () { return global_tick_stamp; }
86  static inline uint64 max_stamp () { return 18446744073709551615LLU; }
87  static void _increment ();
88  static void _set_leap (uint64 ticks);
89 };
91 
92 } // Bse
93 
94 
95 #endif /* __GSL_COMMON_H__ */
The Bse namespace contains all functions of the synthesis engine.
Definition: bstbseutils.cc:91
static uint64 max_stamp()
Maximum stamp value, 2^64-1.
Definition: gslcommon.hh:86
Definition: gslcommon.hh:79
Definition: gslcommon.hh:63
STL class.
Definition: gslcommon.hh:26
Definition: gslcommon.hh:68
uint64_t uint64