From 4d4fe54c6e839e75d3e5c6dcdc6669b215833da9 Mon Sep 17 00:00:00 2001 From: c vw Date: Thu, 15 Dec 2022 18:02:08 +0100 Subject: [PATCH] Added sintab.c --- Makefile | 27 +++--- sintab.c | 267 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 281 insertions(+), 13 deletions(-) create mode 100644 sintab.c diff --git a/Makefile b/Makefile index 966a898..bcf706e 100644 --- a/Makefile +++ b/Makefile @@ -31,9 +31,6 @@ LOCALCW_INCLUDE=LOCALCW # uncomment the line below for SoapySDR #SOAPYSDR_INCLUDE=SOAPYSDR -# uncomment the line to below include support for sx1509 i2c expander -#SX1509_INCLUDE=sx1509 - # uncomment the line below to include support for STEMlab discovery (WITH AVAHI) #STEMLAB_DISCOVERY=STEMLAB_DISCOVERY @@ -54,6 +51,9 @@ LINK?= $(CC) PKG_CONFIG = pkg-config +# +# Add modules for MIDI if required. Note these are different for Linux/MacOS +# ifeq ($(MIDI_INCLUDE),MIDI) MIDI_OPTIONS=-D MIDI MIDI_HEADERS= midi.h midi_menu.h alsa_midi.h @@ -125,6 +125,9 @@ LOCALCW_HEADERS= iambic.h LOCALCW_OBJS = iambic.o endif +# +# disable GPIO for MacOS +# ifeq ($(UNAME_S), Darwin) GPIO_INCLUDE= endif @@ -176,16 +179,13 @@ GTKLIBS=`$(PKG_CONFIG) --libs gtk+-3.0` # # set options for audio module -# - MacOS: only PORTAUDIO -# - Linux: either ALSA or PULSEAUDIO +# - MacOS: only PORTAUDIO tested (although PORTAUDIO might work) +# - Linux: either PULSEAUDIO (default) or ALSO (upon request) # ifeq ($(UNAME_S), Darwin) AUDIO_MODULE=PORTAUDIO endif -# -# default audio for LINUX is PULSEAUDIO but we can also use ALSA -# ifeq ($(UNAME_S), Linux) ifeq ($(AUDIO_MODULE) , ALSA) AUDIO_MODULE=ALSA @@ -284,7 +284,6 @@ old_discovery.c \ new_discovery.c \ old_protocol.c \ new_protocol.c \ -new_protocol_programmer.c \ rx_panadapter.c \ tx_panadapter.c \ property.c \ @@ -318,7 +317,8 @@ i2c.c \ gpio.c \ encoder_menu.c \ switch_menu.c \ -toolbar_menu.c +toolbar_menu.c \ +sintab.c @@ -397,7 +397,8 @@ i2c.h \ gpio.h \ encoder_menu.h \ switch_menu.h \ -toolbar_menu.h +toolbar_menu.h \ +sintab.h @@ -442,7 +443,6 @@ old_discovery.o \ new_discovery.o \ old_protocol.o \ new_protocol.o \ -new_protocol_programmer.o \ rx_panadapter.o \ tx_panadapter.o \ property.o \ @@ -475,7 +475,8 @@ i2c.o \ gpio.o \ encoder_menu.o \ switch_menu.o \ -toolbar_menu.o +toolbar_menu.o \ +sintab.o $(PROGRAM): $(OBJS) $(AUDIO_OBJS) $(REMOTE_OBJS) $(USBOZY_OBJS) $(SOAPYSDR_OBJS) \ $(LOCALCW_OBJS) $(PURESIGNAL_OBJS) \ diff --git a/sintab.c b/sintab.c new file mode 100644 index 0000000..db9e709 --- /dev/null +++ b/sintab.c @@ -0,0 +1,267 @@ +// +// sintab.h +// +// This data is Sin(2 Pi i/256) for i=0,1,2,...,256 +// That is, an array with 257 entries. This is so +// because we want to safely access sintab[i+1] for +// i=0,1,...,255, as we are using an "interpolating +// phaseword generator". +// +float sintab[257]={ +0.00000000000000000000000000, +0.02454122852291228803173453, +0.04906767432741801425495498, +0.07356456359966742352946562, +0.09801714032956060199419556, +0.1224106751992161984987045, +0.1467304744553617516588501, +0.1709618887603012263636424, +0.1950903220161282678482849, +0.2191012401568697972277375, +0.2429801799032638899482742, +0.2667127574748983863252865, +0.2902846772544623676361924, +0.3136817403988914766564788, +0.3368898533922200506892532, +0.3598950365349881487751046, +0.3826834323650897717284600, +0.4052413140049898709084813, +0.4275550934302820943209669, +0.4496113296546066000462946, +0.4713967368259976485563876, +0.4928981922297840368730267, +0.5141027441932217265936938, +0.5349976198870972106630769, +0.5555702330196022247428308, +0.5758081914178453007459725, +0.5956993044924333434670365, +0.6152315905806268454849136, +0.6343932841636454982151716, +0.6531728429537767640842030, +0.6715589548470184006253769, +0.6895405447370669246167306, +0.7071067811865475244008444, +0.7242470829514669209410692, +0.7409511253549590911756169, +0.7572088465064845475754641, +0.7730104533627369608109066, +0.7883464276266062620091647, +0.8032075314806449098066765, +0.8175848131515836965049209, +0.8314696123025452370787884, +0.8448535652497070732595712, +0.8577286100002720699022700, +0.8700869911087114186522924, +0.8819212643483550297127569, +0.8932243011955153203424164, +0.9039892931234433315862003, +0.9142097557035306546350148, +0.9238795325112867561281832, +0.9329927988347388877116603, +0.9415440651830207784125094, +0.9495281805930366671959361, +0.9569403357322088649357979, +0.9637760657954398666864644, +0.9700312531945439926039842, +0.9757021300385285444603958, +0.9807852804032304491261822, +0.9852776423889412447740184, +0.9891765099647809734516737, +0.9924795345987099981567673, +0.9951847266721968862448370, +0.9972904566786902161355971, +0.9987954562051723927147716, +0.9996988186962042201157656, +1.000000000000000000000000, +0.9996988186962042201157656, +0.9987954562051723927147716, +0.9972904566786902161355971, +0.9951847266721968862448370, +0.9924795345987099981567673, +0.9891765099647809734516737, +0.9852776423889412447740184, +0.9807852804032304491261822, +0.9757021300385285444603958, +0.9700312531945439926039842, +0.9637760657954398666864644, +0.9569403357322088649357979, +0.9495281805930366671959361, +0.9415440651830207784125094, +0.9329927988347388877116603, +0.9238795325112867561281832, +0.9142097557035306546350148, +0.9039892931234433315862003, +0.8932243011955153203424164, +0.8819212643483550297127569, +0.8700869911087114186522924, +0.8577286100002720699022700, +0.8448535652497070732595712, +0.8314696123025452370787884, +0.8175848131515836965049209, +0.8032075314806449098066765, +0.7883464276266062620091647, +0.7730104533627369608109066, +0.7572088465064845475754641, +0.7409511253549590911756169, +0.7242470829514669209410692, +0.7071067811865475244008444, +0.6895405447370669246167306, +0.6715589548470184006253769, +0.6531728429537767640842030, +0.6343932841636454982151716, +0.6152315905806268454849136, +0.5956993044924333434670365, +0.5758081914178453007459725, +0.5555702330196022247428308, +0.5349976198870972106630769, +0.5141027441932217265936938, +0.4928981922297840368730267, +0.4713967368259976485563876, +0.4496113296546066000462946, +0.4275550934302820943209669, +0.4052413140049898709084813, +0.3826834323650897717284600, +0.3598950365349881487751046, +0.3368898533922200506892532, +0.3136817403988914766564788, +0.2902846772544623676361924, +0.2667127574748983863252865, +0.2429801799032638899482742, +0.2191012401568697972277375, +0.1950903220161282678482849, +0.1709618887603012263636424, +0.1467304744553617516588501, +0.1224106751992161984987045, +0.09801714032956060199419556, +0.07356456359966742352946562, +0.04906767432741801425495498, +0.02454122852291228803173453, +0.00000000000000000000000000, +-0.02454122852291228803173453, +-0.04906767432741801425495498, +-0.07356456359966742352946562, +-0.09801714032956060199419556, +-0.1224106751992161984987045, +-0.1467304744553617516588501, +-0.1709618887603012263636424, +-0.1950903220161282678482849, +-0.2191012401568697972277375, +-0.2429801799032638899482742, +-0.2667127574748983863252865, +-0.2902846772544623676361924, +-0.3136817403988914766564788, +-0.3368898533922200506892532, +-0.3598950365349881487751046, +-0.3826834323650897717284600, +-0.4052413140049898709084813, +-0.4275550934302820943209669, +-0.4496113296546066000462946, +-0.4713967368259976485563876, +-0.4928981922297840368730267, +-0.5141027441932217265936938, +-0.5349976198870972106630769, +-0.5555702330196022247428308, +-0.5758081914178453007459725, +-0.5956993044924333434670365, +-0.6152315905806268454849136, +-0.6343932841636454982151716, +-0.6531728429537767640842030, +-0.6715589548470184006253769, +-0.6895405447370669246167306, +-0.7071067811865475244008444, +-0.7242470829514669209410692, +-0.7409511253549590911756169, +-0.7572088465064845475754641, +-0.7730104533627369608109066, +-0.7883464276266062620091647, +-0.8032075314806449098066765, +-0.8175848131515836965049209, +-0.8314696123025452370787884, +-0.8448535652497070732595712, +-0.8577286100002720699022700, +-0.8700869911087114186522924, +-0.8819212643483550297127569, +-0.8932243011955153203424164, +-0.9039892931234433315862003, +-0.9142097557035306546350148, +-0.9238795325112867561281832, +-0.9329927988347388877116603, +-0.9415440651830207784125094, +-0.9495281805930366671959361, +-0.9569403357322088649357979, +-0.9637760657954398666864644, +-0.9700312531945439926039842, +-0.9757021300385285444603958, +-0.9807852804032304491261822, +-0.9852776423889412447740184, +-0.9891765099647809734516737, +-0.9924795345987099981567673, +-0.9951847266721968862448370, +-0.9972904566786902161355971, +-0.9987954562051723927147716, +-0.9996988186962042201157656, +-1.000000000000000000000000, +-0.9996988186962042201157656, +-0.9987954562051723927147716, +-0.9972904566786902161355971, +-0.9951847266721968862448370, +-0.9924795345987099981567673, +-0.9891765099647809734516737, +-0.9852776423889412447740184, +-0.9807852804032304491261822, +-0.9757021300385285444603958, +-0.9700312531945439926039842, +-0.9637760657954398666864644, +-0.9569403357322088649357979, +-0.9495281805930366671959361, +-0.9415440651830207784125094, +-0.9329927988347388877116603, +-0.9238795325112867561281832, +-0.9142097557035306546350148, +-0.9039892931234433315862003, +-0.8932243011955153203424164, +-0.8819212643483550297127569, +-0.8700869911087114186522924, +-0.8577286100002720699022700, +-0.8448535652497070732595712, +-0.8314696123025452370787884, +-0.8175848131515836965049209, +-0.8032075314806449098066765, +-0.7883464276266062620091647, +-0.7730104533627369608109066, +-0.7572088465064845475754641, +-0.7409511253549590911756169, +-0.7242470829514669209410692, +-0.7071067811865475244008444, +-0.6895405447370669246167306, +-0.6715589548470184006253769, +-0.6531728429537767640842030, +-0.6343932841636454982151716, +-0.6152315905806268454849136, +-0.5956993044924333434670365, +-0.5758081914178453007459725, +-0.5555702330196022247428308, +-0.5349976198870972106630769, +-0.5141027441932217265936938, +-0.4928981922297840368730267, +-0.4713967368259976485563876, +-0.4496113296546066000462946, +-0.4275550934302820943209669, +-0.4052413140049898709084813, +-0.3826834323650897717284600, +-0.3598950365349881487751046, +-0.3368898533922200506892532, +-0.3136817403988914766564788, +-0.2902846772544623676361924, +-0.2667127574748983863252865, +-0.2429801799032638899482742, +-0.2191012401568697972277375, +-0.1950903220161282678482849, +-0.1709618887603012263636424, +-0.1467304744553617516588501, +-0.1224106751992161984987045, +-0.09801714032956060199419556, +-0.07356456359966742352946562, +-0.04906767432741801425495498, +-0.02454122852291228803173453, +0.000000000000000000000000000}; -- 2.45.2