Thank you Roland, this was it !
So, now I'm trying to compile Squeezelite with the GPIO 4 enabling the
right Clock
I looked at the code of -gpio.c - and -resample.c- in order to build a
new version of resample.o that would integrate GPIO and change it on the
fly
I first integrated a flag that is 0 when the stream sample rate is 44K1
and 1 when the stream sample rate is 48k, this part of the code is
running:
44K1 STREAM -> 44K1 STREAM
Code:
--------------------
root@StudioCube:/tmp/squeezelite-master# tac /tmp/squeezelite.log | grep -m
1 "setting Clock from"
--------------------
> [13:40:11.269653] resample_newstream:200 setting Clock from 0 -> 0
=OK
44K1 STREAM -> 48K STREAM
Code:
--------------------
root@StudioCube:/tmp/squeezelite-master# tac /tmp/squeezelite.log | grep -m
1 "setting Clock from"
--------------------
> [13:50:55.597058] resample_newstream:200 setting Clock from 0 -> 1
=OK
48K STREAM -> 44K1 STREAM
Code:
--------------------
root@StudioCube:/tmp/squeezelite-master# tac /tmp/squeezelite.log | grep -m
1 "setting Clock from"
--------------------
> [13:51:20.552550] resample_newstream:200 setting Clock from 1 -> 0
=OK
44K1 STREAM -> 48K STREAM
Code:
--------------------
root@StudioCube:/tmp/squeezelite-master# tac /tmp/squeezelite.log | grep -m
1 "setting Clock from"
--------------------
> [14:01:15.358690] resample_newstream:200 setting Clock from 0 -> 1
=OK
48K STREAM -> 48K STREAM
Code:
--------------------
root@StudioCube:/tmp/squeezelite-master# tac /tmp/squeezelite.log | grep -m
1 "setting Clock from"
--------------------
> [14:01:31.542105] resample_newstream:200 setting Clock from 1 -> 1
=OK
BUT IF I TRY TO CHANGE THE GPIO, I GET AN ERROR:
Although I get no compiling error I have an error when running
squeezelite.
Code:
--------------------
root@StudioCube:/tmp/squeezelite-master# make -f Makefile.resample
cc -O3 -mcpu=cortex-a53 -mtune=cortex-a53 -mfpu=neon-fp-armv8
-mneon-for-64bits -mfloat-abi=hard -fcommon -DRESAMPLE -DGPIO -DRPI resample.c
-c -o resample.o
cc main.o slimproto.o buffer.o stream.o utils.o output.o output_alsa.o
output_pa.o output_stdout.o output_pack.o output_pulse.o decode.o flac.o pcm.o
mad.o vorbis.o mpg.o process.o resample.o gpio.o minimal_gpio.o faad.o
-lpthread -lm -lrt -ldl -lasound -o squeezelite
root@StudioCube:/tmp/squeezelite-master# cp -f ./squeezelite
/usr/bin/squeezelite
root@StudioCube:/tmp/squeezelite-master# chmod u+x /usr/bin/squeezelite
root@StudioCube:/tmp/squeezelite-master# squeezelite -a 16:4:32:0 -b
10000:200000 -r 192000 -R -u v::6:32:60:150:0 -p 85 -C 5 -n 'Studio' -s
10.144.1.1 -d all=info
--------------------
> [13:20:33.241249] stream_init:448 init stream
> [13:20:33.272285] output_init_alsa:940 init output
> [13:20:33.272504] output_init_alsa:980 requested alsa_buffer: 16
> alsa_period: 4 format: 32 mmap: 0
> [13:20:33.289122] output_init_common:425 supported rates: 192000 176400
> 96000 88200 48000 44100 32000 24
> 000 22500 16000 12000 11025 8000
> [13:20:34.041450] output_init_alsa:1006 memory locked
> [13:20:34.042176] output_init_alsa:1012 glibc detected using mallopt
> [13:20:34.049908] decode_init:153 init decode
> [13:20:34.052063] load_faad:633 loaded libfaad.so.2
> [13:20:34.052563] register_faad:663 using faad to decode aac
> [13:20:34.056100] load_vorbis:351 loaded libvorbisfile.so.3
> [13:20:34.056235] register_vorbis:380 using vorbis to decode ogg
> [13:20:34.059495] load_flac:304 loaded libFLAC.so.8
> [13:20:34.059615] register_flac:332 using flac to decode ogf,flc
> [13:20:34.060018] register_pcm:483 using pcm to decode aif,pcm
> [13:20:34.062340] load_mad:394 loaded libmad.so.0
> [13:20:34.062487] register_mad:423 using mad to decode mp3
> [13:20:34.068641] load_soxr:301 loaded libsoxr.so.0
> [13:20:34.069216] resample_init:394 resampling sync recipe: 0x06, flags:
> 0x00, scale: 0.50, precision: 3
> 2.0, passband_end: 0.60000,
> stopband_begin: 1.50000, phase_response: 0.0
> [13:20:34.069937] slimproto:887 connecting to 10.144.1.1:3483
> [13:20:34.172643] slimproto:926 connected
> [13:20:34.172823] sendHELO:142 mac: b8:27:eb:f0:1a:54
> [13:20:34.172905] sendHELO:144 cap:
> Model=squeezelite,AccuratePlayPoints=1,HasDigitalOut=1,HasPolarityIn
>
> version=1,Firmware=v1.9.8-1307,ModelName=SqueezeLite,MaxSampleRate=192000,aac,ogg,ogf,flc,aif,pcm,mp3
> [13:20:34.246367] decode_flush:236 decode flush
> [13:20:34.246526] output_flush:438 flush output buffer
> [13:20:34.325897] codec_open:264 codec open: 'a'
> [13:20:34.326038] faad_open:558 opening adts stream
> [13:20:34.326235] connect_socket:158 connecting to 51.158.104.58:80
> [13:20:34.349852] stream_sock:591 header: GET /fip-hifi.aac HTTP/1.0
> Cache-Control: no-cache
> Connection: close
> Accept: */*
> Host: icecast.radiofrance.fr
> User-Agent: iTunes/4.7.1 (Linux; N; Debian; armv7l-linux; FR; utf8)
> SqueezeCenter, Squeezebox Server, Lo
> gitech Media Server/8.0.0/1605892076
> Icy-MetaData: 1
>
>
> [13:20:34.461184] stream_thread:325 headers: len: 503
> HTTP/1.1 200 OK
> Server: nginx
> Date: Sun, 27 Dec 2020 12:20:34 GMT
> Content-Type: audio/aac
> Connection: close
> icy-br: 192
> ice-audio-info: channels=2;samplerate=48000;bitrate=192
> icy-br: 192
> icy-name: fip-hifi.aac
> icy-pub: 1
> Cache-Control: no-cache, no-store
> Expires: Mon, 26 Jul 1997 05:00:00 GMT
> Access-Control-Allow-Origin: *
> Access-Control-Allow-Headers: Origin, Accept, X-Requested-With,
> Content-Type, Icy-MetaData
> Access-Control-Allow-Methods: GET, OPTIONS, SOURCE, PUT, HEAD, STATS
>
>
> [13:20:34.571841] faad_decode:385 samplerate: 48000 channels: 2
> [13:20:34.572010] faad_decode:390 setting track_start
> *Erreur de segmentation*
HERE IS MY NEW -RESAMPLE.C- CODE:
Code:
--------------------
//....
// upsampling using libsoxr - only included if RESAMPLE set
#include "squeezelite.h"
#IF GPIO
#INCLUDE <STDIO.H>
#INCLUDE <STDLIB.H>
#INCLUDE <UNISTD.H>
STATIC INT GPIO_STATE = 0;
STATIC INT NEW_GPIO_STATE = 0;
#ENDIF // GPIO
#if RESAMPLE
#include <math.h>
#include <soxr.h>
//....
process->in_sample_rate = raw_sample_rate;
process->out_sample_rate = outrate;
// SET UP AUDIO CLOCK WITH GPIO 4 USING BCM PIN #'S
GPIO_PIN = 4;
GPIO_STATE = NEW_GPIO_STATE;
#IFDEF RPI
// SET UP GPIO USING BCM PIN #'S
GPIOSETMODE (GPIO_PIN, PI_OUTPUT);
*-//=>ERROR-
if (raw_sample_rate == 48000) {
new_gpio_state = 1;
gpioWrite(gpio_pin, PI_HIGH^gpio_active_low);
*-//=>ERROR-*
}
else if(raw_sample_rate == 44100) {
new_gpio_state = 0;
gpioWrite(gpio_pin, PI_LOW^gpio_active_low);
*-//=>ERROR-*
}
LOG_INFO("setting Clock from %u -> %u", gpio_state, new_gpio_state);
#endif
*
if (r->resampler) {
SOXR(r, delete, r->resampler);
r->resampler = NULL;
}
if (raw_sample_rate != outrate) {
soxr_io_spec_t io_spec;
soxr_quality_spec_t q_spec;
soxr_error_t error;
#if RESAMPLE_MP
soxr_runtime_spec_t r_spec;
#endif
LOG_INFO("resampling from %u -> %u", raw_sample_rate, outrate);
//....
--------------------
Hoping, someone can provide with the solution...
Jean
------------------------------------------------------------------------
bidule's Profile: http://forums.slimdevices.com/member.php?userid=15337
View this thread: http://forums.slimdevices.com/showthread.php?t=113499
_______________________________________________
plugins mailing list
[email protected]
http://lists.slimdevices.com/mailman/listinfo/plugins