| | 986 | |
| | 987 | -------------------------------------------------------------------------------- |
| | 988 | 2009-03-22 REVISED ROLE OF H2Core::Hydrogen |
| | 989 | =========================================== |
| | 990 | |
| | 991 | The Hydrogen class has become a combination of the sequencer, audio engine, and |
| | 992 | controller for the audio backend. That seems to me like too much. The new |
| | 993 | Hydrogen class will simply be a controller for the audio engine. |
| | 994 | |
| | 995 | Note that this here is more of a concept. I'm not married to the details (such |
| | 996 | as using std::string as the generic driver identifier). Also, I'd prefer to |
| | 997 | take "Input" and "Output" out of the audio and midi drivers. We generally use |
| | 998 | the same driver for both the input and output side. |
| | 999 | |
| | 1000 | class Hydrogen : public Object |
| | 1001 | { |
| | 1002 | public: |
| | 1003 | typedef std::string driver_id_t; |
| | 1004 | typedef std::deque<driver_id_t> driver_list_t; |
| | 1005 | |
| | 1006 | /// Return the Hydrogen instance |
| | 1007 | static Hydrogen* get_instance(); |
| | 1008 | |
| | 1009 | ~Hydrogen(); |
| | 1010 | |
| | 1011 | /// Access to major objects. |
| | 1012 | TransportMasterInterface& get_transport(); |
| | 1013 | Mixer& get_mixer(); |
| | 1014 | Sequencer& get_sequencer(); |
| | 1015 | Sampler& get_sampler(); |
| | 1016 | AudioOutput& get_audiooutput(); |
| | 1017 | MidiInput& get_midiinput(); |
| | 1018 | |
| | 1019 | /// Should LADSPA effects be handled by Hydrogen or the Mixer? |
| | 1020 | |
| | 1021 | /// Song manipulation |
| | 1022 | /// Should Hydrogen or GUI be loading songs?? |
| | 1023 | Song& get_song(); |
| | 1024 | void set_song(Song* s); |
| | 1025 | void set_song(std::string path); |
| | 1026 | void remove_song(); |
| | 1027 | |
| | 1028 | /// Configuration options |
| | 1029 | const driver_list_t& get_transport_drivers(); |
| | 1030 | int set_transport_driver(const driver_id_t& name); |
| | 1031 | const driver_list_t& get_audio_outputs(); |
| | 1032 | int set_audio_output(const driver_id_t& name); |
| | 1033 | const driver_list_t& get_midi_drivers(); |
| | 1034 | int set_midi_input(const driver_id_t& name); |
| | 1035 | |
| | 1036 | /// Future ideas for interfaces. We could feed the |
| | 1037 | /// GUI a list of the configuration parameters by driver. |
| | 1038 | /// The GUI would create the config dialog based on this |
| | 1039 | /// list. This way, new features can be handled automagically. |
| | 1040 | // typedef (unknown) config_list_t; |
| | 1041 | // const config_list_t& get_transport_configuration(); |
| | 1042 | // int set_transport_configuration(...); |
| | 1043 | // const config_list_t& get_audio_configuration() |
| | 1044 | // ...etc. |
| | 1045 | |
| | 1046 | /// Misc. |
| | 1047 | int get_state(); // For implementing a global "pause", maybe |
| | 1048 | /// playlist stuff? |
| | 1049 | void panic(); // Immediately cease all audio |
| | 1050 | |
| | 1051 | private: |
| | 1052 | static Hydrogen* __instance; |
| | 1053 | |
| | 1054 | class HydrogenPrivate; |
| | 1055 | HydrogenPrivate* d; |
| | 1056 | |
| | 1057 | Hydrogen(); // private because Hydrogen is a singleton. |
| | 1058 | }; |
| | 1059 | |
| | 1060 | |