Skip to content

Commit 722611d

Browse files
committed
Prefix math functions with std::
1 parent 8a37579 commit 722611d

40 files changed

+102
-102
lines changed

projects/demo/demo.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ void processMessage( TickData* data )
104104
else if (value1 == 52.0) {
105105
data->frequency += ( data->message.intValues[1] << 7 );
106106
// Convert to a fractional MIDI note value
107-
StkFloat note = 12.0 * log( data->frequency / 220.0 ) / log( 2.0 ) + 57.0;
107+
StkFloat note = 12.0 * std::log( data->frequency / 220.0 ) / std::log( 2.0 ) + 57.0;
108108
data->voicer->setFrequency( note );
109109
}
110110
else

projects/examples/controlbee.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ void processMessage( TickData* data )
5353
if ( value2 == 0.0 ) // velocity is zero ... really a NoteOff
5454
data->instrument->noteOff( 0.5 );
5555
else { // a NoteOn
56-
StkFloat frequency = 220.0 * pow( 2.0, (value1 - 57.0) / 12.0 );
56+
StkFloat frequency = 220.0 * std::pow( 2.0, (value1 - 57.0) / 12.0 );
5757
data->instrument->noteOn( frequency, value2 * ONE_OVER_128 );
5858
}
5959
break;

src/BandedWG.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ void BandedWG :: setPreset( int preset )
8282
modes_[3] = (StkFloat) 18.0697050938;
8383

8484
for (i=0; i<presetModes_; i++) {
85-
basegains_[i] = (StkFloat) pow(0.999,(float) i+1);
85+
basegains_[i] = (StkFloat) std::pow(0.999,(float) i+1);
8686
excitation_[i] = 1.0;
8787
}
8888

@@ -98,13 +98,13 @@ void BandedWG :: setPreset( int preset )
9898
// modes_[5] = (StkFloat) 12.22;
9999

100100
for (i=0; i<presetModes_; i++) {
101-
basegains_[i] = (StkFloat) pow(0.999,(float) i+1);
101+
basegains_[i] = (StkFloat) std::pow(0.999,(float) i+1);
102102
excitation_[i] = 1.0;
103103
}
104104
/*
105105
baseGain_ = (StkFloat) 0.99999;
106106
for (i=0; i<presetModes_; i++)
107-
gains_[i]= (StkFloat) pow(baseGain_, delay_[i].getDelay()+i);
107+
gains_[i]= (StkFloat) std::pow(baseGain_, delay_[i].getDelay()+i);
108108
*/
109109

110110
break;
@@ -158,7 +158,7 @@ void BandedWG :: setPreset( int preset )
158158
modes_[3] = (StkFloat) 8.933;
159159

160160
for (i=0; i<presetModes_; i++) {
161-
basegains_[i] = (StkFloat) pow(0.9,(float) i+1);
161+
basegains_[i] = (StkFloat) std::pow(0.9,(float) i+1);
162162
excitation_[i] = 1.0;
163163
}
164164

@@ -189,7 +189,7 @@ void BandedWG :: setFrequency( StkFloat frequency )
189189
if ( length > 2.0f) {
190190
delay_[i].setDelay( length );
191191
gains_[i]=basegains_[i];
192-
// gains_[i]=(StkFloat) pow(basegains_[i], 1/((StkFloat)delay_[i].getDelay()));
192+
// gains_[i]=(StkFloat) std::pow(basegains_[i], 1/((StkFloat)delay_[i].getDelay()));
193193
// std::cerr << gains_[i];
194194
}
195195
else {
@@ -339,7 +339,7 @@ void BandedWG :: controlChange( int number, StkFloat value )
339339
// std::cerr << "Yuck!" << std::endl;
340340
for (int i=0; i<nModes_; i++)
341341
gains_[i]=(StkFloat) basegains_[i]*baseGain_;
342-
// gains_[i]=(StkFloat) pow(baseGain_, (int)((StkFloat)delay_[i].getDelay()+i));
342+
// gains_[i]=(StkFloat) std::pow(baseGain_, (int)((StkFloat)delay_[i].getDelay()+i));
343343
}
344344
else if (number == __SK_ModFrequency_) // 11
345345
integrationConstant_ = normalizedValue;

