2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-08-31 14:45:14 +00:00

Alpha 1.0.8: seek in voice messages (by waveform).

This commit is contained in:
John Preston
2017-02-11 01:37:37 +03:00
parent 296c800b39
commit e922e5be39
26 changed files with 347 additions and 125 deletions

View File

@@ -1686,12 +1686,12 @@ public:
QByteArray buffer;
buffer.reserve(AudioVoiceMsgBufferSize);
int64 countbytes = sampleSize * duration(), processed = 0, sumbytes = 0;
if (duration() < WaveformSamplesCount) {
if (duration() < Media::Player::kWaveformSamplesCount) {
return false;
}
QVector<uint16> peaks;
peaks.reserve(WaveformSamplesCount);
peaks.reserve(Media::Player::kWaveformSamplesCount);
int32 fmt = format();
uint16 peak = 0;
@@ -1716,7 +1716,7 @@ public:
}
i += sizeof(uchar);
sumbytes += WaveformSamplesCount;
sumbytes += Media::Player::kWaveformSamplesCount;
if (sumbytes >= countbytes) {
sumbytes -= countbytes;
peaks.push_back(peak);
@@ -1731,7 +1731,7 @@ public:
}
i += sizeof(uint16);
sumbytes += sizeof(uint16) * WaveformSamplesCount;
sumbytes += sizeof(uint16) * Media::Player::kWaveformSamplesCount;
if (sumbytes >= countbytes) {
sumbytes -= countbytes;
peaks.push_back(peak);
@@ -1741,7 +1741,7 @@ public:
}
processed += sampleSize * samples;
}
if (sumbytes > 0 && peaks.size() < WaveformSamplesCount) {
if (sumbytes > 0 && peaks.size() < Media::Player::kWaveformSamplesCount) {
peaks.push_back(peak);
}