Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(215)

Side by Side Diff: Source/modules/webaudio/PannerNode.cpp

Issue 652073003: Change the default panning mode from HRTF to equal-power (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git/+/master
Patch Set: Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 30 matching lines...) Expand all
41 namespace blink { 41 namespace blink {
42 42
43 static void fixNANs(double &x) 43 static void fixNANs(double &x)
44 { 44 {
45 if (std::isnan(x) || std::isinf(x)) 45 if (std::isnan(x) || std::isinf(x))
46 x = 0.0; 46 x = 0.0;
47 } 47 }
48 48
49 PannerNode::PannerNode(AudioContext* context, float sampleRate) 49 PannerNode::PannerNode(AudioContext* context, float sampleRate)
50 : AudioNode(context, sampleRate) 50 : AudioNode(context, sampleRate)
51 , m_panningModel(Panner::PanningModelHRTF) 51 , m_panningModel(Panner::PanningModelEqualPower)
52 , m_distanceModel(DistanceEffect::ModelInverse) 52 , m_distanceModel(DistanceEffect::ModelInverse)
53 , m_position(0, 0, 0) 53 , m_position(0, 0, 0)
54 , m_orientation(1, 0, 0) 54 , m_orientation(1, 0, 0)
55 , m_velocity(0, 0, 0) 55 , m_velocity(0, 0, 0)
56 , m_isAzimuthElevationDirty(true) 56 , m_isAzimuthElevationDirty(true)
57 , m_isDistanceConeGainDirty(true) 57 , m_isDistanceConeGainDirty(true)
58 , m_isDopplerRateDirty(true) 58 , m_isDopplerRateDirty(true)
59 , m_lastGain(-1.0) 59 , m_lastGain(-1.0)
60 , m_cachedAzimuth(0) 60 , m_cachedAzimuth(0)
61 , m_cachedElevation(0) 61 , m_cachedElevation(0)
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 191
192 String PannerNode::panningModel() const 192 String PannerNode::panningModel() const
193 { 193 {
194 switch (m_panningModel) { 194 switch (m_panningModel) {
195 case Panner::PanningModelEqualPower: 195 case Panner::PanningModelEqualPower:
196 return "equalpower"; 196 return "equalpower";
197 case Panner::PanningModelHRTF: 197 case Panner::PanningModelHRTF:
198 return "HRTF"; 198 return "HRTF";
199 default: 199 default:
200 ASSERT_NOT_REACHED(); 200 ASSERT_NOT_REACHED();
201 return "HRTF"; 201 return "equalpower";
202 } 202 }
203 } 203 }
204 204
205 void PannerNode::setPanningModel(const String& model) 205 void PannerNode::setPanningModel(const String& model)
206 { 206 {
207 if (model == "equalpower") 207 if (model == "equalpower")
208 setPanningModel(Panner::PanningModelEqualPower); 208 setPanningModel(Panner::PanningModelEqualPower);
209 else if (model == "HRTF") 209 else if (model == "HRTF")
210 setPanningModel(Panner::PanningModelHRTF); 210 setPanningModel(Panner::PanningModelHRTF);
211 } 211 }
(...skipping 425 matching lines...) Expand 10 before | Expand all | Expand 10 after
637 637
638 void PannerNode::trace(Visitor* visitor) 638 void PannerNode::trace(Visitor* visitor)
639 { 639 {
640 visitor->trace(m_panner); 640 visitor->trace(m_panner);
641 AudioNode::trace(visitor); 641 AudioNode::trace(visitor);
642 } 642 }
643 643
644 } // namespace blink 644 } // namespace blink
645 645
646 #endif // ENABLE(WEB_AUDIO) 646 #endif // ENABLE(WEB_AUDIO)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698