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

Side by Side Diff: third_party/WebKit/Source/platform/audio/ReverbInputBuffer.cpp

Issue 2384073002: reflow comments in platform/audio (Closed)
Patch Set: comments (heh!) Created 4 years, 2 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 * 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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 m_writeIndex = 0; 50 m_writeIndex = 0;
51 } 51 }
52 52
53 float* ReverbInputBuffer::directReadFrom(int* readIndex, 53 float* ReverbInputBuffer::directReadFrom(int* readIndex,
54 size_t numberOfFrames) { 54 size_t numberOfFrames) {
55 size_t bufferLength = m_buffer.size(); 55 size_t bufferLength = m_buffer.size();
56 bool isPointerGood = readIndex && *readIndex >= 0 && 56 bool isPointerGood = readIndex && *readIndex >= 0 &&
57 *readIndex + numberOfFrames <= bufferLength; 57 *readIndex + numberOfFrames <= bufferLength;
58 ASSERT(isPointerGood); 58 ASSERT(isPointerGood);
59 if (!isPointerGood) { 59 if (!isPointerGood) {
60 // Should never happen in practice but return pointer to start of buffer (av oid crash) 60 // Should never happen in practice but return pointer to start of buffer
61 // (avoid crash)
61 if (readIndex) 62 if (readIndex)
62 *readIndex = 0; 63 *readIndex = 0;
63 return m_buffer.data(); 64 return m_buffer.data();
64 } 65 }
65 66
66 float* sourceP = m_buffer.data(); 67 float* sourceP = m_buffer.data();
67 float* p = sourceP + *readIndex; 68 float* p = sourceP + *readIndex;
68 69
69 // Update readIndex 70 // Update readIndex
70 *readIndex = (*readIndex + numberOfFrames) % bufferLength; 71 *readIndex = (*readIndex + numberOfFrames) % bufferLength;
71 72
72 return p; 73 return p;
73 } 74 }
74 75
75 void ReverbInputBuffer::reset() { 76 void ReverbInputBuffer::reset() {
76 m_buffer.zero(); 77 m_buffer.zero();
77 m_writeIndex = 0; 78 m_writeIndex = 0;
78 } 79 }
79 80
80 } // namespace blink 81 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/platform/audio/ReverbInputBuffer.h ('k') | third_party/WebKit/Source/platform/audio/SincResampler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698