7 #ifndef PDSP_RANDOM_PRNOISEGEN_H_INCLUDED 8 #define PDSP_RANDOM_PRNOISEGEN_H_INCLUDED 11 #include "../pdspCore.h" 15 #pragma warning( push ) 16 #pragma warning( disable : C4838) 17 #pragma warning( disable : C4554) 21 #pragma GCC diagnostic push 22 #pragma GCC diagnostic ignored "-Wparentheses" 26 #define EXTRACT_BITS(the_val , bits_start , bits_len) ((the_val >> (bits_start-1)) & ((1<<bits_len-1))) 30 static const float PNDivisor = 1.0 / 268435456.0;
33 inline_f
float PNSequenceNext(uint32_t& PNRegister){
35 uint32_t b0 = EXTRACT_BITS(PNRegister, 1, 1);
36 uint32_t b1 = EXTRACT_BITS(PNRegister, 2, 1);
37 uint32_t b27 = EXTRACT_BITS(PNRegister, 28, 1);
38 uint32_t b28 = EXTRACT_BITS(PNRegister, 29, 1);
41 uint32_t b31 = b0^b1^b27^b28;
51 return ((PNRegister * PNDivisor) - 1.0);
81 void prepareUnit(
int expectedBufferSize,
double sampleRate )
override;
82 void releaseResources()
override;
84 void process(
int bufferSize) noexcept
override;
85 void process_run(
const int &bufferSize) noexcept;
86 void process_PA(
const float* &trigSyncBuffer,
const int &bufferSize) noexcept;
87 void process_SA_TA(
const float* &trigSyncBuffer,
const float* &trigSeedBuffer,
const int &bufferSize) noexcept;
89 inline_f
void reSeed();
105 #pragma warning( pop ) 109 #pragma GCC diagnostic pop 113 #endif // PDSP_RANDOM_PRNOISEGEN_H_INCLUDED Patchable & in_clock()
Sets "clock" as selected input and returns this Unit ready to be patched. This is the default input...
Definition: WhiteNoise.cpp:24
Abstract class for implementing Units.
Definition: BasicNodes.h:223
PseudoRandom Noise Generator (used for white noise, but it can also generate more complex noise timbr...
Definition: WhiteNoise.h:61
Abstract class for implementing Units and Modules.
Definition: BasicNodes.h:82
Patchable & in_reseed()
Sets "reseed" as selected input and returns this Unit ready to be patched. You need to patch an out_t...
Definition: WhiteNoise.cpp:28
Patchable & out_signal()
Sets "signal" as selected output and returns this Unit ready to be patched. This is the default outpu...
Thread-safe value control with smoothing.
Definition: SequencerBridge.h:11
Output of a Unit, contains a buffer of rendered floats and has a variable state flag.
Definition: BasicNodes.h:354