use of com.helospark.tactview.core.timeline.subtimeline.audio.SubtimelineAudioClip in project tactview by helospark.
the class ReplaceTimelineWithSubtimelineCommand method execute.
@Override
public void execute() {
synchronized (timelineManagerAccessor.getFullLock()) {
SubtimelineVisualClip newVideoClip = null;
SubtimelineAudioClip newAudioClip = null;
if (projectRepository.isVideoInitialized()) {
newVideoClip = subtimelineFromTimelineFactory.createSubtimelineVideoClipFromCurrentTimeline(exposedDescriptors);
}
if (projectRepository.isAudioInitialized()) {
newAudioClip = subtimelineFromTimelineFactory.createSubtimelineAudioClipFromCurrentTimeline(exposedDescriptors);
}
for (var id : timelineManagerAccessor.getAllClipIds()) {
TimelineChannel channel = timelineManagerAccessor.findChannelForClipId(id).get();
TimelineClip clip = timelineManagerAccessor.findClipById(id).get().cloneClip(CloneRequestMetadata.fullCopy());
clipsRemoved.add(new ChannelClipPair(channel, clip));
timelineManagerAccessor.removeClip(id);
}
if (newVideoClip != null) {
timelineManagerAccessor.addClip(timelineManagerAccessor.getChannels().get(0), newVideoClip);
addedIds.add(newVideoClip.getId());
}
if (newAudioClip != null) {
timelineManagerAccessor.addClip(timelineManagerAccessor.getChannels().get(1), newAudioClip);
addedIds.add(newAudioClip.getId());
}
if (newVideoClip != null && newAudioClip != null) {
linkClipRepository.linkClip(newVideoClip.getId(), newAudioClip.getId());
}
}
}
use of com.helospark.tactview.core.timeline.subtimeline.audio.SubtimelineAudioClip in project tactview by helospark.
the class TemplateSaveAndLoadHandler method queryAdditionalDataToSave.
protected void queryAdditionalDataToSave(Map<String, Object> result, SaveMetadata saveMetadata, SaveTemplateRequest saveTemplateRequest) {
if (projectRepository.isVideoInitialized()) {
SubtimelineVisualClip videoClip = subtimelineFromTimelineFactory.createSubtimelineVideoClipFromCurrentTimeline(saveTemplateRequest.getExposedDescriptors());
result.put(VIDEO_TRACK_NODE, videoClip.generateSavedContent(saveMetadata));
}
if (projectRepository.isAudioInitialized()) {
SubtimelineAudioClip audioClip = subtimelineFromTimelineFactory.createSubtimelineAudioClipFromCurrentTimeline(saveTemplateRequest.getExposedDescriptors());
result.put(AUDIO_TRACK_NODE, audioClip.generateSavedContent(saveMetadata));
}
context.getListOfBeans(SaveLoadContributor.class).stream().filter(a -> !a.getClass().equals(TimelineManagerAccessor.class)).forEach(a -> a.generateSavedContent(result, saveMetadata));
}
use of com.helospark.tactview.core.timeline.subtimeline.audio.SubtimelineAudioClip in project tactview by helospark.
the class SubtimelineFromTimelineFactory method createSubtimelineAudioClipFromCurrentTimeline.
public SubtimelineAudioClip createSubtimelineAudioClipFromCurrentTimeline(Set<ExposedDescriptorDescriptor> exposedDescriptors) {
TimelineLength length = timelineManager.findEndPosition().toLength();
AudioMediaMetadata metadata = AudioMediaMetadata.builder().withBitRate(timelineManager.findMaximumAudioBitRate()).withBytesPerSample(projectRepository.getBytesPerSample()).withChannels(projectRepository.getNumberOfChannels()).withLength(timelineManager.findEndPosition().toLength()).withSampleRate(projectRepository.getBytesPerSample()).build();
SubtimelineAudioClip result = new SubtimelineAudioClip(metadata, timelineChannelsState.deepClone(CloneRequestMetadata.ofDefault()), timelineManagerAccessorFactory, subtimelineHelper, exposedDescriptors, TimelinePosition.ofZero(), length);
result.setCreatorFactoryId(SubtimelineAudioClipFactory.ID);
return result;
}
Aggregations