aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniil Cherednik <dan.cherednik@gmail.com>2015-11-07 02:24:13 +0300
committerDaniil Cherednik <dan.cherednik@gmail.com>2015-11-07 02:24:13 +0300
commitfce9ed7a4921b43c32ab012e17a18d67dcb23829 (patch)
treed049f1c764bf12eeb4c69b3f06149b5b2954dc65
parent66659c6386c792a3ae9f910578e1b671fd9213ad (diff)
downloadatracdenc-fce9ed7a4921b43c32ab012e17a18d67dcb23829.tar.gz
progress bar added
-rw-r--r--src/main.cpp11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/main.cpp b/src/main.cpp
index fc4bced..5389551 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -24,6 +24,14 @@ static void printUsage(const char* myName) {
cout << "-d decode mode (ATRAC -> PCM), -i aea file, -o wav file" << endl;
}
+static void printProgress(int percent) {
+ static uint32_t counter;
+ counter++;
+ const char symbols[4] = {'-', '\\', '|', '/'};
+ cout << symbols[counter % 4]<< " "<< percent <<"% done\r";
+ fflush(stdout);
+}
+
int main(int argc, char* const* argv) {
const char* myName = argv[0];
static struct option longopts[] = {
@@ -111,8 +119,9 @@ int main(int argc, char* const* argv) {
try {
while (totalSamples/4 > (processed = pcmEngine->ApplyProcess(512, atracLambda)))
{
- cout << "pos: " << processed << " " << totalSamples/4 << endl;
+ printProgress(processed*100/(totalSamples/4));
}
+ cout << "\nDone" << endl;
}
catch (TAeaIOError err) {
cerr << "Aea IO fatal error: " << err.what() << endl;