| 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 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 #ifndef DelayDSPKernel_h | 25 #ifndef DelayDSPKernel_h |
| 26 #define DelayDSPKernel_h | 26 #define DelayDSPKernel_h |
| 27 | 27 |
| 28 #include "core/platform/audio/AudioArray.h" | 28 #include "core/platform/audio/AudioArray.h" |
| 29 #include "core/platform/audio/AudioDSPKernel.h" | 29 #include "core/platform/audio/AudioDSPKernel.h" |
| 30 #include "modules/webaudio/DelayProcessor.h" | 30 #include "modules/webaudio/DelayProcessor.h" |
| 31 | 31 |
| 32 namespace WebCore { | 32 namespace WebCore { |
| 33 | 33 |
| 34 class DelayProcessor; | 34 class DelayProcessor; |
| 35 | 35 |
| 36 class DelayDSPKernel : public AudioDSPKernel { | 36 class DelayDSPKernel : public AudioDSPKernel { |
| 37 public: | 37 public: |
| 38 explicit DelayDSPKernel(DelayProcessor*); | 38 explicit DelayDSPKernel(DelayProcessor*); |
| 39 DelayDSPKernel(double maxDelayTime, float sampleRate); | 39 DelayDSPKernel(double maxDelayTime, float sampleRate); |
| 40 | 40 |
| 41 virtual void process(const float* source, float* destination, size_t framesT
oProcess); | 41 virtual void process(const float* source, float* destination, size_t framesT
oProcess); |
| 42 virtual void reset(); | 42 virtual void reset(); |
| 43 | 43 |
| 44 double maxDelayTime() const { return m_maxDelayTime; } | 44 double maxDelayTime() const { return m_maxDelayTime; } |
| 45 | 45 |
| 46 void setDelayFrames(double numberOfFrames) { m_desiredDelayFrames = numberOf
Frames; } | 46 void setDelayFrames(double numberOfFrames) { m_desiredDelayFrames = numberOf
Frames; } |
| 47 | 47 |
| 48 virtual double tailTime() const OVERRIDE; | 48 virtual double tailTime() const OVERRIDE; |
| 49 virtual double latencyTime() const OVERRIDE; | 49 virtual double latencyTime() const OVERRIDE; |
| 50 | 50 |
| 51 private: | 51 private: |
| 52 AudioFloatArray m_buffer; | 52 AudioFloatArray m_buffer; |
| 53 double m_maxDelayTime; | 53 double m_maxDelayTime; |
| 54 int m_writeIndex; | 54 int m_writeIndex; |
| 55 double m_currentDelayTime; | 55 double m_currentDelayTime; |
| 56 double m_smoothingRate; | 56 double m_smoothingRate; |
| 57 bool m_firstTime; | 57 bool m_firstTime; |
| 58 double m_desiredDelayFrames; | 58 double m_desiredDelayFrames; |
| 59 | 59 |
| 60 AudioFloatArray m_delayTimes; | 60 AudioFloatArray m_delayTimes; |
| 61 | 61 |
| 62 DelayProcessor* delayProcessor() { return static_cast<DelayProcessor*>(proce
ssor()); } | 62 DelayProcessor* delayProcessor() { return static_cast<DelayProcessor*>(proce
ssor()); } |
| 63 size_t bufferLengthForDelay(double delayTime, double sampleRate) const; | 63 size_t bufferLengthForDelay(double delayTime, double sampleRate) const; |
| 64 }; | 64 }; |
| 65 | 65 |
| 66 } // namespace WebCore | 66 } // namespace WebCore |
| 67 | 67 |
| 68 #endif // DelayDSPKernel_h | 68 #endif // DelayDSPKernel_h |
| OLD | NEW |