diff options
author | Daniil Cherednik <dan.cherednik@gmail.com> | 2019-05-17 01:21:41 +0300 |
---|---|---|
committer | Daniil Cherednik <dan.cherednik@gmail.com> | 2019-05-17 01:21:41 +0300 |
commit | 72c3f6ec998e8acfade1e1b40abf32af21eb282b (patch) | |
tree | 2e5444a0711aa29a24e39ae2404d5c5f562af19b /src/main.cpp | |
parent | ed9629395ce9696164c1d617d573a47982e82169 (diff) | |
download | atracdenc-0.0.1.tar.gz |
Fix some VS compilation warnings0.0.1
Diffstat (limited to 'src/main.cpp')
-rw-r--r-- | src/main.cpp | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/src/main.cpp b/src/main.cpp index 4fb1ee9..bd961ec 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -139,17 +139,21 @@ static void PrepareAtrac1Encoder(const string& inFile, CheckInputFormat(wavPtr); wavIO->reset(wavPtr); } - const int numChannels = (*wavIO)->GetChannelNum(); + const uint8_t numChannels = (*wavIO)->GetChannelNum(); *totalSamples = (*wavIO)->GetTotalSamples(); //TODO: recheck it - const uint32_t numFrames = numChannels * (*totalSamples) / TAtrac1Data::NumSamples; - TCompressedIOPtr aeaIO = TCompressedIOPtr(new TAea(outFile, "test", numChannels, numFrames)); + const uint64_t numFrames = numChannels * (*totalSamples) / TAtrac1Data::NumSamples; + if (numFrames >= UINT32_MAX) { + std::cerr << "Number of input samples exceeds output format limitation," + "the result will be incorrect" << std::endl; + } + TCompressedIOPtr aeaIO = TCompressedIOPtr(new TAea(outFile, "test", numChannels, (uint32_t)numFrames)); pcmEngine->reset(new TPCMEngine<TFloat>(4096, numChannels, TPCMEngine<TFloat>::TReaderPtr((*wavIO)->GetPCMReader<TFloat>()))); if (!noStdOut) cout << "Input file: " << inFile - << "\n Channels: " << numChannels + << "\n Channels: " << (int)numChannels << "\n SampleRate: " << (*wavIO)->GetSampleRate() << "\n TotalSamples: " << totalSamples << endl; @@ -166,7 +170,7 @@ static void PrepareAtrac1Decoder(const string& inFile, { TCompressedIOPtr aeaIO = TCompressedIOPtr(new TAea(inFile)); *totalSamples = aeaIO->GetLengthInSamples(); - uint32_t length = aeaIO->GetLengthInSamples(); + uint64_t length = aeaIO->GetLengthInSamples(); if (!noStdOut) cout << "Name: " << aeaIO->GetName() << "\n Channels: " << aeaIO->GetChannelNum() @@ -193,10 +197,15 @@ static void PrepareAtrac3Encoder(const string& inFile, std::cout << "bitrate " << encoderSettings.ConteinerParams->Bitrate << std::endl; const int numChannels = encoderSettings.SourceChannels; *totalSamples = wavIO->GetTotalSamples(); + const uint64_t numFrames = numChannels * ((*totalSamples) / 512); + if (numFrames >= UINT32_MAX) { + std::cerr << "Number of input samples exceeds output format limitation," + "the result will be incorrect" << std::endl; + } TCompressedIOPtr omaIO = TCompressedIOPtr(new TOma(outFile, "test", numChannels, - numChannels * (*totalSamples) / 512, OMAC_ID_ATRAC3, + (int32_t)numFrames, OMAC_ID_ATRAC3, encoderSettings.ConteinerParams->FrameSz)); pcmEngine->reset(new TPCMEngine<TFloat>(4096, numChannels, |