1 /*
2   ZynAddSubFX - a software synthesizer
3 
4   AudioOut.h - Audio Output superclass
5   Copyright (C) 2009-2010 Mark McCurry
6   Author: Mark McCurry
7 
8   This program is free software; you can redistribute it and/or
9   modify it under the terms of the GNU General Public License
10   as published by the Free Software Foundation; either version 2
11   of the License, or (at your option) any later version.
12 */
13 
14 #ifndef AUDIO_OUT_H
15 #define AUDIO_OUT_H
16 
17 #include "../Misc/Stereo.h"
18 #include "../globals.h"
19 #include "Engine.h"
20 
21 namespace zyn {
22 
23 class AudioOut:public virtual Engine
24 {
25     public:
26         AudioOut(const SYNTH_T &synth);
27         virtual ~AudioOut();
28 
29         /**Sets the Sample Rate of this Output
30          * (used for getNext()).*/
31         void setSamplerate(int _samplerate);
32 
33         /**Sets the Samples required per Out of this driver
34          * not a realtime operation */
35         int getSampleRate();
36         void setBufferSize(int _bufferSize);
37 
38         /**Sets the Frame Size for output*/
39         void bufferingSize(int nBuffering);
40         int bufferingSize();
41 
42         virtual void setAudioEn(bool nval) = 0;
43         virtual bool getAudioEn() const    = 0;
44 
45         bool isOutputCompressionEnabled = 0;
46 
47     protected:
48         /**Get the next sample for output.
49          * (has nsamples sampled at a rate of samplerate)*/
50         const Stereo<float *> getNext();
51 
52         const SYNTH_T &synth;
53         int samplerate;
54         int bufferSize;
55 
56 };
57 
58 }
59 
60 #endif
61