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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 namespace blink { | 70 namespace blink { |
71 | 71 |
72 SincResampler::SincResampler(double scaleFactor, unsigned kernelSize, unsigned n
umberOfKernelOffsets) | 72 SincResampler::SincResampler(double scaleFactor, unsigned kernelSize, unsigned n
umberOfKernelOffsets) |
73 : m_scaleFactor(scaleFactor) | 73 : m_scaleFactor(scaleFactor) |
74 , m_kernelSize(kernelSize) | 74 , m_kernelSize(kernelSize) |
75 , m_numberOfKernelOffsets(numberOfKernelOffsets) | 75 , m_numberOfKernelOffsets(numberOfKernelOffsets) |
76 , m_kernelStorage(m_kernelSize * (m_numberOfKernelOffsets + 1)) | 76 , m_kernelStorage(m_kernelSize * (m_numberOfKernelOffsets + 1)) |
77 , m_virtualSourceIndex(0) | 77 , m_virtualSourceIndex(0) |
78 , m_blockSize(512) | 78 , m_blockSize(512) |
79 , m_inputBuffer(m_blockSize + m_kernelSize) // See input buffer layout above
. | 79 , m_inputBuffer(m_blockSize + m_kernelSize) // See input buffer layout above
. |
80 , m_source(0) | 80 , m_source(nullptr) |
81 , m_sourceFramesAvailable(0) | 81 , m_sourceFramesAvailable(0) |
82 , m_sourceProvider(0) | 82 , m_sourceProvider(nullptr) |
83 , m_isBufferPrimed(false) | 83 , m_isBufferPrimed(false) |
84 { | 84 { |
85 initializeKernel(); | 85 initializeKernel(); |
86 } | 86 } |
87 | 87 |
88 void SincResampler::initializeKernel() | 88 void SincResampler::initializeKernel() |
89 { | 89 { |
90 // Blackman window parameters. | 90 // Blackman window parameters. |
91 double alpha = 0.16; | 91 double alpha = 0.16; |
92 double a0 = 0.5 * (1.0 - alpha); | 92 double a0 = 0.5 * (1.0 - alpha); |
(...skipping 371 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 |