zynaddsubfx

ZynAddSubFX open source synthesizer
Log | Files | Refs | Submodules | LICENSE

EngineMgr.h (1414B)


      1 /*
      2   ZynAddSubFX - a software synthesizer
      3 
      4   EngineMgr.h - MIDI/Audio Factory
      5   Copyright (C) 2016 Mark McCurry
      6 
      7   This program is free software; you can redistribute it and/or
      8   modify it under the terms of the GNU General Public License
      9   as published by the Free Software Foundation; either version 2
     10   of the License, or (at your option) any later version.
     11 */
     12 #ifndef ENGINE_MGR_H
     13 #define ENGINE_MGR_H
     14 
     15 #include <list>
     16 #include <string>
     17 #include "Engine.h"
     18 
     19 namespace zyn {
     20 
     21 class MidiIn;
     22 class AudioOut;
     23 class OutMgr;
     24 struct SYNTH_T;
     25 /**Container/Owner of the long lived Engines*/
     26 class EngineMgr
     27 {
     28     public:
     29         static EngineMgr &getInstance(
     30             const SYNTH_T *synth = nullptr,
     31             const class oss_devs_t* oss_devs = nullptr);
     32         ~EngineMgr();
     33 
     34         /**Gets requested engine
     35          * @param name case unsensitive name of engine
     36          * @return pointer to Engine or NULL
     37          */
     38         Engine *getEng(std::string name);
     39 
     40         /**Start up defaults*/
     41         bool start();
     42 
     43         /**Stop all engines*/
     44         void stop();
     45 
     46         std::list<Engine *> engines;
     47 
     48         //return false on failure
     49         bool setInDefault(std::string name);
     50         bool setOutDefault(std::string name);
     51 
     52         //default I/O
     53         AudioOut *defaultOut;
     54         MidiIn   *defaultIn;
     55     private:
     56         EngineMgr(const SYNTH_T *synth, const oss_devs_t &oss_devs);
     57 };
     58 
     59 }
     60 
     61 #endif