Chromium Code Reviews| 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 20 matching lines...) Expand all Loading... | |
| 31 | 31 |
| 32 #include "bindings/core/v8/ScriptWrappable.h" | 32 #include "bindings/core/v8/ScriptWrappable.h" |
| 33 #include "platform/geometry/FloatPoint3D.h" | 33 #include "platform/geometry/FloatPoint3D.h" |
| 34 #include "platform/heap/Handle.h" | 34 #include "platform/heap/Handle.h" |
| 35 #include "wtf/PassRefPtr.h" | 35 #include "wtf/PassRefPtr.h" |
| 36 #include "wtf/RefCounted.h" | 36 #include "wtf/RefCounted.h" |
| 37 #include "wtf/Vector.h" | 37 #include "wtf/Vector.h" |
| 38 | 38 |
| 39 namespace WebCore { | 39 namespace WebCore { |
| 40 | 40 |
| 41 class HRTFDatabaseLoader; | |
| 41 class PannerNode; | 42 class PannerNode; |
| 42 | 43 |
| 43 // AudioListener maintains the state of the listener in the audio scene as defin ed in the OpenAL specification. | 44 // AudioListener maintains the state of the listener in the audio scene as defin ed in the OpenAL specification. |
| 44 | 45 |
| 45 class AudioListener : public RefCountedWillBeGarbageCollectedFinalized<AudioList ener>, public ScriptWrappable { | 46 class AudioListener : public RefCountedWillBeGarbageCollectedFinalized<AudioList ener>, public ScriptWrappable { |
| 46 public: | 47 public: |
| 47 static PassRefPtrWillBeRawPtr<AudioListener> create() | 48 static PassRefPtrWillBeRawPtr<AudioListener> create() |
| 48 { | 49 { |
| 49 return adoptRefWillBeNoop(new AudioListener()); | 50 return adoptRefWillBeNoop(new AudioListener()); |
| 50 } | 51 } |
| (...skipping 21 matching lines...) Expand all Loading... | |
| 72 double dopplerFactor() const { return m_dopplerFactor; } | 73 double dopplerFactor() const { return m_dopplerFactor; } |
| 73 | 74 |
| 74 // Speed of sound | 75 // Speed of sound |
| 75 void setSpeedOfSound(double); | 76 void setSpeedOfSound(double); |
| 76 double speedOfSound() const { return m_speedOfSound; } | 77 double speedOfSound() const { return m_speedOfSound; } |
| 77 | 78 |
| 78 Mutex& listenerLock() { return m_listenerLock; } | 79 Mutex& listenerLock() { return m_listenerLock; } |
| 79 void addPanner(PannerNode*); | 80 void addPanner(PannerNode*); |
| 80 void removePanner(PannerNode*); | 81 void removePanner(PannerNode*); |
| 81 | 82 |
| 83 void createAndLoadHRTFDatabaseLoader(float); | |
| 84 HRTFDatabaseLoader* hrtfDatabaseLoader() { return m_hrtfDatabaseLoader.get() ; } | |
| 85 | |
| 82 void trace(Visitor*) { } | 86 void trace(Visitor*) { } |
| 83 | 87 |
| 84 private: | 88 private: |
| 85 AudioListener(); | 89 AudioListener(); |
| 86 | 90 |
| 87 void setPosition(const FloatPoint3D&); | 91 void setPosition(const FloatPoint3D&); |
| 88 void setOrientation(const FloatPoint3D&); | 92 void setOrientation(const FloatPoint3D&); |
| 89 void setUpVector(const FloatPoint3D&); | 93 void setUpVector(const FloatPoint3D&); |
| 90 void setVelocity(const FloatPoint3D&); | 94 void setVelocity(const FloatPoint3D&); |
| 91 | 95 |
| 92 void markPannersAsDirty(unsigned); | 96 void markPannersAsDirty(unsigned); |
| 93 | 97 |
| 94 FloatPoint3D m_position; | 98 FloatPoint3D m_position; |
| 95 FloatPoint3D m_orientation; | 99 FloatPoint3D m_orientation; |
| 96 FloatPoint3D m_upVector; | 100 FloatPoint3D m_upVector; |
| 97 FloatPoint3D m_velocity; | 101 FloatPoint3D m_velocity; |
| 98 double m_dopplerFactor; | 102 double m_dopplerFactor; |
| 99 double m_speedOfSound; | 103 double m_speedOfSound; |
| 100 | 104 |
| 101 // Synchronize a panner's process() with setting of the state of the listene r. | 105 // Synchronize a panner's process() with setting of the state of the listene r. |
| 102 mutable Mutex m_listenerLock; | 106 mutable Mutex m_listenerLock; |
| 103 | |
| 104 // List for pannerNodes in context. | 107 // List for pannerNodes in context. |
| 105 Vector<PannerNode*> m_panners; | 108 Vector<PannerNode*> m_panners; |
| 109 // HRTF DB loader for panner node. It should be allocated once on constructo r of panner node, | |
| 110 // then keep handle for efficient loading. | |
|
Raymond Toy
2014/07/17 17:25:45
This comment is no longer valid. Remove this?
| |
| 111 RefPtr<HRTFDatabaseLoader> m_hrtfDatabaseLoader; | |
| 106 }; | 112 }; |
| 107 | 113 |
| 108 } // WebCore | 114 } // WebCore |
| 109 | 115 |
| 110 #endif // AudioListener_h | 116 #endif // AudioListener_h |
| OLD | NEW |