@Test public void shouldCreateLeftAndRightMonoFiles() throws InterruptedException, JsonProcessingException { setup(); File[] audioFiles = FileStructure.getFilesInDirectory(Paths.get(appConfigs.getMockDataAudioDir(),"audioparts",TRACK_GUID).toString()); assertThat(audioFiles).isNotEmpty(); QueueState queueState = getQueueStateWithProgression(); queueState.getQueueItem().setQueueItemId(TRACK_GUID); queueState.getQueueItem().setAudioPartFilePath(Paths.get(appConfigs.getMockDataAudioDir(),"audioparts",TRACK_GUID + "/").toString()); queueState.getQueueItem().setMonoPartsFilePath(Paths.get(appConfigs.getMockDataAudioDir(),"monoparts", TRACK_GUID + "/").toString()); queueState.getQueueItem().setStereoPartsFilePath(Paths.get(appConfigs.getMockDataAudioDir(),"stereoparts",TRACK_GUID + "/").toString()); queueState = setPanningEvent.set(queueState); queueState = processMixPanning.set(queueState); File[] monoFiles = FileStructure.getFilesInDirectory(Paths.get(appConfigs.getMockDataAudioDir(),"monoparts",TRACK_GUID).toString()); assertThat(monoFiles.length).isEqualTo(audioFiles.length * 2); for (File monoFileName : monoFiles) { boolean contains = monoFileName.getName().contains("_r.wav") || monoFileName.getName().contains("_l.wav"); assertThat(contains).isTrue(); } File[] stereoFiles = FileStructure.getFilesInDirectory(Paths.get(appConfigs.getMockDataAudioDir(),"stereoparts",TRACK_GUID).toString()); assertThat(stereoFiles.length).isEqualTo((monoFiles.length / 2) - 2); assertThat(stereoFiles.length).isEqualTo(audioFiles.length - 2); for (File stereoFile : stereoFiles) { boolean doesNotContain = !stereoFile.getName().contains("_r.wav") && !stereoFile.getName().contains("_l.wav"); assertThat(doesNotContain).isTrue(); } }
@Override public QueueState set(QueueState queueState) { File[] sourceFiles = FileStructure.getFilesInDirectory(queueState.getQueueItem().getAudioPartFilePath()); for (File sourceFile : sourceFiles) { String panCode = getPancode(sourceFile.getName().toLowerCase(), queueState); if (panCode != null) { Double[] leftRightGain = getLeftAndRightGain(panCode); audioMixer.changeVolume(leftRightGain[0], queueState.getQueueItem().getAudioPartFilePath() + "/" + sourceFile.getName(), queueState.getQueueItem().getMonoPartsFilePath() + "/" + sourceFile.getName().replace(".wav", "_l.wav")); audioMixer.changeVolume(leftRightGain[1], queueState.getQueueItem().getAudioPartFilePath() + "/" + sourceFile.getName(), queueState.getQueueItem().getMonoPartsFilePath() + "/" + sourceFile.getName().replace(".wav", "_r.wav")); } } stereoMixer.createStereoMixes(queueState.getQueueItem(), numOfGeneratedMixes); return queueState; }
ProcessMixPanning implements IEventChain { @Override public QueueState set(QueueState queueState) { File[] sourceFiles = FileStructure.getFilesInDirectory(queueState.getQueueItem().getAudioPartFilePath()); for (File sourceFile : sourceFiles) { String panCode = getPancode(sourceFile.getName().toLowerCase(), queueState); if (panCode != null) { Double[] leftRightGain = getLeftAndRightGain(panCode); audioMixer.changeVolume(leftRightGain[0], queueState.getQueueItem().getAudioPartFilePath() + "/" + sourceFile.getName(), queueState.getQueueItem().getMonoPartsFilePath() + "/" + sourceFile.getName().replace(".wav", "_l.wav")); audioMixer.changeVolume(leftRightGain[1], queueState.getQueueItem().getAudioPartFilePath() + "/" + sourceFile.getName(), queueState.getQueueItem().getMonoPartsFilePath() + "/" + sourceFile.getName().replace(".wav", "_r.wav")); } } stereoMixer.createStereoMixes(queueState.getQueueItem(), numOfGeneratedMixes); return queueState; } }
ProcessMixPanning implements IEventChain { @Override public QueueState set(QueueState queueState) { File[] sourceFiles = FileStructure.getFilesInDirectory(queueState.getQueueItem().getAudioPartFilePath()); for (File sourceFile : sourceFiles) { String panCode = getPancode(sourceFile.getName().toLowerCase(), queueState); if (panCode != null) { Double[] leftRightGain = getLeftAndRightGain(panCode); audioMixer.changeVolume(leftRightGain[0], queueState.getQueueItem().getAudioPartFilePath() + "/" + sourceFile.getName(), queueState.getQueueItem().getMonoPartsFilePath() + "/" + sourceFile.getName().replace(".wav", "_l.wav")); audioMixer.changeVolume(leftRightGain[1], queueState.getQueueItem().getAudioPartFilePath() + "/" + sourceFile.getName(), queueState.getQueueItem().getMonoPartsFilePath() + "/" + sourceFile.getName().replace(".wav", "_r.wav")); } } stereoMixer.createStereoMixes(queueState.getQueueItem(), numOfGeneratedMixes); return queueState; }  }
ProcessMixPanning implements IEventChain { @Override public QueueState set(QueueState queueState) { File[] sourceFiles = FileStructure.getFilesInDirectory(queueState.getQueueItem().getAudioPartFilePath()); for (File sourceFile : sourceFiles) { String panCode = getPancode(sourceFile.getName().toLowerCase(), queueState); if (panCode != null) { Double[] leftRightGain = getLeftAndRightGain(panCode); audioMixer.changeVolume(leftRightGain[0], queueState.getQueueItem().getAudioPartFilePath() + "/" + sourceFile.getName(), queueState.getQueueItem().getMonoPartsFilePath() + "/" + sourceFile.getName().replace(".wav", "_l.wav")); audioMixer.changeVolume(leftRightGain[1], queueState.getQueueItem().getAudioPartFilePath() + "/" + sourceFile.getName(), queueState.getQueueItem().getMonoPartsFilePath() + "/" + sourceFile.getName().replace(".wav", "_r.wav")); } } stereoMixer.createStereoMixes(queueState.getQueueItem(), numOfGeneratedMixes); return queueState; }  @Override QueueState set(QueueState queueState); }
ProcessMixPanning implements IEventChain { @Override public QueueState set(QueueState queueState) { File[] sourceFiles = FileStructure.getFilesInDirectory(queueState.getQueueItem().getAudioPartFilePath()); for (File sourceFile : sourceFiles) { String panCode = getPancode(sourceFile.getName().toLowerCase(), queueState); if (panCode != null) { Double[] leftRightGain = getLeftAndRightGain(panCode); audioMixer.changeVolume(leftRightGain[0], queueState.getQueueItem().getAudioPartFilePath() + "/" + sourceFile.getName(), queueState.getQueueItem().getMonoPartsFilePath() + "/" + sourceFile.getName().replace(".wav", "_l.wav")); audioMixer.changeVolume(leftRightGain[1], queueState.getQueueItem().getAudioPartFilePath() + "/" + sourceFile.getName(), queueState.getQueueItem().getMonoPartsFilePath() + "/" + sourceFile.getName().replace(".wav", "_r.wav")); } } stereoMixer.createStereoMixes(queueState.getQueueItem(), numOfGeneratedMixes); return queueState; }  @Override QueueState set(QueueState queueState); @Autowired
    public AppConfigs appConfigs; }