Just Intonation  Version 1.3.0 (18)
Explore scale-independent dynamically adapting tuning in just intonation
audiooutput.h
Go to the documentation of this file.
1 /*****************************************************************************
2  * Copyright 2016-2017 Karolin Stange, Christoph Wick, and Haye Hinrichsen
3  *
4  * This file is part of JustIntonation.
5  *
6  * JustIntonation is free software: you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by the
8  * Free Software Foundation, either version 3 of the License, or (at your
9  * option) any later version.
10  *
11  * JustIntonation is distributed in the hope that it will be useful, but
12  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
13  * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14  * for more details.
15  *
16  * You should have received a copy of the GNU General Public License along
17  * with JustIntonation. If not, see http://www.gnu.org/licenses/.
18  *****************************************************************************/
19 
20 //=============================================================================
21 // Interface for audio output
22 //=============================================================================
23 
24 #ifndef AUDIOOUTPUT_H
25 #define AUDIOOUTPUT_H
26 
27 #include <QObject>
28 #include <QSettings>
29 
30 #include "audiobase.h"
31 #include "audiooutputdevice.h"
32 #include "audiogenerator.h"
33 
44 
45 class AudioOutput : public AudioBase
46 {
47 public:
48  AudioOutput ();
49  virtual bool init() override;
50  virtual bool start() override;
51  virtual bool stop() override;
52  virtual bool exit() override;
53 
54  virtual void initiallyCalledWorker() override final;
55  virtual void finallyCalledWorker() override final;
56 
57  void setAudioGenerator (AudioGenerator &generator);
59 
60  void updateListOfDevices() override final;
61 
62  void setVolume (double volume);
63  void setActualParameters (const AudioParameters &p);
65 
66 public slots:
67  void connectDevice (const bool active) override final;
68 
69 private:
74  QSettings mSettings;
75 
76 protected:
78 };
79 
80 #endif // AUDIOOUTPUT_H
virtual void finallyCalledWorker() override final
Virtual worker function called when the thread stops.
AudioOutput()
Constructor.
Definition: audiooutput.cpp:35
void updateListOfDevices() override final
Update the list of devices.
virtual bool init() override
Init audio device.
Definition: audiooutput.cpp:54
virtual void initiallyCalledWorker() override final
Initially called worker function.
Definition: audiooutput.cpp:87
AudioOutputDevice mAudioOutputDevice
Instance of the device.
Definition: audiooutput.h:70
Virtual base class for audio-generating modules.
Structure holding the parameters and status of an audio device.
virtual bool stop() override
Stop audio device.
void setVolume(double volume)
Set the global volume of the audio device.
void setAudioGenerator(AudioGenerator &generator)
Select an AudioGenerator for output.
Audio Output Device, supporting 16 and 24 bit signed integer PCM.
Audio Device Guard.
Class for audio output.
Definition: audiooutput.h:45
virtual bool exit() override
Exit audio device.
AudioGenerator * pAudioGenerator
Pointer to synthesizer.
Definition: audiooutput.h:72
AudioGenerator * getAudioGenerator() const
Definition: audiooutput.h:58
void setActualParameters(const AudioParameters &p)
Set audio device parameters (thread safe)
void connectDevice(const bool active) override final
Connect the audio output to a device (e.g. soundcard) with a given set of device parameters.
AudioGenerator defaultGenerator
Default sine generator.
Definition: audiooutput.h:71
QSettings mSettings
Settings object.
Definition: audiooutput.h:74
int mDefaultBufferSize
Default audio buffer size.
Definition: audiooutput.h:77
void setDefaultBufferSize(int n)
Definition: audiooutput.h:64
virtual bool start() override
Start audio device.
Definition: audiooutput.cpp:69
Abstract base class for audio input and output.
Definition: audiobase.h:52
AudioDeviceGuard mAudioDeviceGuard
Audio device guard.
Definition: audiooutput.h:73