This commit is contained in:
josc146 2023-11-29 21:21:14 +08:00
parent 04fbb38861
commit 0d0a3f15cc
4 changed files with 25 additions and 3 deletions

View File

@ -295,5 +295,10 @@
"Sax": "サックス",
"Flute": "フルート",
"Lead": "リード",
"Pad": "パッド"
"Pad": "パッド",
"MIDI Input": "MIDI入力",
"Select the MIDI input device to be used.": "使用するMIDI入力デバイスを選択します。",
"Start Time": "開始時間",
"Content Duration": "内容の長さ",
"Please select a MIDI device first": "まずMIDIデバイスを選択してください"
}

View File

@ -295,5 +295,10 @@
"Sax": "萨克斯",
"Flute": "长笛",
"Lead": "主音",
"Pad": "和音"
"Pad": "和音",
"MIDI Input": "MIDI输入",
"Select the MIDI input device to be used.": "选择要使用的MIDI输入设备",
"Start Time": "开始时间",
"Content Duration": "内容时长",
"Please select a MIDI device first": "请先选择一个MIDI设备"
}

View File

@ -365,6 +365,11 @@ const AudiotrackEditor: FC<{ setPrompt: (prompt: string) => void }> = observer((
if (commonStore.recordingTrackId === track.id) {
commonStore.setRecordingTrackId('');
} else {
if (commonStore.activeMidiDeviceIndex === -1) {
toast(t('Please select a MIDI device first'), { type: 'warning' });
return;
}
dropRecordingTime = true;
setSelectedTrackId(track.id);
@ -393,6 +398,7 @@ const AudiotrackEditor: FC<{ setPrompt: (prompt: string) => void }> = observer((
appearance="subtle" onClick={() => {
const tracks = commonStore.tracks.slice().filter(t => t.id !== track.id);
commonStore.setTracks(tracks);
refreshTracksTotalTime();
}} />
</div>
<div className="relative grow overflow-hidden">
@ -431,7 +437,7 @@ const AudiotrackEditor: FC<{ setPrompt: (prompt: string) => void }> = observer((
<Card size="small" appearance="outline" style={{ minHeight: '150px', maxHeight: '200px' }}>
<div className="flex flex-col gap-1 overflow-hidden">
<Text size={100}>{`${t('Start Time')}: ${selectedTrack.offsetTime} ms`}</Text>
<Text size={100}>{`${t('Content Time')}: ${selectedTrack.contentTime} ms`}</Text>
<Text size={100}>{`${t('Content Duration')}: ${selectedTrack.contentTime} ms`}</Text>
<div className="overflow-y-auto overflow-x-hidden" ref={contentPreviewRef}>
{selectedTrackId === commonStore.recordingTrackId
? commonStore.recordingContent

View File

@ -482,6 +482,12 @@ export function getHfDownloadUrl(url: string) {
}
export function refreshTracksTotalTime() {
if (commonStore.tracks.length === 0) {
commonStore.setTrackTotalTime(tracksMinimalTotalTime);
commonStore.setTrackCurrentTime(0);
commonStore.setTrackPlayStartTime(0);
return;
}
const endTimes = commonStore.tracks.map(t => t.offsetTime + t.contentTime);
const totalTime = Math.max(...endTimes) + tracksMinimalTotalTime;
if (commonStore.trackPlayStartTime > totalTime)