Beast - Music Synthesizer and Composer  0.11.1+10.g2da35
bseloader.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 __BSE_LOADER_H__
3 #define __BSE_LOADER_H__
4 
5 #include <bse/bseutils.hh>
6 #include <bse/gslwavechunk.hh>
7 
8 /* --- structures --- */
10  guint n_waves;
11  struct Wave {
12  gchar *name;
13  } *waves;
14 
15  gchar **comments;
16 
17  /*< private >*/
18  gchar *file_name;
19  BseLoader *loader;
20  guint ref_count;
21 };
23 {
24  gchar *name;
25  guint n_chunks;
26  BseWaveChunkDsc *chunks;
27  guint n_channels;
28  gchar **xinfos;
29  /*< private >*/
30  BseWaveFileInfo *file_info;
31 };
33 {
34  gfloat osc_freq;
35  gfloat mix_freq;
36  gchar **xinfos;
37  /* loader-specific */
38  union {
39  guint uint;
40  gpointer ptr;
41  gfloat vfloat;
42  } loader_data[8];
43 };
44 
45 
46 /* --- functions --- */
47 BseWaveFileInfo* bse_wave_file_info_load (const gchar *file_name,
48  Bse::Error *error);
49 BseWaveFileInfo* bse_wave_file_info_ref (BseWaveFileInfo *wave_file_info);
50 void bse_wave_file_info_unref (BseWaveFileInfo *wave_file_info);
51 const gchar* bse_wave_file_info_loader (BseWaveFileInfo *fi);
52 BseWaveDsc* bse_wave_dsc_load (BseWaveFileInfo *wave_file_info,
53  guint nth_wave,
54  gboolean accept_empty,
55  Bse::Error *error);
56 void bse_wave_dsc_free (BseWaveDsc *wave_dsc);
57 GslDataHandle* bse_wave_handle_create (BseWaveDsc *wave_dsc,
58  guint nth_chunk,
59  Bse::Error *error);
60 GslWaveChunk* bse_wave_chunk_create (BseWaveDsc *wave_dsc,
61  guint nth_chunk,
62  Bse::Error *error);
63 
64 
65 /* --- loader impl --- */
66 typedef enum /*< skip >*/
67 {
68  BSE_LOADER_NO_FLAGS = 0,
69  BSE_LOADER_SKIP_PRECEEDING_NULLS = 1 << 0
70 } BseLoaderFlags;
71 struct BseLoader {
72  const gchar *name; /* format/loader name, e.g. "BseWave" or "WAVE audio, RIFF (little-endian)" */
73 
74  /* at least one of the
75  * following three must
76  * be non-NULL
77  */
78  const gchar **extensions; /* e.g.: "mp3", "ogg" or "bsewave" */
79  const gchar **mime_types; /* e.g.: "audio/x-mpg3" or "audio/x-wav" */
80  BseLoaderFlags flags;
81  const gchar **magic_specs; /* e.g.: "0 string RIFF\n8 string WAVE\n" or "0 string #BseWave1\n" */
82 
83  gint priority; /* -100=high, +100=low, 0=default */
84 
85  /*< private >*/
86  gpointer data;
87  BseWaveFileInfo* (*load_file_info) (gpointer data,
88  const gchar *file_name,
89  Bse::Error *error);
90  void (*free_file_info) (gpointer data,
91  BseWaveFileInfo *file_info);
92  BseWaveDsc* (*load_wave_dsc) (gpointer data,
93  BseWaveFileInfo *file_info,
94  guint nth_wave,
95  Bse::Error *error);
96  void (*free_wave_dsc) (gpointer data,
97  BseWaveDsc *wave_dsc);
98  GslDataHandle* (*create_chunk_handle) (gpointer data,
99  BseWaveDsc *wave_dsc,
100  guint nth_chunk,
101  Bse::Error *error);
102  BseLoader *next; /* must be NULL */
103 };
104 
105 void bse_loader_register (BseLoader *loader);
106 BseLoader* bse_loader_match (const gchar *file_name);
107 
108 #endif /* __BSE_LOADER_H__ */
Definition: bseloader.hh:22
Definition: bseloader.hh:71
Definition: bseloader.hh:32
Definition: bseloader.hh:11
Definition: bseloader.hh:9