1 /*
2   ZynAddSubFX - a software synthesizer
3 
4   Nio.h - IO Interface
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 NIO_H
13 #define NIO_H
14 #include <string>
15 #include <set>
16 
17 namespace zyn {
18 
19 class WavFile;
20 class Master;
21 struct SYNTH_T;
22 class oss_devs_t;
23 
24 /**Interface to Nio Subsystem
25  *
26  * Should be only externally included header */
27 namespace Nio
28 {
29     void init(const SYNTH_T &synth, const oss_devs_t &oss_devs, Master *master);
30     bool start(void);
31     void stop(void);
32 
33     void setDefaultSource(std::string name);
34     void setDefaultSink(std::string name);
35 
36     bool setSource(std::string name);
37     bool setSink(std::string name);
38 
39     void setPostfix(std::string post);
40     std::string getPostfix(void);
41 
42     std::set<std::string> getSources(void);
43     std::set<std::string> getSinks(void);
44 
45     std::string getSource(void);
46     std::string getSink(void);
47 
48     //Get the preferred sample rate from jack (if running)
49     void preferredSampleRate(unsigned &rate);
50 
51     //Complete Master Swaps to ONLY BE CALLED FROM RT CONTEXT
52     void masterSwap(Master *master);
53 
54     //Wave writing
55     void waveNew(class WavFile *wave);
56     void waveStart(void);
57     void waveStop(void);
58     void waveEnd(void);
59 
60     void setAudioCompressor(bool isEnabled);
61     bool getAudioCompressor(void);
62 
63     extern bool autoConnect;
64     extern bool pidInClientName;
65     extern std::string defaultSource;
66     extern std::string defaultSink;
67 };
68 
69 }
70 
71 #endif
72