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 * | 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 16 matching lines...) Expand all Loading... |
27 */ | 27 */ |
28 | 28 |
29 #include "config.h" | 29 #include "config.h" |
30 | 30 |
31 #if ENABLE(WEB_AUDIO) | 31 #if ENABLE(WEB_AUDIO) |
32 | 32 |
33 #include "modules/webaudio/AudioListener.h" | 33 #include "modules/webaudio/AudioListener.h" |
34 | 34 |
35 #include "modules/webaudio/PannerNode.h" | 35 #include "modules/webaudio/PannerNode.h" |
36 #include "platform/audio/AudioBus.h" | 36 #include "platform/audio/AudioBus.h" |
| 37 #include "platform/audio/HRTFDatabaseLoader.h" |
37 | 38 |
38 namespace WebCore { | 39 namespace WebCore { |
39 | 40 |
40 AudioListener::AudioListener() | 41 AudioListener::AudioListener() |
41 : m_position(0, 0, 0) | 42 : m_position(0, 0, 0) |
42 , m_orientation(0, 0, -1) | 43 , m_orientation(0, 0, -1) |
43 , m_upVector(0, 1, 0) | 44 , m_upVector(0, 1, 0) |
44 , m_velocity(0, 0, 0) | 45 , m_velocity(0, 0, 0) |
45 , m_dopplerFactor(1) | 46 , m_dopplerFactor(1) |
46 , m_speedOfSound(343.3) | 47 , m_speedOfSound(343.3) |
(...skipping 17 matching lines...) Expand all Loading... |
64 void AudioListener::removePanner(PannerNode* panner) | 65 void AudioListener::removePanner(PannerNode* panner) |
65 { | 66 { |
66 for (unsigned i = 0; i < m_panners.size(); ++i) { | 67 for (unsigned i = 0; i < m_panners.size(); ++i) { |
67 if (panner == m_panners[i]) { | 68 if (panner == m_panners[i]) { |
68 m_panners.remove(i); | 69 m_panners.remove(i); |
69 break; | 70 break; |
70 } | 71 } |
71 } | 72 } |
72 } | 73 } |
73 | 74 |
| 75 void AudioListener::setHRTFDatabaseLoader(PassRefPtrWillBeRawPtr<HRTFDatabaseLoa
der> loader) |
| 76 { |
| 77 m_hrtfDatabaseLoader = loader; |
| 78 } |
| 79 |
74 void AudioListener::markPannersAsDirty(unsigned type) | 80 void AudioListener::markPannersAsDirty(unsigned type) |
75 { | 81 { |
76 for (unsigned i = 0; i < m_panners.size(); ++i) | 82 for (unsigned i = 0; i < m_panners.size(); ++i) |
77 m_panners[i]->markPannerAsDirty(type); | 83 m_panners[i]->markPannerAsDirty(type); |
78 } | 84 } |
79 | 85 |
80 void AudioListener::setPosition(const FloatPoint3D &position) | 86 void AudioListener::setPosition(const FloatPoint3D &position) |
81 { | 87 { |
82 if (m_position == position) | 88 if (m_position == position) |
83 return; | 89 return; |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
139 | 145 |
140 // This synchronizes with panner's process(). | 146 // This synchronizes with panner's process(). |
141 MutexLocker listenerLocker(m_listenerLock); | 147 MutexLocker listenerLocker(m_listenerLock); |
142 m_speedOfSound = speedOfSound; | 148 m_speedOfSound = speedOfSound; |
143 markPannersAsDirty(PannerNode::DopplerRateDirty); | 149 markPannersAsDirty(PannerNode::DopplerRateDirty); |
144 } | 150 } |
145 | 151 |
146 } // namespace WebCore | 152 } // namespace WebCore |
147 | 153 |
148 #endif // ENABLE(WEB_AUDIO) | 154 #endif // ENABLE(WEB_AUDIO) |
OLD | NEW |