OLD | NEW |
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 18 matching lines...) Expand all Loading... |
29 #include "platform/audio/AudioChannel.h" | 29 #include "platform/audio/AudioChannel.h" |
30 #include "platform/audio/VectorMath.h" | 30 #include "platform/audio/VectorMath.h" |
31 #include <algorithm> | 31 #include <algorithm> |
32 #include <math.h> | 32 #include <math.h> |
33 | 33 |
34 namespace blink { | 34 namespace blink { |
35 | 35 |
36 using namespace VectorMath; | 36 using namespace VectorMath; |
37 | 37 |
38 void AudioChannel::resizeSmaller(size_t newLength) { | 38 void AudioChannel::resizeSmaller(size_t newLength) { |
39 DCHECK_LE(newLength, m_length); | 39 ASSERT(newLength <= m_length); |
40 if (newLength <= m_length) | 40 if (newLength <= m_length) |
41 m_length = newLength; | 41 m_length = newLength; |
42 } | 42 } |
43 | 43 |
44 void AudioChannel::scale(float scale) { | 44 void AudioChannel::scale(float scale) { |
45 if (isSilent()) | 45 if (isSilent()) |
46 return; | 46 return; |
47 | 47 |
48 vsmul(data(), 1, &scale, mutableData(), 1, length()); | 48 vsmul(data(), 1, &scale, mutableData(), 1, length()); |
49 } | 49 } |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 return 0; | 113 return 0; |
114 | 114 |
115 float max = 0; | 115 float max = 0; |
116 | 116 |
117 vmaxmgv(data(), 1, &max, length()); | 117 vmaxmgv(data(), 1, &max, length()); |
118 | 118 |
119 return max; | 119 return max; |
120 } | 120 } |
121 | 121 |
122 } // namespace blink | 122 } // namespace blink |
OLD | NEW |