History

aligning headers with 1.5-beta; Bitcrusher crushing a bit better; removing Faust osx -lcrypto dependency

Ge Wang committed 3 years ago

Commit 6e4b6fc1 parent 01c8ae472 files · +2167 −1113Browse files

Showing the changes to Bitcrusher/Bitcrusher.cpp (1 of 72 files). Show all

Unified · Split

Bitcrusher/Bitcrusher.cpp+10−2
@@ -120,9 +120,17 @@ CK_DLL_TICK(bitcrusher_tick) · 119 unmodified lines
120 120
121 // convert to 32-bit int121 // convert to 32-bit int
122 t_CKINT shift = 32-bcdata->bits;122 t_CKINT shift = 32-bcdata->bits;
123 int q32 = theSample * INT_MAX;123 // cast to double for avoid floating point precision warning/error | (ge) 2023.4.14
124 // "implicit conversion from 'int' to 'float' changes value from 2147483647 to 2147483648"
125 // https://stackoverflow.com/questions/23420783/convert-int-max-to-float-and-then-back-to-integer
126 // for example...
127 // int i = ((float)(INT_MAX)); // on mac (intel and arm64) seem to produce arbitrary and different values
128 // int i = ((float)(INT_MAX)-64); // on mac appears stable
129 // int i = ((double)(INT_MAX)); // on mac appears stable
130 // int i = ((double)(INT_MAX)+.1); // on mac appears stable
131 // int i = ((double)(INT_MAX)+1); // on mac not stable
132 int q32 = ((double)theSample) * INT_MAX;
124 q32 = (q32 >> shift) << shift;133 q32 = (q32 >> shift) << shift;
125
126 *out = q32 / ((float) INT_MAX);134 *out = q32 / ((float) INT_MAX);
127 135
128 return TRUE;136 return TRUE;

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t