mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-01-27 07:59:20 +00:00
Add scale buttons in the incall view to set speaker and mouth volume gain
This commit is contained in:
parent
2c63fa85b0
commit
27a3183e20
4 changed files with 110 additions and 53 deletions
|
|
@ -3204,7 +3204,7 @@ float linphone_call_get_record_volume(LinphoneCall *call){
|
|||
}
|
||||
|
||||
double linphone_call_get_play_percent_volume(const LinphoneCall *call) {
|
||||
if(call->audiostream) return audio_stream_get_output_volume(call->audiostream);
|
||||
if(call->audiostream) return audio_stream_get_sound_card_output_gain(call->audiostream);
|
||||
else {
|
||||
ms_error("Could not get playback volume: no audio stream");
|
||||
return -1.0;
|
||||
|
|
@ -3212,12 +3212,12 @@ double linphone_call_get_play_percent_volume(const LinphoneCall *call) {
|
|||
}
|
||||
|
||||
void linphone_call_set_play_percent_volume(LinphoneCall *call, double volume) {
|
||||
if(call->audiostream) audio_stream_set_output_volume(call->audiostream, volume);
|
||||
if(call->audiostream) audio_stream_set_sound_card_output_gain(call->audiostream, volume);
|
||||
else ms_error("Could not set playback volume: no audio stream");
|
||||
}
|
||||
|
||||
double linphone_call_get_record_percent_volume(const LinphoneCall *call) {
|
||||
if(call->audiostream) return audio_stream_get_input_volume(call->audiostream);
|
||||
if(call->audiostream) return audio_stream_get_sound_card_input_gain(call->audiostream);
|
||||
else {
|
||||
ms_error("Could not get record volume: no audio stream");
|
||||
return -1.0;
|
||||
|
|
@ -3225,7 +3225,7 @@ double linphone_call_get_record_percent_volume(const LinphoneCall *call) {
|
|||
}
|
||||
|
||||
void linphone_call_set_record_percent_volume(LinphoneCall *call, double volume) {
|
||||
if(call->audiostream) audio_stream_set_input_volume(call->audiostream, volume);
|
||||
if(call->audiostream) audio_stream_set_sound_card_input_gain(call->audiostream, volume);
|
||||
else ms_error("Could not set record volume: no audio stream");
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -371,7 +371,6 @@ void linphone_gtk_create_in_call_view(LinphoneCall *call){
|
|||
GtkWidget *button;
|
||||
GtkWidget *image;
|
||||
|
||||
|
||||
if (ms_list_size(linphone_core_get_calls(linphone_gtk_get_core()))==1){
|
||||
/*this is the only call at this time */
|
||||
call_index=1;
|
||||
|
|
@ -634,22 +633,45 @@ void linphone_gtk_uninit_audio_meter(GtkWidget *w){
|
|||
}
|
||||
}
|
||||
|
||||
typedef enum { VOLUME_CTRL_PLAYBACK, VOLUME_CTRL_RECORD } VolumeControlType;
|
||||
|
||||
static void volume_control_value_changed(GtkScaleButton *button, gdouble value, gpointer user_data) {
|
||||
LinphoneCall *call = (LinphoneCall *)g_object_get_data(G_OBJECT(button), "call");
|
||||
VolumeControlType method = (VolumeControlType)g_object_get_data(G_OBJECT(button), "method");
|
||||
|
||||
if(method == VOLUME_CTRL_PLAYBACK) {
|
||||
linphone_call_set_play_percent_volume(call, value);
|
||||
} else if(method == VOLUME_CTRL_RECORD) {
|
||||
linphone_call_set_record_percent_volume(call, value);
|
||||
}
|
||||
}
|
||||
|
||||
static void volume_control_init(GtkWidget *vol_ctrl, VolumeControlType type, LinphoneCall *call) {
|
||||
g_object_set_data(G_OBJECT(vol_ctrl), "call", call);
|
||||
g_object_set_data(G_OBJECT(vol_ctrl), "type", (gpointer)type);
|
||||
|
||||
if(type == VOLUME_CTRL_PLAYBACK) {
|
||||
gtk_scale_button_set_value(GTK_SCALE_BUTTON(vol_ctrl), linphone_call_get_play_volume(call));
|
||||
} else if(type == VOLUME_CTRL_RECORD) {
|
||||
gtk_scale_button_set_value(GTK_SCALE_BUTTON(vol_ctrl), linphone_call_get_record_percent_volume(call));
|
||||
}
|
||||
|
||||
g_signal_connect(G_OBJECT(vol_ctrl), "value-changed", G_CALLBACK(volume_control_value_changed), NULL);
|
||||
}
|
||||
|
||||
void linphone_gtk_in_call_view_enable_audio_view(LinphoneCall *call, gboolean val){
|
||||
GtkWidget *callview=(GtkWidget*)linphone_call_get_user_pointer(call);
|
||||
GtkWidget *audio_view=linphone_gtk_get_widget(callview,"incall_audioview");
|
||||
GtkWidget *mic=linphone_gtk_get_widget(callview,"incall_mic_icon");
|
||||
GtkWidget *spk=linphone_gtk_get_widget(callview,"incall_spk_icon");
|
||||
GtkWidget *mic_level=linphone_gtk_get_widget(callview,"mic_audiolevel");
|
||||
GtkWidget *spk_level=linphone_gtk_get_widget(callview,"spk_audiolevel");
|
||||
GdkPixbuf *pbuf;
|
||||
GtkWidget *spk_vol_ctrl = linphone_gtk_get_widget(callview, "incall_spk_vol_ctrl_button");
|
||||
GtkWidget *mic_vol_ctrl = linphone_gtk_get_widget(callview, "incall_mic_vol_ctrl_button");
|
||||
|
||||
gtk_image_set_from_pixbuf(GTK_IMAGE(mic),(pbuf=create_pixbuf("mic_active.png")));
|
||||
g_object_unref(pbuf);
|
||||
if (val){
|
||||
gtk_image_set_from_pixbuf(GTK_IMAGE(spk),(pbuf=create_pixbuf("speaker.png")));
|
||||
g_object_unref(pbuf);
|
||||
linphone_gtk_init_audio_meter(mic_level,(get_volume_t)linphone_call_get_record_volume,call);
|
||||
linphone_gtk_init_audio_meter(spk_level,(get_volume_t)linphone_call_get_play_volume,call);
|
||||
volume_control_init(spk_vol_ctrl, VOLUME_CTRL_PLAYBACK, call);
|
||||
volume_control_init(mic_vol_ctrl, VOLUME_CTRL_RECORD, call);
|
||||
gtk_widget_show_all(audio_view);
|
||||
}else{
|
||||
linphone_gtk_uninit_audio_meter(mic_level);
|
||||
|
|
@ -709,8 +731,6 @@ char *linphone_gtk_address(const LinphoneAddress *addr){
|
|||
return ms_strdup(displayname);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void linphone_gtk_in_call_view_set_in_call(LinphoneCall *call){
|
||||
GtkWidget *callview=(GtkWidget*)linphone_call_get_user_pointer(call);
|
||||
GtkWidget *status=linphone_gtk_get_widget(callview,"in_call_status");
|
||||
|
|
|
|||
113
gtk/main.ui
113
gtk/main.ui
|
|
@ -402,67 +402,104 @@
|
|||
</child>
|
||||
<child>
|
||||
<object class="GtkHBox" id="incall_audioview">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="homogeneous">True</property>
|
||||
<child>
|
||||
<object class="GtkImage" id="incall_mic_icon">
|
||||
<object class="GtkHBox" id="incall_mic_vol_control">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="stock">gtk-missing-image</property>
|
||||
<property name="icon-size">1</property>
|
||||
<child>
|
||||
<object class="GtkVolumeButton" id="incall_mic_vol_ctrl_button">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
<property name="has_tooltip">True</property>
|
||||
<property name="relief">none</property>
|
||||
<property name="focus_on_click">False</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<property name="icons">audio-volume-muted
|
||||
audio-volume-high
|
||||
audio-volume-low
|
||||
audio-volume-medium</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
<property name="padding">5</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkProgressBar" id="mic_audiolevel">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
<property name="padding">5</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">False</property>
|
||||
<property name="padding">10</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkProgressBar" id="mic_audiolevel">
|
||||
<property name="width_request">90</property>
|
||||
<property name="height_request">10</property>
|
||||
<object class="GtkHBox" id="incall_spk_vol_control">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<child>
|
||||
<object class="GtkVolumeButton" id="incall_spk_vol_ctrl_button">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
<property name="has_tooltip">True</property>
|
||||
<property name="tooltip_text" translatable="yes">Click here to set the speakers volume</property>
|
||||
<property name="relief">none</property>
|
||||
<property name="focus_on_click">False</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<property name="icons">audio-volume-muted
|
||||
audio-volume-high
|
||||
audio-volume-low
|
||||
audio-volume-medium</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
<property name="padding">5</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkProgressBar" id="spk_audiolevel">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
<property name="padding">5</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">False</property>
|
||||
<property name="padding">10</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkImage" id="incall_spk_icon">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="stock">gtk-missing-image</property>
|
||||
<property name="icon-size">0</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
<property name="position">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkProgressBar" id="spk_audiolevel">
|
||||
<property name="width_request">90</property>
|
||||
<property name="height_request">10</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
<property name="padding">1</property>
|
||||
<property name="pack_type">end</property>
|
||||
<property name="position">3</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
<property name="padding">2</property>
|
||||
<property name="padding">5</property>
|
||||
<property name="position">3</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
Subproject commit 224b2994c27f22129a7cf77838c10d60b823c08f
|
||||
Subproject commit 81bfe4db9f1039e80017c8ba9505aa94f193b659
|
||||
Loading…
Add table
Reference in a new issue