@Test public void shouldCreateCorrectWindowSize(){ List<List<String>> windowMarixOne = pitchDetectionHandlerImp.getWindowMarix(1); List<List<String>> windowMarixTwo = pitchDetectionHandlerImp.getWindowMarix(2); List<List<String>> windowMarixThree = pitchDetectionHandlerImp.getWindowMarix(4); assertThat(windowMarixOne.size()).isEqualTo(16); assertThat(windowMarixTwo.size()).isEqualTo(32); assertThat(windowMarixThree.size()).isEqualTo(64); }
public List<List<String>> getWindowMarix(int barCount) { List<List<String>> windows = new ArrayList<>(); if (barCount == 1) { for (int i = 0; i < 16; i++) { windows.add(new ArrayList<>()); } } else if (barCount == 2) { for (int i = 0; i < 32; i++) { windows.add(new ArrayList<>()); } } else if (barCount == 4) { for (int i = 0; i < 64; i++) { windows.add(new ArrayList<>()); } } else { throw new RuntimeException("unknown bar count"); } return windows; }
PitchDetectionHandlerImp implements PitchDetectionHandler { public List<List<String>> getWindowMarix(int barCount) { List<List<String>> windows = new ArrayList<>(); if (barCount == 1) { for (int i = 0; i < 16; i++) { windows.add(new ArrayList<>()); } } else if (barCount == 2) { for (int i = 0; i < 32; i++) { windows.add(new ArrayList<>()); } } else if (barCount == 4) { for (int i = 0; i < 64; i++) { windows.add(new ArrayList<>()); } } else { throw new RuntimeException("unknown bar count"); } return windows; } }
PitchDetectionHandlerImp implements PitchDetectionHandler { public List<List<String>> getWindowMarix(int barCount) { List<List<String>> windows = new ArrayList<>(); if (barCount == 1) { for (int i = 0; i < 16; i++) { windows.add(new ArrayList<>()); } } else if (barCount == 2) { for (int i = 0; i < 32; i++) { windows.add(new ArrayList<>()); } } else if (barCount == 4) { for (int i = 0; i < 64; i++) { windows.add(new ArrayList<>()); } } else { throw new RuntimeException("unknown bar count"); } return windows; }  }
PitchDetectionHandlerImp implements PitchDetectionHandler { public List<List<String>> getWindowMarix(int barCount) { List<List<String>> windows = new ArrayList<>(); if (barCount == 1) { for (int i = 0; i < 16; i++) { windows.add(new ArrayList<>()); } } else if (barCount == 2) { for (int i = 0; i < 32; i++) { windows.add(new ArrayList<>()); } } else if (barCount == 4) { for (int i = 0; i < 64; i++) { windows.add(new ArrayList<>()); } } else { throw new RuntimeException("unknown bar count"); } return windows; }  List<PitchExtractions> getPitchExtractions(double secondsInBar, int barCount); List<PitchExtractions> convertToPitchExtractions(int barCount, List<List<String>> windowMatrix); @Override void handlePitch(PitchDetectionResult pitchDetectionResult, AudioEvent audioEvent); List<List<String>> getWindowMarix(int barCount); }
PitchDetectionHandlerImp implements PitchDetectionHandler { public List<List<String>> getWindowMarix(int barCount) { List<List<String>> windows = new ArrayList<>(); if (barCount == 1) { for (int i = 0; i < 16; i++) { windows.add(new ArrayList<>()); } } else if (barCount == 2) { for (int i = 0; i < 32; i++) { windows.add(new ArrayList<>()); } } else if (barCount == 4) { for (int i = 0; i < 64; i++) { windows.add(new ArrayList<>()); } } else { throw new RuntimeException("unknown bar count"); } return windows; }  List<PitchExtractions> getPitchExtractions(double secondsInBar, int barCount); List<PitchExtractions> convertToPitchExtractions(int barCount, List<List<String>> windowMatrix); @Override void handlePitch(PitchDetectionResult pitchDetectionResult, AudioEvent audioEvent); List<List<String>> getWindowMarix(int barCount);  }