Skip to content

Commit

Permalink
Continuous enumeration crashes on playlist repeating (fixes #56).
Browse files Browse the repository at this point in the history
  • Loading branch information
nwaldispuehl committed Mar 5, 2019
1 parent 6e1dc54 commit 98c5539
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 0 deletions.
5 changes: 5 additions & 0 deletions intervalmusiccompositor.app/src/main/resources/CHANGELOG.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
retorte laboratories (retorte.ch) IntervalMusicCompositor change log
--------------------------------------------------------------------------------

2019-xx-xx 2.9.2 [not yet released]
--------------------------------------------------------------------------------
FIX #56 Continuous enumeration crashes on playlist repeating.


2018-11-15 2.9.1
--------------------------------------------------------------------------------
FIX #50 Stale output directory yields error.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ private List<PlaylistItemFragment> createMusicPlaylist(List<IAudioFile> musicFil
if (newMusicTrack != null) {
musicPlaylist.add(newMusicTrack);
musicPatternCounter++;
skippedTracks = 0;
}
else {
skippedTracks++;
Expand Down Expand Up @@ -187,6 +188,7 @@ private List<PlaylistItemFragment> createBreakPlaylist(List<IAudioFile> breakFil
PlaylistItemFragment newBreakTrack = createPlaylistItemFrom(currentBreakFile, volume, currentBreakPatternMs);
if (newBreakTrack != null) {
breakPlaylist.add(new BreakPlaylistItemFragment(newBreakTrack));
skippedTracks = 0;
}
else {
skippedTracks++;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ public class PlaylistTest {
private IAudioFile musicTrack40s = createAudioFileMockWithLength(sec(40), MUSIC);
private IAudioFile musicTrack60s = createAudioFileMockWithLength(sec(60), MUSIC);
private IAudioFile breakTrack = createAudioFileMockWithLength(sec(60), BREAK);
private IAudioFile breakTrack20s = createAudioFileMockWithLength(sec(20), BREAK);

private SoundEffect soundEffect1 = mock(SoundEffect.class);

Expand Down Expand Up @@ -388,6 +389,22 @@ public void shouldNotThrowExceptionInContinuousShuffleMode() {
assertThat(tracks.get(2).getMusicFragment().getAudioFile(), is(musicTrack20s));
}

@Test
public void shouldLoopMusicWithContinuousExtract() {
// given
Playlist playlist = new Playlist(SEPARATE, 0d, CONTINUOUS, SORT, msgPrd);
musicList.add(musicTrack20s);
breakList.add(breakTrack20s);

musicPattern = pattern(10);
breakPattern = pattern(10);

// when
List<PlaylistItem> tracks = playlist.generatePlaylistFrom(musicList, musicPattern, breakList, breakPattern, 1, 4, soundEffectOccurrences);

// then
assertThat(tracks.size(), is(4));
}

//---- Helper methods

Expand Down

0 comments on commit 98c5539

Please sign in to comment.