#SERVER_INCLUDE=SERVER
CFLAGS?= -O -Wno-deprecated-declarations
+LINK?= $(CC)
+
PKG_CONFIG = pkg-config
ifeq ($(MIDI_INCLUDE),MIDI)
ozyio.o
endif
+
ifeq ($(SOAPYSDR_INCLUDE),SOAPYSDR)
SOAPYSDR_OPTIONS=-D SOAPYSDR
SOAPYSDRLIBS=-lSoapySDR
soapy_protocol.o
endif
+ifeq ($(LOCALCW_INCLUDE),LOCALCW)
+LOCALCW_OPTIONS=-D LOCALCW
+LOCALCW_SOURCES= iambic.c
+LOCALCW_HEADERS= iambic.h
+LOCALCW_OBJS = iambic.o
+endif
+
ifeq ($(PTT_INCLUDE),PTT)
PTT_OPTIONS=-D PTT
endif
ifeq ($(GPIO_INCLUDE),GPIO)
-GPIOD_VERSION=$(shell pkg-config --modversion libgpiod)
-ifeq ($(GPIOD_VERSION),1.2)
-GPIOD_OPTIONS=-D OLD_GPIOD
-endif
GPIO_OPTIONS=-D GPIO
GPIO_LIBS=-lwiringPi
-GPIO_SOURCES= \
- configure.c \
- i2c.c \
- encoder_menu.c
-GPIO_HEADERS= \
- configure.h \
- i2c.h \
- encoder_menu.h
-GPIO_OBJS= \
- configure.o \
- i2c.o \
- encoder_menu.o
-endif
-
-ifeq ($(LOCALCW_INCLUDE),LOCALCW)
-LOCALCW_OPTIONS=-D LOCALCW
-LOCALCW_SOURCES= iambic.c
-LOCALCW_HEADERS= iambic.h
-LOCALCW_OBJS = iambic.o
endif
#
GTKLIBS=$(shell $(PKG_CONFIG) --libs gtk+-3.0)
#
-# MacOS: only PORTAUDIO
+# set options for audio module
+# - MacOS: only PORTAUDIO
+# - Linux: either ALSA or PULSEAUDIO
#
ifeq ($(UNAME_S), Darwin)
AUDIO_MODULE=PORTAUDIO
AUDIO_OBJS=portaudio.o
endif
+OPTIONS=$(SMALL_SCREEN_OPTIONS) $(MIDI_OPTIONS) $(PURESIGNAL_OPTIONS) $(REMOTE_OPTIONS) $(USBOZY_OPTIONS) \
+ $(GPIO_OPTIONS) $(SOAPYSDR_OPTIONS) $(LOCALCW_OPTIONS) \
+ $(STEMLAB_OPTIONS) $(PTT_OPTIONS) \
+ $(SERVER_OPTIONS) \
+ $(AUDIO_OPTIONS) \
+ -D GIT_DATE='"$(GIT_DATE)"' -D GIT_VERSION='"$(GIT_VERSION)"' $(DEBUG_OPTION)
+
+#
+# Specify additional OS-dependent system libraries
+#
+
ifeq ($(UNAME_S), Linux)
SYSLIBS=-lrt
endif
+
ifeq ($(UNAME_S), Darwin)
SYSLIBS=-framework IOKit
endif
-OPTIONS=$(SMALL_SCREEN_OPTIONS) $(MIDI_OPTIONS) $(PURESIGNAL_OPTIONS) $(REMOTE_OPTIONS) $(USBOZY_OPTIONS) \
- $(GPIO_OPTIONS) $(GPIOD_OPTIONS) $(SOAPYSDR_OPTIONS) $(LOCALCW_OPTIONS) \
- $(STEMLAB_OPTIONS) $(PTT_OPTIONS) $(SERVER_OPTIONS) $(AUDIO_OPTIONS) $(GPIO_OPTIONS) \
- -D GIT_DATE='"$(GIT_DATE)"' -D GIT_VERSION='"$(GIT_VERSION)"' $(DEBUG_OPTION)
-
-LIBS= -lm -lwdsp -lpthread $(SYSLIBS) $(AUDIO_LIBS) $(USBOZY_LIBS) $(GTKLIBS) \
- $(GPIO_LIBS) $(SOAPYSDRLIBS) $(STEMLAB_LIBS) $(MIDI_LIBS)
+LIBS= $(LDFLAGS) $(AUDIO_LIBS) $(USBOZY_LIBS) $(GTKLIBS) $(GPIO_LIBS) $(SOAPYSDRLIBS) $(STEMLAB_LIBS) \
+ $(MIDI_LIBS) -lwdsp -lpthread -lm $(SYSLIBS)
INCLUDES=$(GTKINCLUDES)
COMPILE=$(CC) $(CFLAGS) $(OPTIONS) $(INCLUDES)
protocols.c \
css.c \
actions.c \
-switch_menu.c \
-gpio.c
+configure.c \
+is2.c \
+gpio.c \
+encoder_menu.c \
+switch_menu.c
HEADERS= \
ext.h \
error_handler.h \
protocols.h \
+css.h \
actions.h \
-switch_menu.h \
-gpio.h
+configure.h \
+i2c.h \
+gpio.h \
+encoder_menu.h \
+switch_menu.h
OBJS= \
protocols.o \
css.o \
actions.o \
-switch_menu.o \
-gpio.o
+configure.o \
+i2c.o \
+gpio.o \
+encoder_menu.o \
+switch_menu.o
$(PROGRAM): $(OBJS) $(AUDIO_OBJS) $(REMOTE_OBJS) $(USBOZY_OBJS) $(SOAPYSDR_OBJS) \
- $(LOCALCW_OBJS) $(PURESIGNAL_OBJS) $(GPIO_OBJS) \
+ $(LOCALCW_OBJS) $(PURESIGNAL_OBJS) \
$(MIDI_OBJS) $(STEMLAB_OBJS) $(SERVER_OBJS)
- $(CC) -o $(PROGRAM) $(OBJS) $(AUDIO_OBJS) $(REMOTE_OBJS) $(USBOZY_OBJS) \
- $(SOAPYSDR_OBJS) $(LOCALCW_OBJS) $(PURESIGNAL_OBJS) $(GPIO_OBJS) \
- $(MIDI_OBJS) $(STEMLAB_OBJS) $(SERVER_OBJS) $(LIBS) $(LDFLAGS)
+ $(LINK) -o $(PROGRAM) $(OBJS) $(AUDIO_OBJS) $(REMOTE_OBJS) $(USBOZY_OBJS) \
+ $(SOAPYSDR_OBJS) $(LOCALCW_OBJS) $(PURESIGNAL_OBJS) \
+ $(MIDI_OBJS) $(STEMLAB_OBJS) $(SERVER_OBJS) $(LIBS)
-.PHONY: all
-all: prebuild $(PROGRAM) $(HEADERS) $(AUDIO_HEADERS) $(USBOZY_HEADERS) $(SOAPYSDR_HEADERS) \
- $(LOCALCW_HEADERS) $(GPIO_HEADERS) \
+.PHONY: all
+all: prebuild $(PROGRAM) $(HEADERS) $(AUDIO_HEADERS) $(USBOZY_HEADERS) $(SOAPYSDR_HEADERS) \
+ $(LOCALCW_HEADERS) \
$(PURESIGNAL_HEADERS) $(MIDI_HEADERS) $(STEMLAB_HEADERS) $(SERVER_HEADERS) \
- $(AUDIO_SOURCES) $(SOURCES) $(GPIO_SOURCES) \
+ $(AUDIO_SOURCES) $(SOURCES) \
$(USBOZY_SOURCES) $(SOAPYSDR_SOURCES) $(LOCALCW_SOURCE) \
$(PURESIGNAL_SOURCES) $(MIDI_SOURCES) $(STEMLAB_SOURCES) $(SERVER_SOURCES)
-.PHONY: prebuild
+.PHONY: rebuild
prebuild:
rm -f version.o
# Therefore, correct this here. Furthermore, we can add additional options to CPP
# in the variable CPPOPTIONS
#
-CPPOPTIONS= --enable=all --suppress=shadowVariable --suppress=variableScope -D__APPLE__
+CPPOPTIONS= --enable=all --suppress=shadowVariable --suppress=variableScope
+ifeq ($(UNAME_S), Darwin)
+CPPOPTIONS += -D__APPLE__
+endif
CPPINCLUDES:=$(shell echo $(INCLUDES) | sed -e "s/-pthread / /" )
.PHONY: cppcheck
cppcheck:
- cppcheck $(CPPOPTIONS) $(OPTIONS) $(CPPINCLUDES) $(SOURCES) $(REMOTE_SOURCES) \
- $(USBOZY_SOURCES) $(SOAPYSDR_SOURCES) $(SERVER_SOURCES) \
- $(PURESIGNAL_SOURCES) $(MIDI_SOURCES) $(STEMLAB_SOURCES) $(LOCALCW_SOURCES)
+ cppcheck $(CPPOPTIONS) $(OPTIONS) $(CPPINCLUDES) $(AUDIO_SOURCES) $(SOURCES) $(REMOTE_SOURCES) \
+ $(USBOZY_SOURCES) $(SOAPYSDR_SOURCES) \
+ $(PURESIGNAL_SOURCES) $(MIDI_SOURCES) $(STEMLAB_SOURCES) $(LOCALCW_SOURCES) \
+ $(SERVER_SOURCES)
-.PHONY: clean
+.PHONY: clean
clean:
-rm -f *.o
-rm -f $(PROGRAM) hpsdrsim
-rm -rf $(PROGRAM).app
-.PHONY: install
+#
+# If $DESTDIR is set, copy to that directory, otherwise use /usr/local/bin
+#
+DESTDIR?= /usr/local/bin
+
+.PHONY: install
install: $(PROGRAM)
- cp $(PROGRAM) $(DESTDIR)/usr/local/bin
+ cp $(PROGRAM) $(DESTDIR)
-.PHONY: release
+.PHONY: release
release: $(PROGRAM)
cp $(PROGRAM) release/pihpsdr
cd release; tar cvf pihpsdr.tar pihpsdr
cd release; tar cvf pihpsdr-$(GIT_VERSION).tar pihpsdr
-.PHONY: nocontroller
+.PHONY: nocontroller
nocontroller: clean controller1 $(PROGRAM)
cp $(PROGRAM) release/pihpsdr
cd release; tar cvf pihpsdr-nocontroller.$(GIT_VERSION).tar pihpsdr
-.PHONY: controller1
+.PHONY: controller1
controller1: clean $(PROGRAM)
cp $(PROGRAM) release/pihpsdr
cd release; tar cvf pihpsdr-controller1.$(GIT_VERSION).tar pihpsdr
-.PHONY: controller2v1
+.PHONY: controller2v1
controller2v1: clean $(PROGRAM)
cp $(PROGRAM) release/pihpsdr
cd release; tar cvf pihpsdr-controller2-v1.$(GIT_VERSION).tar pihpsdr
-.PHONY: controller2v2
+.PHONY: controller2v2
controller2v2: clean $(PROGRAM)
cp $(PROGRAM) release/pihpsdr
cd release; tar cvf pihpsdr-controller2-v2.$(GIT_VERSION).tar pihpsdr
$(CC) -c -O newhpsdrsim.c
hpsdrsim: hpsdrsim.o newhpsdrsim.o
- $(CC) -o hpsdrsim hpsdrsim.o newhpsdrsim.o -lm -lpthread
+ $(LINK) -o hpsdrsim hpsdrsim.o newhpsdrsim.o -lm -lpthread
debian:
cp $(PROGRAM) pkg/pihpsdr/usr/local/bin
.PHONY: app
app: $(OBJS) $(AUDIO_OBJS) $(REMOTE_OBJS) $(USBOZY_OBJS) $(SOAPYSDR_OBJS) \
- $(LOCALCW_OBJS) $(PURESIGNAL_OBJS) $(GPIO_OBJS) \
+ $(LOCALCW_OBJS) $(PURESIGNAL_OBJS) \
$(MIDI_OBJS) $(STEMLAB_OBJS) $(SERVER_OBJS)
- $(CC) -headerpad_max_install_names -o $(PROGRAM) $(OBJS) $(AUDIO_OBJS) $(REMOTE_OBJS) $(USBOZY_OBJS) \
- $(SOAPYSDR_OBJS) $(LOCALCW_OBJS) $(PURESIGNAL_OBJS) $(GPIO_OBJS) \
+ $(LINK) -headerpad_max_install_names -o $(PROGRAM) $(OBJS) $(AUDIO_OBJS) $(REMOTE_OBJS) $(USBOZY_OBJS) \
+ $(SOAPYSDR_OBJS) $(LOCALCW_OBJS) $(PURESIGNAL_OBJS) \
$(MIDI_OBJS) $(STEMLAB_OBJS) $(SERVER_OBJS) $(LIBS) $(LDFLAGS)
@rm -rf pihpsdr.app
@mkdir -p pihpsdr.app/Contents/MacOS
#
# Copy the WDSP library into the executable
#
- @lib=`otool -L pihpsdr.app/Contents/MacOS/pihpsdr | grep libwdsp | sed -e "s/ (.*//" | sed -e 's/ //'`; \
+ @lib=`/usr/bin/otool -L pihpsdr.app/Contents/MacOS/pihpsdr | grep libwdsp | sed -e "s/ (.*//" | sed -e 's/ //'`; \
libfn=`basename $$lib`; \
cp "$$lib" "pihpsdr.app/Contents/Frameworks/$$libfn"; \
chmod u+w "pihpsdr.app/Contents/Frameworks/$$libfn"; \
- install_name_tool -id "@executable_path/../Frameworks/$$libfn" "pihpsdr.app/Contents/Frameworks/$$libfn"; \
- install_name_tool -change "$$lib" "@executable_path/../Frameworks/$$libfn" pihpsdr.app/Contents/MacOS/pihpsdr
+ /usr/bin/install_name_tool -id "@executable_path/../Frameworks/$$libfn" "pihpsdr.app/Contents/Frameworks/$$libfn"; \
+ /usr/bin/install_name_tool -change "$$lib" "@executable_path/../Frameworks/$$libfn" pihpsdr.app/Contents/MacOS/pihpsdr
#
#############################################################################
/*
- * This file left empty intentionally
+ * Rudimentary file, to be replaced upon version merging
*/
+
+enum {
+ ENCODER_NO_ACTION=0,
+ ENCODER_AF_GAIN,
+ ENCODER_AF_GAIN_RX1,
+ ENCODER_AF_GAIN_RX2,
+ ENCODER_AGC_GAIN,
+ ENCODER_AGC_GAIN_RX1,
+ ENCODER_AGC_GAIN_RX2,
+ ENCODER_ATTENUATION,
+ ENCODER_COMP,
+ ENCODER_CW_FREQUENCY,
+ ENCODER_CW_SPEED,
+ ENCODER_DIVERSITY_GAIN,
+ ENCODER_DIVERSITY_GAIN_COARSE,
+ ENCODER_DIVERSITY_GAIN_FINE,
+ ENCODER_DIVERSITY_PHASE,
+ ENCODER_DIVERSITY_PHASE_COARSE,
+ ENCODER_DIVERSITY_PHASE_FINE,
+ ENCODER_DRIVE,
+ ENCODER_IF_SHIFT,
+ ENCODER_IF_SHIFT_RX1,
+ ENCODER_IF_SHIFT_RX2,
+ ENCODER_IF_WIDTH,
+ ENCODER_IF_WIDTH_RX1,
+ ENCODER_IF_WIDTH_RX2,
+ ENCODER_LINEIN_GAIN,
+ ENCODER_MIC_GAIN,
+ ENCODER_PAN,
+ ENCODER_PANADAPTER_HIGH,
+ ENCODER_PANADAPTER_LOW,
+ ENCODER_PANADAPTER_STEP,
+ ENCODER_RF_GAIN,
+ ENCODER_RF_GAIN_RX1,
+ ENCODER_RF_GAIN_RX2,
+ ENCODER_RIT,
+ ENCODER_RIT_RX1,
+ ENCODER_RIT_RX2,
+ ENCODER_SQUELCH,
+ ENCODER_SQUELCH_RX1,
+ ENCODER_SQUELCH_RX2,
+ ENCODER_TUNE_DRIVE,
+ ENCODER_WATERFALL_HIGH,
+ ENCODER_WATERFALL_LOW,
+ ENCODER_XIT,
+ ENCODER_ZOOM,
+ ENCODER_ACTIONS
+};
+
+enum {
+ NO_ACTION=0,
+ A_TO_B,
+ A_SWAP_B,
+ AGC,
+ ANF,
+ B_TO_A,
+ BAND_MINUS,
+ BAND_PLUS,
+ BANDSTACK_MINUS,
+ BANDSTACK_PLUS,
+ CTUN,
+ DIVERSITY,
+ FILTER_MINUS,
+ FILTER_PLUS,
+ FUNCTION,
+ LOCK,
+ MENU_BAND,
+ MENU_BANDSTACK,
+ MENU_DIVERSITY,
+ MENU_FILTER,
+ MENU_FREQUENCY,
+ MENU_MEMORY,
+ MENU_MODE,
+ MENU_PS,
+ MODE_MINUS,
+ MODE_PLUS,
+ MOX,
+ MUTE,
+ NB,
+ NR,
+ PAN_MINUS,
+ PAN_PLUS,
+ PS,
+ RIT,
+ RIT_CLEAR,
+ SAT,
+ SNB,
+ SPLIT,
+ TUNE,
+ TWO_TONE,
+ XIT,
+ XIT_CLEAR,
+ ZOOM_MINUS,
+ ZOOM_PLUS,
+ SWITCH_ACTIONS
+};
+
+/*
+ * This is for use in sliders, to facilitate the merge
+ */
+
+#define ZOOM ENCODER_ZOOM
+#define PAN ENCODER_PAN
+#define AGC_GAIN ENCODER_AGC_GAIN
+#define ATTENUATION ENCODER_ATTENUATION
+#define COMPRESSION ENCODER_COMP
+#define DIVERSITY_PHASE ENCODER_DIVERSITY_PHASE
+#define DIVERSITY_GAIN ENCODER_DIVERSITY_GAIN
+#define SQUELCH ENCODER_SQUELCH
+#define DRIVE ENCODER_DRIVE
+#define LINEIN_GAIN ENCODER_LINEIN_GAIN
+#define MIC_GAIN ENCODER_MIC_GAIN
+#define IF_WIDTH ENCODER_IF_WIDTH
+#define IF_SHIFT ENCODER_IF_SHIFT
+#define AF_GAIN ENCODER_AF_GAIN
+#define RF_GAIN ENCODER_RF_GAIN
+
+extern char *encoder_string[ENCODER_ACTIONS];
+extern char *sw_string[SWITCH_ACTIONS];
+
// a push-button
if (arg2 == 0) {
if(configure) {
- NewMidiConfigureEvent(MIDI_EVENT_NOTE, chan, arg1, 0);
+ NewMidiConfigureEvent(MIDI_NOTE, chan, arg1, 0);
} else {
- NewMidiEvent(MIDI_EVENT_NOTE, chan, arg1, 0);
+ NewMidiEvent(MIDI_NOTE, chan, arg1, 0);
}
} else {
if(configure) {
- NewMidiConfigureEvent(MIDI_EVENT_NOTE, chan, arg1, 1);
+ NewMidiConfigureEvent(MIDI_NOTE, chan, arg1, 1);
} else {
- NewMidiEvent(MIDI_EVENT_NOTE, chan, arg1, 1);
+ NewMidiEvent(MIDI_NOTE, chan, arg1, 1);
}
}
break;
case CMD_NOTEOFF:
if(configure) {
- NewMidiConfigureEvent(MIDI_EVENT_NOTE, chan, arg1, 0);
+ NewMidiConfigureEvent(MIDI_NOTE, chan, arg1, 0);
} else {
- NewMidiEvent(MIDI_EVENT_NOTE, chan, arg1, 0);
+ NewMidiEvent(MIDI_NOTE, chan, arg1, 0);
}
break;
case CMD_CTRL:
if(configure) {
- NewMidiConfigureEvent(MIDI_EVENT_CTRL, chan, arg1, arg2);
+ NewMidiConfigureEvent(MIDI_CTRL, chan, arg1, arg2);
} else {
- NewMidiEvent(MIDI_EVENT_CTRL, chan, arg1, arg2);
+ NewMidiEvent(MIDI_CTRL, chan, arg1, arg2);
}
break;
case CMD_PITCH:
if(configure) {
- NewMidiConfigureEvent(MIDI_EVENT_PITCH, chan, 0, arg1+128*arg2);
+ NewMidiConfigureEvent(MIDI_PITCH, chan, 0, arg1+128*arg2);
} else {
- NewMidiEvent(MIDI_EVENT_PITCH, chan, 0, arg1+128*arg2);
+ NewMidiEvent(MIDI_PITCH, chan, 0, arg1+128*arg2);
}
break;
}
#include "receiver.h"
#include "vfo.h"
#include "button_text.h"
+#include "actions.h"
#include "gpio.h"
#include "i2c.h"
}
button=getRadioButton(action);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), TRUE);
+ return TRUE;
}
static gboolean top_select_cb (GtkWidget *widget, gpointer data) {
}
button=getTopRadioButton(action);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), TRUE);
+ return TRUE;
}
void encoder_select(int pos) {
e5_encoder_action=action;
break;
}
+ return TRUE;
}
static gboolean top_action_select_cb (GtkWidget *widget, gpointer data) {
e5_top_encoder_action=action;
break;
}
+ return TRUE;
}
static gboolean enc2_cb(GtkWidget *widget, gpointer data) {
extern int ext_receiver_remote_update_display(void *data);
#endif
+extern int ext_menu_filter(void *data);
+extern int ext_menu_mode(void *data);
+extern int ext_num_pad(void *data);
extern int ext_discovery(void *data);
extern int ext_vfo_update(void *data);
extern int ext_set_frequency(void *data);
extern int ext_nb_update(void *data);
extern int ext_snb_update(void *data);
extern int ext_anf_update(void *data);
+extern int ext_band_select(void *data);
+
extern int ext_band_plus(void *data);
extern int ext_band_minus(void *data);
extern int ext_bandstack_plus(void *data);
#include "iambic.h"
#endif
#include "zoompan.h"
+#include "actions.h"
// debounce settle time in ms
#define DEFAULT_SETTLE_TIME 50
"IF WIDTH",
"IF WIDTH RX1",
"IF WIDTH RX2",
+ "LINEIN GAIN",
"MIC GAIN",
"PAN",
"PANADAPTER HIGH",
#ifndef _GPIO_H
#define _GPIO_H
-enum {
- ENCODER_NO_ACTION=0,
- ENCODER_AF_GAIN,
- ENCODER_AF_GAIN_RX1,
- ENCODER_AF_GAIN_RX2,
- ENCODER_AGC_GAIN,
- ENCODER_AGC_GAIN_RX1,
- ENCODER_AGC_GAIN_RX2,
- ENCODER_ATTENUATION,
- ENCODER_COMP,
- ENCODER_CW_FREQUENCY,
- ENCODER_CW_SPEED,
- ENCODER_DIVERSITY_GAIN,
- ENCODER_DIVERSITY_GAIN_COARSE,
- ENCODER_DIVERSITY_GAIN_FINE,
- ENCODER_DIVERSITY_PHASE,
- ENCODER_DIVERSITY_PHASE_COARSE,
- ENCODER_DIVERSITY_PHASE_FINE,
- ENCODER_DRIVE,
- ENCODER_IF_SHIFT,
- ENCODER_IF_SHIFT_RX1,
- ENCODER_IF_SHIFT_RX2,
- ENCODER_IF_WIDTH,
- ENCODER_IF_WIDTH_RX1,
- ENCODER_IF_WIDTH_RX2,
- ENCODER_MIC_GAIN,
- ENCODER_PAN,
- ENCODER_PANADAPTER_HIGH,
- ENCODER_PANADAPTER_LOW,
- ENCODER_PANADAPTER_STEP,
- ENCODER_RF_GAIN,
- ENCODER_RF_GAIN_RX1,
- ENCODER_RF_GAIN_RX2,
- ENCODER_RIT,
- ENCODER_RIT_RX1,
- ENCODER_RIT_RX2,
- ENCODER_SQUELCH,
- ENCODER_SQUELCH_RX1,
- ENCODER_SQUELCH_RX2,
- ENCODER_TUNE_DRIVE,
- ENCODER_WATERFALL_HIGH,
- ENCODER_WATERFALL_LOW,
- ENCODER_XIT,
- ENCODER_ZOOM,
- ENCODER_ACTIONS
-};
-
-extern char *encoder_string[ENCODER_ACTIONS];
-
-enum {
- NO_ACTION=0,
- A_TO_B,
- A_SWAP_B,
- AGC,
- ANF,
- B_TO_A,
- BAND_MINUS,
- BAND_PLUS,
- BANDSTACK_MINUS,
- BANDSTACK_PLUS,
- CTUN,
- DIVERSITY,
- FILTER_MINUS,
- FILTER_PLUS,
- FUNCTION,
- LOCK,
- MENU_BAND,
- MENU_BANDSTACK,
- MENU_DIVERSITY,
- MENU_FILTER,
- MENU_FREQUENCY,
- MENU_MEMORY,
- MENU_MODE,
- MENU_PS,
- MODE_MINUS,
- MODE_PLUS,
- MOX,
- MUTE,
- NB,
- NR,
- PAN_MINUS,
- PAN_PLUS,
- PS,
- RIT,
- RIT_CLEAR,
- SAT,
- SNB,
- SPLIT,
- TUNE,
- TWO_TONE,
- XIT,
- XIT_CLEAR,
- ZOOM_MINUS,
- ZOOM_PLUS,
- SWITCH_ACTIONS
-};
-
-extern char *sw_string[SWITCH_ACTIONS];
-
-
enum {
CONTROLLER1_SW1=0,
CONTROLLER1_SW2,
+#ifdef GPIO
#include <string.h>
#include <unistd.h>
#include <errno.h>
#include <gtk/gtk.h>
//#include "i2c.h"
#include "wiringPiI2C.h"
+#include "actions.h"
#include "gpio.h"
#include "band.h"
#include "band_menu.h"
} while(flags!=0);
}
+#endif
#include "adc.h"
#include "dac.h"
#include "radio.h"
+#include "actions.h"
#include "midi.h"
#include "midi_menu.h"
#include "alsa_midi.h"
// a push-button.
if (arg2 == 0) {
if(configure) {
- NewMidiConfigureEvent(MIDI_EVENT_NOTE, chan, arg1, 0);
+ NewMidiConfigureEvent(MIDI_NOTE, chan, arg1, 0);
} else {
- NewMidiEvent(MIDI_EVENT_NOTE, chan, arg1, 0);
+ NewMidiEvent(MIDI_NOTE, chan, arg1, 0);
}
} else {
if(configure) {
- NewMidiConfigureEvent(MIDI_EVENT_NOTE, chan, arg1, 1);
+ NewMidiConfigureEvent(MIDI_NOTE, chan, arg1, 1);
} else {
- NewMidiEvent(MIDI_EVENT_NOTE, chan, arg1, 1);
+ NewMidiEvent(MIDI_NOTE, chan, arg1, 1);
}
}
break;
case CMD_NOTEOFF:
if(configure) {
- NewMidiConfigureEvent(MIDI_EVENT_NOTE, chan, arg1, 0);
+ NewMidiConfigureEvent(MIDI_NOTE, chan, arg1, 0);
} else {
- NewMidiEvent(MIDI_EVENT_NOTE, chan, arg1, 0);
+ NewMidiEvent(MIDI_NOTE, chan, arg1, 0);
}
break;
case CMD_CTRL:
if(configure) {
- NewMidiConfigureEvent(MIDI_EVENT_CTRL, chan, arg1, arg2);
+ NewMidiConfigureEvent(MIDI_CTRL, chan, arg1, arg2);
} else {
- NewMidiEvent(MIDI_EVENT_CTRL, chan, arg1, arg2);
+ NewMidiEvent(MIDI_CTRL, chan, arg1, arg2);
}
break;
case CMD_PITCH:
if(configure) {
- NewMidiConfigureEvent(MIDI_EVENT_PITCH, chan, 0, arg1+128*arg2);
+ NewMidiConfigureEvent(MIDI_PITCH, chan, 0, arg1+128*arg2);
} else {
- NewMidiEvent(MIDI_EVENT_PITCH, chan, 0, arg1+128*arg2);
+ NewMidiEvent(MIDI_PITCH, chan, 0, arg1+128*arg2);
}
break;
}
* must generate MIDI events on different channels
*/
+#ifndef _MIDI_H
+#define _MIDI_H
+
//
// MIDIaction encodes the "action" to be taken in Layer3
// (sorted alphabetically by the keyword).
// MIDItype encodes the type of MIDI control. This info
// is passed from Layer-2 to Layer-3
//
-// MIDI_TYPE_KEY has no parameters and indicates that some
+// MIDI_KEY has no parameters and indicates that some
// button has been pressed.
//
-// MIDI_TYPE_KNOB has a "value" parameter (between 0 and 100)
+// MIDI_KNOB has a "value" parameter (between 0 and 100)
// and indicates that some knob has been set to a specific
// position.
//
-// MIDI_TYPE_WHEEL has a "direction" parameter and indicates that
+// MIDI_WHEEL has a "direction" parameter and indicates that
// some knob has been turned left/down or right/ip. The value
// can be
//
//
enum MIDItype {
- MIDI_TYPE_NONE =0,
- MIDI_TYPE_KEY =1, // Button (press event)
- MIDI_TYPE_KNOB =2, // Knob (value between 0 and 100)
- MIDI_TYPE_WHEEL=4 // Wheel (direction and speed)
+ TYPE_NONE =0,
+ MIDI_KEY =1, // Button (press event)
+ MIDI_KNOB =2, // Knob (value between 0 and 100)
+ MIDI_WHEEL=4 // Wheel (direction and speed)
};
extern gchar *midi_types[];
// MIDI_KNOB or MIDI_WHEEL, depending on the device description.
//
enum MIDIevent {
- MIDI_EVENT_NONE=0,
- MIDI_EVENT_NOTE,
- MIDI_EVENT_CTRL,
- MIDI_EVENT_PITCH
+ EVENT_NONE=0,
+ MIDI_NOTE,
+ MIDI_CTRL,
+ MIDI_PITCH
};
typedef struct _action_table {
//
void DoTheMidi(enum MIDIaction code, enum MIDItype type, int val);
+
+#endif
#include "transmitter.h"
#include "radio.h"
#include "main.h"
+#include "actions.h"
#include "midi.h"
#include "alsa_midi.h"
//now=ts.tv_sec + 1E-9*ts.tv_nsec;
//g_print("%s:%12.3f:EVENT=%d CHAN=%d NOTE=%d VAL=%d\n",__FUNCTION__,now,event,channel,note,val);
- if (event == MIDI_EVENT_PITCH) {
+ if (event == MIDI_PITCH) {
desc=MidiCommandsTable[128];
} else {
desc=MidiCommandsTable[note];
}
-//g_print("MIDI:init DESC=%p\n",desc);
+//g_print("%s: init DESC=%p\n",__FUNCTION__,desc);
while (desc) {
-//g_print("DESC=%p next=%p CHAN=%d EVENT=%d\n", desc,desc->next,desc->channel,desc->event);
+//g_print("%s: DESC=%p next=%p CHAN=%d EVENT=%d\n",__FUNCTION__,desc,desc->next,desc->channel,desc->event);
if ((desc->channel == channel || desc->channel == -1) && (desc->event == event)) {
// Found matching entry
switch (desc->event) {
- case MIDI_EVENT_NOTE:
- if (desc->type == MIDI_TYPE_KEY) {
+ case MIDI_NOTE:
+ if (desc->type == MIDI_KEY) {
switch (desc->action) {
case MIDI_ACTION_CWLEFT:
case MIDI_ACTION_CWRIGHT:
case MIDI_ACTION_CWKEYER:
case MIDI_ACTION_PTTKEYER:
// deliver message for note-on and note-off
- DoTheMidi(desc->action, desc->type, val);
+ DoTheMidi(desc->action, desc->type, val);
break;
default:
// deliver only note-on messages
- if (val == 1) DoTheMidi(desc->action, desc->type, val);
+ if (val == 1) DoTheMidi(desc->action, desc->type, val);
break;
}
}
- break;
- case MIDI_EVENT_CTRL:
- if (desc->type == MIDI_TYPE_KNOB) {
+ break;
+ case MIDI_CTRL:
+ if (desc->type == MIDI_KNOB) {
// normalize value to range 0 - 100
new = (val*100)/127;
DoTheMidi(desc->action, desc->type, new);
- } else if (desc->type == MIDI_TYPE_WHEEL) {
+ } else if (desc->type == MIDI_WHEEL) {
if (desc->delay > 0 && last_wheel_action == desc->action) {
clock_gettime(CLOCK_MONOTONIC, &tp);
delta=1000*(tp.tv_sec - last_wheel_tp.tv_sec);
if ((val >= desc->rgt1) && (val <= desc->rgt2)) new= 1;
if ((val >= desc-> fr1) && (val <= desc-> fr2)) new= 4;
if ((val >= desc->vfr1) && (val <= desc->vfr2)) new= 16;
-// g_print("WHEEL: val=%d new=%d thrs=%d/%d, %d/%d, %d/%d, %d/%d, %d/%d, %d/%d\n",
+// g_print("%s: WHEEL: val=%d new=%d thrs=%d/%d, %d/%d, %d/%d, %d/%d, %d/%d, %d/%d\n",
+// __FUNCTION__,
// val, new, desc->vfl1, desc->vfl2, desc->fl1, desc->fl2, desc->lft1, desc->lft2,
// desc->rgt1, desc->rgt2, desc->fr1, desc->fr2, desc->vfr1, desc->vfr2);
if (new != 0) DoTheMidi(desc->action, desc->type, new);
last_wheel_action=desc->action;
}
break;
- case MIDI_EVENT_PITCH:
- if (desc->type == MIDI_TYPE_KNOB) {
+ case MIDI_PITCH:
+ if (desc->type == MIDI_KNOB) {
// normalize value to 0 - 100
new = (val*100)/16383;
DoTheMidi(desc->action, desc->type, new);
}
break;
- case MIDI_EVENT_NONE:
+ case EVENT_NONE:
break;
}
break;
}
if (!desc) {
// Nothing found. This is nothing to worry about, but log the key to stderr
- if (event == MIDI_EVENT_PITCH) g_print("Unassigned PitchBend Value=%d\n", val);
- if (event == MIDI_EVENT_NOTE ) g_print("Unassigned Key Note=%d Val=%d\n", note, val);
- if (event == MIDI_EVENT_CTRL ) g_print("Unassigned Controller Ctl=%d Val=%d\n", note, val);
+ if (event == MIDI_PITCH) g_print("Unassigned PitchBend Value=%d\n", val);
+ if (event == MIDI_NOTE ) g_print("Unassigned Key Note=%d Val=%d\n", note, val);
+ if (event == MIDI_CTRL ) g_print("Unassigned Controller Ctl=%d Val=%d\n", note, val);
}
}
*/
ACTION_TABLE ActionTable[] = {
- { MIDI_ACTION_NONE, "NONE", MIDI_TYPE_KEY|MIDI_TYPE_KNOB|MIDI_TYPE_WHEEL },
- { MIDI_ACTION_VFO_A2B, "A2B", MIDI_TYPE_KEY },
- { MIDI_ACTION_AF_GAIN, "AFGAIN", MIDI_TYPE_KNOB|MIDI_TYPE_WHEEL },
- { MIDI_ACTION_AGCATTACK, "AGCATTACK", MIDI_TYPE_KEY },
- { MIDI_ACTION_AGC, "AGCVAL", MIDI_TYPE_KNOB|MIDI_TYPE_WHEEL },
- { MIDI_ACTION_ANF, "ANF", MIDI_TYPE_KEY },
- { MIDI_ACTION_ATT, "ATT", MIDI_TYPE_KEY|MIDI_TYPE_KNOB|MIDI_TYPE_WHEEL },
- { MIDI_ACTION_VFO_B2A, "B2A", MIDI_TYPE_KEY },
- { MIDI_ACTION_BAND_10, "BAND10", MIDI_TYPE_KEY },
- { MIDI_ACTION_BAND_12, "BAND12", MIDI_TYPE_KEY },
- { MIDI_ACTION_BAND_1240, "BAND1240", MIDI_TYPE_KEY },
- { MIDI_ACTION_BAND_144, "BAND144", MIDI_TYPE_KEY },
- { MIDI_ACTION_BAND_15, "BAND15", MIDI_TYPE_KEY },
- { MIDI_ACTION_BAND_160, "BAND160", MIDI_TYPE_KEY },
- { MIDI_ACTION_BAND_17, "BAND17", MIDI_TYPE_KEY },
- { MIDI_ACTION_BAND_20, "BAND20", MIDI_TYPE_KEY },
- { MIDI_ACTION_BAND_220, "BAND220", MIDI_TYPE_KEY },
- { MIDI_ACTION_BAND_2300, "BAND2300", MIDI_TYPE_KEY },
- { MIDI_ACTION_BAND_30, "BAND30", MIDI_TYPE_KEY },
- { MIDI_ACTION_BAND_3400, "BAND3400", MIDI_TYPE_KEY },
- { MIDI_ACTION_BAND_40, "BAND40", MIDI_TYPE_KEY },
- { MIDI_ACTION_BAND_430, "BAND430", MIDI_TYPE_KEY },
- { MIDI_ACTION_BAND_6, "BAND6", MIDI_TYPE_KEY },
- { MIDI_ACTION_BAND_60, "BAND60", MIDI_TYPE_KEY },
- { MIDI_ACTION_BAND_70, "BAND70", MIDI_TYPE_KEY },
- { MIDI_ACTION_BAND_80, "BAND80", MIDI_TYPE_KEY },
- { MIDI_ACTION_BAND_902, "BAND902", MIDI_TYPE_KEY },
- { MIDI_ACTION_BAND_AIR, "BANDAIR", MIDI_TYPE_KEY },
- { MIDI_ACTION_BAND_DOWN, "BANDDOWN", MIDI_TYPE_KEY|MIDI_TYPE_KNOB|MIDI_TYPE_WHEEL },
- { MIDI_ACTION_BAND_GEN, "BANDGEN", MIDI_TYPE_KEY },
- { MIDI_ACTION_BAND_UP, "BANDUP", MIDI_TYPE_KEY|MIDI_TYPE_KNOB|MIDI_TYPE_WHEEL },
- { MIDI_ACTION_BAND_WWV, "BANDWWV", MIDI_TYPE_KEY },
- { MIDI_ACTION_COMPRESS, "COMPRESS", MIDI_TYPE_KNOB|MIDI_TYPE_WHEEL },
- { MIDI_ACTION_CTUN, "CTUN", MIDI_TYPE_KEY },
- { MIDI_ACTION_VFO, "CURRVFO", MIDI_TYPE_WHEEL },
- { MIDI_ACTION_CWKEYER, "CW(Keyer)", MIDI_TYPE_KEY },
- { MIDI_ACTION_CWLEFT, "CWLEFT", MIDI_TYPE_KEY },
- { MIDI_ACTION_CWRIGHT, "CWRIGHT", MIDI_TYPE_KEY },
- { MIDI_ACTION_CWSPEED, "CWSPEED", MIDI_TYPE_KNOB|MIDI_TYPE_WHEEL },
- { MIDI_ACTION_DIV_COARSEGAIN, "DIVCOARSEGAIN", MIDI_TYPE_KNOB|MIDI_TYPE_WHEEL },
- { MIDI_ACTION_DIV_COARSEPHASE, "DIVCOARSEPHASE", MIDI_TYPE_KNOB|MIDI_TYPE_WHEEL },
- { MIDI_ACTION_DIV_FINEGAIN, "DIVFINEGAIN", MIDI_TYPE_KNOB|MIDI_TYPE_WHEEL },
- { MIDI_ACTION_DIV_FINEPHASE, "DIVFINEPHASE", MIDI_TYPE_KNOB|MIDI_TYPE_WHEEL },
- { MIDI_ACTION_DIV_GAIN, "DIVGAIN", MIDI_TYPE_KNOB|MIDI_TYPE_WHEEL },
- { MIDI_ACTION_DIV_PHASE, "DIVPHASE", MIDI_TYPE_KNOB|MIDI_TYPE_WHEEL },
- { MIDI_ACTION_DIV_TOGGLE, "DIVTOGGLE", MIDI_TYPE_KEY },
- { MIDI_ACTION_DUP, "DUP", MIDI_TYPE_KEY },
- { MIDI_ACTION_FILTER_DOWN, "FILTERDOWN", MIDI_TYPE_KEY|MIDI_TYPE_KNOB|MIDI_TYPE_WHEEL },
- { MIDI_ACTION_FILTER_UP, "FILTERUP", MIDI_TYPE_KEY|MIDI_TYPE_KNOB|MIDI_TYPE_WHEEL },
- { MIDI_ACTION_LOCK, "LOCK", MIDI_TYPE_KEY },
- { MIDI_ACTION_MEM_RECALL_M0, "RECALLM0", MIDI_TYPE_KEY },
- { MIDI_ACTION_MEM_RECALL_M1, "RECALLM1", MIDI_TYPE_KEY },
- { MIDI_ACTION_MEM_RECALL_M2, "RECALLM2", MIDI_TYPE_KEY },
- { MIDI_ACTION_MEM_RECALL_M3, "RECALLM3", MIDI_TYPE_KEY },
- { MIDI_ACTION_MEM_RECALL_M4, "RECALLM4", MIDI_TYPE_KEY },
- { MIDI_ACTION_MENU_FILTER, "MENU_FILTER", MIDI_TYPE_KEY },
- { MIDI_ACTION_MENU_MODE, "MENU_MODE", MIDI_TYPE_KEY },
- { MIDI_ACTION_MIC_VOLUME, "MICGAIN", MIDI_TYPE_KNOB|MIDI_TYPE_WHEEL },
- { MIDI_ACTION_MODE_DOWN, "MODEDOWN", MIDI_TYPE_KEY|MIDI_TYPE_KNOB|MIDI_TYPE_WHEEL },
- { MIDI_ACTION_MODE_UP, "MODEUP", MIDI_TYPE_KEY|MIDI_TYPE_KNOB|MIDI_TYPE_WHEEL },
- { MIDI_ACTION_MOX, "MOX", MIDI_TYPE_KEY },
- { MIDI_ACTION_MUTE, "MUTE", MIDI_TYPE_KEY },
- { MIDI_ACTION_NB, "NOISEBLANKER", MIDI_TYPE_KEY },
- { MIDI_ACTION_NR, "NOISEREDUCTION", MIDI_TYPE_KEY },
- { MIDI_ACTION_NUMPAD_0, "NUMPAD0", MIDI_TYPE_KEY },
- { MIDI_ACTION_NUMPAD_1, "NUMPAD1", MIDI_TYPE_KEY },
- { MIDI_ACTION_NUMPAD_2, "NUMPAD2", MIDI_TYPE_KEY },
- { MIDI_ACTION_NUMPAD_3, "NUMPAD3", MIDI_TYPE_KEY },
- { MIDI_ACTION_NUMPAD_4, "NUMPAD4", MIDI_TYPE_KEY },
- { MIDI_ACTION_NUMPAD_5, "NUMPAD5", MIDI_TYPE_KEY },
- { MIDI_ACTION_NUMPAD_6, "NUMPAD6", MIDI_TYPE_KEY },
- { MIDI_ACTION_NUMPAD_7, "NUMPAD7", MIDI_TYPE_KEY },
- { MIDI_ACTION_NUMPAD_8, "NUMPAD8", MIDI_TYPE_KEY },
- { MIDI_ACTION_NUMPAD_9, "NUMPAD9", MIDI_TYPE_KEY },
- { MIDI_ACTION_NUMPAD_CL, "NUMPADCL", MIDI_TYPE_KEY },
- { MIDI_ACTION_NUMPAD_ENTER, "NUMPADENTER", MIDI_TYPE_KEY },
- { MIDI_ACTION_PAN, "PAN", MIDI_TYPE_KNOB|MIDI_TYPE_WHEEL },
- { MIDI_ACTION_PAN_HIGH, "PANHIGH", MIDI_TYPE_KNOB|MIDI_TYPE_WHEEL },
- { MIDI_ACTION_PAN_LOW, "PANLOW", MIDI_TYPE_KNOB|MIDI_TYPE_WHEEL },
- { MIDI_ACTION_PRE, "PREAMP", MIDI_TYPE_KEY },
- { MIDI_ACTION_PTTKEYER, "PTT(Keyer)", MIDI_TYPE_KEY },
- { MIDI_ACTION_PS, "PURESIGNAL", MIDI_TYPE_KEY },
- { MIDI_ACTION_RF_GAIN, "RFGAIN", MIDI_TYPE_KNOB|MIDI_TYPE_WHEEL },
- { MIDI_ACTION_TX_DRIVE, "RFPOWER", MIDI_TYPE_KNOB|MIDI_TYPE_WHEEL },
- { MIDI_ACTION_RIT_CLEAR, "RITCLEAR", MIDI_TYPE_KEY },
- { MIDI_ACTION_RIT_STEP, "RITSTEP", MIDI_TYPE_KEY|MIDI_TYPE_WHEEL },
- { MIDI_ACTION_RIT_TOGGLE, "RITTOGGLE", MIDI_TYPE_KEY },
- { MIDI_ACTION_RIT_VAL, "RITVAL", MIDI_TYPE_KNOB|MIDI_TYPE_WHEEL },
- { MIDI_ACTION_SAT, "SAT", MIDI_TYPE_KEY },
- { MIDI_ACTION_SNB, "SNB", MIDI_TYPE_KEY },
- { MIDI_ACTION_SPLIT, "SPLIT", MIDI_TYPE_KEY },
- { MIDI_ACTION_MEM_STORE_M0, "STOREM0", MIDI_TYPE_KEY },
- { MIDI_ACTION_MEM_STORE_M1, "STOREM1", MIDI_TYPE_KEY },
- { MIDI_ACTION_MEM_STORE_M2, "STOREM2", MIDI_TYPE_KEY },
- { MIDI_ACTION_MEM_STORE_M3, "STOREM3", MIDI_TYPE_KEY },
- { MIDI_ACTION_MEM_STORE_M4, "STOREM4", MIDI_TYPE_KEY },
- { MIDI_ACTION_SWAP_RX, "SWAPRX", MIDI_TYPE_KEY },
- { MIDI_ACTION_SWAP_VFO, "SWAPVFO", MIDI_TYPE_KEY },
- { MIDI_ACTION_TUNE, "TUNE", MIDI_TYPE_KEY },
- { MIDI_ACTION_VFOA, "VFOA", MIDI_TYPE_WHEEL },
- { MIDI_ACTION_VFOB, "VFOB", MIDI_TYPE_WHEEL },
- { MIDI_ACTION_VFO_STEP_UP, "VFOSTEPUP", MIDI_TYPE_KEY|MIDI_TYPE_WHEEL },
- { MIDI_ACTION_VFO_STEP_DOWN, "VFOSTEPDOWN", MIDI_TYPE_KEY|MIDI_TYPE_WHEEL },
- { MIDI_ACTION_VOX, "VOX", MIDI_TYPE_KEY },
- { MIDI_ACTION_VOXLEVEL, "VOXLEVEL", MIDI_TYPE_KNOB|MIDI_TYPE_WHEEL },
- { MIDI_ACTION_XIT_CLEAR, "XITCLEAR", MIDI_TYPE_KEY },
- { MIDI_ACTION_XIT_VAL, "XITVAL", MIDI_TYPE_KNOB|MIDI_TYPE_WHEEL },
- { MIDI_ACTION_ZOOM, "ZOOM", MIDI_TYPE_KNOB|MIDI_TYPE_WHEEL },
- { MIDI_ACTION_ZOOM_UP, "ZOOMUP", MIDI_TYPE_KEY|MIDI_TYPE_WHEEL },
- { MIDI_ACTION_ZOOM_DOWN, "ZOOMDOWN", MIDI_TYPE_KEY|MIDI_TYPE_WHEEL },
- { MIDI_ACTION_LAST, "NONE", MIDI_TYPE_NONE },
+ { MIDI_ACTION_NONE, "NONE", MIDI_KEY|MIDI_KNOB|MIDI_WHEEL },
+ { MIDI_ACTION_VFO_A2B, "A2B", MIDI_KEY },
+ { MIDI_ACTION_AF_GAIN, "AFGAIN", MIDI_KNOB|MIDI_WHEEL },
+ { MIDI_ACTION_AGCATTACK, "AGCATTACK", MIDI_KEY },
+ { MIDI_ACTION_AGC, "AGCVAL", MIDI_KNOB|MIDI_WHEEL },
+ { MIDI_ACTION_ANF, "ANF", MIDI_KEY },
+ { MIDI_ACTION_ATT, "ATT", MIDI_KEY|MIDI_KNOB|MIDI_WHEEL },
+ { MIDI_ACTION_VFO_B2A, "B2A", MIDI_KEY },
+ { MIDI_ACTION_BAND_10, "BAND10", MIDI_KEY },
+ { MIDI_ACTION_BAND_12, "BAND12", MIDI_KEY },
+ { MIDI_ACTION_BAND_1240, "BAND1240", MIDI_KEY },
+ { MIDI_ACTION_BAND_144, "BAND144", MIDI_KEY },
+ { MIDI_ACTION_BAND_15, "BAND15", MIDI_KEY },
+ { MIDI_ACTION_BAND_160, "BAND160", MIDI_KEY },
+ { MIDI_ACTION_BAND_17, "BAND17", MIDI_KEY },
+ { MIDI_ACTION_BAND_20, "BAND20", MIDI_KEY },
+ { MIDI_ACTION_BAND_220, "BAND220", MIDI_KEY },
+ { MIDI_ACTION_BAND_2300, "BAND2300", MIDI_KEY },
+ { MIDI_ACTION_BAND_30, "BAND30", MIDI_KEY },
+ { MIDI_ACTION_BAND_3400, "BAND3400", MIDI_KEY },
+ { MIDI_ACTION_BAND_40, "BAND40", MIDI_KEY },
+ { MIDI_ACTION_BAND_430, "BAND430", MIDI_KEY },
+ { MIDI_ACTION_BAND_6, "BAND6", MIDI_KEY },
+ { MIDI_ACTION_BAND_60, "BAND60", MIDI_KEY },
+ { MIDI_ACTION_BAND_70, "BAND70", MIDI_KEY },
+ { MIDI_ACTION_BAND_80, "BAND80", MIDI_KEY },
+ { MIDI_ACTION_BAND_902, "BAND902", MIDI_KEY },
+ { MIDI_ACTION_BAND_AIR, "BANDAIR", MIDI_KEY },
+ { MIDI_ACTION_BAND_DOWN, "BANDDOWN", MIDI_KEY|MIDI_KNOB|MIDI_WHEEL },
+ { MIDI_ACTION_BAND_GEN, "BANDGEN", MIDI_KEY },
+ { MIDI_ACTION_BAND_UP, "BANDUP", MIDI_KEY|MIDI_KNOB|MIDI_WHEEL },
+ { MIDI_ACTION_BAND_WWV, "BANDWWV", MIDI_KEY },
+ { MIDI_ACTION_COMPRESS, "COMPRESS", MIDI_KNOB|MIDI_WHEEL },
+ { MIDI_ACTION_CTUN, "CTUN", MIDI_KEY },
+ { MIDI_ACTION_VFO, "CURRVFO", MIDI_WHEEL },
+ { MIDI_ACTION_CWKEYER, "CW(Keyer)", MIDI_KEY },
+ { MIDI_ACTION_CWLEFT, "CWLEFT", MIDI_KEY },
+ { MIDI_ACTION_CWRIGHT, "CWRIGHT", MIDI_KEY },
+ { MIDI_ACTION_CWSPEED, "CWSPEED", MIDI_KNOB|MIDI_WHEEL },
+ { MIDI_ACTION_DIV_COARSEGAIN, "DIVCOARSEGAIN", MIDI_KNOB|MIDI_WHEEL },
+ { MIDI_ACTION_DIV_COARSEPHASE, "DIVCOARSEPHASE", MIDI_KNOB|MIDI_WHEEL },
+ { MIDI_ACTION_DIV_FINEGAIN, "DIVFINEGAIN", MIDI_KNOB|MIDI_WHEEL },
+ { MIDI_ACTION_DIV_FINEPHASE, "DIVFINEPHASE", MIDI_KNOB|MIDI_WHEEL },
+ { MIDI_ACTION_DIV_GAIN, "DIVGAIN", MIDI_KNOB|MIDI_WHEEL },
+ { MIDI_ACTION_DIV_PHASE, "DIVPHASE", MIDI_KNOB|MIDI_WHEEL },
+ { MIDI_ACTION_DIV_TOGGLE, "DIVTOGGLE", MIDI_KEY },
+ { MIDI_ACTION_DUP, "DUP", MIDI_KEY },
+ { MIDI_ACTION_FILTER_DOWN, "FILTERDOWN", MIDI_KEY|MIDI_KNOB|MIDI_WHEEL },
+ { MIDI_ACTION_FILTER_UP, "FILTERUP", MIDI_KEY|MIDI_KNOB|MIDI_WHEEL },
+ { MIDI_ACTION_LOCK, "LOCK", MIDI_KEY },
+ { MIDI_ACTION_MEM_RECALL_M0, "RECALLM0", MIDI_KEY },
+ { MIDI_ACTION_MEM_RECALL_M1, "RECALLM1", MIDI_KEY },
+ { MIDI_ACTION_MEM_RECALL_M2, "RECALLM2", MIDI_KEY },
+ { MIDI_ACTION_MEM_RECALL_M3, "RECALLM3", MIDI_KEY },
+ { MIDI_ACTION_MEM_RECALL_M4, "RECALLM4", MIDI_KEY },
+ { MIDI_ACTION_MENU_FILTER, "MENU_FILTER", MIDI_KEY },
+ { MIDI_ACTION_MENU_MODE, "MENU_MODE", MIDI_KEY },
+ { MIDI_ACTION_MIC_VOLUME, "MICGAIN", MIDI_KNOB|MIDI_WHEEL },
+ { MIDI_ACTION_MODE_DOWN, "MODEDOWN", MIDI_KEY|MIDI_KNOB|MIDI_WHEEL },
+ { MIDI_ACTION_MODE_UP, "MODEUP", MIDI_KEY|MIDI_KNOB|MIDI_WHEEL },
+ { MIDI_ACTION_MOX, "MOX", MIDI_KEY },
+ { MIDI_ACTION_MUTE, "MUTE", MIDI_KEY },
+ { MIDI_ACTION_NB, "NOISEBLANKER", MIDI_KEY },
+ { MIDI_ACTION_NR, "NOISEREDUCTION", MIDI_KEY },
+ { MIDI_ACTION_NUMPAD_0, "NUMPAD0", MIDI_KEY },
+ { MIDI_ACTION_NUMPAD_1, "NUMPAD1", MIDI_KEY },
+ { MIDI_ACTION_NUMPAD_2, "NUMPAD2", MIDI_KEY },
+ { MIDI_ACTION_NUMPAD_3, "NUMPAD3", MIDI_KEY },
+ { MIDI_ACTION_NUMPAD_4, "NUMPAD4", MIDI_KEY },
+ { MIDI_ACTION_NUMPAD_5, "NUMPAD5", MIDI_KEY },
+ { MIDI_ACTION_NUMPAD_6, "NUMPAD6", MIDI_KEY },
+ { MIDI_ACTION_NUMPAD_7, "NUMPAD7", MIDI_KEY },
+ { MIDI_ACTION_NUMPAD_8, "NUMPAD8", MIDI_KEY },
+ { MIDI_ACTION_NUMPAD_9, "NUMPAD9", MIDI_KEY },
+ { MIDI_ACTION_NUMPAD_CL, "NUMPADCL", MIDI_KEY },
+ { MIDI_ACTION_NUMPAD_ENTER, "NUMPADENTER", MIDI_KEY },
+ { MIDI_ACTION_PAN, "PAN", MIDI_KNOB|MIDI_WHEEL },
+ { MIDI_ACTION_PAN_HIGH, "PANHIGH", MIDI_KNOB|MIDI_WHEEL },
+ { MIDI_ACTION_PAN_LOW, "PANLOW", MIDI_KNOB|MIDI_WHEEL },
+ { MIDI_ACTION_PRE, "PREAMP", MIDI_KEY },
+ { MIDI_ACTION_PTTKEYER, "PTT(Keyer)", MIDI_KEY },
+ { MIDI_ACTION_PS, "PURESIGNAL", MIDI_KEY },
+ { MIDI_ACTION_RF_GAIN, "RFGAIN", MIDI_KNOB|MIDI_WHEEL },
+ { MIDI_ACTION_TX_DRIVE, "RFPOWER", MIDI_KNOB|MIDI_WHEEL },
+ { MIDI_ACTION_RIT_CLEAR, "RITCLEAR", MIDI_KEY },
+ { MIDI_ACTION_RIT_STEP, "RITSTEP", MIDI_KEY|MIDI_WHEEL },
+ { MIDI_ACTION_RIT_TOGGLE, "RITTOGGLE", MIDI_KEY },
+ { MIDI_ACTION_RIT_VAL, "RITVAL", MIDI_KNOB|MIDI_WHEEL },
+ { MIDI_ACTION_SAT, "SAT", MIDI_KEY },
+ { MIDI_ACTION_SNB, "SNB", MIDI_KEY },
+ { MIDI_ACTION_SPLIT, "SPLIT", MIDI_KEY },
+ { MIDI_ACTION_MEM_STORE_M0, "STOREM0", MIDI_KEY },
+ { MIDI_ACTION_MEM_STORE_M1, "STOREM1", MIDI_KEY },
+ { MIDI_ACTION_MEM_STORE_M2, "STOREM2", MIDI_KEY },
+ { MIDI_ACTION_MEM_STORE_M3, "STOREM3", MIDI_KEY },
+ { MIDI_ACTION_MEM_STORE_M4, "STOREM4", MIDI_KEY },
+ { MIDI_ACTION_SWAP_RX, "SWAPRX", MIDI_KEY },
+ { MIDI_ACTION_SWAP_VFO, "SWAPVFO", MIDI_KEY },
+ { MIDI_ACTION_TUNE, "TUNE", MIDI_KEY },
+ { MIDI_ACTION_VFOA, "VFOA", MIDI_WHEEL },
+ { MIDI_ACTION_VFOB, "VFOB", MIDI_WHEEL },
+ { MIDI_ACTION_VFO_STEP_UP, "VFOSTEPUP", MIDI_KEY|MIDI_WHEEL },
+ { MIDI_ACTION_VFO_STEP_DOWN, "VFOSTEPDOWN", MIDI_KEY|MIDI_WHEEL },
+ { MIDI_ACTION_VOX, "VOX", MIDI_KEY },
+ { MIDI_ACTION_VOXLEVEL, "VOXLEVEL", MIDI_KNOB|MIDI_WHEEL },
+ { MIDI_ACTION_XIT_CLEAR, "XITCLEAR", MIDI_KEY },
+ { MIDI_ACTION_XIT_VAL, "XITVAL", MIDI_KNOB|MIDI_WHEEL },
+ { MIDI_ACTION_ZOOM, "ZOOM", MIDI_KNOB|MIDI_WHEEL },
+ { MIDI_ACTION_ZOOM_UP, "ZOOMUP", MIDI_KEY|MIDI_WHEEL },
+ { MIDI_ACTION_ZOOM_DOWN, "ZOOMDOWN", MIDI_KEY|MIDI_WHEEL },
+ { MIDI_ACTION_LAST, "NONE", TYPE_NONE },
};
t5= 0; t6= 63;
t7=65; t8=127;
t9 = t10 = t11 = t12 = -1;
- event=MIDI_EVENT_NONE;
- type=MIDI_TYPE_NONE;
+ event=EVENT_NONE;
+ type=TYPE_NONE;
key=0;
delay=0;
//
if ((cp = strstr(zeile, "KEY="))) {
sscanf(cp+4, "%d", &key);
- event=MIDI_EVENT_NOTE;
- type=MIDI_TYPE_KEY;
+ event=MIDI_NOTE;
+ type=MIDI_KEY;
//g_print("%s: MIDI:KEY:%d\n",__FUNCTION__, key);
}
if ((cp = strstr(zeile, "CTRL="))) {
sscanf(cp+5, "%d", &key);
- event=MIDI_EVENT_CTRL;
- type=MIDI_TYPE_KNOB;
+ event=MIDI_CTRL;
+ type=MIDI_KNOB;
//g_print("%s: MIDI:CTL:%d\n",__FUNCTION__, key);
}
if ((cp = strstr(zeile, "PITCH "))) {
- event=MIDI_EVENT_PITCH;
- type=MIDI_TYPE_KNOB;
+ event=MIDI_PITCH;
+ type=MIDI_KNOB;
//g_print("%s: MIDI:PITCH\n",__FUNCTION__);
}
//
// If event is still undefined, skip line
//
- if (event == MIDI_EVENT_NONE) {
+ if (event == EVENT_NONE) {
//g_print("%s: no event found: %s\n", __FUNCTION__, zeile);
continue;
}
if (chan<0 || chan>15) chan=-1;
//g_print("%s:CHAN:%d\n",__FUNCTION__,chan);
}
- if ((cp = strstr(zeile, "WHEEL")) && (type == MIDI_TYPE_KNOB)) {
- // change type from MIDI_TYPE_KNOB to MIDI_TYPE_WHEEL
- type=MIDI_TYPE_WHEEL;
+ if ((cp = strstr(zeile, "WHEEL")) && (type == MIDI_KNOB)) {
+ // change type from MIDI_KNOB to MIDI_WHEEL
+ type=MIDI_WHEEL;
//g_print("%s:WHEEL\n",__FUNCTION__);
}
if ((cp = strstr(zeile, "DELAY="))) {
cq=cp+7;
while (*cq != 0 && *cq != '\n' && *cq != ' ' && *cq != '\t') cq++;
*cq=0;
- action = keyword2action(cp+7);
- //g_print("MIDI:ACTION:%s (%d)\n",cp+7, action);
+ action = keyword2action(cp+7);
+//g_print("MIDI:ACTION:%s (%d)\n",cp+7, action);
}
//
// All data for a descriptor has been read. Construct it!
// insert descriptor into linked list.
// We have a linked list for each key value to speed up searches
//
- if (event == MIDI_EVENT_PITCH) {
+ if (event == MIDI_PITCH) {
//g_print("%s: Insert desc=%p in CMDS[128] table\n",__FUNCTION__,desc);
MidiAddCommand(128, desc);
}
- if (event == MIDI_EVENT_NOTE || event == MIDI_EVENT_CTRL) {
+ if (event == MIDI_NOTE || event == MIDI_CTRL) {
//g_print("%s: Insert desc=%p in CMDS[%d] table\n",__FUNCTION__,desc,key);
MidiAddCommand(key, desc);
}
*
* In most cases, a certain action only makes sense for a specific
* type. For example, changing the VFO frequency will only be implemeted
- * for MIDI_TYPE_WHEEL, and TUNE off/on only with MIDI_TYPE_KNOB.
+ * for MIDI_WHEEL, and TUNE off/on only with MIDI_KNOB.
*
- * However, changing the volume makes sense both with MIDI_TYPE_KNOB and MIDI_TYPE_WHEEL.
+ * However, changing the volume makes sense both with MIDI_KNOB and MIDI_WHEEL.
*/
#include <gtk/gtk.h>
/////////////////////////////////////////////////////////// "AFGAIN"
case MIDI_ACTION_AF_GAIN: // knob or wheel supported
switch (type) {
- case MIDI_TYPE_KNOB:
+ case MIDI_KNOB:
active_receiver->volume = 0.01*val;
break;
- case MIDI_TYPE_WHEEL:
+ case MIDI_WHEEL:
dnew=active_receiver->volume += 0.01*val;
if (dnew < 0.0) dnew=0.0; if (dnew > 1.0) dnew=1.0;
active_receiver->volume = dnew;
/////////////////////////////////////////////////////////// "AGCVAL"
case MIDI_ACTION_AGC: // knob or wheel supported
switch (type) {
- case MIDI_TYPE_KNOB:
+ case MIDI_KNOB:
dnew = -20.0 + 1.4*val;
break;
- case MIDI_TYPE_WHEEL:
+ case MIDI_WHEEL:
dnew=active_receiver->agc_gain + val;
if (dnew < -20.0) dnew = -20.0;
if (dnew > 120.0) dnew = 120.0;
/////////////////////////////////////////////////////////// "ATT"
case MIDI_ACTION_ATT: // Key for ALEX attenuator, wheel or knob for slider
switch(type) {
- case MIDI_TYPE_KEY:
+ case MIDI_KEY:
if (filter_board == ALEX && active_receiver->adc == 0) {
new=active_receiver->alex_attenuation + 1;
if (new > 3) new=0;
update_att_preamp();
}
break;
- case MIDI_TYPE_WHEEL:
+ case MIDI_WHEEL:
dnew=adc[active_receiver->adc].attenuation + val;
if(have_rx_gain) {
if(dnew < -12.0) {
}
set_attenuation_value(dnew);
break;
- case MIDI_TYPE_KNOB:
+ case MIDI_KNOB:
if (have_rx_gain) {
dnew = -12.0 + 0.6*val;
} else {
case MIDI_ACTION_BAND_DOWN:
case MIDI_ACTION_BAND_UP:
switch (type) {
- case MIDI_TYPE_KEY:
+ case MIDI_KEY:
new=(action == MIDI_ACTION_BAND_UP) ? 1 : -1;
break;
- case MIDI_TYPE_WHEEL:
+ case MIDI_WHEEL:
new=val > 0 ? 1 : -1;
break;
- case MIDI_TYPE_KNOB:
+ case MIDI_KNOB:
// cycle through the bands
new = ((BANDS-1) * val) / 100 - vfo[active_receiver->id].band;
break;
/////////////////////////////////////////////////////////// "COMPRESS"
case MIDI_ACTION_COMPRESS: // wheel or knob
switch (type) {
- case MIDI_TYPE_WHEEL:
+ case MIDI_WHEEL:
dnew=transmitter->compressor_level + val;
if (dnew > 20.0) dnew=20.0;
if (dnew < 0 ) dnew=0;
break;
- case MIDI_TYPE_KNOB:
+ case MIDI_KNOB:
dnew=(20.0*val)/100.0;
break;
default:
/////////////////////////////////////////////////////////// "CWSPEED"
case MIDI_ACTION_CWSPEED: // knob or wheel
switch (type) {
- case MIDI_TYPE_KNOB:
+ case MIDI_KNOB:
// speed between 5 and 35 wpm
new= (int) (5.0 + (double) val * 0.3);
break;
- case MIDI_TYPE_WHEEL:
+ case MIDI_WHEEL:
// here we allow from 1 to 60 wpm
new = cw_keyer_speed + val;
if (new < 1) new=1;
case MIDI_ACTION_DIV_FINEGAIN: // knob or wheel supported
case MIDI_ACTION_DIV_GAIN: // knob or wheel supported
switch (type) {
- case MIDI_TYPE_KNOB:
+ case MIDI_KNOB:
if (action == MIDI_ACTION_DIV_COARSEGAIN || action == MIDI_ACTION_DIV_GAIN) {
// -25 to +25 dB in steps of 0.5 dB
dnew = 10.0*(-25.0 + 0.5*val - div_gain);
dnew = 10.0*((double) new + 0.01*val - 0.5 - div_gain);
}
break;
- case MIDI_TYPE_WHEEL:
+ case MIDI_WHEEL:
// coarse: increaments in steps of 0.25 dB, medium: steps of 0.1 dB fine: in steps of 0.01 dB
if (action == MIDI_ACTION_DIV_GAIN) {
dnew = val*0.5;
case MIDI_ACTION_DIV_PHASE: // knob or wheel supported
dnew=0.0;
switch (type) {
- case MIDI_TYPE_KNOB:
+ case MIDI_KNOB:
// coarse: change phase from -180 to 180
// fine: change from -5 to 5
if (action == MIDI_ACTION_DIV_COARSEPHASE || action == MIDI_ACTION_DIV_PHASE) {
dnew = (double) new + 0.1*val -5.0 -div_phase;
}
break;
- case MIDI_TYPE_WHEEL:
+ case MIDI_WHEEL:
if (action == MIDI_ACTION_DIV_PHASE) {
dnew = val*0.5;
} else if (action == MIDI_ACTION_DIV_COARSEPHASE) {
// Therefore let MIDI_ACTION_FILTER_UP move down.
//
switch (type) {
- case MIDI_TYPE_KEY:
+ case MIDI_KEY:
new=(action == MIDI_ACTION_FILTER_UP) ? -1 : 1;
break;
- case MIDI_TYPE_WHEEL:
+ case MIDI_WHEEL:
new=val > 0 ? -1 : 1;
break;
- case MIDI_TYPE_KNOB:
+ case MIDI_KNOB:
// cycle through all the filters: val=100 maps to filter #0
new = ((FILTERS-1) * (val-100)) / 100 - vfo[active_receiver->id].filter;
break;
case MIDI_ACTION_MIC_VOLUME: // knob or wheel supported
// TODO: possibly adjust linein value if that is effective
switch (type) {
- case MIDI_TYPE_KNOB:
+ case MIDI_KNOB:
dnew = -10.0 + 0.6*val;
break;
- case MIDI_TYPE_WHEEL:
+ case MIDI_WHEEL:
dnew = mic_gain + val;
if (dnew < -10.0) dnew = -10.0;
if (dnew > 50.0) dnew = 50.0;
case MIDI_ACTION_MODE_DOWN:
case MIDI_ACTION_MODE_UP:
switch (type) {
- case MIDI_TYPE_KEY:
+ case MIDI_KEY:
new=(action == MIDI_ACTION_MODE_UP) ? 1 : -1;
break;
- case MIDI_TYPE_WHEEL:
+ case MIDI_WHEEL:
new=val > 0 ? 1 : -1;
break;
- case MIDI_TYPE_KNOB:
+ case MIDI_KNOB:
// cycle through all the modes
new = ((MODES-1) * val) / 100 - vfo[active_receiver->id].mode;
break;
/////////////////////////////////////////////////////////// "PAN"
case MIDI_ACTION_PAN: // wheel and knob
switch (type) {
- case MIDI_TYPE_WHEEL:
+ case MIDI_WHEEL:
update_pan(val*10.0);
break;
- case MIDI_TYPE_KNOB:
+ case MIDI_KNOB:
if(active_receiver->zoom>1) {
int pos=GPOINTER_TO_INT(data);
double pan=(double)((active_receiver->zoom-1)*active_receiver->width)*((double)pos/100.0);
/////////////////////////////////////////////////////////// "PANHIGH"
case MIDI_ACTION_PAN_HIGH: // wheel or knob
switch (type) {
- case MIDI_TYPE_WHEEL:
+ case MIDI_WHEEL:
if (mox) {
// TX panadapter affected
transmitter->panadapter_high += val;
active_receiver->panadapter_high += val;
}
break;
- case MIDI_TYPE_KNOB:
+ case MIDI_KNOB:
// Adjust "high water" in the range -50 ... 0 dBm
new = -50 + val/2;
if (mox) {
/////////////////////////////////////////////////////////// "PANLOW"
case MIDI_ACTION_PAN_LOW: // wheel and knob
switch (type) {
- case MIDI_TYPE_WHEEL:
+ case MIDI_WHEEL:
if (isTransmitting()) {
// TX panadapter affected
transmitter->panadapter_low += val;
active_receiver->panadapter_low += val;
}
break;
- case MIDI_TYPE_KNOB:
+ case MIDI_KNOB:
if (isTransmitting()) {
// TX panadapter: use values -100 through -50
new = -100 + val/2;
/////////////////////////////////////////////////////////// "RFGAIN"
case MIDI_ACTION_RF_GAIN: // knob or wheel supported
switch (type) {
- case MIDI_TYPE_KNOB:
+ case MIDI_KNOB:
dnew=val;
break;
- case MIDI_TYPE_WHEEL:
+ case MIDI_WHEEL:
dnew=adc[active_receiver->id].gain+val;
break;
default:
/////////////////////////////////////////////////////////// "RFPOWER"
case MIDI_ACTION_TX_DRIVE: // knob or wheel supported
switch (type) {
- case MIDI_TYPE_KNOB:
+ case MIDI_KNOB:
dnew = val;
break;
- case MIDI_TYPE_WHEEL:
+ case MIDI_WHEEL:
dnew=transmitter->drive + val;
if (dnew < 0.0) dnew=0.0; if (dnew > 100.0) dnew=100.0;
break;
case MIDI_ACTION_RIT_STEP: // key or wheel supported
// This cycles between RIT increments 1, 10, 100, 1, 10, 100, ...
switch (type) {
- case MIDI_TYPE_KEY:
+ case MIDI_KEY:
// key cycles through in upward direction
val=1;
/* FALLTHROUGH */
- case MIDI_TYPE_WHEEL:
+ case MIDI_WHEEL:
// wheel cycles upward or downward
if (val > 0) {
rit_increment=10*rit_increment;
/////////////////////////////////////////////////////////// "RITVAL"
case MIDI_ACTION_RIT_VAL: // wheel or knob
switch (type) {
- case MIDI_TYPE_WHEEL:
+ case MIDI_WHEEL:
// This changes the RIT value incrementally,
// but we restrict the change to +/ 9.999 kHz
new = vfo[active_receiver->id].rit + val*rit_increment;
if (new < -9999) new= -9999;
vfo[active_receiver->id].rit = new;
break;
- case MIDI_TYPE_KNOB:
+ case MIDI_KNOB:
// knob: adjust in the range +/ 50*rit_increment
new = (val-50) * rit_increment;
vfo[active_receiver->id].rit = new;
case MIDI_ACTION_VFO_STEP_DOWN: // key or wheel supported
case MIDI_ACTION_VFO_STEP_UP:
switch (type) {
- case MIDI_TYPE_KEY:
+ case MIDI_KEY:
new = (action == MIDI_ACTION_VFO_STEP_UP) ? 1 : -1;
update_vfo_step(new);
break;
- case MIDI_TYPE_WHEEL:
+ case MIDI_WHEEL:
new = (val > 0) ? 1 : -1;
update_vfo_step(new);
break;
/////////////////////////////////////////////////////////// "VOXLEVEL"
case MIDI_ACTION_VOXLEVEL: // knob or wheel supported
switch (type) {
- case MIDI_TYPE_WHEEL:
+ case MIDI_WHEEL:
// This changes the value incrementally,
// but stay within limits (0.0 through 1.0)
vox_threshold += (double) val * 0.01;
if (vox_threshold > 1.0) vox_threshold=1.0;
if (vox_threshold < 0.0) vox_threshold=0.0;
break;
- case MIDI_TYPE_KNOB:
+ case MIDI_KNOB:
vox_threshold = 0.01 * (double) val;
break;
default:
case MIDI_ACTION_XIT_VAL: // wheel and knob supported.
if (can_transmit) {
switch (type) {
- case MIDI_TYPE_WHEEL:
+ case MIDI_WHEEL:
// This changes the XIT value incrementally,
// but we restrict the change to +/ 9.999 kHz
new = transmitter->xit + val*rit_increment;
if (new < -9999) new = -9999;
transmitter->xit = new;
break;
- case MIDI_TYPE_KNOB:
+ case MIDI_KNOB:
// knob: adjust in the range +/ 50*rit_increment
new = (val-50) * rit_increment;
transmitter->xit = new;
case MIDI_ACTION_ZOOM_UP: // key, wheel, knob
case MIDI_ACTION_ZOOM_DOWN: // key, wheel, knob
switch (type) {
- case MIDI_TYPE_KEY:
+ case MIDI_KEY:
if (action == MIDI_ACTION_ZOOM) break;
dnew = (action == MIDI_ACTION_ZOOM_UP) ? 1.0 :-1.0;
update_zoom(dnew);
break;
- case MIDI_TYPE_WHEEL:
+ case MIDI_WHEEL:
dnew = (val > 0) ? 1.0 : -1.0;
update_zoom(dnew);
break;
- case MIDI_TYPE_KNOB:
+ case MIDI_KNOB:
dnew= 1.0+ 0.07*val; // from 1.0 to 8.0
if((int)dnew != active_receiver->zoom) {
set_zoom(active_receiver->id, dnew);
static GtkWidget *delete_b;
static GtkWidget *device_b[MAX_MIDI_DEVICES];
-static enum MIDIevent thisEvent=MIDI_EVENT_NONE;
+static enum MIDIevent thisEvent=EVENT_NONE;
static int thisChannel;
static int thisNote;
static int thisVal;
// thre current type is a wheel. If it is a wheel,
// set spin buttons to current values.
//
- if (thisType==MIDI_TYPE_WHEEL) {
+ if (thisType==MIDI_WHEEL) {
gtk_spin_button_set_value(GTK_SPIN_BUTTON(set_delay),(double) thisDelay);
gtk_spin_button_set_value(GTK_SPIN_BUTTON(set_vfl1 ),(double) thisVfl1 );
gtk_spin_button_set_value(GTK_SPIN_BUTTON(set_vfl2 ),(double) thisVfl2 );
gtk_widget_hide(newAction_knob);
gtk_widget_hide(newAction_wheel);
if (strcmp(type,"NONE")==0) {
- thisType=MIDI_TYPE_NONE;
+ thisType=TYPE_NONE;
} else if(strcmp(type,"KEY")==0) {
- thisType=MIDI_TYPE_KEY;
+ thisType=MIDI_KEY;
gtk_widget_show(newAction_key);
gtk_combo_box_set_active(GTK_COMBO_BOX(newAction_key),key_list[thisAction]);
} else if(strcmp(type,"KNOB/SLIDER")==0) {
- thisType=MIDI_TYPE_KNOB;
+ thisType=MIDI_KNOB;
gtk_widget_show(newAction_knob);
gtk_combo_box_set_active(GTK_COMBO_BOX(newAction_knob),knob_list[thisAction]);
} else if(strcmp(type,"WHEEL")==0) {
- thisType=MIDI_TYPE_WHEEL;
+ thisType=MIDI_WHEEL;
gtk_widget_show(newAction_wheel);
gtk_combo_box_set_active(GTK_COMBO_BOX(newAction_wheel),wheel_list[thisAction]);
}
if(str_event!=NULL && str_channel!=NULL && str_note!=NULL && str_type!=NULL && str_action!=NULL) {
if(strcmp(str_event,"CTRL")==0) {
- thisEvent=MIDI_EVENT_CTRL;
+ thisEvent=MIDI_CTRL;
} else if(strcmp(str_event,"PITCH")==0) {
- thisEvent=MIDI_EVENT_PITCH;
+ thisEvent=MIDI_PITCH;
} else if(strcmp(str_event,"NOTE")==0) {
- thisEvent=MIDI_EVENT_NOTE;
+ thisEvent=MIDI_NOTE;
} else {
- thisEvent=MIDI_EVENT_NONE;
+ thisEvent=EVENT_NONE;
}
if (!strncmp(str_channel,"Any", 3)) {
thisChannel=-1;
thisMin=0;
thisMax=0;
if(strcmp(str_type,"KEY")==0) {
- thisType=MIDI_TYPE_KEY;
+ thisType=MIDI_KEY;
} else if(strcmp(str_type,"KNOB/SLIDER")==0) {
- thisType=MIDI_TYPE_KNOB;
+ thisType=MIDI_KNOB;
} else if(strcmp(str_type,"WHEEL")==0) {
- thisType=MIDI_TYPE_WHEEL;
+ thisType=MIDI_WHEEL;
} else {
- thisType=MIDI_TYPE_NONE;
+ thisType=TYPE_NONE;
}
thisAction=MIDI_ACTION_NONE;
int i=0;
int val=gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(widget));
int newval=val;
- if (thisType != MIDI_TYPE_WHEEL) {
+ if (thisType != MIDI_WHEEL) {
// we should never arrive here
return;
}
//g_print("%s: key=%d desc=%p\n",__FUNCTION__,key,cmd);
switch(cmd->event) {
- case MIDI_EVENT_NONE:
+ case EVENT_NONE:
strcpy(str_event,"NONE");
break;
- case MIDI_EVENT_NOTE:
+ case MIDI_NOTE:
strcpy(str_event,"NOTE");
break;
- case MIDI_EVENT_CTRL:
+ case MIDI_CTRL:
strcpy(str_event,"CTRL");
break;
- case MIDI_EVENT_PITCH:
+ case MIDI_PITCH:
strcpy(str_event,"PITCH");
break;
}
}
sprintf(str_note,"%d",key);
switch(cmd->type) {
- case MIDI_TYPE_NONE:
+ case TYPE_NONE:
strcpy(str_type,"NONE");
break;
- case MIDI_TYPE_KEY:
+ case MIDI_KEY:
strcpy(str_type,"KEY");
break;
- case MIDI_TYPE_KNOB:
+ case MIDI_KNOB:
strcpy(str_type,"KNOB/SLIDER");
break;
- case MIDI_TYPE_WHEEL:
+ case MIDI_WHEEL:
strcpy(str_type,"WHEEL");
break;
}
}
if(strcmp(str_type,"KEY")==0) {
- type=MIDI_TYPE_KEY;
+ type=MIDI_KEY;
str_action=gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(newAction_key));
} else if(strcmp(str_type,"KNOB/SLIDER")==0) {
- type=MIDI_TYPE_KNOB;
+ type=MIDI_KNOB;
str_action=gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(newAction_knob));
} else if(strcmp(str_type,"WHEEL")==0) {
- type=MIDI_TYPE_WHEEL;
+ type=MIDI_WHEEL;
str_action=gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(newAction_wheel));
} else {
- type=MIDI_TYPE_NONE;
+ type=TYPE_NONE;
str_action="NONE";
}
gchar *str_action;
if(strcmp(str_type,"KEY")==0) {
- thisType=MIDI_TYPE_KEY;
+ thisType=MIDI_KEY;
str_action=gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(newAction_key));
} else if(strcmp(str_type,"KNOB/SLIDER")==0) {
- thisType=MIDI_TYPE_KNOB;
+ thisType=MIDI_KNOB;
str_action=gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(newAction_knob));
} else if(strcmp(str_type,"WHEEL")==0) {
- thisType=MIDI_TYPE_WHEEL;
+ thisType=MIDI_WHEEL;
str_action=gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(newAction_wheel));
} else {
- thisType=MIDI_TYPE_NONE;
+ thisType=TYPE_NONE;
str_action="NONE";
}
//g_print("%s: type=%s action=%s\n",__FUNCTION__,str_type,str_action);
current_cmd->vfr2 =thisVfr2;
switch(current_cmd->event) {
- case MIDI_EVENT_NONE:
+ case EVENT_NONE:
strcpy(str_event,"NONE");
break;
- case MIDI_EVENT_NOTE:
+ case MIDI_NOTE:
strcpy(str_event,"NOTE");
break;
- case MIDI_EVENT_CTRL:
+ case MIDI_CTRL:
strcpy(str_event,"CTRL");
break;
- case MIDI_EVENT_PITCH:
+ case MIDI_PITCH:
strcpy(str_event,"PITCH");
break;
}
key_list[i]=0;
knob_list[i]=0;
wheel_list[i]=0;
- if(ActionTable[i].type&MIDI_TYPE_KEY) {
+ if(ActionTable[i].type&MIDI_KEY) {
gtk_combo_box_text_append(GTK_COMBO_BOX_TEXT(newAction_key),NULL,ActionTable[i].str);
key_list[i]=jkey++;
}
- if(ActionTable[i].type&MIDI_TYPE_KNOB) {
+ if(ActionTable[i].type&MIDI_KNOB) {
gtk_combo_box_text_append(GTK_COMBO_BOX_TEXT(newAction_knob),NULL,ActionTable[i].str);
knob_list[i]=jknob++;
}
- if(ActionTable[i].type&MIDI_TYPE_WHEEL) {
+ if(ActionTable[i].type&MIDI_WHEEL) {
gtk_combo_box_text_append(GTK_COMBO_BOX_TEXT(newAction_wheel),NULL,ActionTable[i].str);
wheel_list[i]=jwheel++;
}
case UPDATE_NEW:
g_print("%s: UPDATE_NEW\n",__FUNCTION__);
switch(thisEvent) {
- case MIDI_EVENT_NONE:
+ case EVENT_NONE:
gtk_label_set_text(GTK_LABEL(newEvent),"NONE");
break;
- case MIDI_EVENT_NOTE:
+ case MIDI_NOTE:
gtk_label_set_text(GTK_LABEL(newEvent),"NOTE");
break;
- case MIDI_EVENT_CTRL:
+ case MIDI_CTRL:
gtk_label_set_text(GTK_LABEL(newEvent),"CTRL");
break;
- case MIDI_EVENT_PITCH:
+ case MIDI_PITCH:
gtk_label_set_text(GTK_LABEL(newEvent),"PITCH");
break;
}
gtk_combo_box_text_remove_all(GTK_COMBO_BOX_TEXT(newType));
gtk_combo_box_text_append(GTK_COMBO_BOX_TEXT(newType),NULL,"NONE");
switch(thisEvent) {
- case MIDI_EVENT_NONE:
+ case EVENT_NONE:
gtk_combo_box_set_active (GTK_COMBO_BOX(newType),0);
break;
- case MIDI_EVENT_NOTE:
- case MIDI_EVENT_PITCH:
+ case MIDI_NOTE:
+ case MIDI_PITCH:
gtk_combo_box_text_append(GTK_COMBO_BOX_TEXT(newType),NULL,"KEY");
gtk_combo_box_set_active (GTK_COMBO_BOX(newType),1);
break;
- case MIDI_EVENT_CTRL:
+ case MIDI_CTRL:
gtk_combo_box_text_append(GTK_COMBO_BOX_TEXT(newType),NULL,"KNOB/SLIDER");
gtk_combo_box_text_append(GTK_COMBO_BOX_TEXT(newType),NULL,"WHEEL");
gtk_combo_box_set_active (GTK_COMBO_BOX(newType),0);
case UPDATE_EXISTING:
g_print("%s: UPDATE_EXISTING Type=%d Action=%d\n",__FUNCTION__,thisType,thisAction);
switch(thisEvent) {
- case MIDI_EVENT_NONE:
+ case EVENT_NONE:
gtk_label_set_text(GTK_LABEL(newEvent),"NONE");
break;
- case MIDI_EVENT_NOTE:
+ case MIDI_NOTE:
gtk_label_set_text(GTK_LABEL(newEvent),"NOTE");
break;
- case MIDI_EVENT_CTRL:
+ case MIDI_CTRL:
gtk_label_set_text(GTK_LABEL(newEvent),"CTRL");
break;
- case MIDI_EVENT_PITCH:
+ case MIDI_PITCH:
gtk_label_set_text(GTK_LABEL(newEvent),"PITCH");
break;
}
gtk_combo_box_text_remove_all(GTK_COMBO_BOX_TEXT(newType));
gtk_combo_box_text_append(GTK_COMBO_BOX_TEXT(newType),NULL,"NONE");
switch(thisEvent) {
- case MIDI_EVENT_NONE:
+ case EVENT_NONE:
gtk_combo_box_set_active (GTK_COMBO_BOX(newType),0);
break;
- case MIDI_EVENT_NOTE:
- case MIDI_EVENT_PITCH:
+ case MIDI_NOTE:
+ case MIDI_PITCH:
gtk_combo_box_text_append(GTK_COMBO_BOX_TEXT(newType),NULL,"KEY");
- if(thisType==MIDI_TYPE_NONE) {
+ if(thisType==TYPE_NONE) {
gtk_combo_box_set_active (GTK_COMBO_BOX(newType),0);
- } else if(thisType==MIDI_TYPE_KEY) {
+ } else if(thisType==MIDI_KEY) {
gtk_combo_box_set_active (GTK_COMBO_BOX(newType),1);
}
break;
- case MIDI_EVENT_CTRL:
+ case MIDI_CTRL:
gtk_combo_box_text_append(GTK_COMBO_BOX_TEXT(newType),NULL,"KNOB/SLIDER");
gtk_combo_box_text_append(GTK_COMBO_BOX_TEXT(newType),NULL,"WHEEL");
- if(thisType==MIDI_TYPE_NONE) {
+ if(thisType==TYPE_NONE) {
gtk_combo_box_set_active (GTK_COMBO_BOX(newType),0);
- } else if(thisType==MIDI_TYPE_KNOB) {
+ } else if(thisType==MIDI_KNOB) {
gtk_combo_box_set_active (GTK_COMBO_BOX(newType),1);
- } else if(thisType==MIDI_TYPE_WHEEL) {
+ } else if(thisType==MIDI_WHEEL) {
gtk_combo_box_set_active (GTK_COMBO_BOX(newType),2);
}
break;
thisVal=val;
thisMin=val;
thisMax=val;
- thisType=MIDI_TYPE_NONE;
+ thisType=TYPE_NONE;
thisAction=MIDI_ACTION_NONE;
//
// set default values for wheel parameters
if(str_event!=NULL && str_channel!=NULL && str_note!=NULL && str_type!=NULL && str_action!=NULL) {
if(strcmp(str_event,"CTRL")==0) {
- tree_event=MIDI_EVENT_CTRL;
+ tree_event=MIDI_CTRL;
} else if(strcmp(str_event,"PITCH")==0) {
- tree_event=MIDI_EVENT_PITCH;
+ tree_event=MIDI_PITCH;
} else if(strcmp(str_event,"NOTE")==0) {
- tree_event=MIDI_EVENT_NOTE;
+ tree_event=MIDI_NOTE;
} else {
- tree_event=MIDI_EVENT_NONE;
+ tree_event=EVENT_NONE;
}
if (!strncmp(str_channel,"Any", 3)) {
tree_channel=-1;
thisMin=0;
thisMax=0;
if(strcmp(str_type,"KEY")==0) {
- thisType=MIDI_TYPE_KEY;
+ thisType=MIDI_KEY;
} else if(strcmp(str_type,"KNOB/SLIDER")==0) {
- thisType=MIDI_TYPE_KNOB;
+ thisType=MIDI_KNOB;
} else if(strcmp(str_type,"WHEEL")==0) {
- thisType=MIDI_TYPE_WHEEL;
+ thisType=MIDI_WHEEL;
} else {
- thisType=MIDI_TYPE_NONE;
+ thisType=TYPE_NONE;
}
thisAction=MIDI_ACTION_NONE;
int i=1;
// For wheels, also store the additional parameters,
// but do so only if they deviate from the default values.
//
- if (cmd->type == MIDI_TYPE_WHEEL) {
+ if (cmd->type == MIDI_WHEEL) {
if (cmd->delay > 0) {
sprintf(name,"midi[%d].index[%d].delay",i,index);
sprintf(value,"%d",cmd->delay);
// set the "active" flag, and the devices will be opened in
// radio.c when it is appropriate
//
-
for(int i=0; i<MAX_MIDI_DEVICES; i++) {
sprintf(name,"mididevice[%d].name",i);
value=getProperty(name);
for(int index=0; index<indices; index++) {
sprintf(name,"midi[%d].index[%d].event",i,index);
value=getProperty(name);
- event=MIDI_EVENT_NONE;
+ event=EVENT_NONE;
if(value) {
for(int j=0;j<4;j++) {
if(strcmp(value,midi_events[j])==0) {
}
sprintf(name,"midi[%d].index[%d].type",i,index);
value=getProperty(name);
- type=MIDI_TYPE_NONE;
+ type=TYPE_NONE;
if(value) {
for(int j=0;j<5;j++) {
if(strcmp(value,midi_types[j])==0) {
}
void start_store() {
+ int old_menu=active_menu;
cleanup();
- store_menu(top_window);
+ if (old_menu != STORE_MENU) {
+ store_menu(top_window);
+ active_menu=STORE_MENU;
+ }
}
static gboolean store_cb (GtkWidget *widget, GdkEventButton *event, gpointer data) {
// The "Restart" restarts the protocol
// This may help to recover from certain error conditions
//
- if (protocol != SOAPYSDR_PROTOCOL) {
+#ifdef SOAPYSDR
+ if (protocol != SOAPYSDR_PROTOCOL)
+#endif
+ {
GtkWidget *restart_b=gtk_button_new_with_label("Restart");
g_signal_connect (restart_b, "button-press-event", G_CALLBACK(restart_cb), NULL);
gtk_grid_attach(GTK_GRID(grid),restart_b,2,0,2,1);
FILTER_MENU,
NOISE_MENU,
AGC_MENU,
- VFO_MENU
+ VFO_MENU,
+ STORE_MENU
};
extern int active_menu;
gtk_fixed_put(GTK_FIXED(fixed),audio_waterfall,0,VFO_HEIGHT+20);
#endif
- gboolean init_gpio=FALSE;
-#ifdef LOCALCW
- init_gpio=TRUE;
-#endif
-#ifdef PTT
- init_gpio=TRUE;
-#endif
-#ifdef GPIO
- init_gpio=TRUE;
-#endif
-
- if(init_gpio) {
#ifdef GPIO
if(gpio_init()<0) {
g_print("GPIO failed to initialize\n");
}
#endif
- }
#ifdef LOCALCW
// init local keyer if enabled
memRestoreState();
vfo_restore_state();
modesettings_restore_state();
-//#ifdef GPIO
-// gpio_restore_actions();
-//#endif
gpio_restore_actions();
value=getProperty("rigctl_enable");
if(value) rigctl_enable=atoi(value);
if(device==SOAPYSDR_USB_DEVICE) {
value=getProperty("radio.adc[0].agc");
if (value) adc[0].agc=atoi(value);
- //if(value) soapy_protocol_set_automatic_gain(atoi(value));
}
#endif
if(device==SOAPYSDR_USB_DEVICE) {
value=getProperty("radio.adc[1].agc");
if (value) adc[1].agc=atoi(value);
- //if(value) soapy_protocol_set_automatic_gain(atoi(value));
}
#endif
g_mutex_lock(&property_mutex);
clearProperties();
-//#ifdef GPIO
-// if(controller!=NO_CONTROLLER) {
-// gpio_save_actions();
-// }
-//#endif
gpio_save_actions();
sprintf(value,"%d",receivers);
setProperty("receivers",value);
#ifdef SOAPYSDR
#include "soapy_protocol.h"
#endif
-#ifdef GPIO
#include "actions.h"
+#ifdef GPIO
#include "gpio.h"
#endif
#include "vfo.h"
gtk_grid_attach(GTK_GRID(grid),rit_label,col,row,1,1);
row++;
- GtkWidget *rit_1=gtk_radio_button_new_with_label(NULL,"1/10");
+ GtkWidget *rit_1=gtk_radio_button_new_with_label(NULL,"1");
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (rit_1), rit_increment==1);
gtk_grid_attach(GTK_GRID(grid),rit_1,col,row,1,1);
g_signal_connect(rit_1,"pressed",G_CALLBACK(rit_cb),(gpointer *)1);
row++;
- GtkWidget *rit_10=gtk_radio_button_new_with_label_from_widget(GTK_RADIO_BUTTON(rit_1),"10/100");
+ GtkWidget *rit_10=gtk_radio_button_new_with_label_from_widget(GTK_RADIO_BUTTON(rit_1),"10");
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (rit_10), rit_increment==10);
gtk_grid_attach(GTK_GRID(grid),rit_10,col,row,1,1);
g_signal_connect(rit_10,"pressed",G_CALLBACK(rit_cb),(gpointer *)10);
row++;
- GtkWidget *rit_100=gtk_radio_button_new_with_label_from_widget(GTK_RADIO_BUTTON(rit_10),"100/1000");
+ GtkWidget *rit_100=gtk_radio_button_new_with_label_from_widget(GTK_RADIO_BUTTON(rit_10),"100");
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (rit_100), rit_increment==100);
gtk_grid_attach(GTK_GRID(grid),rit_100,col,row,1,1);
g_signal_connect(rit_100,"pressed",G_CALLBACK(rit_cb),(gpointer *)100);
GtkWidget *grid=gtk_grid_new();
gtk_grid_set_column_spacing (GTK_GRID(grid),10);
- //gtk_grid_set_row_spacing (GTK_GRID(grid),10);
- //gtk_grid_set_row_homogeneous(GTK_GRID(grid),TRUE);
- //gtk_grid_set_column_homogeneous(GTK_GRID(grid),TRUE);
GtkWidget *close_b=gtk_button_new_with_label("Close");
g_signal_connect (close_b, "button_press_event", G_CALLBACK(close_cb), NULL);
#include "rx_panadapter.h"
#include "vfo.h"
#include "mode.h"
+#include "actions.h"
#ifdef GPIO
#include "gpio.h"
#endif
#ifdef CLIENT_SERVER
#include "client_server.h"
#endif
+#include "actions.h"
static int width;
static int height;
static GtkWidget *sliders;
gint scale_timer;
-int scale_status=NO_FUNCTION;
+int scale_status=NO_ACTION;
int scale_rx=0;
GtkWidget *scale_dialog;
int scale_timeout_cb(gpointer data) {
gtk_widget_destroy(scale_dialog);
- scale_status=NO_FUNCTION;
+ scale_status=NO_ACTION;
return FALSE;
}
}
} else {
if(scale_status!=ATTENUATION) {
- if(scale_status!=NO_FUNCTION) {
+ if(scale_status!=NO_ACTION) {
g_source_remove(scale_timer);
gtk_widget_destroy(scale_dialog);
- scale_status=NO_FUNCTION;
+ scale_status=NO_ACTION;
}
}
- if(scale_status==NO_FUNCTION) {
+ if(scale_status==NO_ACTION) {
char title[64];
if (have_rx_gain) {
sprintf(title,"RX GAIN - ADC-%d (dB)",active_receiver->adc);
gtk_range_set_value (GTK_RANGE(agc_scale),receiver[rx]->agc_gain);
} else {
if(scale_status!=AGC_GAIN || scale_rx!=rx) {
- if(scale_status!=NO_FUNCTION) {
+ if(scale_status!=NO_ACTION) {
g_source_remove(scale_timer);
gtk_widget_destroy(scale_dialog);
- scale_status=NO_FUNCTION;
+ scale_status=NO_ACTION;
}
}
- if(scale_status==NO_FUNCTION) {
+ if(scale_status==NO_ACTION) {
scale_status=AGC_GAIN;
scale_rx=rx;
char title[64];
}
void set_af_gain(int rx,double value) {
- g_print("%s\n",__FUNCTION__);
receiver[rx]->volume=value;
SetRXAPanelGain1 (receiver[rx]->id, receiver[rx]->volume);
if(display_sliders) {
gtk_range_set_value (GTK_RANGE(af_gain_scale),receiver[rx]->volume*100.0);
} else {
if(scale_status!=AF_GAIN || scale_rx!=rx) {
- if(scale_status!=NO_FUNCTION) {
+ if(scale_status!=NO_ACTION) {
g_source_remove(scale_timer);
gtk_widget_destroy(scale_dialog);
- scale_status=NO_FUNCTION;
+ scale_status=NO_ACTION;
}
}
- if(scale_status==NO_FUNCTION) {
+ if(scale_status==NO_ACTION) {
scale_status=AF_GAIN;
scale_rx=rx;
char title[64];
gtk_range_set_value (GTK_RANGE(rf_gain_scale),adc[receiver[rx]->id].gain);
} else {
if(scale_status!=RF_GAIN || scale_rx!=rx) {
- if(scale_status!=NO_FUNCTION) {
+ if(scale_status!=NO_ACTION) {
g_source_remove(scale_timer);
gtk_widget_destroy(scale_dialog);
- scale_status=NO_FUNCTION;
+ scale_status=NO_ACTION;
}
}
- if(scale_status==NO_FUNCTION) {
+ if(scale_status==NO_ACTION) {
scale_status=RF_GAIN;
scale_rx=rx;
char title[64];
void set_filter_width(int rx,int width) {
g_print("%s\n",__FUNCTION__);
- if(scale_status!=FILTER_WIDTH || scale_rx!=rx) {
- if(scale_status!=NO_FUNCTION) {
+ if(scale_status!=IF_WIDTH || scale_rx!=rx) {
+ if(scale_status!=NO_ACTION) {
g_source_remove(scale_timer);
gtk_widget_destroy(scale_dialog);
- scale_status=NO_FUNCTION;
+ scale_status=NO_ACTION;
}
}
- if(scale_status==NO_FUNCTION) {
- scale_status=FILTER_WIDTH;
+ if(scale_status==NO_ACTION) {
+ scale_status=IF_WIDTH;
scale_rx=rx;
char title[64];
sprintf(title,"Filter Width RX %d (Hz)",rx);
void set_filter_shift(int rx,int shift) {
g_print("%s\n",__FUNCTION__);
- if(scale_status!=FILTER_SHIFT || scale_rx!=rx) {
- if(scale_status!=NO_FUNCTION) {
+ if(scale_status!=IF_SHIFT || scale_rx!=rx) {
+ if(scale_status!=NO_ACTION) {
g_source_remove(scale_timer);
gtk_widget_destroy(scale_dialog);
- scale_status=NO_FUNCTION;
+ scale_status=NO_ACTION;
}
}
- if(scale_status==NO_FUNCTION) {
- scale_status=FILTER_SHIFT;
+ if(scale_status==NO_ACTION) {
+ scale_status=IF_SHIFT;
scale_rx=rx;
char title[64];
sprintf(title,"Filter SHIFT RX %d (Hz)",rx);
gtk_range_set_value (GTK_RANGE(mic_gain_scale),mic_gain);
} else {
if(scale_status!=MIC_GAIN) {
- if(scale_status!=NO_FUNCTION) {
+ if(scale_status!=NO_ACTION) {
g_source_remove(scale_timer);
gtk_widget_destroy(scale_dialog);
- scale_status=NO_FUNCTION;
+ scale_status=NO_ACTION;
}
}
- if(scale_status==NO_FUNCTION) {
+ if(scale_status==NO_ACTION) {
scale_status=MIC_GAIN;
scale_dialog=gtk_dialog_new_with_buttons("Mic Gain",GTK_WINDOW(top_window),GTK_DIALOG_DESTROY_WITH_PARENT,NULL,NULL);
GtkWidget *content=gtk_dialog_get_content_area(GTK_DIALOG(scale_dialog));
gtk_range_set_value (GTK_RANGE(mic_gain_scale),linein_gain);
} else {
if(scale_status!=LINEIN_GAIN) {
- if(scale_status!=NO_FUNCTION) {
+ if(scale_status!=NO_ACTION) {
g_source_remove(scale_timer);
gtk_widget_destroy(scale_dialog);
- scale_status=NO_FUNCTION;
+ scale_status=NO_ACTION;
}
}
- if(scale_status==NO_FUNCTION) {
+ if(scale_status==NO_ACTION) {
scale_status=LINEIN_GAIN;
scale_dialog=gtk_dialog_new_with_buttons("Linein Gain",GTK_WINDOW(top_window),GTK_DIALOG_DESTROY_WITH_PARENT,NULL,NULL);
GtkWidget *content=gtk_dialog_get_content_area(GTK_DIALOG(scale_dialog));
gtk_range_set_value (GTK_RANGE(drive_scale),value);
} else {
if(scale_status!=DRIVE) {
- if(scale_status!=NO_FUNCTION) {
+ if(scale_status!=NO_ACTION) {
g_source_remove(scale_timer);
gtk_widget_destroy(scale_dialog);
- scale_status=NO_FUNCTION;
+ scale_status=NO_ACTION;
}
}
- if(scale_status==NO_FUNCTION) {
+ if(scale_status==NO_ACTION) {
scale_status=DRIVE;
scale_dialog=gtk_dialog_new_with_buttons("Drive",GTK_WINDOW(top_window),GTK_DIALOG_DESTROY_WITH_PARENT,NULL,NULL);
GtkWidget *content=gtk_dialog_get_content_area(GTK_DIALOG(scale_dialog));
} else {
#endif
if(scale_status!=SQUELCH) {
- if(scale_status!=NO_FUNCTION) {
+ if(scale_status!=NO_ACTION) {
g_source_remove(scale_timer);
gtk_widget_destroy(scale_dialog);
- scale_status=NO_FUNCTION;
+ scale_status=NO_ACTION;
}
}
- if(scale_status==NO_FUNCTION) {
+ if(scale_status==NO_ACTION) {
scale_status=SQUELCH;
char title[64];
sprintf(title,"Squelch RX %d (Hz)",active_receiver->id);
gtk_range_set_value (GTK_RANGE(comp_scale),tx->compressor_level);
} else {
#endif
- if(scale_status!=COMP) {
- if(scale_status!=NO_FUNCTION) {
+ if(scale_status!=COMPRESSION) {
+ if(scale_status!=NO_ACTION) {
g_source_remove(scale_timer);
gtk_widget_destroy(scale_dialog);
- scale_status=NO_FUNCTION;
+ scale_status=NO_ACTION;
}
}
- if(scale_status==NO_FUNCTION) {
- scale_status=COMP;
+ if(scale_status==NO_ACTION) {
+ scale_status=COMPRESSION;
scale_dialog=gtk_dialog_new_with_buttons("COMP",GTK_WINDOW(top_window),GTK_DIALOG_DESTROY_WITH_PARENT,NULL,NULL);
GtkWidget *content=gtk_dialog_get_content_area(GTK_DIALOG(scale_dialog));
comp_scale=gtk_scale_new_with_range(GTK_ORIENTATION_HORIZONTAL,0.0, 20.0, 1.00);
void show_diversity_gain() {
g_print("%s\n",__FUNCTION__);
if(scale_status!=DIVERSITY_GAIN) {
- if(scale_status!=NO_FUNCTION) {
+ if(scale_status!=NO_ACTION) {
g_source_remove(scale_timer);
gtk_widget_destroy(scale_dialog);
- scale_status=NO_FUNCTION;
+ scale_status=NO_ACTION;
}
}
- if(scale_status==NO_FUNCTION) {
+ if(scale_status==NO_ACTION) {
scale_status=DIVERSITY_GAIN;
scale_dialog=gtk_dialog_new_with_buttons("Diversity Gain",GTK_WINDOW(top_window),GTK_DIALOG_DESTROY_WITH_PARENT,NULL,NULL);
GtkWidget *content=gtk_dialog_get_content_area(GTK_DIALOG(scale_dialog));
void show_diversity_phase() {
g_print("%s\n",__FUNCTION__);
if(scale_status!=DIVERSITY_PHASE) {
- if(scale_status!=NO_FUNCTION) {
+ if(scale_status!=NO_ACTION) {
g_source_remove(scale_timer);
gtk_widget_destroy(scale_dialog);
- scale_status=NO_FUNCTION;
+ scale_status=NO_ACTION;
}
}
- if(scale_status==NO_FUNCTION) {
+ if(scale_status==NO_ACTION) {
scale_status=DIVERSITY_PHASE;
scale_dialog=gtk_dialog_new_with_buttons("Diversity Phase",GTK_WINDOW(top_window),GTK_DIALOG_DESTROY_WITH_PARENT,NULL,NULL);
GtkWidget *content=gtk_dialog_get_content_area(GTK_DIALOG(scale_dialog));
#include "receiver.h"
#include "transmitter.h"
-enum {
- NO_FUNCTION=0,
- AF_GAIN,
- RF_GAIN,
- MIC_GAIN,
- LINEIN_GAIN,
- AGC_GAIN,
- DRIVE,
- ATTENUATION,
- SQUELCH,
- COMP,
- FILTER_WIDTH,
- FILTER_SHIFT,
- DIVERSITY_GAIN,
- DIVERSITY_PHASE,
- ZOOM,
- PAN
-};
-
extern gint scale_timer;
extern gint scale_status;
extern gint scale_rx;
}
- int sample_rate=0;
+ int sample_rate=768000;
SoapySDRRange *rx_rates=SoapySDRDevice_getSampleRateRange(sdr, SOAPY_SDR_RX, 0, &rx_rates_length);
fprintf(stderr,"Rx sample rates: ");
for (size_t i = 0; i < rx_rates_length; i++) {
fprintf(stderr,"%f -> %f (%f),", rx_rates[i].minimum, rx_rates[i].maximum, rx_rates[i].minimum/48000.0);
- if(sample_rate==0) {
- if(rx_rates[i].minimum==rx_rates[i].maximum) {
- if(((int)rx_rates[i].minimum%48000)==0) {
- sample_rate=(int)rx_rates[i].minimum;
- }
- } else {
- if((384000.0>=rx_rates[i].minimum) && (384000<=(int)rx_rates[i].maximum)) {
- sample_rate=384000;
- }
- if((768000.0>=rx_rates[i].minimum) && (768000<=(int)rx_rates[i].maximum)) {
- sample_rate=768000;
- }
- }
- }
}
- fprintf(stderr,"\n");
- free(rx_rates);
-
- if(strcmp(driver,"lime")==0) {
- sample_rate=768000;
- } else if(strcmp(driver,"plutosdr")==0) {
- sample_rate=768000;
- } else if(strcmp(driver,"rtlsdr")==0) {
+ if(strcmp(driver,"rtlsdr")==0) {
sample_rate=1536000;
- } else if(strcmp(driver,"sdrplay")==0) {
- //sample_rate=96000;
- sample_rate=768000;
} else if(strcmp(driver,"radioberry")==0) {
sample_rate=48000;
- } else {
- sample_rate=1048576;
}
+ fprintf(stderr,"\n");
+ free(rx_rates);
fprintf(stderr,"sample_rate selected %d\n",sample_rate);
if(tx_channels>0) {
#include "receiver.h"
#include "vfo.h"
#include "button_text.h"
+#include "actions.h"
#include "gpio.h"
#include "i2c.h"
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
+#include "actions.h"
#ifdef GPIO
#include "gpio.h"
#endif
#ifdef CLIENT_SERVER
#include "client_server.h"
#endif
+#include "actions.h"
static int width;
static int height;
gtk_range_set_value (GTK_RANGE(zoom_scale),receiver[rx]->zoom);
} else {
if(scale_status!=ZOOM || scale_rx!=rx) {
- if(scale_status!=NO_FUNCTION) {
+ if(scale_status!=NO_ACTION) {
g_source_remove(scale_timer);
gtk_widget_destroy(scale_dialog);
- scale_status=NO_FUNCTION;
+ scale_status=NO_ACTION;
}
}
receiver_change_zoom(active_receiver,value);
- if(scale_status==NO_FUNCTION) {
+ if(scale_status==NO_ACTION) {
scale_status=ZOOM;
scale_rx=rx;
char title[64];
gtk_range_set_value (GTK_RANGE(pan_scale),receiver[rx]->pan);
} else {
if(scale_status!=PAN || scale_rx!=rx) {
- if(scale_status!=NO_FUNCTION) {
+ if(scale_status!=NO_ACTION) {
g_source_remove(scale_timer);
gtk_widget_destroy(scale_dialog);
- scale_status=NO_FUNCTION;
+ scale_status=NO_ACTION;
}
}
receiver_change_pan(active_receiver,value);
- if(scale_status==NO_FUNCTION) {
+ if(scale_status==NO_ACTION) {
scale_status=PAN;
scale_rx=rx;
char title[64];