mirror of
https://github.com/TomHarte/CLK.git
synced 2026-04-19 19:16:34 +00:00
Eliminate all references to M_PI.
This commit is contained in:
@@ -7219,7 +7219,6 @@
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
BUNDLE_LOADER = "$(TEST_HOST)";
|
||||
CLANG_CXX_LANGUAGE_STANDARD = "c++17";
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "Apple Development";
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
@@ -7237,7 +7236,6 @@
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
BUNDLE_LOADER = "$(TEST_HOST)";
|
||||
CLANG_CXX_LANGUAGE_STANDARD = "c++17";
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "Apple Development";
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
#include "Tables.hpp"
|
||||
|
||||
#include <cmath>
|
||||
#include <numbers>
|
||||
|
||||
@interface OPLTests: XCTestCase
|
||||
@end
|
||||
@@ -24,7 +25,7 @@
|
||||
const auto logSin = Yamaha::OPL::negative_log_sin(c);
|
||||
const auto level = Yamaha::OPL::power_two(logSin);
|
||||
|
||||
double fl_angle = double(c) * M_PI / 512.0;
|
||||
double fl_angle = double(c) * std::numbers::pi_v<double> / 512.0;
|
||||
double fl_level = sin(fl_angle);
|
||||
|
||||
XCTAssertLessThanOrEqual(fabs(fl_level - double(level) / 4096.0), 0.01, "Sine varies by more than 0.01 at angle %d", c);
|
||||
|
||||
@@ -9,10 +9,7 @@
|
||||
#include "ScanTarget.hpp"
|
||||
|
||||
#include <cmath>
|
||||
|
||||
#ifndef M_PI
|
||||
#define M_PI 3.1415926f
|
||||
#endif
|
||||
#include <numbers>
|
||||
|
||||
using namespace Outputs::Display::OpenGL;
|
||||
|
||||
@@ -37,7 +34,7 @@ void ScanTarget::set_uniforms(ShaderType type, Shader &target) const {
|
||||
for(int c = 0; c < 4; ++c) {
|
||||
GLfloat angle = (GLfloat(c) - 1.5f) / 4.0f;
|
||||
texture_offsets[c] = angle * clocks_per_angle;
|
||||
angles[c] = GLfloat(angle * 2.0f * M_PI);
|
||||
angles[c] = GLfloat(angle * 2.0f * std::numbers::pi_v<float>);
|
||||
}
|
||||
target.set_uniform("textureCoordinateOffsets", 1, 4, texture_offsets);
|
||||
target.set_uniform("compositeAngleOffsets", 4, 1, angles);
|
||||
@@ -70,7 +67,7 @@ void ScanTarget::set_sampling_window(int output_width, int, Shader &target) {
|
||||
GLfloat angles[4];
|
||||
for(int c = 0; c < 4; ++c) {
|
||||
texture_offsets[c] = 1.0f * (((one_pixel_width * float(c)) / 3.0f) - (one_pixel_width * 0.5f));
|
||||
angles[c] = GLfloat((texture_offsets[c] / clocks_per_angle) * 2.0f * M_PI);
|
||||
angles[c] = GLfloat((texture_offsets[c] / clocks_per_angle) * 2.0f * std::numbers::pi_v<float>);
|
||||
}
|
||||
target.set_uniform("textureCoordinateOffsets", 1, 4, texture_offsets);
|
||||
target.set_uniform("compositeAngleOffsets", 4, 1, angles);
|
||||
|
||||
@@ -9,13 +9,9 @@
|
||||
#include "FIRFilter.hpp"
|
||||
|
||||
#include <cmath>
|
||||
#include <numbers>
|
||||
#include <numeric>
|
||||
|
||||
#ifndef M_PI
|
||||
static constexpr float M_PI = 3.1415926f;
|
||||
// TODO: use std::numbers::pi_v when switching to C++20.
|
||||
#endif
|
||||
|
||||
using namespace SignalProcessing;
|
||||
|
||||
/*
|
||||
@@ -134,7 +130,7 @@ FIRFilter::FIRFilter(
|
||||
std::vector<float> A(Np+1);
|
||||
A[0] = 2.0f * (high_frequency - low_frequency) / input_sample_rate;
|
||||
for(unsigned int i = 1; i <= Np; ++i) {
|
||||
const float i_pi = float(i) * float(M_PI);
|
||||
const float i_pi = float(i) * std::numbers::pi_v<float>;
|
||||
A[i] =
|
||||
(
|
||||
sinf(two_over_sample_rate * i_pi * high_frequency) -
|
||||
|
||||
Reference in New Issue
Block a user