mirror of
https://github.com/radio95-rnt/fm95.git
synced 2026-02-27 03:23:54 +01:00
add a version with rds
This commit is contained in:
@@ -9,13 +9,12 @@
|
||||
#define OUTPUT_DEVICE "alsa_output.platform-soc_sound.stereo-fallback"
|
||||
#define BUFFER_SIZE 512
|
||||
|
||||
#define MONO_VOLUME 0.5f
|
||||
#define PILOT_VOLUME 0.025f
|
||||
#define STEREO_VOLUME 0.275f
|
||||
|
||||
#define MONO_VOLUME 0.5f // L+R Signal
|
||||
#define PILOT_VOLUME 0.025f // 19 KHz Pilot
|
||||
#define STEREO_VOLUME 0.275f // L-R signal
|
||||
|
||||
#define TWO_BUFFER_SIZE (BUFFER_SIZE*2) // Don't touch this
|
||||
volatile int to_run = 1;
|
||||
volatile sig_atomic_t to_run = 1;
|
||||
|
||||
const float format_scale = 1.0f / 32768.0f;
|
||||
void stereo_s16le_to_float(const int16_t *input, float *left, float *right, size_t num_samples) {
|
||||
@@ -66,12 +65,12 @@ int main() {
|
||||
const float STEREO_FREQ = 38000.0f;
|
||||
|
||||
// Define formats and buffer atributes
|
||||
pa_sample_spec input_format = {
|
||||
pa_sample_spec stereo_format = {
|
||||
.format = PA_SAMPLE_S16LE,
|
||||
.channels = 2,
|
||||
.rate = SAMPLE_RATE
|
||||
};
|
||||
pa_sample_spec output_format = {
|
||||
pa_sample_spec mono_format = {
|
||||
.format = PA_SAMPLE_S16LE,
|
||||
.channels = 1,
|
||||
.rate = SAMPLE_RATE
|
||||
@@ -95,7 +94,7 @@ int main() {
|
||||
PA_STREAM_RECORD,
|
||||
INPUT_DEVICE,
|
||||
"Audio Input",
|
||||
&input_format,
|
||||
&stereo_format,
|
||||
NULL,
|
||||
&input_buffer_atr,
|
||||
NULL
|
||||
@@ -113,7 +112,7 @@ int main() {
|
||||
PA_STREAM_PLAYBACK,
|
||||
OUTPUT_DEVICE,
|
||||
"MPX",
|
||||
&output_format,
|
||||
&mono_format,
|
||||
NULL,
|
||||
&output_buffer_atr,
|
||||
NULL
|
||||
@@ -148,7 +147,7 @@ int main() {
|
||||
|
||||
float mono = (left[i] + right[i]) / 2.0f;
|
||||
float stereo = (left[i] - right[i]) / 2.0f;
|
||||
|
||||
|
||||
mpx[i] = mono*MONO_VOLUME +
|
||||
(stereo * stereo_carrier)*STEREO_VOLUME +
|
||||
(pilot * PILOT_VOLUME);
|
||||
|
||||
Reference in New Issue
Block a user