@Test public void ShouldRenderBeatLoopsToCorrectLength() throws IOException { String targetPath = appConfigs.getApplicationRoot(); String fileName = "beatLoopRenderTest.wav"; File targetFile = new File(targetPath + fileName); if(targetFile != null && targetFile.exists()){ deleteFolderAndContents(targetFile); } ObjectMapper mapper = new ObjectMapper(); BeatLoopRenderTransport beatLoopRenderTransport = mapper.readValue(new File(appConfigs.getMockDataDir() + "render\\beatLoopsRenderMock.json"), BeatLoopRenderTransport.class); beatLoopRenderer.renderRhythm("FIX THIS!!!!", targetPath, fileName, beatLoopRenderTransport); File outPutFile = new File(targetPath + fileName); int bpm = 80; int barCount = 32; float audioLengthInSeconds = audioUtils.getAudioLength(targetPath + fileName); float targetTrackLengthInSeconds = LoopUtils.getSecondsInBar(bpm) * barCount; if(outPutFile != null && outPutFile.exists()){ deleteFolderAndContents(targetFile); } Assert.assertEquals(targetTrackLengthInSeconds, audioLengthInSeconds, 0.02f); }
@Override public void renderRhythm(String queueItemId, String rhythmTargetPath, String rhythmFileName, BeatLoopRenderTransport beatLoopRenderTransport) { concatenateAndFinalizeRendering(queueItemId, rhythmTargetPath, rhythmFileName, beatLoopRenderTransport.getBeatLoops()); }
BeatLoopRenderer extends BaseRenderer implements IBeatLoopRenderer { @Override public void renderRhythm(String queueItemId, String rhythmTargetPath, String rhythmFileName, BeatLoopRenderTransport beatLoopRenderTransport) { concatenateAndFinalizeRendering(queueItemId, rhythmTargetPath, rhythmFileName, beatLoopRenderTransport.getBeatLoops()); } }
BeatLoopRenderer extends BaseRenderer implements IBeatLoopRenderer { @Override public void renderRhythm(String queueItemId, String rhythmTargetPath, String rhythmFileName, BeatLoopRenderTransport beatLoopRenderTransport) { concatenateAndFinalizeRendering(queueItemId, rhythmTargetPath, rhythmFileName, beatLoopRenderTransport.getBeatLoops()); }  }
BeatLoopRenderer extends BaseRenderer implements IBeatLoopRenderer { @Override public void renderRhythm(String queueItemId, String rhythmTargetPath, String rhythmFileName, BeatLoopRenderTransport beatLoopRenderTransport) { concatenateAndFinalizeRendering(queueItemId, rhythmTargetPath, rhythmFileName, beatLoopRenderTransport.getBeatLoops()); }  @Override void renderRhythm(String queueItemId, String rhythmTargetPath, String rhythmFileName, BeatLoopRenderTransport beatLoopRenderTransport); @Override BeatLoopRenderTransport extractLoopsToRender(QueueItem queueItem); @Override void concatenateAndFinalizeRendering(String queueItemId, String targetPath, String fileName, List<BeatLoop> beatLoops); }
BeatLoopRenderer extends BaseRenderer implements IBeatLoopRenderer { @Override public void renderRhythm(String queueItemId, String rhythmTargetPath, String rhythmFileName, BeatLoopRenderTransport beatLoopRenderTransport) { concatenateAndFinalizeRendering(queueItemId, rhythmTargetPath, rhythmFileName, beatLoopRenderTransport.getBeatLoops()); }  @Override void renderRhythm(String queueItemId, String rhythmTargetPath, String rhythmFileName, BeatLoopRenderTransport beatLoopRenderTransport); @Override BeatLoopRenderTransport extractLoopsToRender(QueueItem queueItem); @Override void concatenateAndFinalizeRendering(String queueItemId, String targetPath, String fileName, List<BeatLoop> beatLoops);  }