BEAST - Free Software Audio Synthesizer and Tracker  0.9.2
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 G_BEGIN_DECLS
7 /* --- initialization --- */
8 void gsl_init (void);
9 
10 /* --- misc --- */
11 const gchar* gsl_byte_order_to_string (guint byte_order);
12 guint gsl_byte_order_from_string (const gchar *string);
13 Bse::ErrorType gsl_error_from_errno (gint sys_errno,
14  Bse::ErrorType fallback);
15 Bse::ErrorType gsl_error_select (guint n_errors,
16  Bse::ErrorType first_error,
17  ...);
18 Bse::ErrorType gsl_file_check (const gchar *file_name,
19  const gchar *mode);
20 
21 
22 /* --- progress notification --- */
23 typedef struct _GslProgressState GslProgressState;
24 typedef guint (*GslProgressFunc) (gpointer data,
25  gfloat pval, /* -1, 0..100 */
26  const gchar *detail,
27  GslProgressState *pstate);
29 {
30  uint wipe_length;
31  int precision;
32  gfloat pval, epsilon;
33  gpointer pdata;
34  GslProgressFunc pfunc;
35 };
36 GslProgressState gsl_progress_state (gpointer data,
37  GslProgressFunc pfunc,
38  guint precision);
39 void gsl_progress_notify (GslProgressState *pstate,
40  gfloat pval,
41  const gchar *detail_format,
42  ...);
43 void gsl_progress_wipe (GslProgressState *pstate);
44 guint gsl_progress_printerr (gpointer message,
45  gfloat pval,
46  const gchar *detail,
47  GslProgressState *pstate);
48 
49 
50 /* --- implementation details --- */
51 void _gsl_init_fd_pool (void);
52 void _gsl_init_data_caches (void);
53 void _gsl_init_loader_gslwave (void);
54 void _gsl_init_loader_aiff (void);
55 void _gsl_init_loader_wav (void);
56 void _gsl_init_loader_oggvorbis (void);
57 void _gsl_init_loader_mad (void);
58 void bse_init_loader_gus_patch (void);
59 void bse_init_loader_flac (void);
60 #define GSL_N_IO_RETRIES (5)
61 G_END_DECLS
62 
63 
64 namespace Bse {
65 
66 // == TickStamp ==
67 class TickStamp {
68  static Rapicorn::Atomic<uint64> global_tick_stamp;
69 protected:
70  static void _init_forgsl ();
71 public:
72  class Wakeup : public std::enable_shared_from_this<Wakeup> {
73  std::function<void()> wakeup_;
74  uint64 awake_stamp_;
75  protected:
76  explicit Wakeup (const std::function<void()> &wakeup);
77  static void _emit_wakeups (uint64 wakeup_stamp);
78  public:
79  void awake_after (uint64 stamp);
80  void awake_before (uint64 stamp);
81  };
83  struct Update {
84  uint64 tick_stamp;
85  uint64 system_time;
86  };
87  static Update get_last ();
88  static WakeupP create_wakeup (const std::function<void()> &wakeup);
89  static inline uint64 current () { return global_tick_stamp; }
90  static inline uint64 max_stamp () { return 18446744073709551615LLU; }
91  static void _increment ();
92  static void _set_leap (uint64 ticks);
93 };
94 typedef TickStamp::WakeupP TickStampWakeupP;
95 
96 } // Bse
97 
98 
99 #endif /* __GSL_COMMON_H__ */
static Update get_last()
Definition: gslcommon.cc:85
The Bse namespace contains all functions of the synthesis engine.
Definition: bstbseutils.cc:67
static uint64 max_stamp()
Maximum stamp value, 2^64-1.
Definition: gslcommon.hh:90
Definition: gslcommon.hh:83
void awake_before(uint64 stamp)
Definition: gslcommon.cc:143
Definition: gslcommon.hh:67
Definition: gslcommon.hh:28
void awake_after(uint64 stamp)
Definition: gslcommon.cc:116
Definition: gslcommon.hh:72