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

Side by Side Diff: Source/platform/audio/HRTFKernel.cpp

Issue 170603003: Use nullptr_t for RefPtr, PassRefPtr and RawPtr. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Final rebase Created 6 years, 10 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 | Annotate | Revision Log
« no previous file with comments | « Source/platform/audio/HRTFElevation.cpp ('k') | Source/platform/exported/WebHTTPBody.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 * 7 *
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 fftFrame.doInverseFFT(channel->mutableData()); 106 fftFrame.doInverseFFT(channel->mutableData());
107 107
108 return channel.release(); 108 return channel.release();
109 } 109 }
110 110
111 // Interpolates two kernels with x: 0 -> 1 and returns the result. 111 // Interpolates two kernels with x: 0 -> 1 and returns the result.
112 PassRefPtr<HRTFKernel> HRTFKernel::createInterpolatedKernel(HRTFKernel* kernel1, HRTFKernel* kernel2, float x) 112 PassRefPtr<HRTFKernel> HRTFKernel::createInterpolatedKernel(HRTFKernel* kernel1, HRTFKernel* kernel2, float x)
113 { 113 {
114 ASSERT(kernel1 && kernel2); 114 ASSERT(kernel1 && kernel2);
115 if (!kernel1 || !kernel2) 115 if (!kernel1 || !kernel2)
116 return 0; 116 return nullptr;
117 117
118 ASSERT(x >= 0.0 && x < 1.0); 118 ASSERT(x >= 0.0 && x < 1.0);
119 x = min(1.0f, max(0.0f, x)); 119 x = min(1.0f, max(0.0f, x));
120 120
121 float sampleRate1 = kernel1->sampleRate(); 121 float sampleRate1 = kernel1->sampleRate();
122 float sampleRate2 = kernel2->sampleRate(); 122 float sampleRate2 = kernel2->sampleRate();
123 ASSERT(sampleRate1 == sampleRate2); 123 ASSERT(sampleRate1 == sampleRate2);
124 if (sampleRate1 != sampleRate2) 124 if (sampleRate1 != sampleRate2)
125 return 0; 125 return nullptr;
126 126
127 float frameDelay = (1 - x) * kernel1->frameDelay() + x * kernel2->frameDelay (); 127 float frameDelay = (1 - x) * kernel1->frameDelay() + x * kernel2->frameDelay ();
128 128
129 OwnPtr<FFTFrame> interpolatedFrame = FFTFrame::createInterpolatedFrame(*kern el1->fftFrame(), *kernel2->fftFrame(), x); 129 OwnPtr<FFTFrame> interpolatedFrame = FFTFrame::createInterpolatedFrame(*kern el1->fftFrame(), *kernel2->fftFrame(), x);
130 return HRTFKernel::create(interpolatedFrame.release(), frameDelay, sampleRat e1); 130 return HRTFKernel::create(interpolatedFrame.release(), frameDelay, sampleRat e1);
131 } 131 }
132 132
133 } // namespace WebCore 133 } // namespace WebCore
134 134
135 #endif // ENABLE(WEB_AUDIO) 135 #endif // ENABLE(WEB_AUDIO)
OLDNEW
« no previous file with comments | « Source/platform/audio/HRTFElevation.cpp ('k') | Source/platform/exported/WebHTTPBody.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698