Skip to content

Commit

Permalink
Buildfixes
Browse files Browse the repository at this point in the history
  • Loading branch information
hrydgard committed Dec 21, 2016
1 parent 9917a36 commit 76e746c
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 8 deletions.
8 changes: 2 additions & 6 deletions Core/HW/StereoResampler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ StereoResampler::StereoResampler()
, sample_rate_(0.0f)
, lastBufSize_(0) {
// Need to have space for the worst case in case it changes.
m_buffer = new int16_t[MAX_SAMPLES_EXTRA * 2]();
m_buffer.reset(new int16_t[MAX_SAMPLES_EXTRA * 2]());

// Some Android devices are v-synced to non-60Hz framerates. We simply timestretch audio to fit.
// TODO: should only do this if auto frameskip is off?
Expand All @@ -73,10 +73,6 @@ StereoResampler::StereoResampler()
UpdateBufferSize();
}

StereoResampler::~StereoResampler() {
delete[] m_buffer;
}

void StereoResampler::UpdateBufferSize() {
if (g_Config.bExtraAudioBuffering) {
m_bufsize = MAX_SAMPLES_EXTRA;
Expand Down Expand Up @@ -121,7 +117,7 @@ inline void ClampBufferToS16WithVolume(s16 *out, const s32 *in, size_t size) {
}

void StereoResampler::Clear() {
memset(m_buffer, 0, m_bufsize * 2 * sizeof(int16_t));
memset(&m_buffer[0], 0, m_bufsize * 2 * sizeof(int16_t));
}

// Executed from sound stream thread
Expand Down
4 changes: 3 additions & 1 deletion Core/HW/StereoResampler.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#pragma once

#include <string>
#include <memory>

#include "base/mutex.h"

Expand All @@ -43,6 +44,7 @@ class StereoResampler : public AsyncAudioQueue {
void DoState(PointerWrap &p) override;

void GetAudioDebugStats(AudioDebugStats *stats) override;
void Clear() override;

protected:
void UpdateBufferSize();
Expand All @@ -51,7 +53,7 @@ class StereoResampler : public AsyncAudioQueue {
int m_bufsize;
int m_lowwatermark;
unsigned int m_input_sample_rate;
int16_t *m_buffer;
std::unique_ptr<int16_t[]> m_buffer;
volatile u32 m_indexW;
volatile u32 m_indexR;
float m_numLeftI;
Expand Down
2 changes: 1 addition & 1 deletion Core/Util/TimeStretcher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ namespace AudioCore {
}

int TimeStretcher::GetSamplesQueued() {
return impl->samples_queued;
return (int)impl->samples_queued;
}

void TimeStretcher::Flush() {
Expand Down

0 comments on commit 76e746c

Please sign in to comment.