Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(15)

Side by Side Diff: Source/WebCore/webaudio/DelayDSPKernel.cpp

Issue 7745029: Merge 92408 - Make sure that AudioArray is 16-byte aligned (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/835/
Patch Set: Created 9 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2010, Google Inc. All rights reserved. 2 * Copyright (C) 2010, Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 30 matching lines...) Expand all
41 DelayDSPKernel::DelayDSPKernel(DelayProcessor* processor) 41 DelayDSPKernel::DelayDSPKernel(DelayProcessor* processor)
42 : AudioDSPKernel(processor) 42 : AudioDSPKernel(processor)
43 , m_maxDelayTime(DefaultMaxDelayTime) 43 , m_maxDelayTime(DefaultMaxDelayTime)
44 , m_writeIndex(0) 44 , m_writeIndex(0)
45 , m_firstTime(true) 45 , m_firstTime(true)
46 { 46 {
47 ASSERT(processor && processor->sampleRate() > 0); 47 ASSERT(processor && processor->sampleRate() > 0);
48 if (!processor) 48 if (!processor)
49 return; 49 return;
50 50
51 m_buffer.resize(static_cast<size_t>(processor->sampleRate() * DefaultMaxDela yTime)); 51 m_buffer.allocate(static_cast<size_t>(processor->sampleRate() * DefaultMaxDe layTime));
52 m_buffer.zero(); 52 m_buffer.zero();
53 53
54 m_smoothingRate = AudioUtilities::discreteTimeConstantForSampleRate(Smoothin gTimeConstant, processor->sampleRate()); 54 m_smoothingRate = AudioUtilities::discreteTimeConstantForSampleRate(Smoothin gTimeConstant, processor->sampleRate());
55 } 55 }
56 56
57 DelayDSPKernel::DelayDSPKernel(double maxDelayTime, double sampleRate) 57 DelayDSPKernel::DelayDSPKernel(double maxDelayTime, double sampleRate)
58 : AudioDSPKernel(sampleRate) 58 : AudioDSPKernel(sampleRate)
59 , m_maxDelayTime(maxDelayTime) 59 , m_maxDelayTime(maxDelayTime)
60 , m_writeIndex(0) 60 , m_writeIndex(0)
61 , m_firstTime(true) 61 , m_firstTime(true)
62 { 62 {
63 ASSERT(maxDelayTime > 0.0); 63 ASSERT(maxDelayTime > 0.0);
64 if (maxDelayTime <= 0.0) 64 if (maxDelayTime <= 0.0)
65 return; 65 return;
66 66
67 size_t bufferLength = static_cast<size_t>(sampleRate * maxDelayTime); 67 size_t bufferLength = static_cast<size_t>(sampleRate * maxDelayTime);
68 ASSERT(bufferLength); 68 ASSERT(bufferLength);
69 if (!bufferLength) 69 if (!bufferLength)
70 return; 70 return;
71 71
72 m_buffer.resize(bufferLength); 72 m_buffer.allocate(bufferLength);
73 m_buffer.zero(); 73 m_buffer.zero();
74 74
75 m_smoothingRate = AudioUtilities::discreteTimeConstantForSampleRate(Smoothin gTimeConstant, sampleRate); 75 m_smoothingRate = AudioUtilities::discreteTimeConstantForSampleRate(Smoothin gTimeConstant, sampleRate);
76 } 76 }
77 77
78 void DelayDSPKernel::process(const float* source, float* destination, size_t fra mesToProcess) 78 void DelayDSPKernel::process(const float* source, float* destination, size_t fra mesToProcess)
79 { 79 {
80 size_t bufferLength = m_buffer.size(); 80 size_t bufferLength = m_buffer.size();
81 float* buffer = m_buffer.data(); 81 float* buffer = m_buffer.data();
82 82
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 131
132 void DelayDSPKernel::reset() 132 void DelayDSPKernel::reset()
133 { 133 {
134 m_firstTime = true; 134 m_firstTime = true;
135 m_buffer.zero(); 135 m_buffer.zero();
136 } 136 }
137 137
138 } // namespace WebCore 138 } // namespace WebCore
139 139
140 #endif // ENABLE(WEB_AUDIO) 140 #endif // ENABLE(WEB_AUDIO)
OLDNEW
« no previous file with comments | « Source/WebCore/platform/audio/ReverbConvolverStage.cpp ('k') | Source/WebCore/webaudio/RealtimeAnalyser.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698