BEAST/BSE - Better Audio System and Sound Engine  0.8.2
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
bsewave.hh
Go to the documentation of this file.
00001  // Licensed GNU LGPL v2.1 or later: http://www.gnu.org/licenses/lgpl.html
00002 #ifndef __BSE_WAVE_H__
00003 #define __BSE_WAVE_H__
00004 
00005 #include        <bse/bsesource.hh>
00006 
00007 G_BEGIN_DECLS
00008 
00009 /* --- BSE type macros --- */
00010 #define BSE_TYPE_WAVE              (BSE_TYPE_ID (BseWave))
00011 #define BSE_WAVE(object)           (G_TYPE_CHECK_INSTANCE_CAST ((object), BSE_TYPE_WAVE, BseWave))
00012 #define BSE_WAVE_CLASS(class)      (G_TYPE_CHECK_CLASS_CAST ((class), BSE_TYPE_WAVE, BseWaveClass))
00013 #define BSE_IS_WAVE(object)        (G_TYPE_CHECK_INSTANCE_TYPE ((object), BSE_TYPE_WAVE))
00014 #define BSE_IS_WAVE_CLASS(class)   (G_TYPE_CHECK_CLASS_TYPE ((class), BSE_TYPE_WAVE))
00015 #define BSE_WAVE_GET_CLASS(object) (G_TYPE_INSTANCE_GET_CLASS ((object), BSE_TYPE_WAVE, BseWaveClass))
00016 
00017 struct BseWaveEntry {
00018   GslWaveChunk *wchunk;
00019   gfloat        osc_freq;
00020   gfloat        velocity; /* 0..1 */
00021 };
00022 struct BseWaveIndex {
00023   guint         n_entries;
00024   BseWaveEntry  entries[1];     /* flexible array */
00025 };
00026 struct BseWave : BseSource {
00027   /* requested BseModule indices */
00028   guint              request_count;
00029   GSList            *index_list;
00030   guint              index_dirty : 1;
00031   /* locator */
00032   guint              locator_set : 1;
00033   gchar             *file_name;
00034   gchar             *wave_name;
00035   /* wave data */
00036   gchar            **xinfos;
00037   /* wave chunks */
00038   guint              n_wchunks;
00039   SfiRing           *wave_chunks;       /* data=GslWaveChunk* */
00040   SfiRing           *open_handles;      /* data=GslDataHandle* */
00041 };
00042 struct BseWaveClass : BseSourceClass
00043 {};
00044 
00045 void            bse_wave_clear                  (BseWave        *wave);
00046 BseErrorType    bse_wave_load_wave_file         (BseWave        *wave,
00047                                                  const gchar    *file_name,
00048                                                  const gchar    *wave_name,
00049                                                  BseFreqArray   *list_array,
00050                                                  BseFreqArray   *skip_array,
00051                                                  gboolean        rename_wave);
00052 void            bse_wave_add_chunk              (BseWave        *wave,
00053                                                  GslWaveChunk   *wchunk);
00054 GslWaveChunk*   bse_wave_lookup_chunk           (BseWave        *wave,
00055                                                  gfloat          mix_freq,
00056                                                  gfloat          osc_freq,
00057                                                  gfloat          velocity);
00058 void            bse_wave_remove_chunk           (BseWave        *wave,
00059                                                  GslWaveChunk   *wchunk);
00060 void            bse_wave_request_index          (BseWave        *wave);
00061 BseWaveIndex*   bse_wave_get_index_for_modules  (BseWave        *wave);
00062 void            bse_wave_drop_index             (BseWave        *wave);
00063 
00064 /* BseWaveIndex is safe to use from BseModules (self-contained constant structure) */
00065 GslWaveChunk*   bse_wave_index_lookup_best      (BseWaveIndex   *windex,
00066                                                  gfloat          osc_freq,
00067                                                  gfloat          velocity);
00068 
00069 G_END_DECLS
00070 
00071 #endif /* __BSE_WAVE_H__ */
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines