From 4b5b14253103b01a78df5ac5f04daea0a01c0310 Mon Sep 17 00:00:00 2001 From: "Grzegorz Szwoch (sound)" Date: Thu, 25 Feb 2021 13:17:58 +0100 Subject: [PATCH] StkFrames: add * and *= operators for multiplication by StkFloat; return reference from += and *- operators --- include/Stk.h | 50 ++++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 46 insertions(+), 4 deletions(-) diff --git a/include/Stk.h b/include/Stk.h index 58776ab..015aaec 100644 --- a/include/Stk.h +++ b/include/Stk.h @@ -324,7 +324,7 @@ public: self. No range checking is performed unless _STK_DEBUG_ is defined. */ - void operator+= ( StkFrames& f ); + StkFrames& operator+= ( StkFrames& f ); //! Assignment by product operator into self. /*! @@ -332,7 +332,16 @@ public: self. No range checking is performed unless _STK_DEBUG_ is defined. */ - void operator*= ( StkFrames& f ); + StkFrames& operator*= ( StkFrames& f ); + + //! Scaling operator (StkFrame * StkFloat). + StkFrames operator* ( StkFloat v ) const; + + //! Scaling operator (StkFloat * StkFrame) + friend StkFrames operator*(StkFloat v, const StkFrames& f); + + //! Scaling operator (inline). + StkFrames& operator*= ( StkFloat v ); //! Channel / frame subscript operator that returns a reference. /*! @@ -511,7 +520,7 @@ inline StkFrames StkFrames::operator+(const StkFrames &f) const return sum; } -inline void StkFrames :: operator+= ( StkFrames& f ) +inline StkFrames& StkFrames :: operator+= ( StkFrames& f ) { #if defined(_STK_DEBUG_) if ( f.frames() != nFrames_ || f.channels() != nChannels_ ) { @@ -525,9 +534,10 @@ inline void StkFrames :: operator+= ( StkFrames& f ) StkFloat *dptr = data_; for ( unsigned int i=0; i