mirror of
https://github.com/radio95-rnt/fm95.git
synced 2026-02-27 11:33:54 +01:00
something here and there
This commit is contained in:
@@ -311,6 +311,6 @@ int main(int argc, char **argv) {
|
||||
|
||||
int ret = run_chimer95(config, &runtime);
|
||||
printf("Cleaning up...\n");
|
||||
free_PulseOutputDevice(&runtime.output_device);
|
||||
free_PulseDevice(&runtime.output_device);
|
||||
return ret;
|
||||
}
|
||||
23
src/fm95.c
23
src/fm95.c
@@ -7,7 +7,6 @@
|
||||
|
||||
#define buffer_maxlength 12288
|
||||
#define buffer_tlength_fragsize 12288
|
||||
#define buffer_prebuf 8
|
||||
|
||||
#include "../dsp/oscillator.h"
|
||||
#include "../filter/iir.h"
|
||||
@@ -129,13 +128,13 @@ void cleanup_runtime(FM95_Runtime* runtime, FM95_Config config) {
|
||||
}
|
||||
|
||||
void cleanup_audio_runtime(FM95_Runtime *rt, bool mpx_on, bool rds_on) {
|
||||
free_PulseInputDevice(&rt->input_device);
|
||||
if (mpx_on) free_PulseInputDevice(&rt->mpx_device);
|
||||
free_PulseDevice(&rt->input_device);
|
||||
if (mpx_on) free_PulseDevice(&rt->mpx_device);
|
||||
if (rds_on) {
|
||||
free_PulseInputDevice(&rt->rds_device);
|
||||
free_PulseDevice(&rt->rds_device);
|
||||
free(rt->rds_in);
|
||||
}
|
||||
free_PulseOutputDevice(&rt->output_device);
|
||||
free_PulseDevice(&rt->output_device);
|
||||
}
|
||||
|
||||
int run_fm95(const FM95_Config config, FM95_Runtime* runtime) {
|
||||
@@ -379,7 +378,7 @@ int setup_audio(FM95_Runtime* runtime, const FM95_DeviceNames dv_names, const FM
|
||||
pa_buffer_attr output_buffer_atr = {
|
||||
.maxlength = buffer_maxlength,
|
||||
.tlength = buffer_tlength_fragsize,
|
||||
.prebuf = buffer_prebuf
|
||||
.prebuf = 16
|
||||
};
|
||||
|
||||
int opentime_pulse_error;
|
||||
@@ -397,7 +396,7 @@ int setup_audio(FM95_Runtime* runtime, const FM95_DeviceNames dv_names, const FM
|
||||
opentime_pulse_error = init_PulseInputDevice(&runtime->mpx_device, config.sample_rate, 1, "fm95", "MPX Input", dv_names.mpx, &input_buffer_atr, PA_SAMPLE_FLOAT32NE);
|
||||
if (opentime_pulse_error) {
|
||||
fprintf(stderr, "Error: cannot open MPX device: %s\n", pa_strerror(opentime_pulse_error));
|
||||
free_PulseInputDevice(&runtime->input_device);
|
||||
free_PulseDevice(&runtime->input_device);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
@@ -407,8 +406,8 @@ int setup_audio(FM95_Runtime* runtime, const FM95_DeviceNames dv_names, const FM
|
||||
opentime_pulse_error = init_PulseInputDevice(&runtime->rds_device, config.sample_rate, config.rds_streams, "fm95", "RDS95 Input", dv_names.rds, &input_buffer_atr, PA_SAMPLE_FLOAT32NE);
|
||||
if (opentime_pulse_error) {
|
||||
fprintf(stderr, "Error: cannot open RDS device: %s\n", pa_strerror(opentime_pulse_error));
|
||||
free_PulseInputDevice(&runtime->input_device);
|
||||
if(mpx_on) free_PulseInputDevice(&runtime->mpx_device);
|
||||
free_PulseDevice(&runtime->input_device);
|
||||
if(mpx_on) free_PulseDevice(&runtime->mpx_device);
|
||||
return 1;
|
||||
}
|
||||
runtime->rds_in = malloc(sizeof(float) * BUFFER_SIZE * config.rds_streams);
|
||||
@@ -419,9 +418,9 @@ int setup_audio(FM95_Runtime* runtime, const FM95_DeviceNames dv_names, const FM
|
||||
opentime_pulse_error = init_PulseOutputDevice(&runtime->output_device, config.sample_rate, 1, "fm95", "Main Audio Output", dv_names.output, &output_buffer_atr, PA_SAMPLE_FLOAT32NE);
|
||||
if (opentime_pulse_error) {
|
||||
fprintf(stderr, "Error: cannot open output device: %s\n", pa_strerror(opentime_pulse_error));
|
||||
free_PulseInputDevice(&runtime->input_device);
|
||||
if(mpx_on) free_PulseInputDevice(&runtime->mpx_device);
|
||||
if(rds_on) free_PulseInputDevice(&runtime->rds_device);
|
||||
free_PulseDevice(&runtime->input_device);
|
||||
if(mpx_on) free_PulseDevice(&runtime->mpx_device);
|
||||
if(rds_on) free_PulseDevice(&runtime->rds_device);
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
|
||||
@@ -187,7 +187,7 @@ int main(int argc, char **argv) {
|
||||
opentime_pulse_error = init_PulseOutputDevice(&runtime.output, config.sample_rate, 1, "sca95", "Signal Output", audio_output_device, &output_buffer_atr, PA_SAMPLE_FLOAT32NE);
|
||||
if (opentime_pulse_error) {
|
||||
fprintf(stderr, "Error: cannot open output device: %s\n", pa_strerror(opentime_pulse_error));
|
||||
free_PulseInputDevice(&runtime.input);
|
||||
free_PulseDevice(&runtime.input);
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -196,7 +196,7 @@ int main(int argc, char **argv) {
|
||||
|
||||
int ret = run_sca95(config, &runtime);
|
||||
printf("Cleaning up...\n");
|
||||
free_PulseInputDevice(&runtime.input);
|
||||
free_PulseOutputDevice(&runtime.output);
|
||||
free_PulseDevice(&runtime.input);
|
||||
free_PulseDevice(&runtime.output);
|
||||
return ret;
|
||||
}
|
||||
@@ -385,7 +385,7 @@ int main(int argc, char *argv[]) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (output.initialized) free_PulseOutputDevice(&output);
|
||||
if (output.initialized) free_PulseDevice(&output);
|
||||
|
||||
int result = init_PulseOutputDevice(
|
||||
&output,
|
||||
@@ -410,7 +410,7 @@ int main(int argc, char *argv[]) {
|
||||
|
||||
// Clean up
|
||||
printf("Cleaning up...\n");
|
||||
if (output.initialized) free_PulseOutputDevice(&output);
|
||||
if (output.initialized) free_PulseDevice(&output);
|
||||
destroy_audio_buffer(audio_buffer);
|
||||
close(sockfd);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user