aboutsummaryrefslogtreecommitdiffstats
path: root/src/ManagementServer.cpp
diff options
context:
space:
mode:
authorMatthias P. Braendli <matthias.braendli@mpb.li>2018-02-24 17:40:16 +0100
committerMatthias P. Braendli <matthias.braendli@mpb.li>2018-02-24 17:40:16 +0100
commit0ad10f6aeebf75ef550cfa2ce772d28b2b9fd7e0 (patch)
tree92ec7b189debd4ee5559bb9a1500c8ce6b8a9cfe /src/ManagementServer.cpp
parentc27252b79363b46658fccbe743dc911049dd3450 (diff)
downloaddabmux-0ad10f6aeebf75ef550cfa2ce772d28b2b9fd7e0.tar.gz
dabmux-0ad10f6aeebf75ef550cfa2ce772d28b2b9fd7e0.tar.bz2
dabmux-0ad10f6aeebf75ef550cfa2ce772d28b2b9fd7e0.zip
Use enum class for input_state_t
Diffstat (limited to 'src/ManagementServer.cpp')
-rw-r--r--src/ManagementServer.cpp18
1 files changed, 8 insertions, 10 deletions
diff --git a/src/ManagementServer.cpp b/src/ManagementServer.cpp
index 917d3c7..cd70b77 100644
--- a/src/ManagementServer.cpp
+++ b/src/ManagementServer.cpp
@@ -514,20 +514,18 @@ std::string InputStat::encodeValuesJSON()
ss << "\"state\": ";
switch (determineState()) {
- case NoData:
+ case input_state_t::NoData:
ss << "\"NoData (1)\"";
break;
- case Unstable:
+ case input_state_t::Unstable:
ss << "\"Unstable (2)\"";
break;
- case Silence:
+ case input_state_t::Silence:
ss << "\"Silent (3)\"";
break;
- case Streaming:
+ case input_state_t::Streaming:
ss << "\"Streaming (4)\"";
break;
- default:
- ss << "\"Unknown (0)\"";
}
ss << " } }";
@@ -558,20 +556,20 @@ input_state_t InputStat::determineState()
if (std::all_of(
m_buffer_fill_stats.begin(), m_buffer_fill_stats.end(),
[](long fill) { return fill == 0; }) ) {
- state = NoData;
+ state = input_state_t::NoData;
}
/* Otherwise, the state depends on the glitch counter */
else if (m_glitch_counter >= INPUT_UNSTABLE_THRESHOLD) {
- state = Unstable;
+ state = input_state_t::Unstable;
}
else {
/* The input is streaming, check if the audio level is too low */
if (m_silence_counter > INPUT_AUDIO_LEVEL_SILENCE_COUNT) {
- state = Silence;
+ state = input_state_t::Silence;
}
else {
- state = Streaming;
+ state = input_state_t::Streaming;
}
}