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

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: Move all HRTF loader functionality to AudioListener. 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
« no previous file with comments | « no previous file | Source/modules/webaudio/AudioListener.cpp » ('j') | 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 * 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/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 blink { 39 namespace blink {
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 // HRTF DB loader
84 HRTFDatabaseLoader* hrtfDatabaseLoader() { return m_hrtfDatabaseLoader.get() ; }
85 void createAndLoadHRTFDatabaseLoader(float);
86 bool isHRTFDatabaseLoaded();
87 void waitForHRTFDatabaseLoaderThreadCompletion();
88
82 void trace(Visitor*) { } 89 void trace(Visitor*) { }
83 90
84 private: 91 private:
85 AudioListener(); 92 AudioListener();
86 93
87 void setPosition(const FloatPoint3D&); 94 void setPosition(const FloatPoint3D&);
88 void setOrientation(const FloatPoint3D&); 95 void setOrientation(const FloatPoint3D&);
89 void setUpVector(const FloatPoint3D&); 96 void setUpVector(const FloatPoint3D&);
90 void setVelocity(const FloatPoint3D&); 97 void setVelocity(const FloatPoint3D&);
91 98
92 void markPannersAsDirty(unsigned); 99 void markPannersAsDirty(unsigned);
93 100
94 FloatPoint3D m_position; 101 FloatPoint3D m_position;
95 FloatPoint3D m_orientation; 102 FloatPoint3D m_orientation;
96 FloatPoint3D m_upVector; 103 FloatPoint3D m_upVector;
97 FloatPoint3D m_velocity; 104 FloatPoint3D m_velocity;
98 double m_dopplerFactor; 105 double m_dopplerFactor;
99 double m_speedOfSound; 106 double m_speedOfSound;
100 107
101 // Synchronize a panner's process() with setting of the state of the listene r. 108 // Synchronize a panner's process() with setting of the state of the listene r.
102 mutable Mutex m_listenerLock; 109 mutable Mutex m_listenerLock;
103
104 // List for pannerNodes in context. 110 // List for pannerNodes in context.
105 Vector<PannerNode*> m_panners; 111 Vector<PannerNode*> m_panners;
112 // HRTF DB loader for panner node.
113 RefPtr<HRTFDatabaseLoader> m_hrtfDatabaseLoader;
106 }; 114 };
107 115
108 } // WebCore 116 } // WebCore
109 117
110 #endif // AudioListener_h 118 #endif // AudioListener_h
OLDNEW
« no previous file with comments | « no previous file | Source/modules/webaudio/AudioListener.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698