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

Unified Diff: media/audio/point.h

Issue 1275783003: Add a virtual beamforming audio device on ChromeOS. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix Chromebook not booting. Created 5 years, 3 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 side-by-side diff with in-line comments
Download patch
Index: media/audio/point.h
diff --git a/media/audio/point.h b/media/audio/point.h
new file mode 100644
index 0000000000000000000000000000000000000000..1fbe752c3417b15b79da869f8838f930c173966a
--- /dev/null
+++ b/media/audio/point.h
@@ -0,0 +1,57 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef MEDIA_AUDIO_MIC_POSITIONS_H_
DaleCurtis 2015/09/03 01:58:37 Header tag is not correct. Is it worth reusing ui/
ajm 2015/09/03 04:19:29 It appears to do everything we need except for the
Henrik Grunell 2015/09/03 07:14:20 If we can't use an existing point class, maybe a b
ajm 2015/09/09 01:01:29 gfx::Point3F works fine. I added a typedef below,
+#define MEDIA_AUDIO_MIC_POSITIONS_H_
+
+#include <cmath>
+#include <string>
+#include <vector>
+
+#include "media/base/media_export.h"
+
+namespace media {
+
+// Represents a 3D point using Cartesian coordinates in meters.
+class MEDIA_EXPORT Point final {
+ public:
+ Point();
+ Point(float x, float y, float z);
+
+ float x() const { return x_; }
+ float y() const { return y_; }
+ float z() const { return z_; }
+
+ // Checks that all coordinates are finite (not infinite or NaN).
+ bool IsValid() const;
+
+ // Returns a human-readable string of the coordinates.
+ std::string ToString() const;
+
+ Point(const Point&) = default;
+ Point& operator=(const Point&) = default;
+
+ bool operator==(const Point& rhs) const {
+ return x_ == rhs.x_ && y_ == rhs.y_ && z_ == rhs.z_;
+ }
+
+ bool operator!=(const Point& rhs) const { return !(*this == rhs); }
+
+ private:
+ float x_;
+ float y_;
+ float z_;
+};
+
+// Returns a vector of points parsed from a whitespace-separated string
+// formatted
+// as: "x1 y1 z1 ... zn yn zn" for n points.
+//
+// Returns an empty vector if |points_string| is empty or isn't parseable.
+MEDIA_EXPORT std::vector<Point> ParsePointsFromString(
+ const std::string& points_string);
+
+} // namespace media
+
+#endif // MEDIA_AUDIO_MIC_POSITIONS_H_

Powered by Google App Engine
This is Rietveld 408576698