From 84ea0b37438ef80a1c63c27e24c9d91f9a5e1017 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Le=20Bihan?= Date: Tue, 28 Nov 2023 17:58:49 +0100 Subject: [PATCH] Fix tsc --- front/views/PlayView.tsx | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/front/views/PlayView.tsx b/front/views/PlayView.tsx index 1849ffa..53ac144 100644 --- a/front/views/PlayView.tsx +++ b/front/views/PlayView.tsx @@ -11,9 +11,7 @@ import Animated, { withDelay, } from 'react-native-reanimated'; import * as ScreenOrientation from 'expo-screen-orientation'; -import { Text, Row, View, useToast, Icon, Image } from 'native-base'; -import IconButton from '../components/IconButton'; -import { Ionicons } from '@expo/vector-icons'; +import { Text, Row, View, useToast } from 'native-base'; import { RouteProps, useNavigation } from '../Navigation'; import { useQuery } from '../Queries'; import API from '../API'; @@ -23,7 +21,7 @@ import { RootState } from '../state/Store'; import { Translate, translate } from '../i18n/i18n'; import { ColorSchemeType } from 'native-base/lib/typescript/components/types'; import { useStopwatch } from 'react-use-precision-timer'; -// import { MIDIAccess, MIDIMessageEvent, requestMIDIAccess } from '@arthi-chaud/react-native-midi'; +import { MIDIAccess, MIDIMessageEvent, requestMIDIAccess } from '@arthi-chaud/react-native-midi'; import * as Linking from 'expo-linking'; import url from 'url'; import { PianoCanvasContext } from '../models/PianoGame'; @@ -62,14 +60,14 @@ if (process.env.NODE_ENV != 'development' && Platform.OS === 'web') { }); } -// function parseMidiMessage(message: MIDIMessageEvent) { -// return { -// command: message.data.at(0)! >> 4, -// channel: message.data.at(0)! & 0xf, -// note: message.data.at(1)!, -// velocity: message.data.at(2)! / 127, -// }; -// } +function parseMidiMessage(message: MIDIMessageEvent) { + return { + command: message.data.at(0)! >> 4, + channel: message.data.at(0)! & 0xf, + note: message.data.at(1)!, + velocity: message.data.at(2)! / 127, + }; +} //create a context with an array of number export const PianoCC = createContext({ @@ -301,7 +299,7 @@ const PlayView = ({ songId, route }: RouteProps) => { return; } if (song.data && !webSocket.current && partitionRendered) { - // requestMIDIAccess().then(onMIDISuccess).catch(onMIDIFailure); + requestMIDIAccess().then(onMIDISuccess).catch(onMIDIFailure); } }, [song.data, partitionRendered]); @@ -487,6 +485,7 @@ const PlayView = ({ songId, route }: RouteProps) => { score={score} time={time} paused={paused} + disabled={!midiKeyboardFound} song={song.data} onEnd={onEnd} onPause={onPause}