Commit 35c5b67c authored by Philippe Gorley's avatar Philippe Gorley Committed by Philippe Gorley

mediasettingsview: add audio volume meter

Change-Id: I889b686322eb41011714ddc1223d62d8240b8e14
parent 38f01095
......@@ -57,6 +57,7 @@ struct _MediaSettingsViewPrivate
GtkWidget *combobox_ringtone;
GtkWidget *combobox_output;
GtkWidget *combobox_input;
GtkWidget *levelbar_input;
/* camera settings */
GtkWidget *combobox_device;
......@@ -73,6 +74,7 @@ struct _MediaSettingsViewPrivate
QMetaObject::Connection local_renderer_connection;
QMetaObject::Connection device_event_connection;
QMetaObject::Connection audio_meter_connection;
/* hardware accel settings */
GtkWidget *checkbutton_hardware_decoding;
......@@ -125,6 +127,8 @@ CppImpl::CppImpl(MediaSettingsView& widget, lrc::api::AVModel& avModel)
gtk_combo_box_set_active(GTK_COMBO_BOX(widgets->combobox_manager), activeIdx);
drawAudioDevices();
drawVideoDevices();
gtk_level_bar_set_value(GTK_LEVEL_BAR(widgets->levelbar_input), 0.0);
}
void
......@@ -304,6 +308,7 @@ media_settings_view_dispose(GObject *object)
QObject::disconnect(priv->local_renderer_connection);
QObject::disconnect(priv->device_event_connection);
QObject::disconnect(priv->audio_meter_connection);
G_OBJECT_CLASS(media_settings_view_parent_class)->dispose(object);
}
......@@ -461,6 +466,7 @@ media_settings_view_class_init(MediaSettingsViewClass *klass)
gtk_widget_class_bind_template_child_private(GTK_WIDGET_CLASS (klass), MediaSettingsView, combobox_resolution);
gtk_widget_class_bind_template_child_private(GTK_WIDGET_CLASS (klass), MediaSettingsView, combobox_framerate);
gtk_widget_class_bind_template_child_private(GTK_WIDGET_CLASS (klass), MediaSettingsView, checkbutton_hardware_decoding);
gtk_widget_class_bind_template_child_private(GTK_WIDGET_CLASS (klass), MediaSettingsView, levelbar_input);
}
GtkWidget *
......@@ -491,6 +497,13 @@ media_settings_view_new(lrc::api::AVModel& avModel)
G_CALLBACK(set_resolution), self);
g_signal_connect_swapped(priv->combobox_framerate, "changed",
G_CALLBACK(set_framerate), self);
priv->audio_meter_connection = QObject::connect(
&*priv->cpp->avModel_,
&lrc::api::AVModel::audioMeter,
[=](const std::string& id, float level) {
if (id == "audiolayer_id")
gtk_level_bar_set_value(GTK_LEVEL_BAR(priv->levelbar_input), level);
});
return (GtkWidget *)self;
}
......@@ -546,6 +559,8 @@ media_settings_view_show_preview(MediaSettingsView *self, gboolean show_preview)
} catch (const std::out_of_range& e) {
g_warning("Cannot start preview");
}
priv->cpp->avModel_->startAudioDevice();
priv->cpp->avModel_->setAudioMeterState(true);
} else {
if (priv->video_started_by_settings) {
priv->cpp->avModel_->stopPreview();
......@@ -557,6 +572,8 @@ media_settings_view_show_preview(MediaSettingsView *self, gboolean show_preview)
if (priv->video_widget && IS_VIDEO_WIDGET(priv->video_widget))
gtk_container_remove(GTK_CONTAINER(priv->vbox_main), priv->video_widget);
priv->video_widget = NULL;
priv->cpp->avModel_->setAudioMeterState(false);
priv->cpp->avModel_->stopAudioDevice();
}
}
......@@ -81,6 +81,18 @@
<property name="top_attach">4</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label_input_meter">
<property name="visible">True</property>
<property name="halign">end</property>
<property name="label" translatable="yes">Input volume meter:</property>
<property name="margin_left">10</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">5</property>
</packing>
</child>
<child>
<object class="GtkComboBoxText" id="combobox_manager">
<property name="visible">True</property>
......@@ -125,6 +137,16 @@
<property name="top_attach">4</property>
</packing>
</child>
<child>
<object class="GtkLevelBar" id="levelbar_input">
<property name="visible">True</property>
<property name="margin_left">10</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">5</property>
</packing>
</child>
<!-- end audio selection -->
<!-- start camera selection -->
<child>
......@@ -139,7 +161,7 @@
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">5</property>
<property name="top_attach">6</property>
<property name="width">2</property>
</packing>
</child>
......@@ -152,7 +174,7 @@
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">6</property>
<property name="top_attach">7</property>
</packing>
</child>
<child>
......@@ -164,7 +186,7 @@
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">7</property>
<property name="top_attach">8</property>
</packing>
</child>
<child>
......@@ -176,7 +198,7 @@
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">8</property>
<property name="top_attach">9</property>
</packing>
</child>
<child>
......@@ -188,7 +210,7 @@
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">9</property>
<property name="top_attach">10</property>
</packing>
</child>
<child>
......@@ -199,7 +221,7 @@
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">6</property>
<property name="top_attach">7</property>
</packing>
</child>
<child>
......@@ -210,7 +232,7 @@
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">7</property>
<property name="top_attach">8</property>
</packing>
</child>
<child>
......@@ -221,7 +243,7 @@
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">8</property>
<property name="top_attach">9</property>
</packing>
</child>
<child>
......@@ -232,7 +254,7 @@
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">9</property>
<property name="top_attach">10</property>
</packing>
</child>
<!-- end camera selection -->
......@@ -249,7 +271,7 @@
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">10</property>
<property name="top_attach">11</property>
<property name="width">2</property>
</packing>
</child>
......@@ -262,7 +284,7 @@
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">11</property>
<property name="top_attach">12</property>
</packing>
</child>
<child>
......@@ -276,7 +298,7 @@
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">11</property>
<property name="top_attach">12</property>
</packing>
</child>
<!-- end hardware accel selection -->
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment