From 0837c016c52237ca6dcffdac98b8ca4d514bf4af Mon Sep 17 00:00:00 2001 From: Howard Stearns Date: Tue, 2 Jun 2015 09:18:45 -0700 Subject: [PATCH] Update constant to use AudioConstants.h --- libraries/entities-renderer/src/EntityTreeRenderer.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/libraries/entities-renderer/src/EntityTreeRenderer.cpp b/libraries/entities-renderer/src/EntityTreeRenderer.cpp index e3680d4614..23e504bfb8 100644 --- a/libraries/entities-renderer/src/EntityTreeRenderer.cpp +++ b/libraries/entities-renderer/src/EntityTreeRenderer.cpp @@ -28,6 +28,7 @@ #include #include #include +#include #include "EntityTreeRenderer.h" @@ -1167,18 +1168,18 @@ void EntityTreeRenderer::playEntityCollisionSound(const QUuid& myNodeID, EntityT soxr_quality_spec_t qualitySpec = soxr_quality_spec(SOXR_MQ, 0); const int channelCount = sound->isStereo() ? 2 : 1; const float factor = log(1.0f + (entity->getMaximumAACube().getLargestDimension() / COLLISION_SIZE_FOR_STANDARD_PITCH)) / log(2); - const int HIFI_SAMPLE_RATE = 24000; //AudioConstants::SAMPLE_RATE - const int resampledRate = HIFI_SAMPLE_RATE * factor; + const int standardRate = AudioConstants::SAMPLE_RATE; + const int resampledRate = standardRate * factor; const int nInputSamples = samples.size() / sizeof(int16_t); const int nOutputSamples = nInputSamples * factor; QByteArray resampled(nOutputSamples * sizeof(int16_t), '\0'); const int16_t* receivedSamples = reinterpret_cast(samples.data()); - soxr_error_t soxError = soxr_oneshot(HIFI_SAMPLE_RATE, resampledRate, channelCount, + soxr_error_t soxError = soxr_oneshot(standardRate, resampledRate, channelCount, receivedSamples, nInputSamples, NULL, reinterpret_cast(resampled.data()), nOutputSamples, NULL, &spec, &qualitySpec, 0); if (soxError) { - qCDebug(entitiesrenderer) << "Unable to resample" << collisionSoundURL << "from" << nInputSamples << "@" << HIFI_SAMPLE_RATE << "to" << nOutputSamples << "@" << resampledRate; + qCDebug(entitiesrenderer) << "Unable to resample" << collisionSoundURL << "from" << nInputSamples << "@" << standardRate << "to" << nOutputSamples << "@" << resampledRate; resampled = samples; }