mirror of
https://github.com/radio95-rnt/fm95.git
synced 2026-02-26 19:23:51 +01:00
remove polar stereo
fix
This commit is contained in:
@@ -1,10 +1,9 @@
|
||||
#include "stereo_encoder.h"
|
||||
|
||||
// Multiplier is the multiplier to get to 19 khz, or 31.25 if polar
|
||||
void init_stereo_encoder(StereoEncoder* st, uint8_t multiplier, Oscillator* osc, uint8_t polar, float mono_volume, float pilot_volume, float stereo_volume) {
|
||||
// Multiplier is the multiplier to get to 19 khz
|
||||
void init_stereo_encoder(StereoEncoder* st, uint8_t multiplier, Oscillator* osc, float mono_volume, float pilot_volume, float stereo_volume) {
|
||||
st->multiplier = multiplier;
|
||||
st->osc = osc;
|
||||
st->polar = polar;
|
||||
st->mono_volume = mono_volume;
|
||||
st->pilot_volume = pilot_volume;
|
||||
st->stereo_volume = stereo_volume;
|
||||
@@ -17,11 +16,7 @@ float stereo_encode(StereoEncoder* st, uint8_t enabled, float left, float right)
|
||||
float side = (left-right) * 0.5f;
|
||||
|
||||
float signalx1 = get_oscillator_sin_multiplier_ni(st->osc, st->multiplier);
|
||||
float signalx2 = get_oscillator_sin_multiplier_ni(st->osc, st->multiplier * 2.0f);
|
||||
|
||||
if(!st->polar) {
|
||||
float signalx2 = get_oscillator_sin_multiplier_ni(st->osc, st->multiplier * 2.0f);
|
||||
return (mid*st->mono_volume) + (signalx1*st->pilot_volume) + ((side*signalx2) * st->stereo_volume);
|
||||
} else {
|
||||
return (mid*st->mono_volume) + (((side+0.2f)*signalx1) * st->stereo_volume); // Polar stereo does not contain a pilot, but it contains a -14 db carrier wave on the stereo subcarrier
|
||||
}
|
||||
return (mid*st->mono_volume) + (signalx1*st->pilot_volume) + ((side*signalx2) * st->stereo_volume);
|
||||
}
|
||||
@@ -7,12 +7,11 @@ typedef struct
|
||||
{
|
||||
uint8_t multiplier;
|
||||
Oscillator* osc;
|
||||
uint8_t polar;
|
||||
float mono_volume;
|
||||
float pilot_volume;
|
||||
float stereo_volume;
|
||||
} StereoEncoder;
|
||||
|
||||
void init_stereo_encoder(StereoEncoder *st, uint8_t multiplier, Oscillator *osc, uint8_t polar, float mono_volume, float pilot_volume, float stereo_volume);
|
||||
void init_stereo_encoder(StereoEncoder *st, uint8_t multiplier, Oscillator *osc, float mono_volume, float pilot_volume, float stereo_volume);
|
||||
|
||||
float stereo_encode(StereoEncoder* st, uint8_t enabled, float left, float right);
|
||||
|
||||
Reference in New Issue
Block a user