Deluge Firmware 1.3.0
Build date: 2025.09.14
Loading...
Searching...
No Matches
stem_export.h
1/*
2 * Copyright (c) 2024 Sean Ditny
3 *
4 * This file is part of The Synthstrom Audible Deluge Firmware.
5 *
6 * The Synthstrom Audible Deluge Firmware is free software: you can redistribute it and/or modify it under the
7 * terms of the GNU General Public License as published by the Free Software Foundation,
8 * either version 3 of the License, or (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
11 * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12 * See the GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License along with this program.
15 * If not, see <https://www.gnu.org/licenses/>.
16 */
17
18#pragma once
19
20#include "definitions_cxx.hpp"
21#include "processing/sound/sound_drum.h"
22#include "util/d_string.h"
23#include <cstdint>
24
25class Output;
26class Clip;
27class SoundDrum;
28
29class StemExport {
30public:
31 StemExport();
32
33 // start & stop process
34 void startStemExportProcess(StemExportType stemExportType);
37 void stopPlayback();
39 bool checkForLoopEnd();
40 bool checkForSilence();
41 bool processStarted;
42 bool stopRecording;
43 StemExportType currentStemExportType;
44 uint32_t timePlaybackStopped;
45 uint32_t timeThereWasLastSomeActivity;
46
47 // export config variables
48 bool allowNormalization;
49 bool allowNormalizationForDrums;
50 bool exportToSilence;
51 bool includeSongFX;
52 bool includeKitFX;
53 bool renderOffline;
54 bool exportMixdown;
55
56 // export instruments
57 int32_t disarmAllInstrumentsForStemExport(StemExportType stemExportType);
58 int32_t exportInstrumentStems(StemExportType stemExportType);
59 int32_t exportMixdownStem(StemExportType stemExportType);
60 void restoreAllInstrumentMutes(int32_t totalNumOutputs);
61
62 // export clips
64 int32_t exportClipStems(StemExportType stemExportType);
65 void restoreAllClipMutes(int32_t totalNumClips);
67 void getLoopEndPointInSamplesForAudioFile(int32_t loopLength);
68 bool writeLoopEndPos();
69 int32_t loopLengthToStopStemExport;
70 int32_t loopEndPointInSamplesForAudioFile;
71
72 // export drums
74 int32_t exportDrumStems(StemExportType stemExportType);
75 void restoreAllDrumMutes(int32_t totalNumNoteRows);
76
77 // start exporting
78 bool startCurrentStemExport(StemExportType stemExportType, Output* output, bool& muteState, int32_t fileNumber,
79 bool exportStem, SoundDrum* drum = nullptr);
80
81 // finish exporting
82 void finishCurrentStemExport(StemExportType stemExportType, bool& muteState);
83 void finishStemExportProcess(StemExportType stemExportType, int32_t elementsProcessed);
84 void updateScrollPosition(StemExportType stemExportType, int32_t indexNumber);
85
86 // export status
87 void displayStemExportProgress(StemExportType stemExportType);
88 void displayStemExportProgressOLED(StemExportType stemExportType);
89 void displayStemExportProgress7SEG();
90 int32_t numStemsExported;
91 int32_t totalNumStemsToExport;
92
93 // audio file management
94 Error getUnusedStemRecordingFilePath(String* filePath, AudioRecordingFolder folder);
95 Error getUnusedStemRecordingFolderPath(String* filePath, AudioRecordingFolder folder);
96 int32_t highestUsedStemFolderNumber;
97 String lastFolderNameForStemExport;
98 void setWavFileNameForStemExport(StemExportType type, Output* output, int32_t fileNumber,
99 SoundDrum* drum = nullptr);
100 String wavFileNameForStemExport;
101 bool wavFileNameForStemExportSet;
102
103 // check if we're in context menu
104 bool inContextMenu();
105};
106
107extern StemExport stemExport;
Definition clip.h:46
Definition output.h:79
Definition sound_drum.h:28
Definition stem_export.h:29
int32_t exportClipStems(StemExportType stemExportType)
Definition stem_export.cpp:502
bool checkForLoopEnd()
Definition stem_export.cpp:212
void restoreAllInstrumentMutes(int32_t totalNumOutputs)
set instrument mutes back to their previous state (before exporting stems)
Definition stem_export.cpp:317
void getLoopEndPointInSamplesForAudioFile(int32_t loopLength)
converts clip / drum loop length into samples so that clip / drum end position can be written to clip...
Definition stem_export.cpp:485
Error getUnusedStemRecordingFolderPath(String *filePath, AudioRecordingFolder folder)
Definition stem_export.cpp:876
void stopPlayback()
simulate pressing play
Definition stem_export.cpp:187
int32_t exportMixdownStem(StemExportType stemExportType)
Definition stem_export.cpp:379
bool inContextMenu()
Definition stem_export.cpp:1148
void finishCurrentStemExport(StemExportType stemExportType, bool &muteState)
Definition stem_export.cpp:707
void stopOutputRecording()
simulate pressing record
Definition stem_export.cpp:194
bool writeLoopEndPos()
Definition stem_export.cpp:491
int32_t exportInstrumentStems(StemExportType stemExportType)
Definition stem_export.cpp:332
void updateScrollPosition(StemExportType stemExportType, int32_t indexNumber)
Definition stem_export.cpp:755
void startStemExportProcess(StemExportType stemExportType)
Definition stem_export.cpp:83
int32_t disarmAllDrumsForStemExport()
disarms and prepares all the drums so that they can be exported
Definition stem_export.cpp:551
void displayStemExportProgress(StemExportType stemExportType)
display how many stems we've exported so far
Definition stem_export.cpp:776
void stopStemExportProcess()
Stop stem export process.
Definition stem_export.cpp:150
int32_t disarmAllClipsForStemExport()
disarms and prepares all the clips so that they can be exported
Definition stem_export.cpp:412
void getLoopLengthOfLongestNotEmptyNoteRow(Clip *clip)
Definition stem_export.cpp:465
void restoreAllClipMutes(int32_t totalNumClips)
set clip mutes back to their previous state (before exporting stems)
Definition stem_export.cpp:451
void restoreAllDrumMutes(int32_t totalNumNoteRows)
set drum mutes back to their previous state (before exporting stems)
Definition stem_export.cpp:593
int32_t exportDrumStems(StemExportType stemExportType)
Definition stem_export.cpp:607
bool checkForSilence()
Definition stem_export.cpp:239
void setWavFileNameForStemExport(StemExportType type, Output *output, int32_t fileNumber, SoundDrum *drum=nullptr)
Definition stem_export.cpp:1059
void startOutputRecordingUntilLoopEndAndSilence()
Simulate pressing record and play in order to trigger resampling of out output that ends when loop en...
Definition stem_export.cpp:159
int32_t disarmAllInstrumentsForStemExport(StemExportType stemExportType)
disarms and prepares all the instruments so that they can be exported
Definition stem_export.cpp:269
Definition d_string.h:41