Folge dem Video um zu sehen, wie unsere Website als Web-App auf dem Startbildschirm installiert werden kann.
Anmerkung: This feature may not be available in some browsers.
.
// ------- Quad saw or pwm (mit aliasing) ------------------------------------
void Oscillator::RenderQuad(uint8_t* buffer) {
uint16_t phase_spread = (
static_cast<uint32_t>(phase_increment_.integral) * parameter_) >> 13;
++phase_spread;
uint16_t phase_increment = phase_increment_.integral;
uint16_t increments[3];
for (uint8_t i = 0; i < 3; ++i) {
phase_increment += phase_spread;
increments[i] = phase_increment;
}
if (shape_ == WAVEFORM_QUAD_SAW_PAD) {
BEGIN_SAMPLE_LOOP
UPDATE_PHASE
data_.qs.phase[0] += increments[0];
data_.qs.phase[1] += increments[1];
data_.qs.phase[2] += increments[2];
uint8_t value = (phase.integral >> 10);
value += (data_.qs.phase[0] >> 10);
value += (data_.qs.phase[1] >> 10);
value += (data_.qs.phase[2] >> 10);
*buffer++ = value;
END_SAMPLE_LOOP
}
else { //WAVEFORM_QUAD_PWM
uint16_t pwm_phase = static_cast<uint16_t>(127 + parameter_) << 8;
BEGIN_SAMPLE_LOOP
UPDATE_PHASE
data_.qs.phase[0] += increments[0];
data_.qs.phase[1] += increments[1];
data_.qs.phase[2] += increments[2];
uint8_t value = phase.integral < pwm_phase ? 0 : 63;
value += data_.qs.phase[0] < pwm_phase ? 0 : 63;
value += data_.qs.phase[1] < pwm_phase ? 0 : 63;
value += data_.qs.phase[2] < pwm_phase ? 0 : 63;
*buffer++ = value;
END_SAMPLE_LOOP
}
}
.
//*************************************************************************
// OscRender: Quad saw or pwm (mit aliasing)
//*************************************************************************
void OscRender_PAD(uint8_t osc_nr)
{
uint8_t block_size = 40;
uint8_t shape = Osc.shape[osc_nr];
uint8_t parameter = Osc.prm[osc_nr];
uint8_t *buffer; // pointer name
uint8_t i = 0;
if (osc_nr == 0)
{
if (Voice.buffer_nr == 0)
{
buffer = Voice.Buffer2a;
}
else {buffer = Voice.Buffer1a;}
}
else
{
if (Voice.buffer_nr == 0)
{
buffer = Voice.Buffer2b;
}
else {buffer = Voice.Buffer1b;}
}
uint16_t phase_increment_ = (Osc.phase_increment[osc_nr] >> 8);
uint16_t phase_spread = (uint32_t)(phase_increment_ * parameter) >> 13;
++phase_spread;
uint16_t increments[3];
for (uint8_t i = 0; i < 3; ++i) {
phase_increment_ += phase_spread;
increments[i] = phase_increment_;
}
//BEGIN_SAMPLE_LOOP ---------------------------------------------------
if (shape == OSC_SAW_PAD) {
do
{
// update Phase
Osc.phase[osc_nr] += Osc.phase_increment[osc_nr];
if (SREG & 0b00000001) // test overflow
{
Osc.phase[osc_nr] = 0;
}
uint16_t phase_intergral = Osc.phase[osc_nr] >> 8;
uint8_t value = (phase_intergral >> 10);
// Osc1
if (osc_nr == 0)
{
Osc1.data_qs_phase[0] += increments[0];
Osc1.data_qs_phase[1] += increments[1];
Osc1.data_qs_phase[2] += increments[2];
value += (Osc1.data_qs_phase[0] >> 10);
value += (Osc1.data_qs_phase[1] >> 10);
value += (Osc1.data_qs_phase[2] >> 10);
}
else // Osc2
{
Osc2.data_qs_phase[0] += increments[0];
Osc2.data_qs_phase[1] += increments[1];
Osc2.data_qs_phase[2] += increments[2];
value += (Osc2.data_qs_phase[0] >> 10);
value += (Osc2.data_qs_phase[1] >> 10);
value += (Osc2.data_qs_phase[2] >> 10);
}
// write sample in sound-buffer
buffer[i++] = ~value;
} while (--block_size);
}
}
//*************************************************************************
// OscRender: Quad saw or pwm (mit aliasing)
//*************************************************************************
void OscRender_PAD(uint8_t osc_nr)
{
uint8_t block_size = 40;
uint8_t shape = Osc.shape[osc_nr];
uint8_t parameter = Osc.prm[osc_nr];
uint8_t *buffer; // pointer name
uint8_t i = 0;
if (osc_nr == 0)
{
if (Voice.buffer_nr == 0)
{
buffer = Voice.Buffer2a;
}
else {buffer = Voice.Buffer1a;}
}
else
{
if (Voice.buffer_nr == 0)
{
buffer = Voice.Buffer2b;
}
else {buffer = Voice.Buffer1b;}
}
uint16_t phase_increment_ = (Osc.phase_increment[osc_nr] >> 8);
uint16_t phase_spread = (uint32_t)(phase_increment_ * parameter) >> 13;
// Test phase_spread with/without random value
if (Osc.Test_flag == 0)
{
++phase_spread;
}
else {phase_spread += (Noise.sample >> 7);}
uint16_t increments[3];
for (uint8_t i = 0; i < 3; ++i) {
phase_increment_ += phase_spread;
increments[i] = phase_increment_;
}
//BEGIN_SAMPLE_LOOP ---------------------------------------------------
if (shape == OSC_SAW_PAD) {
do
{
// update Phase
Osc.phase[osc_nr] += Osc.phase_increment[osc_nr];
if (SREG & 0b00000001) // test overflow
{
Osc.phase[osc_nr] = 0;
}
uint16_t phase_intergral = Osc.phase[osc_nr] >> 8;
uint8_t value = (phase_intergral >> 10);
// Osc1
if (osc_nr == 0)
{
Osc1.data_qs_phase[0] += increments[0];
Osc1.data_qs_phase[1] += increments[1];
Osc1.data_qs_phase[2] += increments[2];
value += (Osc1.data_qs_phase[0] >> 10);
value += (Osc1.data_qs_phase[1] >> 10);
value += (Osc1.data_qs_phase[2] >> 10);
}
else // Osc2
{
Osc2.data_qs_phase[0] += increments[0];
Osc2.data_qs_phase[1] += increments[1];
Osc2.data_qs_phase[2] += increments[2];
value += (Osc2.data_qs_phase[0] >> 10);
value += (Osc2.data_qs_phase[1] >> 10);
value += (Osc2.data_qs_phase[2] >> 10);
}
// write sample in sound-buffer
buffer[i++] = ~value;
} while (--block_size);
}
}
uint16_t phase_spread = (
static_cast<uint32_t>(phase_increment_.integral) * parameter_) >> 13;
++phase_spread;
uint16_t phase_increment = phase_increment_.integral;
uint16_t increments[3];
//*************************************************************************
// OscRender: Quad saw or pwm (mit aliasing)
//*************************************************************************
void OscRender_PAD(uint8_t osc_nr)
{
if (osc_nr == 1)
{
return;
}
uint8_t block_size = 128;
uint8_t shape = Osc.shape[osc_nr];
uint8_t parameter = Osc.prm[osc_nr];
uint8_t *buffer; // pointer name
uint16_t increments[3];
// Double buffering
if (Voice.buffer_nr == 0)
{
buffer = Voice.Buffer2a;
}
else {buffer = Voice.Buffer1a;}
uint16_t phase_increment_ = (Osc.phase_increment[osc_nr] >> 8);
uint16_t phase_spread = (uint32_t)(phase_increment_ * parameter) >> 13;
++phase_spread;
for (uint8_t i = 0; i < 3; ++i) {
phase_increment_ += phase_spread;
increments[i] = phase_increment_;
}
//BEGIN_SAMPLE_LOOP ---------------------------------------------------
do
{
// update Phase
Osc.phase[osc_nr] += Osc.phase_increment[osc_nr];
if (SREG & 0b00000001) // test overflow
{
Osc.phase[osc_nr] = 0;
}
uint16_t phase_intergral = Osc.phase[osc_nr] >> 8;
uint8_t value = (phase_intergral >> 10);
Osc1.data_qs_phase[0] += increments[0];
Osc1.data_qs_phase[1] += increments[1];
Osc1.data_qs_phase[2] += increments[2];
value += (Osc1.data_qs_phase[0] >> 10);
value += (Osc1.data_qs_phase[1] >> 10);
value += (Osc1.data_qs_phase[2] >> 10);
// write sample in sound-buffer
*buffer++ = ~value;
} while (--block_size);
}
uint16_t phase_spread = (uint32_t)(phase_increment_ * parameter) >> 13;
__uint24 phase_increment_ = (Osc.phase_increment[osc_nr] >> 8);
uint16_t phase_spread = (uint32_t)(phase_increment_ * parameter) >> 13;
//++phase_spread;
phase_spread += (Noise.sample >> 7);
for (uint8_t i = 0; i < 3; ++i) {
phase_increment_ += phase_spread;
increments[i] = phase_increment_;
}
buffer = (Voice.buffer_nr == 0) ? Voice.Buffer2a : Voice.Buffer1a;Code:if (Voice.buffer_nr == 0) { buffer = Voice.Buffer2a; } else {buffer = Voice.Buffer1a;}
Code:if (!Osc.vw_update) { uint8_t offset_1 = U8ShiftRight4(parameter); offset_1 = U8U8Mul(offset_1, 7); uint8_t offset_2 = offset_1 + 7; uint8_t balance = parameter & 15; // Interpolate formant frequencies. for (uint8_t i = 0; i < 3; ++i) { Osc.vw_formant_increment = U8U4MixU12( pgm_read_byte (&(wav_res_vowel_data[offset_1 + i])), pgm_read_byte (&(wav_res_vowel_data[offset_2 + i])),balance); Osc.vw_formant_increment <<= 3; } // Interpolate formant amplitudes. for (uint8_t i = 0; i < 4; ++i) { uint8_t amplitude_a = pgm_read_byte (&(wav_res_vowel_data[offset_1 + 3 + i])); uint8_t amplitude_b = pgm_read_byte (&(wav_res_vowel_data[offset_2 + 3 + i])); Osc.vw_formant_amplitude = U8U4MixU8(amplitude_a,amplitude_b, balance); } }
Als ob da ein Wert überläuft ????
Hab alles geprüft. Ich seh da keinen Fehler. Der einzige Unterschied in den Codezeile ist der Cast im Shruthi:Code:uint16_t phase_spread = (static_cast<uint32_t>(phase_increment_.integral) * parameter_) >> 13;
De-Generator:Code:uint8_t parameter = ...; uint16_t phase_increment_ = ...; uint16_t phase_spread = (uint32_t)(phase_increment_ * parameter) >> 13;
uint16_t phase_spread = ( (uint32_t)phase_increment_ * parameter ) >> 13;
Soundtrack: