1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
|
#pragma once
#ifndef SOUNDMANAGERCONFIG_FILENAME
#define SOUNDMANAGERCONFIG_FILENAME "soundconfig.xml"
#endif
#include <QString>
#include <QMultiHash>
#include <QFileInfo>
#include "soundio/soundmanagerutil.h"
class SoundDevice;
class SoundManager;
class SoundManagerConfig {
public:
explicit SoundManagerConfig(
SoundManager* pSoundManager);
enum Defaults {
API = (1 << 0),
DEVICES = (1 << 1),
OTHER = (1 << 2),
ALL = (API | DEVICES | OTHER),
};
static const unsigned int kMaxAudioBufferSizeIndex;
static const QString kDefaultAPI;
static const QString kEmptyComboBox;
static const unsigned int kFallbackSampleRate;
static const unsigned int kDefaultDeckCount;
static const int kDefaultAudioBufferSizeIndex;
static const int kDefaultSyncBuffers;
SoundManagerConfig();
~SoundManagerConfig();
bool readFromDisk();
bool writeToDisk() const;
QString getAPI() const;
void setAPI(const QString& api);
bool checkAPI();
unsigned int getSampleRate() const;
void setSampleRate(unsigned int sampleRate);
bool checkSampleRate(const SoundManager& soundManager);
// Record the number of decks configured with this setup so they can
// be created and configured.
unsigned int getDeckCount() const;
void setDeckCount(unsigned int deckCount);
void setCorrectDeckCount(int configuredDeckCount);
QSet<SoundDeviceId> getDevices() const;
unsigned int getAudioBufferSizeIndex() const;
unsigned int getFramesPerBuffer() const;
// Returns the processing latency in milliseconds
double getProcessingLatency() const;
void setAudioBufferSizeIndex(unsigned int latency);
unsigned int getSyncBuffers() const;
void setSyncBuffers(unsigned int sampleRate);
bool getForceNetworkClock() const;
void setForceNetworkClock(bool force);
void addOutput(const SoundDeviceId& device, const AudioOutput& out);
void addInput(const SoundDeviceId& device, const AudioInput& in);
QMultiHash<SoundDeviceId, AudioOutput> getOutputs() const;
QMultiHash<SoundDeviceId, AudioInput> getInputs() const;
void clearOutputs();
void clearInputs();
bool hasMicInputs();
bool hasExternalRecordBroadcast();
void loadDefaults(SoundManager* soundManager, unsigned int flags);
private:
QFileInfo m_configFile;
QString m_api;
// none of our sample rates are actually decimals, this avoids
// the weirdness using floating point can introduce
unsigned int m_sampleRate;
unsigned int m_deckCount;
// m_latency is an index > 0, where 1 is a latency of 1ms and
// higher indices represent subsequently higher latencies (storing
// latency as milliseconds or frames per buffer is bad because those
// values vary with sample rate) -- bkgood
unsigned int m_audioBufferSizeIndex;
unsigned int m_syncBuffers;
bool m_forceNetworkClock;
QMultiHash<SoundDeviceId, AudioOutput> m_outputs;
QMultiHash<SoundDeviceId, AudioInput> m_inputs;
int m_iNumMicInputs;
bool m_bExternalRecordBroadcastConnected;
SoundManager* m_pSoundManager;
};
|