@Test public void shouldSetMidiPattern(){ setKickPatternEvent = new SetKickMidiPatternEvent(); queueState = setKickPatternEvent.set(queueState); Pattern p1b1 = queueState.getQueueItem().getProgression().getStructure().get(0).getProgressionUnitBars().get(0).getKickMidiPattern(); Pattern p2b1 = queueState.getQueueItem().getProgression().getStructure().get(1).getProgressionUnitBars().get(0).getKickMidiPattern(); assertThat(p1b1.toString()).isEqualToIgnoringCase("T77 f#0s rs f#0s rs f#0s rs f#0s rs f#0s rs f#0s rs f#0s rs f#0s rs "); assertThat(p2b1.toString()).isEqualToIgnoringCase("T77 rs rs f#0s f#0s rs rs f#0s f#0s rs rs f#0s f#0s rs rs f#0s f#0s "); }
@Override public QueueState set(QueueState queueState) { for(ProgressionUnit pUnit : queueState.getStructure()) { String jfugueStr = "T" + queueState.getQueueItem().getBpm() + " "; for (ProgressionUnitBar pBar : pUnit.getProgressionUnitBars()) { for (Integer k : pBar.getKickPattern().getAsIntegerArray()) { jfugueStr += intToDuration(pUnit.getKey(), k) + " "; } pBar.setKickMidiPattern(new Pattern(jfugueStr)); } } return queueState; }
SetKickMidiPatternEvent implements IEventChain { @Override public QueueState set(QueueState queueState) { for(ProgressionUnit pUnit : queueState.getStructure()) { String jfugueStr = "T" + queueState.getQueueItem().getBpm() + " "; for (ProgressionUnitBar pBar : pUnit.getProgressionUnitBars()) { for (Integer k : pBar.getKickPattern().getAsIntegerArray()) { jfugueStr += intToDuration(pUnit.getKey(), k) + " "; } pBar.setKickMidiPattern(new Pattern(jfugueStr)); } } return queueState; } }
SetKickMidiPatternEvent implements IEventChain { @Override public QueueState set(QueueState queueState) { for(ProgressionUnit pUnit : queueState.getStructure()) { String jfugueStr = "T" + queueState.getQueueItem().getBpm() + " "; for (ProgressionUnitBar pBar : pUnit.getProgressionUnitBars()) { for (Integer k : pBar.getKickPattern().getAsIntegerArray()) { jfugueStr += intToDuration(pUnit.getKey(), k) + " "; } pBar.setKickMidiPattern(new Pattern(jfugueStr)); } } return queueState; }  }
SetKickMidiPatternEvent implements IEventChain { @Override public QueueState set(QueueState queueState) { for(ProgressionUnit pUnit : queueState.getStructure()) { String jfugueStr = "T" + queueState.getQueueItem().getBpm() + " "; for (ProgressionUnitBar pBar : pUnit.getProgressionUnitBars()) { for (Integer k : pBar.getKickPattern().getAsIntegerArray()) { jfugueStr += intToDuration(pUnit.getKey(), k) + " "; } pBar.setKickMidiPattern(new Pattern(jfugueStr)); } } return queueState; }  @Override QueueState set(QueueState queueState); }
SetKickMidiPatternEvent implements IEventChain { @Override public QueueState set(QueueState queueState) { for(ProgressionUnit pUnit : queueState.getStructure()) { String jfugueStr = "T" + queueState.getQueueItem().getBpm() + " "; for (ProgressionUnitBar pBar : pUnit.getProgressionUnitBars()) { for (Integer k : pBar.getKickPattern().getAsIntegerArray()) { jfugueStr += intToDuration(pUnit.getKey(), k) + " "; } pBar.setKickMidiPattern(new Pattern(jfugueStr)); } } return queueState; }  @Override QueueState set(QueueState queueState);  }