@Test public void ShouldSetHarmonicLoopOptions(){ List<RhythmicAccents> accentsList = new ArrayList<>(); accentsList.add(new RhythmicAccents()); List<HarmonicLoop> sourceLoops = new ArrayList<>(); HarmonicLoop loopA = new HarmonicLoop(); loopA.setId(1111); loopA.setRhythmicAccents(accentsList); loopA.setChords(new ArrayList<HiveChord>() {{ add(new HiveChord("a_min_7")); }}); HarmonicLoop loopB = new HarmonicLoop(); loopB.setId(2222); loopB.setFileName("loopB"); loopB.setRhythmicAccents(accentsList); loopB.setChords(new ArrayList<HiveChord>(){{ add(new HiveChord("c_maj_7")); }}); HarmonicLoop loopC = new HarmonicLoop(); loopC.setId(3333); loopC.setFileName("loopC"); loopC.setRhythmicAccents(accentsList); loopC.setChords(new ArrayList<HiveChord>(){{ add(new HiveChord("b_dom_7")); add(new HiveChord("c_maj_7")); }}); sourceLoops.add(loopA); sourceLoops.add(loopB); sourceLoops.add(loopC); SourceData sourceData = new SourceData(); sourceData.setHarmonicLoops(sourceLoops); ProgressionUnitBar progressionUnitBar = new ProgressionUnitBar(); progressionUnitBar.setChord(new HiveChord("c_maj_7")); harmonicLoopOptions.setHarmonicLoopAltOptions(progressionUnitBar, sourceData.getHarmonicLoops(0)); assertThat(progressionUnitBar.getHarmonicLoopAltOptions()).isNotNull(); assertThat(progressionUnitBar.getHarmonicLoopAltOptions()).hasSize(2); }
@Override public void setHarmonicLoopAltOptions(ProgressionUnitBar progressionUnitBar, List<HarmonicLoop> harmonicLoopOptions) { List<HarmonicLoop> harmonicLoopAltOptions = getLoopOptionsFromAChord(progressionUnitBar.getChord(), harmonicLoopOptions); if(harmonicLoopAltOptions.size() == 0){ harmonicLoopAltOptions.add(harmonicLoopOptions.stream().filter(hl -> hl.getFileName().contains("shim.wav")).findFirst().get()); } List<HarmonicLoop> clonedOptions = CloneUtils.cloneHarmonicLoops(harmonicLoopAltOptions); progressionUnitBar.setHarmonicLoopAltOptions(clonedOptions); }
HarmonicLoopOptions implements IHarmonicLoopOptions { @Override public void setHarmonicLoopAltOptions(ProgressionUnitBar progressionUnitBar, List<HarmonicLoop> harmonicLoopOptions) { List<HarmonicLoop> harmonicLoopAltOptions = getLoopOptionsFromAChord(progressionUnitBar.getChord(), harmonicLoopOptions); if(harmonicLoopAltOptions.size() == 0){ harmonicLoopAltOptions.add(harmonicLoopOptions.stream().filter(hl -> hl.getFileName().contains("shim.wav")).findFirst().get()); } List<HarmonicLoop> clonedOptions = CloneUtils.cloneHarmonicLoops(harmonicLoopAltOptions); progressionUnitBar.setHarmonicLoopAltOptions(clonedOptions); } }
HarmonicLoopOptions implements IHarmonicLoopOptions { @Override public void setHarmonicLoopAltOptions(ProgressionUnitBar progressionUnitBar, List<HarmonicLoop> harmonicLoopOptions) { List<HarmonicLoop> harmonicLoopAltOptions = getLoopOptionsFromAChord(progressionUnitBar.getChord(), harmonicLoopOptions); if(harmonicLoopAltOptions.size() == 0){ harmonicLoopAltOptions.add(harmonicLoopOptions.stream().filter(hl -> hl.getFileName().contains("shim.wav")).findFirst().get()); } List<HarmonicLoop> clonedOptions = CloneUtils.cloneHarmonicLoops(harmonicLoopAltOptions); progressionUnitBar.setHarmonicLoopAltOptions(clonedOptions); } @Autowired  HarmonicLoopOptions(OptionsFilter optionsFilter); }
HarmonicLoopOptions implements IHarmonicLoopOptions { @Override public void setHarmonicLoopAltOptions(ProgressionUnitBar progressionUnitBar, List<HarmonicLoop> harmonicLoopOptions) { List<HarmonicLoop> harmonicLoopAltOptions = getLoopOptionsFromAChord(progressionUnitBar.getChord(), harmonicLoopOptions); if(harmonicLoopAltOptions.size() == 0){ harmonicLoopAltOptions.add(harmonicLoopOptions.stream().filter(hl -> hl.getFileName().contains("shim.wav")).findFirst().get()); } List<HarmonicLoop> clonedOptions = CloneUtils.cloneHarmonicLoops(harmonicLoopAltOptions); progressionUnitBar.setHarmonicLoopAltOptions(clonedOptions); } @Autowired  HarmonicLoopOptions(OptionsFilter optionsFilter); @Override void setHarmonicLoopAltOptions(ProgressionUnitBar progressionUnitBar, List<HarmonicLoop> harmonicLoopOptions); @Override void setHarmonicLoopOptions(ProgressionUnitBar progressionUnitBar, List<HarmonicLoop> harmonicLoopOptions, ProcessingState processingState); @Override List<HarmonicLoop> getLoopOptionsFromHarmonicLoopAndChord(HarmonicLoop harmonicLoop, HiveChord chord, List<HarmonicLoop> harmonicLoopOptions); @Override List<HarmonicLoop> getLoopOptionsFromHarmonicLoop(HarmonicLoop harmonicLoop, List<HarmonicLoop> harmonicLoopOptions); @Override List<HarmonicLoop> getLoopOptionsFromAChord(HiveChord chord, List<HarmonicLoop> harmonicLoopOptions); }
HarmonicLoopOptions implements IHarmonicLoopOptions { @Override public void setHarmonicLoopAltOptions(ProgressionUnitBar progressionUnitBar, List<HarmonicLoop> harmonicLoopOptions) { List<HarmonicLoop> harmonicLoopAltOptions = getLoopOptionsFromAChord(progressionUnitBar.getChord(), harmonicLoopOptions); if(harmonicLoopAltOptions.size() == 0){ harmonicLoopAltOptions.add(harmonicLoopOptions.stream().filter(hl -> hl.getFileName().contains("shim.wav")).findFirst().get()); } List<HarmonicLoop> clonedOptions = CloneUtils.cloneHarmonicLoops(harmonicLoopAltOptions); progressionUnitBar.setHarmonicLoopAltOptions(clonedOptions); } @Autowired  HarmonicLoopOptions(OptionsFilter optionsFilter); @Override void setHarmonicLoopAltOptions(ProgressionUnitBar progressionUnitBar, List<HarmonicLoop> harmonicLoopOptions); @Override void setHarmonicLoopOptions(ProgressionUnitBar progressionUnitBar, List<HarmonicLoop> harmonicLoopOptions, ProcessingState processingState); @Override List<HarmonicLoop> getLoopOptionsFromHarmonicLoopAndChord(HarmonicLoop harmonicLoop, HiveChord chord, List<HarmonicLoop> harmonicLoopOptions); @Override List<HarmonicLoop> getLoopOptionsFromHarmonicLoop(HarmonicLoop harmonicLoop, List<HarmonicLoop> harmonicLoopOptions); @Override List<HarmonicLoop> getLoopOptionsFromAChord(HiveChord chord, List<HarmonicLoop> harmonicLoopOptions);  }