| 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 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 unsigned frames_to_process); | 76 unsigned frames_to_process); |
| 77 void Reset(); | 77 void Reset(); |
| 78 void SetNumberOfChannels(unsigned); | 78 void SetNumberOfChannels(unsigned); |
| 79 | 79 |
| 80 void SetParameterValue(unsigned parameter_id, float value); | 80 void SetParameterValue(unsigned parameter_id, float value); |
| 81 float ParameterValue(unsigned parameter_id); | 81 float ParameterValue(unsigned parameter_id); |
| 82 | 82 |
| 83 float SampleRate() const { return sample_rate_; } | 83 float SampleRate() const { return sample_rate_; } |
| 84 float Nyquist() const { return sample_rate_ / 2; } | 84 float Nyquist() const { return sample_rate_ / 2; } |
| 85 | 85 |
| 86 double TailTime() const { return 0; } | 86 double TailTime() const; |
| 87 double LatencyTime() const { | 87 double LatencyTime() const { |
| 88 return compressor_.LatencyFrames() / static_cast<double>(SampleRate()); | 88 return compressor_.LatencyFrames() / static_cast<double>(SampleRate()); |
| 89 } | 89 } |
| 90 bool RequiresTailProcessing() const { |
| 91 // Always return true even if the tail time and latency might both |
| 92 // be zero. |
| 93 return true; |
| 94 } |
| 90 | 95 |
| 91 protected: | 96 protected: |
| 92 unsigned number_of_channels_; | 97 unsigned number_of_channels_; |
| 93 | 98 |
| 94 // m_parameters holds the tweakable compressor parameters. | 99 // m_parameters holds the tweakable compressor parameters. |
| 95 float parameters_[kParamLast]; | 100 float parameters_[kParamLast]; |
| 96 void InitializeParameters(); | 101 void InitializeParameters(); |
| 97 | 102 |
| 98 float sample_rate_; | 103 float sample_rate_; |
| 99 | 104 |
| 100 // Emphasis filter controls. | 105 // Emphasis filter controls. |
| 101 float last_filter_stage_ratio_; | 106 float last_filter_stage_ratio_; |
| 102 float last_anchor_; | 107 float last_anchor_; |
| 103 float last_filter_stage_gain_; | 108 float last_filter_stage_gain_; |
| 104 | 109 |
| 105 std::unique_ptr<const float* []> source_channels_; | 110 std::unique_ptr<const float* []> source_channels_; |
| 106 std::unique_ptr<float* []> destination_channels_; | 111 std::unique_ptr<float* []> destination_channels_; |
| 107 | 112 |
| 108 // The core compressor. | 113 // The core compressor. |
| 109 DynamicsCompressorKernel compressor_; | 114 DynamicsCompressorKernel compressor_; |
| 110 }; | 115 }; |
| 111 | 116 |
| 112 } // namespace blink | 117 } // namespace blink |
| 113 | 118 |
| 114 #endif // DynamicsCompressor_h | 119 #endif // DynamicsCompressor_h |
| OLD | NEW |