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

Side by Side Diff: Source/modules/webaudio/AudioListener.h

Issue 393363002: Move handle of HRTFDatabaseLoader to AudioListener. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 5 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 * 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
31 31
32 #include "bindings/v8/ScriptWrappable.h" 32 #include "bindings/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
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 setHRTFDatabaseLoader(PassRefPtrWillBeRawPtr<HRTFDatabaseLoader>);
tkent 2014/07/16 23:32:25 PassRefPtrWIllBeRawPtr should be PassRefPtr becaus
KhNo 2014/07/17 16:23:17 Done.
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,
Raymond Toy 2014/07/16 16:35:38 How do you enforce that it is allocated only once
KhNo 2014/07/17 16:23:17 Yes, you right. I missed it. Basically it should b
110 // then keep handle for efficiant loading.
Raymond Toy 2014/07/16 16:35:38 Typo: efficiant -> efficient
KhNo 2014/07/17 16:23:17 Done.
111 RefPtrWillBeRawPtr<HRTFDatabaseLoader> m_hrtfDatabaseLoader;
tkent 2014/07/16 23:32:25 RefPtrWillBeRawPtr should be RefPtr.
KhNo 2014/07/17 16:23:17 Thanks for comment. :) Done.
106 }; 112 };
107 113
108 } // WebCore 114 } // WebCore
109 115
110 #endif // AudioListener_h 116 #endif // AudioListener_h
OLDNEW
« no previous file with comments | « no previous file | Source/modules/webaudio/AudioListener.cpp » ('j') | Source/modules/webaudio/PannerNode.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698