aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/amps/dsp.c12
-rw-r--r--src/anetz/dsp.c16
-rw-r--r--src/bnetz/dsp.c4
-rw-r--r--src/cnetz/dsp.c28
-rw-r--r--src/nmt/dsp.c6
5 files changed, 33 insertions, 33 deletions
diff --git a/src/amps/dsp.c b/src/amps/dsp.c
index 7fcabcc..1a1e3d1 100644
--- a/src/amps/dsp.c
+++ b/src/amps/dsp.c
@@ -316,7 +316,7 @@ static int fsk_encode(amps_t *amps, char bit)
if ((last & 1)) {
/* last bit was 1, this bit is 1, so we ramp down first */
do {
- *spl++ = ramp_down[(int)phase];
+ *spl++ = ramp_down[(uint8_t)phase];
phase += bitstep;
} while (phase < 256.0);
phase -= 256.0;
@@ -330,7 +330,7 @@ static int fsk_encode(amps_t *amps, char bit)
}
/* ramp up */
do {
- *spl++ = ramp_up[(int)phase];
+ *spl++ = ramp_up[(uint8_t)phase];
phase += bitstep;
} while (phase < 256.0);
phase -= 256.0;
@@ -345,14 +345,14 @@ static int fsk_encode(amps_t *amps, char bit)
} else {
/* last bit was 0, this bit is 0, so we ramp up first */
do {
- *spl++ = ramp_up[(int)phase];
+ *spl++ = ramp_up[(uint8_t)phase];
phase += bitstep;
} while (phase < 256.0);
phase -= 256.0;
}
/* ramp down */
do {
- *spl++ = ramp_down[(int)phase];
+ *spl++ = ramp_down[(uint8_t)phase];
phase += bitstep;
} while (phase < 256.0);
phase -= 256.0;
@@ -441,7 +441,7 @@ static void sat_encode(amps_t *amps, int16_t *samples, int length)
for (i = 0; i < length; i++) {
sample = *samples;
- sample += dsp_sine_sat[((uint8_t)phase) & 0xff];
+ sample += dsp_sine_sat[(uint8_t)phase];
if (sample > 32767)
sample = 32767;
else if (sample < -32767)
@@ -464,7 +464,7 @@ static void test_tone_encode(amps_t *amps, int16_t *samples, int length)
phase = amps->test_phase256;
for (i = 0; i < length; i++) {
- *samples++ = dsp_sine_test[((uint8_t)phase) & 0xff];
+ *samples++ = dsp_sine_test[(uint8_t)phase];
phase += phaseshift;
if (phase >= 256)
phase -= 256;
diff --git a/src/anetz/dsp.c b/src/anetz/dsp.c
index ee5bdd7..a680366 100644
--- a/src/anetz/dsp.c
+++ b/src/anetz/dsp.c
@@ -254,10 +254,10 @@ static void fsk_paging_tone(anetz_t *anetz, int16_t *samples, int length)
}
for (i = 0; i < length; i++) {
- sample = (int32_t)dsp_sine_tone[((uint8_t)phase[0]) & 0xff]
- + (int32_t)dsp_sine_tone[((uint8_t)phase[1]) & 0xff]
- + (int32_t)dsp_sine_tone[((uint8_t)phase[2]) & 0xff]
- + (int32_t)dsp_sine_tone[((uint8_t)phase[3]) & 0xff];
+ sample = (int32_t)dsp_sine_tone[(uint8_t)phase[0]]
+ + (int32_t)dsp_sine_tone[(uint8_t)phase[1]]
+ + (int32_t)dsp_sine_tone[(uint8_t)phase[2]]
+ + (int32_t)dsp_sine_tone[(uint8_t)phase[3]];
*samples++ = sample / 4.0 * anetz->page_gain;
phase[0] += phaseshift[0];
phase[1] += phaseshift[1];
@@ -300,12 +300,12 @@ static void fsk_paging_tone_sequence(anetz_t *anetz, int16_t *samples, int lengt
while (length) {
/* use tone, but during transition of tones, keep phase 0 degrees (high level) until next tone reaches 0 degrees (high level) */
if (!transition)
- *samples++ = dsp_sine_tone[((uint8_t)phase[tone]) & 0xff] * anetz->page_gain;
+ *samples++ = dsp_sine_tone[(uint8_t)phase[tone]] * anetz->page_gain;
else {
/* fade between old an new tone */
*samples++
- = (double)dsp_sine_tone[((uint8_t)phase[(tone - 1) & 3]) & 0xff] * (double)(transition - count) / (double)transition / 2.0 * anetz->page_gain
- + (double)dsp_sine_tone[((uint8_t)phase[tone]) & 0xff] * (double)count / (double)transition / 2.0 * anetz->page_gain;
+ = (double)dsp_sine_tone[(uint8_t)phase[(tone - 1) & 3]] * (double)(transition - count) / (double)transition / 2.0 * anetz->page_gain
+ + (double)dsp_sine_tone[(uint8_t)phase[tone]] * (double)count / (double)transition / 2.0 * anetz->page_gain;
}
phase[0] += phaseshift[0];
phase[1] += phaseshift[1];
@@ -350,7 +350,7 @@ static void fsk_tone(anetz_t *anetz, int16_t *samples, int length)
phase = anetz->tone_phase256;
for (i = 0; i < length; i++) {
- *samples++ = dsp_sine_tone[((uint8_t)phase) & 0xff];
+ *samples++ = dsp_sine_tone[(uint8_t)phase];
phase += phaseshift;
if (phase >= 256)
phase -= 256;
diff --git a/src/bnetz/dsp.c b/src/bnetz/dsp.c
index 90a1821..58a5375 100644
--- a/src/bnetz/dsp.c
+++ b/src/bnetz/dsp.c
@@ -317,7 +317,7 @@ static void fsk_tone(bnetz_t *bnetz, int16_t *samples, int length, int tone)
phaseshift = bnetz->phaseshift256[tone];
for (i = 0; i < length; i++) {
- *samples++ = dsp_sine[((uint8_t)phase) & 0xff];
+ *samples++ = dsp_sine[(uint8_t)phase];
phase += phaseshift;
if (phase >= 256)
phase -= 256;
@@ -351,7 +351,7 @@ next_telegramm:
for (i = 0; i < 16; i++) {
phaseshift = bnetz->phaseshift256[telegramm[i] == '1'];
for (j = 0; j < bnetz->samples_per_bit; j++) {
- *spl++ = dsp_sine[((uint8_t)phase) & 0xff];
+ *spl++ = dsp_sine[(uint8_t)phase];
phase += phaseshift;
if (phase >= 256)
phase -= 256;
diff --git a/src/cnetz/dsp.c b/src/cnetz/dsp.c
index ae453c6..d3a3c69 100644
--- a/src/cnetz/dsp.c
+++ b/src/cnetz/dsp.c
@@ -253,12 +253,12 @@ static int fsk_testtone_encode(cnetz_t *cnetz)
/* add 198 bits of test tone */
for (i = 0; i < 99; i++) {
do {
- *spl++ = ramp_up[(int)phase];
+ *spl++ = ramp_up[(uint8_t)phase];
phase += bitstep;
} while (phase < 256.0);
phase -= 256.0;
do {
- *spl++ = ramp_down[(int)phase];
+ *spl++ = ramp_down[(uint8_t)phase];
phase += bitstep;
} while (phase < 256.0);
phase -= 256.0;
@@ -346,14 +346,14 @@ static int fsk_block_encode(cnetz_t *cnetz, const char *bits)
if (bits[i] == '1') {
/* ramp up from 0 */
do {
- *spl++ = ramp_up[(int)phase] / 2 + deviation / 2;
+ *spl++ = ramp_up[(uint8_t)phase] / 2 + deviation / 2;
phase += bitstep;
} while (phase < 256.0);
phase -= 256.0;
} else {
/* ramp down from 0 */
do {
- *spl++ = ramp_down[(int)phase] / 2 - deviation / 2;
+ *spl++ = ramp_down[(uint8_t)phase] / 2 - deviation / 2;
phase += bitstep;
} while (phase < 256.0);
phase -= 256.0;
@@ -370,7 +370,7 @@ static int fsk_block_encode(cnetz_t *cnetz, const char *bits)
} else {
/* ramp down */
do {
- *spl++ = ramp_down[(int)phase];
+ *spl++ = ramp_down[(uint8_t)phase];
phase += bitstep;
} while (phase < 256.0);
phase -= 256.0;
@@ -380,7 +380,7 @@ static int fsk_block_encode(cnetz_t *cnetz, const char *bits)
if (bits[i] == '1') {
/* ramp up */
do {
- *spl++ = ramp_up[(int)phase];
+ *spl++ = ramp_up[(uint8_t)phase];
phase += bitstep;
} while (phase < 256.0);
phase -= 256.0;
@@ -400,14 +400,14 @@ static int fsk_block_encode(cnetz_t *cnetz, const char *bits)
if (last == '0') {
/* ramp up to 0 */
do {
- *spl++ = ramp_up[(int)phase] / 2 - deviation / 2;
+ *spl++ = ramp_up[(uint8_t)phase] / 2 - deviation / 2;
phase += bitstep;
} while (phase < 256.0);
phase -= 256.0;
} else {
/* ramp down to 0 */
do {
- *spl++ = ramp_down[(int)phase] / 2 + deviation / 2;
+ *spl++ = ramp_down[(uint8_t)phase] / 2 + deviation / 2;
phase += bitstep;
} while (phase < 256.0);
phase -= 256.0;
@@ -481,14 +481,14 @@ static int fsk_distributed_encode(cnetz_t *cnetz, const char *bits)
if (bits[i * 4 + j] == '1') {
/* ramp up from 0 */
do {
- *spl++ = ramp_up[(int)phase] / 2 + deviation / 2;
+ *spl++ = ramp_up[(uint8_t)phase] / 2 + deviation / 2;
phase += bitstep;
} while (phase < 256.0);
phase -= 256.0;
} else {
/* ramp down from 0 */
do {
- *spl++ = ramp_down[(int)phase] / 2 - deviation / 2;
+ *spl++ = ramp_down[(uint8_t)phase] / 2 - deviation / 2;
phase += bitstep;
} while (phase < 256.0);
phase -= 256.0;
@@ -505,7 +505,7 @@ static int fsk_distributed_encode(cnetz_t *cnetz, const char *bits)
} else {
/* ramp down */
do {
- *spl++ = ramp_down[(int)phase];
+ *spl++ = ramp_down[(uint8_t)phase];
phase += bitstep;
} while (phase < 256.0);
phase -= 256.0;
@@ -515,7 +515,7 @@ static int fsk_distributed_encode(cnetz_t *cnetz, const char *bits)
if (bits[i * 4 + j] == '1') {
/* ramp up */
do {
- *spl++ = ramp_up[(int)phase];
+ *spl++ = ramp_up[(uint8_t)phase];
phase += bitstep;
} while (phase < 256.0);
phase -= 256.0;
@@ -535,14 +535,14 @@ static int fsk_distributed_encode(cnetz_t *cnetz, const char *bits)
if (last == '0') {
/* ramp up to 0 */
do {
- *spl++ = ramp_up[(int)phase] / 2 - deviation / 2;
+ *spl++ = ramp_up[(uint8_t)phase] / 2 - deviation / 2;
phase += bitstep;
} while (phase < 256.0);
phase -= 256.0;
} else {
/* ramp down to 0 */
do {
- *spl++ = ramp_down[(int)phase] / 2 + deviation / 2;
+ *spl++ = ramp_down[(uint8_t)phase] / 2 + deviation / 2;
phase += bitstep;
} while (phase < 256.0);
phase -= 256.0;
diff --git a/src/nmt/dsp.c b/src/nmt/dsp.c
index e3ff165..ac3018c 100644
--- a/src/nmt/dsp.c
+++ b/src/nmt/dsp.c
@@ -512,7 +512,7 @@ int fsk_render_frame(nmt_t *nmt, const char *frame, int length, int16_t *sample)
for (i = 0; i < length; i++) {
bit = (frame[i] == '1');
do {
- *sample++ = dsp_tone_bit[polarity][bit][((uint8_t)phase) & 0xff];
+ *sample++ = dsp_tone_bit[polarity][bit][(uint8_t)phase];
count++;
phase += phaseshift;
} while (phase < 256.0);
@@ -586,7 +586,7 @@ static void super_encode(nmt_t *nmt, int16_t *samples, int length)
for (i = 0; i < length; i++) {
sample = *samples;
- sample += dsp_sine_super[((uint8_t)phase) & 0xff];
+ sample += dsp_sine_super[(uint8_t)phase];
if (sample > 32767)
sample = 32767;
else if (sample < -32767)
@@ -610,7 +610,7 @@ static void dial_tone(nmt_t *nmt, int16_t *samples, int length)
phase = nmt->dial_phase256;
for (i = 0; i < length; i++) {
- *samples++ = dsp_sine_dialtone[((uint8_t)phase) & 0xff];
+ *samples++ = dsp_sine_dialtone[(uint8_t)phase];
phase += phaseshift;
if (phase >= 256)
phase -= 256;