Beast - Music Synthesizer and Composer  0.11.1+10.g2da35
bsesong.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_SONG_H__
3 #define __BSE_SONG_H__
4 
5 #include <bse/bsesnet.hh>
6 
7 
8 
9 /* --- BSE type macros --- */
10 #define BSE_TYPE_SONG (BSE_TYPE_ID (BseSong))
11 #define BSE_SONG(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), BSE_TYPE_SONG, BseSong))
12 #define BSE_SONG_CLASS(class) (G_TYPE_CHECK_CLASS_CAST ((class), BSE_TYPE_SONG, BseSongClass))
13 #define BSE_IS_SONG(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), BSE_TYPE_SONG))
14 #define BSE_IS_SONG_CLASS(class) (G_TYPE_CHECK_CLASS_TYPE ((class), BSE_TYPE_SONG))
15 #define BSE_SONG_GET_CLASS(object) (G_TYPE_INSTANCE_GET_CLASS ((object), BSE_TYPE_SONG, BseSongClass))
16 
17 
18 /* --- BseSong object --- */
19 struct BseSongVoice {
20  BseSource *constant;
21  BseSource *sub_synth;
22 };
23 struct BseSong : BseSNet {
24  guint tpqn; /* ticks per querter note */
25  guint numerator;
26  guint denominator;
27  float bpm;
28  Bse::MusicalTuning musical_tuning;
29  SfiRing *parts; /* of type BsePart* */
30  SfiRing *busses; /* of type BseBus* */
31  BseBus *solo_bus;
32  BseSource *postprocess;
33  BseSource *output;
34  BseSNet *pnet;
35  /* song position pointer */
36  SfiInt last_position;
37  guint position_handler;
38  BseMidiReceiver *midi_receiver_SL;
39  /* fields protected by sequencer mutex */
40  gdouble tpsi_SL; /* ticks per stamp increment (sample) */
41  SfiRing *tracks_SL; /* of type BseTrack* */
42  /* sequencer stuff */
43  guint64 sequencer_start_request_SL;
44  guint64 sequencer_start_SL; /* playback start */
45  guint64 sequencer_done_SL;
46  gdouble delta_stamp_SL; /* start + delta_stamp => tick */
47  guint tick_SL; /* tick at stamp_SL */
48  guint sequencer_owns_refcount_SL : 1;
49  guint sequencer_underrun_detected_SL : 1;
50  guint loop_enabled_SL : 1;
51  SfiInt loop_left_SL; /* left loop tick */
52  SfiInt loop_right_SL; /* left loop tick */
53 };
55 {};
56 
57 BseSong* bse_song_lookup (BseProject *project, const char *name);
58 void bse_song_stop_sequencing_SL (BseSong *self);
59 void bse_song_get_timing (BseSong *self, uint tick, Bse::SongTiming *timing);
60 void bse_song_timing_get_default (Bse::SongTiming *timing);
61 BseSource* bse_song_create_summation (BseSong *self);
62 BseBus* bse_song_find_master (BseSong *self);
63 BseSource* bse_song_ensure_master (BseSong *self);
64 void bse_song_set_solo_bus (BseSong *self, BseBus *bus);
65 BseTrack* bse_song_find_first_track (BseSong *self, BsePart *part);
66 
67 namespace Bse {
68 
69 class SongImpl : public SNetImpl, public virtual SongIface {
70 protected:
71  virtual ~SongImpl ();
72 public:
73  explicit SongImpl (BseObject*);
74  virtual double bpm () const override;
75  virtual void bpm (double val) override;
76  virtual MusicalTuning musical_tuning () const override;
77  virtual void musical_tuning (MusicalTuning tuning) override;
78  virtual SongTiming get_timing (int tick);
79  virtual TrackIfaceP find_any_track_for_part (PartIface &part) override;
80  virtual BusIfaceP create_bus () override;
81  virtual void remove_bus (BusIface &bus) override;
82  virtual PartIfaceP create_part () override;
83  virtual void remove_part (PartIface &part) override;
84  virtual TrackIfaceP create_track () override;
85  virtual void remove_track (TrackIface &track) override;
86  virtual BusIfaceP ensure_master_bus () override;
87  virtual void ensure_track_links () override;
88  virtual TrackIfaceP find_track_for_part (PartIface &part) override;
89  virtual BusIfaceP get_master_bus () override;
90  virtual void synthesize_note (TrackIface &track, int duration, int note, int fine_tune, double velocity) override;
91 };
92 
93 } // Bse
94 
95 #endif /* __BSE_SONG_H__ */
Definition: bsetrack.hh:22
The Bse namespace contains all functions of the synthesis engine.
Definition: bstbseutils.cc:91
Definition: bsesnet.hh:105
Definition: bsesnet.hh:34
Definition: bsesong.hh:54
Definition: bsesong.hh:19
Definition: bsebus.hh:17
Definition: bseobject.hh:57
Definition: bsesource.hh:82
Definition: bsesong.hh:69
Definition: sfiring.hh:21
Definition: bsesong.hh:23
Song timing configuration.
Definition: bseapi.idl:428
Definition: bsesnet.hh:43
Definition: bseproject.hh:17
Definition: bsepart.hh:24