99#include < viam/sdk/common/utils.hpp>
1010#include < viam/sdk/config/resource.hpp>
1111
12-
1312namespace viam {
1413namespace sdk {
1514
@@ -22,7 +21,7 @@ namespace sdk {
2221// / This acts as an abstract parent class to be inherited from by any drivers representing
2322// / specific AudioIn implementations. This class cannot be used on its own.
2423class AudioIn : public Component {
25- public:
24+ public:
2625 // / @struct properties
2726 // / @brief properties of the AudioIn component
2827 struct properties {
@@ -31,7 +30,6 @@ class AudioIn : public Component {
3130 int num_channels;
3231 };
3332
34-
3533 // / @struct audio_info
3634 // / @brief Information about a piece of audio data
3735 struct audio_info {
@@ -41,7 +39,8 @@ class AudioIn : public Component {
4139 };
4240
4341 // / @struct audio_chunk
44- // / @brief A sequential chunk of audio data with timing information for continuous audio streams.
42+ // / @brief A sequential chunk of audio data with timing information for continuous audio
43+ // / streams.
4544 struct audio_chunk {
4645 std::vector<std::byte> audio_data;
4746 audio_info audio_info;
@@ -55,41 +54,44 @@ class AudioIn : public Component {
5554 // / until completed or cancelled
5655 // / @param codec requested codec of the audio data
5756 // / @param chunk_handler callback function to call when an audio response is received.
58- // / For an infinite stream this should return true to keep streaming audio and false to indicate that the stream should terminate.
59- // / The callback function should not be blocking.
57+ // / For an infinite stream this should return true to keep streaming audio and false to indicate
58+ // / that the stream should terminate. The callback function should not be blocking.
6059 // / @param duration_seconds duration of audio stream. If not set, stream duration is indefinite.
61- // / @param previous_timestamp timestamp to start the audio stream from for continuity between multiple calls. If not set, will stream data
60+ // / @param previous_timestamp timestamp to start the audio stream from for continuity between
61+ // / multiple calls. If not set, will stream data
6262 // starting from the time the request was received by the server.
6363 inline void get_audio (std::string const & codec,
64- std::function<bool (audio_chunk&& chunk)> const & chunk_handler,
65- double const & duration_seconds,
66- int64_t const & previous_timestamp) {
64+ std::function<bool (audio_chunk&& chunk)> const & chunk_handler,
65+ double const & duration_seconds,
66+ int64_t const & previous_timestamp) {
6767 return get_audio (codec, chunk_handler, duration_seconds, previous_timestamp, {});
6868 }
6969
70-
7170 // / @brief Get a stream of audio from the device
7271 // / until completed or cancelled
7372 // / @param codec requested codec of the audio data
7473 // / @param chunk_handler callback function to call when an audio response is received.
75- // / For an infinite stream this should return true to keep streaming audio and false to indicate that the stream should terminate.
76- // / The callback function should not be blocking.
74+ // / For an infinite stream this should return true to keep streaming audio and false to indicate
75+ // / that the stream should terminate. The callback function should not be blocking.
7776 // / @param duration_seconds duration of audio stream. If zero, stream duration is indefinite.
78- // / @param previous_timestamp timestamp to start the audio stream from for continuity between multiple calls. If zero, will stream data
79- // starting from the time the request was received by the server.
77+ // / @param previous_timestamp timestamp to start the audio stream from for continuity between
78+ // / multiple calls. If zero, will stream data
79+ // starting from the time the request was received by the server.
8080 // / @param extra Any additional arguments to the method
8181 virtual void get_audio (std::string const & codec,
82- std::function<bool (audio_chunk&& chunk)> const & chunk_handler,
83- double const & duration_seconds,
84- int64_t const & previous_timestamp,
85- const ProtoStruct& extra) = 0;
82+ std::function<bool (audio_chunk&& chunk)> const & chunk_handler,
83+ double const & duration_seconds,
84+ int64_t const & previous_timestamp,
85+ const ProtoStruct& extra) = 0;
8686
87- // / @brief Returns properties of the audio in device (supported codecs, sample rate, number of channels)
87+ // / @brief Returns properties of the audio in device (supported codecs, sample rate, number of
88+ // / channels)
8889 inline properties get_properties () {
8990 return get_properties ({});
9091 }
9192
92- // / @brief Returns properties of the audio in device (supported codecs, sample rate, number of channels)
93+ // / @brief Returns properties of the audio in device (supported codecs, sample rate, number of
94+ // / channels)
9395 // / @param extra Any additional arguments to the method
9496 virtual properties get_properties (const ProtoStruct& extra) = 0;
9597
@@ -113,16 +115,14 @@ class AudioIn : public Component {
113115
114116 protected:
115117 explicit AudioIn (std::string name);
118+ };
116119
117- };
118-
119- template <>
120- struct API ::traits<AudioIn> {
121- static API api ();
122- };
123-
124- bool operator ==(const AudioIn::properties& lhs, const AudioIn::properties& rhs);
120+ template <>
121+ struct API ::traits<AudioIn> {
122+ static API api ();
123+ };
125124
126- } // namespace sdk
127- } // namespace viam
125+ bool operator ==(const AudioIn::properties& lhs, const AudioIn::properties& rhs);
128126
127+ } // namespace sdk
128+ } // namespace viam
0 commit comments