Skip to content

Commit

Permalink
Fix warnings in Video.cpp
Browse files Browse the repository at this point in the history
  • Loading branch information
jhasse committed Feb 9, 2024
1 parent 2640c48 commit e68430d
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/jngl/Video.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@

#ifdef JNGL_VIDEO

#include "../audio.hpp"
#include "../audio/constants.hpp"
#include "../audio/effect/pitch.hpp"
#include "../audio.hpp"
#include "../main.hpp"
#include "../opengl.hpp"
#include "../theoraplay/theoraplay.h"
Expand All @@ -22,7 +22,6 @@

#include <algorithm>
#include <cmath>
#include <deque>
#include <gsl/narrow>

namespace jngl {
Expand Down Expand Up @@ -285,14 +284,14 @@ class Video::Impl : public Stream {
{
std::scoped_lock lock(audioBufferMutex);
if (audio->channels == 1) {
for (size_t i = 0; i < audio->frames; ++i) {
for (int i = 0; i < audio->frames; ++i) {
audioBuffer.push_back(audio->samples[i]);
audioBuffer.push_back(audio->samples[i]);
}
} else {
assert(audio->channels == 2);
audioBuffer.insert(audioBuffer.end(), audio->samples,
audio->samples + audio->frames * 2);
audio->samples + static_cast<ptrdiff_t>(audio->frames * 2));
}
}
THEORAPLAY_freeAudio(audio);
Expand All @@ -315,7 +314,7 @@ class Video::Impl : public Stream {
return sample_count;
}
const auto begin = audioBuffer.begin();
const auto end = begin + sample_count;
const auto end = begin + static_cast<long>(sample_count);
std::copy(begin, end, data);
audioBuffer.erase(begin, end);
return sample_count;
Expand Down Expand Up @@ -343,7 +342,8 @@ class Video::Impl : public Stream {

Video::Video(const std::string& filename) : impl(std::make_shared<Impl>(filename)) {
if (impl->getFrequency() != audio::frequency) {
getMixer()->add(audio::pitch(impl, float(impl->getFrequency()) / audio::frequency));
getMixer()->add(
audio::pitch(impl, static_cast<float>(impl->getFrequency()) / audio::frequency));
} else {
getMixer()->add(impl);
}
Expand Down

0 comments on commit e68430d

Please sign in to comment.