Skip to content

Commit 827a549

Browse files
authored
feat: Media Sync Editor updates for modified tempo calculation (#135)
1 parent cd25f0e commit 827a549

5 files changed

Lines changed: 411 additions & 227 deletions

File tree

src/components/AlphaTabPlayground/index.tsx

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,19 @@ export const AlphaTabPlayground: React.FC = () => {
3838
setLoading(false);
3939
});
4040

41+
useAlphaTabEvent(api, 'scoreLoaded', score => {
42+
if (score.backingTrack?.rawAudioFile) {
43+
setMediaType({
44+
type: MediaType.Audio,
45+
audioFile: score.backingTrack!.rawAudioFile
46+
});
47+
} else {
48+
setMediaType({
49+
type: MediaType.Synth
50+
});
51+
}
52+
});
53+
4154
const onDragOver = (e: React.DragEvent) => {
4255
e.stopPropagation();
4356
e.preventDefault();

src/components/AlphaTabPlayground/media-sync-editor.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,9 @@ export const MediaSyncEditor: React.FC<MediaSyncEditorProps> = ({
204204
shouldStoreToUndo.current = false;
205205
}
206206

207-
applySyncPoints(api, syncPointInfo);
207+
if (syncPointInfo.syncPointMarkers.length > 0) {
208+
applySyncPoints(api, syncPointInfo);
209+
}
208210
}, [syncPointInfo]);
209211

210212
// cursor handling

src/components/AlphaTabPlayground/styles.module.scss

Lines changed: 30 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -486,13 +486,6 @@
486486
align-items: center;
487487
font-size: 12px;
488488

489-
opacity: 0.4;
490-
491-
&:hover {
492-
opacity: 1;
493-
}
494-
495-
496489
&>.marker-label {
497490
height: 20px;
498491
white-space: nowrap;
@@ -516,22 +509,33 @@
516509
&>.marker-arrow {
517510
width: 20px;
518511
height: 20px;
519-
clip-path: polygon(0 0, 100% 0, 50% 100%);
520-
background: #444950;
512+
background: #FFF;
513+
514+
&::after {
515+
content: ' ';
516+
display: block;
517+
width: 20px;
518+
height: 20px;
519+
clip-path: polygon(0 0, 100% 0, 50% 100%);
520+
background: #a3b9d0;
521+
}
522+
521523
}
522524

523525
&>.marker-tempo {
524526
white-space: nowrap;
525527
text-align: left;
526-
transform: translateX(25px);
528+
transform: translateX(20px);
527529
pointer-events: none;
530+
font-size: 80%;
531+
background: #FFF;
528532
}
529533
}
530534

531535
&>.marker-line {
532536
flex-grow: 1;
533537
width: 0;
534-
border-right: 1px solid #444950;
538+
border-right: 1px solid #a1a4a7;
535539
}
536540

537541
&.masterbar-marker-startmarker,
@@ -549,23 +553,30 @@
549553
}
550554

551555
&.masterbar-marker-intermediate {
552-
&>.marker-line {
556+
& .marker-arrow {
557+
display: none;
558+
}
559+
560+
&.has-sync-point .marker-arrow {
561+
display: block;
562+
}
563+
564+
& .marker-line {
553565
border-right-style: dashed;
554566
}
555567
}
556568

557569

558570
cursor: col-resize;
559571

560-
&.has-sync-point {
561-
opacity: 0.75;
562-
563-
&:hover {
564-
opacity: 1;
572+
&.has-sync-point,
573+
&:hover {
574+
& .marker-arrow::after {
575+
background: #4972a1;
565576
}
566577

567-
& .marker-arrow {
568-
background: #4972a1;
578+
& .marker-line {
579+
border-right-color: #444950;
569580
}
570581
}
571582
}

0 commit comments

Comments
 (0)