From f6bc17f71b298af9bdbe7a3166550bd277188e57 Mon Sep 17 00:00:00 2001 From: rexy712 Date: Sun, 30 Aug 2020 10:48:06 -0700 Subject: [PATCH] Add some more small clarification comments --- include/audio/channel.hpp | 1 + include/audio/error.hpp | 5 +++-- include/audio/frame_fmt.hpp | 1 + include/audio/init.hpp | 1 + include/audio/mixdata.hpp | 2 ++ include/audio/mixer.hpp | 1 + include/audio/sndrd.hpp | 1 + include/audio/stream.hpp | 1 + include/math/fwd_declare.hpp | 2 ++ include/math/mat.hpp | 7 +++++++ include/math/math.hpp | 2 ++ include/math/math_common.hpp | 2 ++ include/math/quat.hpp | 1 + include/math/vec.hpp | 2 ++ include/util/ring_buffer.hpp | 1 + include/util/sequence.hpp | 1 + 16 files changed, 29 insertions(+), 2 deletions(-) diff --git a/include/audio/channel.hpp b/include/audio/channel.hpp index e989f16..167a8ae 100644 --- a/include/audio/channel.hpp +++ b/include/audio/channel.hpp @@ -29,6 +29,7 @@ namespace audio{ class channel; } + //Playback for one simultaneos audio source //needs to be thread safe, lock free, and avoid false sharing class channel { diff --git a/include/audio/error.hpp b/include/audio/error.hpp index c3eaf13..4b27180 100644 --- a/include/audio/error.hpp +++ b/include/audio/error.hpp @@ -21,6 +21,7 @@ namespace audio{ + //Combine errors from multiple libraries into one to make for easier end usage class error { public: @@ -48,8 +49,8 @@ namespace audio{ BAD_BUFFER, }; private: - int m_actual; - int m_homog; + int m_actual; //actual error generated by a library + int m_homog; //homogenized error (from the above enum) public: error(int actual); diff --git a/include/audio/frame_fmt.hpp b/include/audio/frame_fmt.hpp index 3d0574b..a63f921 100644 --- a/include/audio/frame_fmt.hpp +++ b/include/audio/frame_fmt.hpp @@ -23,6 +23,7 @@ namespace audio{ + //supported audio frame data formats enum class frame_fmt{ float32 = paFloat32, }; diff --git a/include/audio/init.hpp b/include/audio/init.hpp index 6e273c8..5551100 100644 --- a/include/audio/init.hpp +++ b/include/audio/init.hpp @@ -21,6 +21,7 @@ namespace audio{ + //initializer/deinitializer for portaudio class pa_system { private: diff --git a/include/audio/mixdata.hpp b/include/audio/mixdata.hpp index 7ab7500..7eb549c 100644 --- a/include/audio/mixdata.hpp +++ b/include/audio/mixdata.hpp @@ -23,6 +23,7 @@ namespace audio{ + //raw chunk of mixdata used by mixer struct mixdata { float* data = nullptr; size_t frames = 0; @@ -32,6 +33,7 @@ namespace audio{ bool allocated = true; }; + //managed chunk of mixdata used by the end user class mixchunk { private: diff --git a/include/audio/mixer.hpp b/include/audio/mixer.hpp index 20224ba..08a7389 100644 --- a/include/audio/mixer.hpp +++ b/include/audio/mixer.hpp @@ -28,6 +28,7 @@ namespace audio{ class mixer; } + //Handle playback of multiple simultaneous audio streams class mixer { public: diff --git a/include/audio/sndrd.hpp b/include/audio/sndrd.hpp index 62c652a..94e9b99 100644 --- a/include/audio/sndrd.hpp +++ b/include/audio/sndrd.hpp @@ -29,6 +29,7 @@ namespace audio{ + //Sound file reader. Reads directly into mixchunks which can be passed directly to a mixer channel class sndrd { private: diff --git a/include/audio/stream.hpp b/include/audio/stream.hpp index ca1f7b2..711a3b4 100644 --- a/include/audio/stream.hpp +++ b/include/audio/stream.hpp @@ -28,6 +28,7 @@ namespace audio{ + //Represents an audio device under the control of portaudio class stream { private: diff --git a/include/math/fwd_declare.hpp b/include/math/fwd_declare.hpp index 5e0c155..dc032bf 100644 --- a/include/math/fwd_declare.hpp +++ b/include/math/fwd_declare.hpp @@ -21,6 +21,8 @@ #include //size_t +//Provide aliases for common matrix, vector, and quaternion types + namespace math{ template diff --git a/include/math/mat.hpp b/include/math/mat.hpp index d892112..a2459dd 100644 --- a/include/math/mat.hpp +++ b/include/math/mat.hpp @@ -27,6 +27,7 @@ namespace math{ + //Common stuff shared by all types of matrices template class matrix_base { @@ -92,6 +93,7 @@ namespace math{ constexpr operator const_pointer()const; }; + //Non square matrices template class matrix : public matrix_base { @@ -119,6 +121,7 @@ namespace math{ constexpr matrix& operator=(const matrix& m); }; + //Square matrices template class matrix : public matrix_base { @@ -200,6 +203,7 @@ namespace math{ } + //Determine if a given list of tyes are all matrix types template struct is_matrix { static constexpr bool value = (detail::is_matrix_helper::value && ...); @@ -221,11 +225,13 @@ namespace math{ } + //Logic operators template constexpr bool operator==(const matrix_base& left, const matrix_base right); template constexpr bool operator!=(const matrix_base& left, const matrix_base right); + //Arithmetic operators template constexpr auto operator*(const matrix& left, const matrix& right); template>,int> = 0> @@ -241,6 +247,7 @@ namespace math{ template constexpr auto operator-(const matrix& left); + //Arithmetic assignment operators template constexpr decltype(auto) operator*=(matrix& left, const matrix& right); template>,int> = 0> diff --git a/include/math/math.hpp b/include/math/math.hpp index 8b8e337..e59d15c 100644 --- a/include/math/math.hpp +++ b/include/math/math.hpp @@ -19,6 +19,8 @@ #ifndef REXY_MATH_HPP #define REXY_MATH_HPP +//include this file to access all the math components easily + #include "fwd_declare.hpp" #include "math_common.hpp" #include "vec.hpp" diff --git a/include/math/math_common.hpp b/include/math/math_common.hpp index ffe4268..47ad9b8 100644 --- a/include/math/math_common.hpp +++ b/include/math/math_common.hpp @@ -22,12 +22,14 @@ namespace math{ namespace detail{ + //sentinel classes saying how to initialize some math classes struct zero_initialize_t {}; struct no_initialize_t {}; struct id_initialize_t {}; struct manual_initialize_t {}; } + //instantiation of sentinels static inline constexpr detail::zero_initialize_t zero_initialize; static inline constexpr detail::no_initialize_t no_initialize; static inline constexpr detail::id_initialize_t id_initialize; diff --git a/include/math/quat.hpp b/include/math/quat.hpp index 28e9259..0883691 100644 --- a/include/math/quat.hpp +++ b/include/math/quat.hpp @@ -28,6 +28,7 @@ namespace math{ + //( ͡° ͜ʖ ͡°) template class quaternion { diff --git a/include/math/vec.hpp b/include/math/vec.hpp index 77534bc..6a525e0 100644 --- a/include/math/vec.hpp +++ b/include/math/vec.hpp @@ -23,6 +23,8 @@ namespace math{ + //class representing vectors + //inherit from matrix base because it also shared matrix attributes template class vector : public matrix_base { diff --git a/include/util/ring_buffer.hpp b/include/util/ring_buffer.hpp index bf84996..7bbb777 100644 --- a/include/util/ring_buffer.hpp +++ b/include/util/ring_buffer.hpp @@ -34,6 +34,7 @@ namespace util{ + //multiproducer, multiconsumer thread safe ring buffer with some attempts to optimize against thread thrashing template class mpmc_ring_buffer { diff --git a/include/util/sequence.hpp b/include/util/sequence.hpp index c7d4d0e..4ee947d 100644 --- a/include/util/sequence.hpp +++ b/include/util/sequence.hpp @@ -22,6 +22,7 @@ #include //integer_sequence namespace util{ + //generate an integer sequence counting up from 0. eg 0,1,2,3... template struct sequence_gen{ using type = typename sequence_gen::type;