diff --git a/src/midi/MidiPlaybackController.ts b/src/midi/MidiPlaybackController.ts
index 05e4e4c1d..c4fe956e6 100644
--- a/src/midi/MidiPlaybackController.ts
+++ b/src/midi/MidiPlaybackController.ts
@@ -55,6 +55,7 @@ export class MidiPlaybackController {
                 this._repeatStack.push(repeat);
                 this._groupsOnStack.add(masterBar.repeatGroup);
                 this._previousAlternateEndings = 0;
+                masterBarAlternateEndings = masterBar.alternateEndings;
             }
         }
 
diff --git a/test/audio/MidiPlaybackController.test.ts b/test/audio/MidiPlaybackController.test.ts
index 539eadd9f..80a0ffff2 100644
--- a/test/audio/MidiPlaybackController.test.ts
+++ b/test/audio/MidiPlaybackController.test.ts
@@ -139,4 +139,19 @@ describe('MidiPlaybackControllerTest', () => {
         ];
         testAlphaTexRepeat(tex, expectedBars, 50);
     });
+
+    it('alternate-endings-1046', () => {
+        let tex: string = `
+        \\tempo 175
+        .
+        \\ro :1 r | \\ae 1 r | \\ae 2 \\rc 2 r | \\ro r | \\ae 1 r | \\ae (2 3 4) \\rc 4 r |       
+        `;
+        let expectedBars: number[] = [
+            0, 1, 0, 2,
+            3, 4,
+            3, 5, 3, 5, 3, 5,
+            6
+        ];
+        testAlphaTexRepeat(tex, expectedBars, 50);
+    });
 });