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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 AudioChannel(float* storage, size_t length) | 46 AudioChannel(float* storage, size_t length) |
47 : m_length(length) | 47 : m_length(length) |
48 , m_rawPointer(storage) | 48 , m_rawPointer(storage) |
49 , m_silent(false) | 49 , m_silent(false) |
50 { | 50 { |
51 } | 51 } |
52 | 52 |
53 // Manage storage for us. | 53 // Manage storage for us. |
54 explicit AudioChannel(size_t length) | 54 explicit AudioChannel(size_t length) |
55 : m_length(length) | 55 : m_length(length) |
56 , m_rawPointer(0) | 56 , m_rawPointer(nullptr) |
57 , m_silent(true) | 57 , m_silent(true) |
58 { | 58 { |
59 m_memBuffer = adoptPtr(new AudioFloatArray(length)); | 59 m_memBuffer = adoptPtr(new AudioFloatArray(length)); |
60 } | 60 } |
61 | 61 |
62 // A "blank" audio channel -- must call set() before it's useful... | 62 // A "blank" audio channel -- must call set() before it's useful... |
63 AudioChannel() | 63 AudioChannel() |
64 : m_length(0) | 64 : m_length(0) |
65 , m_rawPointer(0) | 65 , m_rawPointer(nullptr) |
66 , m_silent(true) | 66 , m_silent(true) |
67 { | 67 { |
68 } | 68 } |
69 | 69 |
70 // Redefine the memory for this channel. | 70 // Redefine the memory for this channel. |
71 // storage represents external memory not managed by this object. | 71 // storage represents external memory not managed by this object. |
72 void set(float* storage, size_t length) | 72 void set(float* storage, size_t length) |
73 { | 73 { |
74 m_memBuffer.clear(); // cleanup managed storage | 74 m_memBuffer.clear(); // cleanup managed storage |
75 m_rawPointer = storage; | 75 m_rawPointer = storage; |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 size_t m_length; | 131 size_t m_length; |
132 | 132 |
133 float* m_rawPointer; | 133 float* m_rawPointer; |
134 OwnPtr<AudioFloatArray> m_memBuffer; | 134 OwnPtr<AudioFloatArray> m_memBuffer; |
135 bool m_silent; | 135 bool m_silent; |
136 }; | 136 }; |
137 | 137 |
138 } // namespace blink | 138 } // namespace blink |
139 | 139 |
140 #endif // AudioChannel_h | 140 #endif // AudioChannel_h |
OLD | NEW |