Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhance call sounds: Reduce backgroundnoise on ringing sounds, reduce filesize, reintroduce 'connecting' sound, add 'call ended' sound #8948

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file removed res/raw/redphone_busy.mp3
Binary file not shown.
Binary file removed res/raw/redphone_outring.mp3
Binary file not shown.
Binary file added res/raw/signal_busy.mp3
Binary file not shown.
Binary file added res/raw/signal_call_ended.mp3
Binary file not shown.
Binary file added res/raw/signal_connecting.mp3
Binary file not shown.
Binary file added res/raw/signal_outring.mp3
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -432,7 +432,7 @@ private void handleOutgoingCall(Intent intent) {
sendMessage(WebRtcViewModel.State.CALL_OUTGOING, recipient, localCameraState, remoteVideoEnabled, bluetoothAvailable, microphoneEnabled);
lockManager.updatePhoneState(LockManager.PhoneState.IN_CALL);
audioManager.initializeAudioForCall();
audioManager.startOutgoingRinger(OutgoingRinger.Type.RINGING);
audioManager.startOutgoingRinger(OutgoingRinger.Type.CONNECTING);
bluetoothStateManager.setWantsConnection(true);

setCallInProgressNotification(TYPE_OUTGOING_RINGING, recipient);
Expand Down Expand Up @@ -594,6 +594,7 @@ private void handleIceConnected(Intent intent) {
if (this.recipient == null) throw new AssertionError("assert");

this.callState = CallState.STATE_REMOTE_RINGING;
this.audioManager.startOutgoingRinger(OutgoingRinger.Type.RINGING);

sendMessage(WebRtcViewModel.State.CALL_RINGING, recipient, localCameraState, remoteVideoEnabled, bluetoothAvailable, microphoneEnabled);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ public class OutgoingRinger {
private static final String TAG = OutgoingRinger.class.getSimpleName();

public enum Type {
CONNECTING,
RINGING,
BUSY
}
Expand All @@ -27,12 +28,13 @@ public enum Type {
public OutgoingRinger(@NonNull Context context) {
this.context = context;
}

public void start(Type type) {
int soundId;

if (type == Type.RINGING) soundId = R.raw.redphone_outring;
else if (type == Type.BUSY) soundId = R.raw.redphone_busy;
if (type == Type.CONNECTING) soundId = R.raw.signal_connecting;
else if (type == Type.RINGING) soundId = R.raw.signal_outring;
else if (type == Type.BUSY) soundId = R.raw.signal_busy;
else throw new IllegalArgumentException("Not a valid sound type");

if( mediaPlayer != null ) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@ public void startOutgoingRinger(OutgoingRinger.Type type) {
AudioManager audioManager = ServiceUtil.getAudioManager(context);
audioManager.setMicrophoneMute(false);

if (type == OutgoingRinger.Type.CONNECTING) {
audioManager.setSpeakerphoneOn(false);
}

audioManager.setMode(AudioManager.MODE_IN_COMMUNICATION);

outgoingRinger.start(type);
Expand Down