Skip to content

Commit 4325d26

Browse files
author
maciejmakowski2003
committed
fix: added SAMPLE_RATE constant
1 parent 710a8bf commit 4325d26

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

apps/common-app/src/examples/PlaybackSpeed/PlaybackSpeed.tsx

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,12 @@ import { View, StyleSheet } from 'react-native';
1010
import { Container, Button, Spacer, Slider, Select } from '../../components';
1111
import { AudioContext } from 'react-native-audio-api';
1212
import type { AudioBufferSourceNode } from 'react-native-audio-api';
13-
import { PCM_DATA, labelWidth, PLAYBACK_SPEED_CONFIG } from './constants';
13+
import {
14+
PCM_DATA,
15+
labelWidth,
16+
PLAYBACK_SPEED_CONFIG,
17+
SAMPLE_RATE,
18+
} from './constants';
1419
import { TimeStretchingAlgorithm, TIME_STRETCHING_OPTIONS } from './types';
1520
import { getAudioSettings } from './helpers';
1621

@@ -33,7 +38,7 @@ const PlaybackSpeed: FC = () => {
3338

3439
const initializeAudioContext = useCallback(() => {
3540
if (!aCtxRef.current) {
36-
aCtxRef.current = new AudioContext({ sampleRate: 44100 });
41+
aCtxRef.current = new AudioContext({ sampleRate: SAMPLE_RATE });
3742
}
3843
return aCtxRef.current;
3944
}, []);

apps/common-app/src/examples/PlaybackSpeed/constants.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,5 @@ export const PLAYBACK_SPEED_CONFIG = {
2020
step: 0.25,
2121
default: 1,
2222
} as const;
23+
24+
export const SAMPLE_RATE = 44100;

0 commit comments

Comments
 (0)