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

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

Issue 231033002: Remove unused AudioParams in PannerNode. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 8 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
« no previous file with comments | « Source/modules/webaudio/PannerNode.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 69
70 ScriptWrappable::init(this); 70 ScriptWrappable::init(this);
71 addInput(adoptPtr(new AudioNodeInput(this))); 71 addInput(adoptPtr(new AudioNodeInput(this)));
72 addOutput(adoptPtr(new AudioNodeOutput(this, 2))); 72 addOutput(adoptPtr(new AudioNodeOutput(this, 2)));
73 73
74 // Node-specific default mixing rules. 74 // Node-specific default mixing rules.
75 m_channelCount = 2; 75 m_channelCount = 2;
76 m_channelCountMode = ClampedMax; 76 m_channelCountMode = ClampedMax;
77 m_channelInterpretation = AudioBus::Speakers; 77 m_channelInterpretation = AudioBus::Speakers;
78 78
79 m_distanceGain = AudioParam::create(context, "distanceGain", 1.0, 0.0, 1.0);
80 m_coneGain = AudioParam::create(context, "coneGain", 1.0, 0.0, 1.0);
81
82 m_cachedListener = AudioListener::create(); 79 m_cachedListener = AudioListener::create();
83 80
84 setNodeType(NodeTypePanner); 81 setNodeType(NodeTypePanner);
85 82
86 initialize(); 83 initialize();
87 } 84 }
88 85
89 PannerNode::~PannerNode() 86 PannerNode::~PannerNode()
90 { 87 {
91 uninitialize(); 88 uninitialize();
(...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after
422 419
423 return dopplerShift; 420 return dopplerShift;
424 } 421 }
425 422
426 float PannerNode::calculateDistanceConeGain() 423 float PannerNode::calculateDistanceConeGain()
427 { 424 {
428 FloatPoint3D listenerPosition = listener()->position(); 425 FloatPoint3D listenerPosition = listener()->position();
429 426
430 double listenerDistance = m_position.distanceTo(listenerPosition); 427 double listenerDistance = m_position.distanceTo(listenerPosition);
431 double distanceGain = m_distanceEffect.gain(listenerDistance); 428 double distanceGain = m_distanceEffect.gain(listenerDistance);
432
433 m_distanceGain->setValue(static_cast<float>(distanceGain));
434
435 double coneGain = m_coneEffect.gain(m_position, m_orientation, listenerPosit ion); 429 double coneGain = m_coneEffect.gain(m_position, m_orientation, listenerPosit ion);
436 430
437 m_coneGain->setValue(static_cast<float>(coneGain));
438
439 return float(distanceGain * coneGain); 431 return float(distanceGain * coneGain);
440 } 432 }
441 433
442 void PannerNode::azimuthElevation(double* outAzimuth, double* outElevation) 434 void PannerNode::azimuthElevation(double* outAzimuth, double* outElevation)
443 { 435 {
444 ASSERT(context()->isAudioThread()); 436 ASSERT(context()->isAudioThread());
445 437
446 if (isAzimuthElevationDirty()) 438 if (isAzimuthElevationDirty())
447 calculateAzimuthElevation(&m_cachedAzimuth, &m_cachedElevation); 439 calculateAzimuthElevation(&m_cachedAzimuth, &m_cachedElevation);
448 440
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
560 ASSERT(context()->isAudioThread()); 552 ASSERT(context()->isAudioThread());
561 553
562 m_cachedPosition = m_position; 554 m_cachedPosition = m_position;
563 m_cachedOrientation = m_orientation; 555 m_cachedOrientation = m_orientation;
564 m_cachedVelocity = m_velocity; 556 m_cachedVelocity = m_velocity;
565 } 557 }
566 558
567 } // namespace WebCore 559 } // namespace WebCore
568 560
569 #endif // ENABLE(WEB_AUDIO) 561 #endif // ENABLE(WEB_AUDIO)
OLDNEW
« no previous file with comments | « Source/modules/webaudio/PannerNode.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698