1a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch/* 2a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch * Copyright (C) 2010, Google Inc. All rights reserved. 3a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch * 4a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch * Redistribution and use in source and binary forms, with or without 5a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch * modification, are permitted provided that the following conditions 6a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch * are met: 7a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch * 1. Redistributions of source code must retain the above copyright 8a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch * notice, this list of conditions and the following disclaimer. 9a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch * 2. Redistributions in binary form must reproduce the above copyright 10a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch * notice, this list of conditions and the following disclaimer in the 11a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch * documentation and/or other materials provided with the distribution. 12a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch * 13a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY 14a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 15a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 16a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch * DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY 17a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 18a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 19a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 20a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 21a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 22a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 23a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch */ 24a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch 25a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch#ifndef EqualPowerPanner_h 26a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch#define EqualPowerPanner_h 27a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch 28a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch#include "Panner.h" 29a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch 30a94275402997c11dd2e778633dacf4b7e630a35dBen Murdochnamespace WebCore { 31a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch 32a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch// Common type of stereo panner as found in normal audio mixing equipment. 33a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch 34a94275402997c11dd2e778633dacf4b7e630a35dBen Murdochclass EqualPowerPanner : public Panner { 35a94275402997c11dd2e778633dacf4b7e630a35dBen Murdochpublic: 36a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch EqualPowerPanner(double sampleRate); 37a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch 38a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch virtual void pan(double azimuth, double elevation, AudioBus* inputBus, AudioBus* outputBuf, size_t framesToProcess); 39a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch 40a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch virtual void reset() { m_isFirstRender = true; } 41a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch 42a94275402997c11dd2e778633dacf4b7e630a35dBen Murdochprivate: 43a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch // For smoothing / de-zippering 44a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch bool m_isFirstRender; 45a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch double m_smoothingConstant; 46a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch 47a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch double m_gainL; 48a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch double m_gainR; 49a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch}; 50a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch 51a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch} // namespace WebCore 52a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch 53a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch#endif // EqualPowerPanner_h 54