Skip to content

Commit

Permalink
Converts wav files to ogg
Browse files Browse the repository at this point in the history
  • Loading branch information
josh-signal committed May 9, 2023
1 parent 7b039fa commit 8761bb8
Show file tree
Hide file tree
Showing 7 changed files with 30 additions and 13 deletions.
Binary file added sounds/pop.ogg
Binary file not shown.
Binary file removed sounds/pop.wav
Binary file not shown.
Binary file added sounds/whoosh.ogg
Binary file not shown.
Binary file removed sounds/whoosh.wav
Binary file not shown.
4 changes: 3 additions & 1 deletion ts/state/ducks/composer.ts
Expand Up @@ -618,7 +618,9 @@ function sendMultiMediaMessage(
dispatch(incrementSendCounter(conversationId));
dispatch(setComposerDisabledState(conversationId, false));

drop(new Sound({ soundType: SoundType.Whoosh }).play());
if (state.items.audioMessage) {
drop(new Sound({ soundType: SoundType.Whoosh }).play());
}
},
}
);
Expand Down
35 changes: 25 additions & 10 deletions ts/state/ducks/conversations.ts
Expand Up @@ -160,6 +160,7 @@ import {
} from './composer';
import { ReceiptType } from '../../types/Receipt';
import { sortByMessageOrder } from '../../util/maybeForwardMessages';
import { Sound, SoundType } from '../../util/Sound';

// State

Expand Down Expand Up @@ -2769,16 +2770,30 @@ function messagesAdded({
isJustSent: boolean;
isNewMessage: boolean;
messages: ReadonlyArray<MessageAttributesType>;
}): MessagesAddedActionType {
return {
type: 'MESSAGES_ADDED',
payload: {
conversationId,
isActive,
isJustSent,
isNewMessage,
messages,
},
}): ThunkAction<void, RootStateType, unknown, MessagesAddedActionType> {
return (dispatch, getState) => {
const state = getState();
if (
isNewMessage &&
state.items.audioMessage &&
conversationId === state.conversations.selectedConversationId &&
isActive &&
!isJustSent &&
messages.some(isIncoming)
) {
drop(new Sound({ soundType: SoundType.Pop }).play());
}

dispatch({
type: 'MESSAGES_ADDED',
payload: {
conversationId,
isActive,
isJustSent,
isNewMessage,
messages,
},
});
};
}

Expand Down
4 changes: 2 additions & 2 deletions ts/util/Sound.ts
Expand Up @@ -112,7 +112,7 @@ export class Sound {
}

if (soundStyle === SoundType.Pop) {
return 'sounds/pop.wav';
return 'sounds/pop.ogg';
}

if (soundStyle === SoundType.TriTone) {
Expand All @@ -132,7 +132,7 @@ export class Sound {
}

if (soundStyle === SoundType.Whoosh) {
return 'sounds/whoosh.wav';
return 'sounds/whoosh.ogg';
}

throw missingCaseError(soundStyle);
Expand Down

0 comments on commit 8761bb8

Please sign in to comment.