-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMultitool-Main.cpp
More file actions
137 lines (113 loc) · 4.37 KB
/
Multitool-Main.cpp
File metadata and controls
137 lines (113 loc) · 4.37 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
#include <iostream>
#include <sstream>
#include <string> // std::string
#include <algorithm> // std::search or size_t
#include "Multitool-Actions.h"
void showTitle()
{
std::cout << R"(
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
((((
(((( _______ _______. ___
)))) | \ / | / \
_ .---. | .--. | | (----` / ^ \
( |`---'| | | | | \ \ / /_\ \ _
\| | | '--' |.----) | / _____ \ / _ _| _ _ ._ | _
: .___, : |_______/ |_______/ /__/ \__\ \_ (_) (_| (/_ \/\/ (_) | |< _>
`-----'
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
)";
std::cout << '\n';
}
bool CheckFfmpeg()
{
std::string sSearchString = "ffmpeg";
char* pValue;
size_t len;
errno_t err = _dupenv_s(&pValue, &len, "path");
// if (err) return -1; NOT SURE WHY IS THIS HERE?
std::string sToSearch(pValue);
std::for_each(sToSearch.begin(), sToSearch.end(), [](char& c)
{
c = ::tolower(c); // make PATH completely lowercase to be searchable
});
std::size_t found = sToSearch.find(sSearchString);
if (found != std::string::npos)
{
//std::cout << "FFmpeg Found!" << '\n' << '\n'; // ONLY FOR DEBUGGING
free(pValue); // free buffer again
return true;
}
else std::cout << "ERROR: FFmpeg not found, please install FFmpeg first." << '\n' << '\n';
free(pValue); // free buffer again
return false;
}
int main()
{
int iSelection = 0;
bool hasEnded = false;
while (!hasEnded)
{
if (CheckFfmpeg())
{
showTitle();
std::cout << " Double Shot Audio Multi Tool v0.1\n";
std::cout << " Only use if you have ffmpeg installed and configured in cmd\n\n";
std::cout << "Tools selection: \n";
std::cout << "1. Video Converter for Nuendo / Cubase \n";
std::cout << "2. Audio Extractor \n";
std::cout << "3. Audio Replacer for Video (MOV container with WAV) \n";
std::cout << "4. Audio Replacer for Video (MP4 container with AAC) \n";
std::cout << "5. WAV to MP3 converter (VBR 192k) \n";
std::cout << "6. Quit\n\n";
std::cout << "Input your selection : ";
while (!(std::cin >> iSelection) || (iSelection < 1 || iSelection > 100)) // Input validation
{
std::cout << "ERROR: Please enter a valid number : ";
std::cin.clear();
std::cin.ignore();
}
std::cin.ignore(); // to ignore the \n character after enter!
switch (iSelection)
{
case 1:
ConvertVideo();
break;
case 2:
ExtractAudio();
break;
case 3:
CombineVideoAudioWav();
break;
case 4:
CombineVideoAudioAac();
break;
case 5:
ConvertAudioToMp3();
break;
case 6:
hasEnded = true;
default:
std::cout << "This is not a valid option! \n"; //TODO: when invalid selection is entered, ask user to input again
break;
}
}
else
{
std::cout << "Program has ended. \n";
system("pause");
return 0;
}
}
}
// Run program: Ctrl + F5 or Debug > Start Without Debugging menu
// Debug program: F5 or Debug > Start Debugging menu
// Tips for Getting Started:
// 1. Use the Solution Explorer window to add/manage files
// 2. Use the Team Explorer window to connect to source control
// 3. Use the Output window to see build output and other messages
// 4. Use the Error List window to view errors
// 5. Go to Project > Add New Item to create new code files, or Project > Add Existing Item to add existing code files to the project
// 6. In the future, to open this project again, go to File > Open > Project and select the .sln file