@Test public void shouldCreateStringArray() { int BPM = 80; kickPatternOne = new KickPattern(); kickPatternOne.setId(1); kickPatternOne.setFromArray(new int[]{0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1}); kickPatternTwo = new KickPattern(); kickPatternTwo.setId(2); kickPatternTwo.setFromArray(new int[]{1, 0, 1, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0}); kickPatternThree = new KickPattern(); kickPatternThree.setId(3); kickPatternThree.setFromArray(new int[]{1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}); List<KickPattern> patternsToRender = new ArrayList<>(); patternsToRender.add(kickPatternOne); patternsToRender.add(kickPatternTwo); patternsToRender.add(kickPatternThree); String shimpath = Paths.get(appConfigs.getApplicationRoot(),"Loops","2","Kicks","shim_kick_80.wav").toString(); String kickpath = Paths.get(appConfigs.getApplicationRoot(),"Loops","2","Kicks","kick17.wav").toString(); KickSample kickSample = new KickSample(); kickSample.setStationId("2"); kickSample.setFileName("kick17.wav"); List<String> kickPatternFilePaths = kickPatternRenderer.getKickPatternFilePaths(patternsToRender, kickSample, BPM); assertThat(kickPatternFilePaths).hasSize(48); assertThat(kickPatternFilePaths.get(0)).isEqualToIgnoringCase(shimpath); assertThat(kickPatternFilePaths.get(4)).isEqualToIgnoringCase(kickpath); assertThat(kickPatternFilePaths.get(19)).isEqualToIgnoringCase(shimpath); assertThat(kickPatternFilePaths.get(31)).isEqualToIgnoringCase(shimpath); assertThat(kickPatternFilePaths.get(37)).isEqualToIgnoringCase(kickpath); assertThat(kickPatternFilePaths.get(46)).isEqualToIgnoringCase(kickpath); BaseRenderer baseRenderer = new BaseRenderer(); try { baseRenderer.concatenateFiles(kickPatternFilePaths, Paths.get(appConfigs.getApplicationRoot(),"Loops","2","SUNDAY_KICK.wav").toString()); } catch (Exception e) { Application.logger.debug("LOG:", e); } }
public List<String> getKickPatternFilePaths(List<KickPattern> patternsToRender, KickSample kickSample, int bpm) { List<String> kickPatternFilePaths = new ArrayList<>(); for (KickPattern kickPatternFilePath : patternsToRender) { for (int kickHit : kickPatternFilePath.getAsIntegerArray()) { if (kickHit == 0) { kickPatternFilePaths.add(appConfigs.getKickShimFullPath(kickSample, bpm)); } else if (kickHit == 1) { kickPatternFilePaths.add(appConfigs.getKickFullPath(kickSample)); } else { throw new RuntimeException("Unexpected Kick Value"); } } } return kickPatternFilePaths; }
KickPatternRenderer extends BaseRenderer { public List<String> getKickPatternFilePaths(List<KickPattern> patternsToRender, KickSample kickSample, int bpm) { List<String> kickPatternFilePaths = new ArrayList<>(); for (KickPattern kickPatternFilePath : patternsToRender) { for (int kickHit : kickPatternFilePath.getAsIntegerArray()) { if (kickHit == 0) { kickPatternFilePaths.add(appConfigs.getKickShimFullPath(kickSample, bpm)); } else if (kickHit == 1) { kickPatternFilePaths.add(appConfigs.getKickFullPath(kickSample)); } else { throw new RuntimeException("Unexpected Kick Value"); } } } return kickPatternFilePaths; } }
KickPatternRenderer extends BaseRenderer { public List<String> getKickPatternFilePaths(List<KickPattern> patternsToRender, KickSample kickSample, int bpm) { List<String> kickPatternFilePaths = new ArrayList<>(); for (KickPattern kickPatternFilePath : patternsToRender) { for (int kickHit : kickPatternFilePath.getAsIntegerArray()) { if (kickHit == 0) { kickPatternFilePaths.add(appConfigs.getKickShimFullPath(kickSample, bpm)); } else if (kickHit == 1) { kickPatternFilePaths.add(appConfigs.getKickFullPath(kickSample)); } else { throw new RuntimeException("Unexpected Kick Value"); } } } return kickPatternFilePaths; }  }
KickPatternRenderer extends BaseRenderer { public List<String> getKickPatternFilePaths(List<KickPattern> patternsToRender, KickSample kickSample, int bpm) { List<String> kickPatternFilePaths = new ArrayList<>(); for (KickPattern kickPatternFilePath : patternsToRender) { for (int kickHit : kickPatternFilePath.getAsIntegerArray()) { if (kickHit == 0) { kickPatternFilePaths.add(appConfigs.getKickShimFullPath(kickSample, bpm)); } else if (kickHit == 1) { kickPatternFilePaths.add(appConfigs.getKickFullPath(kickSample)); } else { throw new RuntimeException("Unexpected Kick Value"); } } } return kickPatternFilePaths; }  void render(QueueState queueState); List<KickPattern> getPatternsToRender(QueueState queueState); List<String> getKickPatternFilePaths(List<KickPattern> patternsToRender, KickSample kickSample, int bpm); }
KickPatternRenderer extends BaseRenderer { public List<String> getKickPatternFilePaths(List<KickPattern> patternsToRender, KickSample kickSample, int bpm) { List<String> kickPatternFilePaths = new ArrayList<>(); for (KickPattern kickPatternFilePath : patternsToRender) { for (int kickHit : kickPatternFilePath.getAsIntegerArray()) { if (kickHit == 0) { kickPatternFilePaths.add(appConfigs.getKickShimFullPath(kickSample, bpm)); } else if (kickHit == 1) { kickPatternFilePaths.add(appConfigs.getKickFullPath(kickSample)); } else { throw new RuntimeException("Unexpected Kick Value"); } } } return kickPatternFilePaths; }  void render(QueueState queueState); List<KickPattern> getPatternsToRender(QueueState queueState); List<String> getKickPatternFilePaths(List<KickPattern> patternsToRender, KickSample kickSample, int bpm);  }