Philipp Hörist pushed to branch master at gajim / gajim
Commits:
9 changed files:
- gajim/common/helpers.py
- gajim/common/jingle_rtp.py
- gajim/common/setting_values.py
- + gajim/data/sounds/CREDITS
- + gajim/data/sounds/call_incoming.wav
- + gajim/data/sounds/call_outgoing.wav
- gajim/gtk/call_widget.py
- gajim/gtk/conversation/rows/call.py
- gajim/gtk/manage_sounds.py
Changes:
| ... | ... | @@ -467,13 +467,16 @@ def get_contact_dict_for_account(account): |
| 467 | 467 |
return contacts_dict
|
| 468 | 468 |
|
| 469 | 469 |
|
| 470 |
-def play_sound(sound_event: str, account: str,
|
|
| 471 |
- force: bool = False) -> None:
|
|
| 470 |
+def play_sound(sound_event: str,
|
|
| 471 |
+ account: str,
|
|
| 472 |
+ force: bool = False,
|
|
| 473 |
+ loop: bool = False) -> None:
|
|
| 474 |
+ |
|
| 472 | 475 |
if sound_event is None:
|
| 473 | 476 |
return
|
| 474 | 477 |
if force or allow_sound_notification(account, sound_event):
|
| 475 | 478 |
play_sound_file(
|
| 476 |
- app.settings.get_soundevent_settings(sound_event)['path'])
|
|
| 479 |
+ app.settings.get_soundevent_settings(sound_event)['path'], loop)
|
|
| 477 | 480 |
|
| 478 | 481 |
|
| 479 | 482 |
def check_soundfile_path(file_, dirs=None):
|
| ... | ... | @@ -530,13 +533,13 @@ def strip_soundfile_path(file_, dirs=None, abs_=True): |
| 530 | 533 |
return name
|
| 531 | 534 |
return file_
|
| 532 | 535 |
|
| 533 |
-def play_sound_file(path_to_soundfile):
|
|
| 536 |
+def play_sound_file(path_to_soundfile: str, loop: bool = False):
|
|
| 534 | 537 |
path_to_soundfile = check_soundfile_path(path_to_soundfile)
|
| 535 | 538 |
if path_to_soundfile is None:
|
| 536 | 539 |
return
|
| 537 | 540 |
|
| 538 | 541 |
from gajim.common import sound
|
| 539 |
- sound.play(path_to_soundfile)
|
|
| 542 |
+ sound.play(path_to_soundfile, loop)
|
|
| 540 | 543 |
|
| 541 | 544 |
def get_connection_status(account: str) -> str:
|
| 542 | 545 |
if not app.account_is_available(account):
|
| ... | ... | @@ -413,12 +413,19 @@ def setup_stream(self): |
| 413 | 413 |
# TODO: Add queues?
|
| 414 | 414 |
self.src_bin = self.make_bin_from_config(
|
| 415 | 415 |
'audio_input_device',
|
| 416 |
- '%s ! audioconvert',
|
|
| 416 |
+ '''%s
|
|
| 417 |
+ ! webrtcdsp
|
|
| 418 |
+ echo-suppression-level=high
|
|
| 419 |
+ noise-suppression-level=very-high
|
|
| 420 |
+ voice-detection=true
|
|
| 421 |
+ ! audioconvert ''',
|
|
| 417 | 422 |
_('audio input'))
|
| 418 | 423 |
|
| 424 |
+ # setting name=webrtcechoprobe0 is needed because lingering probes
|
|
| 425 |
+ # cause a bug in subsequent calls
|
|
| 419 | 426 |
self.sink = self.make_bin_from_config(
|
| 420 | 427 |
'audio_output_device',
|
| 421 |
- 'audioconvert ! volume name=gajim_out_vol ! %s',
|
|
| 428 |
+ 'audioconvert ! volume name=gajim_out_vol ! webrtcechoprobe name=webrtcechoprobe0 ! %s',
|
|
| 422 | 429 |
_('audio output'))
|
| 423 | 430 |
|
| 424 | 431 |
self.mic_volume = self.src_bin.get_by_name('gajim_vol')
|
| ... | ... | @@ -538,6 +538,14 @@ class _ACCOUNT_DEFAULT: |
| 538 | 538 |
'muc_message_received': {
|
| 539 | 539 |
'enabled': True,
|
| 540 | 540 |
'path': 'message2.wav'
|
| 541 |
+ },
|
|
| 542 |
+ 'incoming-call-sound': {
|
|
| 543 |
+ 'enabled': True,
|
|
| 544 |
+ 'path': 'call_incoming.wav'
|
|
| 545 |
+ },
|
|
| 546 |
+ 'outgoing-call-sound': {
|
|
| 547 |
+ 'enabled': True,
|
|
| 548 |
+ 'path': 'call_outgoing.wav'
|
|
| 541 | 549 |
}
|
| 542 | 550 |
}
|
| 543 | 551 |
|
| 1 |
+incoming-call.wav
|
|
| 2 |
+outgoing-call.wav
|
|
| 3 |
+ Copyright: Damien Sandras
|
|
| 4 |
+ URL: http://git.gnome.org/cgit/ekiga/tree/sounds
|
|
| 5 |
+ License: GPLv2+
|
No preview for this file type
No preview for this file type
| ... | ... | @@ -35,6 +35,8 @@ |
| 35 | 35 |
from gajim.common.i18n import _
|
| 36 | 36 |
from gajim.common.jingle_rtp import JingleAudio
|
| 37 | 37 |
from gajim.common.nec import NetworkEvent
|
| 38 |
+from gajim.common.helpers import play_sound
|
|
| 39 |
+from gajim.common import sound
|
|
| 38 | 40 |
|
| 39 | 41 |
from .gstreamer import create_gtk_widget
|
| 40 | 42 |
from .builder import get_builder
|
| ... | ... | @@ -109,10 +111,12 @@ def get_jingle_available(self, content_type: str) -> bool: |
| 109 | 111 |
return self._jingle[content_type].available
|
| 110 | 112 |
|
| 111 | 113 |
def _on_call_with_mic(self, _button: Gtk.Button) -> None:
|
| 114 |
+ play_sound('outgoing-call-sound', self._account, force=True, loop=True)
|
|
| 112 | 115 |
self._on_jingle_button_toggled(['audio'])
|
| 113 | 116 |
self._ui.av_start_box.hide()
|
| 114 | 117 |
|
| 115 | 118 |
def _on_call_with_mic_and_cam(self, _button: Gtk.Button) -> None:
|
| 119 |
+ play_sound('outgoing-call-sound', self._account, force=True, loop=True)
|
|
| 116 | 120 |
self._on_jingle_button_toggled(['audio', 'video'])
|
| 117 | 121 |
self._ui.av_start_box.hide()
|
| 118 | 122 |
|
| ... | ... | @@ -237,8 +241,9 @@ def _on_jingle_request(self, event): |
| 237 | 241 |
self._incoming_video_event = event
|
| 238 | 242 |
else:
|
| 239 | 243 |
# There is no voice call running running yet
|
| 240 |
- self.emit('incoming-call', event)
|
|
| 244 |
+ play_sound('incoming-call-sound', self._account, loop=True)
|
|
| 241 | 245 |
|
| 246 |
+ self.emit('incoming-call', event)
|
|
| 242 | 247 |
app.nec.push_incoming_event(
|
| 243 | 248 |
NetworkEvent('notification',
|
| 244 | 249 |
account=self._account,
|
| ... | ... | @@ -268,6 +273,7 @@ def _on_jingle_connected(self, event): |
| 268 | 273 |
session.approve_session()
|
| 269 | 274 |
for content in event.media:
|
| 270 | 275 |
session.approve_content(content)
|
| 276 |
+ sound.stop() # dialing/ringing
|
|
| 271 | 277 |
|
| 272 | 278 |
def _on_jingle_disconnected(self, event):
|
| 273 | 279 |
if event.media is None:
|
| ... | ... | @@ -284,6 +290,7 @@ def _on_jingle_disconnected(self, event): |
| 284 | 290 |
JingleState.NULL,
|
| 285 | 291 |
sid=event.sid,
|
| 286 | 292 |
reason=event.reason)
|
| 293 |
+ sound.stop() # dialing/ringing
|
|
| 287 | 294 |
|
| 288 | 295 |
def _on_jingle_error(self, event):
|
| 289 | 296 |
if event.sid == self._jingle['audio'].sid:
|
| ... | ... | @@ -291,6 +298,7 @@ def _on_jingle_error(self, event): |
| 291 | 298 |
'audio',
|
| 292 | 299 |
JingleState.ERROR,
|
| 293 | 300 |
reason=event.reason)
|
| 301 |
+ sound.stop() # dialing/ringing
|
|
| 294 | 302 |
|
| 295 | 303 |
def start_call(self) -> None:
|
| 296 | 304 |
audio_state = self._jingle['audio'].state
|
| ... | ... | @@ -305,6 +313,8 @@ def start_call(self) -> None: |
| 305 | 313 |
self._ui.av_cam_button.set_sensitive(False)
|
| 306 | 314 |
|
| 307 | 315 |
def accept_call(self, session):
|
| 316 |
+ sound.stop() # dialing/ringing
|
|
| 317 |
+ |
|
| 308 | 318 |
if not session:
|
| 309 | 319 |
return
|
| 310 | 320 |
|
| ... | ... | @@ -328,6 +338,8 @@ def accept_call(self, session): |
| 328 | 338 |
|
| 329 | 339 |
@staticmethod
|
| 330 | 340 |
def decline_call(session):
|
| 341 |
+ sound.stop() # dialing/ringing
|
|
| 342 |
+ |
|
| 331 | 343 |
if not session:
|
| 332 | 344 |
return
|
| 333 | 345 |
|
| ... | ... | @@ -24,6 +24,7 @@ |
| 24 | 24 |
from gajim.common.const import KindConstant
|
| 25 | 25 |
from gajim.common.i18n import _
|
| 26 | 26 |
from gajim.common.jingle_session import JingleSession
|
| 27 |
+from gajim.common import sound
|
|
| 27 | 28 |
|
| 28 | 29 |
from .widgets import SimpleLabel
|
| 29 | 30 |
from .base import BaseRow
|
| ... | ... | @@ -95,6 +96,7 @@ def _on_accept(self, button): |
| 95 | 96 |
self.get_parent().accept_call(self._session)
|
| 96 | 97 |
|
| 97 | 98 |
def _on_decline(self, _button):
|
| 99 |
+ sound.stop() # dialing/ringing
|
|
| 98 | 100 |
if self._event is not None:
|
| 99 | 101 |
session = self._client.get_module('Jingle').get_jingle_session(
|
| 100 | 102 |
self._event.fjid, self._event.sid)
|
| ... | ... | @@ -39,6 +39,8 @@ |
| 39 | 39 |
'message_sent': _('Message Sent'),
|
| 40 | 40 |
'muc_message_highlight': _('Group Chat Message Highlight'),
|
| 41 | 41 |
'muc_message_received': _('Group Chat Message Received'),
|
| 42 |
+ 'incoming-call-sound': _('Call Incoming'),
|
|
| 43 |
+ 'outgoing-call-sound': _('Call Outgoing'),
|
|
| 42 | 44 |
}
|
| 43 | 45 |
|
| 44 | 46 |
|