Deluge Firmware 1.3.0
Build date: 2025.04.16
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 "util/d_string.h"
22#include <cstdint>
23
24class Output;
25class Clip;
26
27class StemExport {
28public:
29 StemExport();
30
31 // start & stop process
32 void startStemExportProcess(StemExportType stemExportType);
35 void stopPlayback();
37 bool checkForLoopEnd();
38 bool checkForSilence();
39 bool processStarted;
40 bool stopRecording;
41 StemExportType currentStemExportType;
42 uint32_t timePlaybackStopped;
43 uint32_t timeThereWasLastSomeActivity;
44
45 // export config variables
46 bool allowNormalization;
47 bool exportToSilence;
48 bool includeSongFX;
49 bool renderOffline;
50 bool exportMixdown;
51
52 // export instruments
53 int32_t disarmAllInstrumentsForStemExport(StemExportType stemExportType);
54 int32_t exportInstrumentStems(StemExportType stemExportType);
55 int32_t exportMixdownStem(StemExportType stemExportType);
56 void restoreAllInstrumentMutes(int32_t totalNumOutputs);
57
58 // export clips
60 int32_t exportClipStems(StemExportType stemExportType);
61 void restoreAllClipMutes(int32_t totalNumClips);
63 void getLoopEndPointInSamplesForAudioFile(int32_t loopLength);
64 bool writeLoopEndPos();
65 int32_t loopLengthToStopStemExport;
66 int32_t loopEndPointInSamplesForAudioFile;
67
68 // start exporting
69 bool startCurrentStemExport(StemExportType stemExportType, Output* output, bool& muteState, int32_t fileNumber,
70 bool exportStem);
71
72 // finish exporting
73 void finishCurrentStemExport(StemExportType stemExportType, bool& muteState);
74 void finishStemExportProcess(StemExportType stemExportType, int32_t elementsProcessed);
75 void updateScrollPosition(StemExportType stemExportType, int32_t indexNumber);
76
77 // export status
78 void displayStemExportProgress(StemExportType stemExportType);
79 void displayStemExportProgressOLED(StemExportType stemExportType);
80 void displayStemExportProgress7SEG();
81 int32_t numStemsExported;
82 int32_t totalNumStemsToExport;
83
84 // audio file management
85 Error getUnusedStemRecordingFilePath(String* filePath, AudioRecordingFolder folder);
86 Error getUnusedStemRecordingFolderPath(String* filePath, AudioRecordingFolder folder);
87 int32_t highestUsedStemFolderNumber;
88 String lastFolderNameForStemExport;
89 void setWavFileNameForStemExport(StemExportType type, Output* output, int32_t fileNumber);
90 String wavFileNameForStemExport;
91 bool wavFileNameForStemExportSet;
92
93 // check if we're in context menu
94 bool inContextMenu();
95};
96
97extern StemExport stemExport;
Definition clip.h:46
Definition output.h:81
Definition stem_export.h:27
int32_t exportClipStems(StemExportType stemExportType)
Definition stem_export.cpp:491
bool checkForLoopEnd()
Definition stem_export.cpp:202
void restoreAllInstrumentMutes(int32_t totalNumOutputs)
set instrument mutes back to their previous state (before exporting stems)
Definition stem_export.cpp:307
void getLoopEndPointInSamplesForAudioFile(int32_t loopLength)
converts clip loop length into samples so that clip end position can be written to clip stem
Definition stem_export.cpp:475
Error getUnusedStemRecordingFolderPath(String *filePath, AudioRecordingFolder folder)
Definition stem_export.cpp:737
void stopPlayback()
simulate pressing play
Definition stem_export.cpp:176
int32_t exportMixdownStem(StemExportType stemExportType)
Definition stem_export.cpp:369
bool inContextMenu()
Definition stem_export.cpp:995
void finishCurrentStemExport(StemExportType stemExportType, bool &muteState)
Definition stem_export.cpp:576
void stopOutputRecording()
simulate pressing record
Definition stem_export.cpp:184
bool writeLoopEndPos()
Definition stem_export.cpp:481
int32_t exportInstrumentStems(StemExportType stemExportType)
Definition stem_export.cpp:322
void updateScrollPosition(StemExportType stemExportType, int32_t indexNumber)
Definition stem_export.cpp:624
void startStemExportProcess(StemExportType stemExportType)
Definition stem_export.cpp:81
void displayStemExportProgress(StemExportType stemExportType)
display how many stems we've exported so far
Definition stem_export.cpp:640
void stopStemExportProcess()
Stop stem export process.
Definition stem_export.cpp:142
int32_t disarmAllClipsForStemExport()
disarms and prepares all the clips so that they can be exported
Definition stem_export.cpp:402
void getLoopLengthOfLongestNotEmptyNoteRow(Clip *clip)
Definition stem_export.cpp:455
void setWavFileNameForStemExport(StemExportType type, Output *output, int32_t fileNumber)
Definition stem_export.cpp:907
void restoreAllClipMutes(int32_t totalNumClips)
set clip mutes back to their previous state (before exporting stems)
Definition stem_export.cpp:441
bool checkForSilence()
Definition stem_export.cpp:229
void startOutputRecordingUntilLoopEndAndSilence()
Simulate pressing record and play in order to trigger resampling of out output that ends when loop en...
Definition stem_export.cpp:150
int32_t disarmAllInstrumentsForStemExport(StemExportType stemExportType)
disarms and prepares all the instruments so that they can be exported
Definition stem_export.cpp:259
Definition d_string.h:46