OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 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 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
138 // FIXME: Find a way to make the following const-correct: | 138 // FIXME: Find a way to make the following const-correct: |
139 bus->setChannelMemory(0, buffer, numberOfSourceFrames); | 139 bus->setChannelMemory(0, buffer, numberOfSourceFrames); |
140 | 140 |
141 m_sourceProvider->provideInput(bus.get(), numberOfSourceFrames); | 141 m_sourceProvider->provideInput(bus.get(), numberOfSourceFrames); |
142 } | 142 } |
143 | 143 |
144 namespace { | 144 namespace { |
145 | 145 |
146 // BufferSourceProvider is an AudioSourceProvider wrapping an in-memory buffer. | 146 // BufferSourceProvider is an AudioSourceProvider wrapping an in-memory buffer. |
147 | 147 |
148 class BufferSourceProvider FINAL : public AudioSourceProvider { | 148 class BufferSourceProvider final : public AudioSourceProvider { |
149 public: | 149 public: |
150 BufferSourceProvider(const float* source, size_t numberOfSourceFrames) | 150 BufferSourceProvider(const float* source, size_t numberOfSourceFrames) |
151 : m_source(source) | 151 : m_source(source) |
152 , m_sourceFramesAvailable(numberOfSourceFrames) | 152 , m_sourceFramesAvailable(numberOfSourceFrames) |
153 { | 153 { |
154 } | 154 } |
155 | 155 |
156 // Consumes samples from the in-memory buffer. | 156 // Consumes samples from the in-memory buffer. |
157 virtual void provideInput(AudioBus* bus, size_t framesToProcess) override | 157 virtual void provideInput(AudioBus* bus, size_t framesToProcess) override |
158 { | 158 { |
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
464 | 464 |
465 // Step (4) | 465 // Step (4) |
466 // Refresh the buffer with more input. | 466 // Refresh the buffer with more input. |
467 consumeSource(r5, m_blockSize); | 467 consumeSource(r5, m_blockSize); |
468 } | 468 } |
469 } | 469 } |
470 | 470 |
471 } // namespace blink | 471 } // namespace blink |
472 | 472 |
473 #endif // ENABLE(WEB_AUDIO) | 473 #endif // ENABLE(WEB_AUDIO) |
OLD | NEW |