src/BiQuad.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ void BiQuad :: setResonance( StkFloat frequency, StkFloat radius, bool normalize
6565
#endif
6666

6767
a_[2] = radius * radius;
68-
a_[1] = -2.0f * radius * cos( STK_TWO_PI * frequency / Stk::sampleRate() );
68+
a_[1] = -2.0f * radius * std::cos( STK_TWO_PI * frequency / Stk::sampleRate() );
6969

7070
if ( normalize ) {
7171
// Use zeros at +- 1 and normalize the filter peak gain.
@@ -90,7 +90,7 @@ void BiQuad :: setNotch( StkFloat frequency, StkFloat radius )
9090

9191
// This method does not attempt to normalize the filter gain.
9292
b_[2] = radius * radius;
93-
b_[1] = (StkFloat) -2.0 * radius * cos( STK_TWO_PI * (float) frequency / Stk::sampleRate() );
93+
b_[1] = (StkFloat) -2.0 * radius * std::cos( STK_TWO_PI * (float) frequency / Stk::sampleRate() );
9494
}
9595

9696
void BiQuad :: setEqualGainZeroes( void )

src/Blit.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ void Blit :: setHarmonics( unsigned int nHarmonics )
6868
void Blit :: updateHarmonics( void )
6969
{
7070
if ( nHarmonics_ <= 0 ) {
71-
unsigned int maxHarmonics = (unsigned int) floor( 0.5f * p_ );
71+
unsigned int maxHarmonics = (unsigned int) std::floor( 0.5f * p_ );
7272
m_ = 2 * maxHarmonics + 1;
7373
}
7474
else

src/Blit.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ inline StkFloat Blit :: tick( void )
118118
if ( denominator <= std::numeric_limits<StkFloat>::epsilon() )
119119
tmp = 1.0;
120120
else {
121-
tmp = sin( m_ * phase_ );
121+
tmp = std::sin( m_ * phase_ );
122122
tmp /= m_ * denominator;
123123
}
124124

src/BlitSaw.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ void BlitSaw :: setHarmonics( unsigned int nHarmonics )
7979
void BlitSaw :: updateHarmonics( void )
8080
{
8181
if ( nHarmonics_ <= 0 ) {
82-
unsigned int maxHarmonics = (unsigned int) floor( 0.5f * p_ );
82+
unsigned int maxHarmonics = (unsigned int) std::floor( 0.5f * p_ );
8383
m_ = 2 * maxHarmonics + 1;
8484
}
8585
else

src/BlitSaw.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,10 +108,10 @@ inline StkFloat BlitSaw :: tick( void )
108108
// Avoid a divide by zero, or use of a denormalized divisor
109109
// at the sinc peak, which has a limiting value of m_ / p_.
110110
StkFloat tmp, denominator = sin( phase_ );
111-
if ( fabs(denominator) <= std::numeric_limits<StkFloat>::epsilon() )
111+
if ( std::fabs(denominator) <= std::numeric_limits<StkFloat>::epsilon() )
112112
tmp = a_;
113113
else {
114-
tmp = sin( m_ * phase_ );
114+
tmp = std::sin( m_ * phase_ );
115115
tmp /= p_ * denominator;
116116
}
117117

src/BlitSquare.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ void BlitSquare :: updateHarmonics( void )
8383
{
8484
// Make sure we end up with an even value of the parameter M here.
8585
if ( nHarmonics_ <= 0 ) {
86-
unsigned int maxHarmonics = (unsigned int) floor( 0.5f * p_ );
86+
unsigned int maxHarmonics = (unsigned int) std::floor( 0.5f * p_ );
8787
m_ = 2 * (maxHarmonics + 1);
8888
}
8989
else

src/BlitSquare.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -123,16 +123,16 @@ inline StkFloat BlitSquare :: tick( void )
123123

124124
// Avoid a divide by zero, or use of a denomralized divisor
125125
// at the sinc peak, which has a limiting value of 1.0.
126-
StkFloat denominator = sin( phase_ );
127-
if ( fabs( denominator ) < std::numeric_limits<StkFloat>::epsilon() ) {
126+
StkFloat denominator = std::sin( phase_ );
127+
if ( std::fabs( denominator ) < std::numeric_limits<StkFloat>::epsilon() ) {
128128
// Inexact comparison safely distinguishes betwen *close to zero*, and *close to PI*.
129129
if ( phase_ < 0.1f || phase_ > STK_TWO_PI - 0.1f )
130130
lastBlitOutput_ = a_;
131131
else
132132
lastBlitOutput_ = -a_;
133133
}
134134
else {
135-
lastBlitOutput_ = sin( m_ * phase_ );
135+
lastBlitOutput_ = std::sin( m_ * phase_ );
136136
lastBlitOutput_ /= p_ * denominator;
137137
}
138138

0 commit comments

Comments
 (0)