1
1
//
2
2
// This file is part of Dire Wolf, an amateur radio packet TNC.
3
3
//
4
- // Copyright (C) 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2021 John Langner, WB2OSZ
4
+ // Copyright (C) 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2021, 2023 John Langner, WB2OSZ
5
5
//
6
6
// This program is free software: you can redistribute it and/or modify
7
7
// it under the terms of the GNU General Public License as published by
@@ -755,12 +755,13 @@ void config_init (char *fname, struct audio_s *p_audio_config,
755
755
strlcpy (p_audio_config -> adev [adevice ].adevice_out , DEFAULT_ADEVICE , sizeof (p_audio_config -> adev [adevice ].adevice_out ));
756
756
757
757
p_audio_config -> adev [adevice ].defined = 0 ;
758
+ p_audio_config -> adev [adevice ].copy_from = -1 ;
758
759
p_audio_config -> adev [adevice ].num_channels = DEFAULT_NUM_CHANNELS ; /* -2 stereo */
759
760
p_audio_config -> adev [adevice ].samples_per_sec = DEFAULT_SAMPLES_PER_SEC ; /* -r option */
760
761
p_audio_config -> adev [adevice ].bits_per_sample = DEFAULT_BITS_PER_SAMPLE ; /* -8 option for 8 instead of 16 bits */
761
762
}
762
763
763
- p_audio_config -> adev [0 ].defined = 1 ;
764
+ p_audio_config -> adev [0 ].defined = 2 ; // 2 means it was done by default and not the user's config file.
764
765
765
766
for (channel = 0 ; channel < MAX_CHANS ; channel ++ ) {
766
767
int ot , it ;
@@ -925,10 +926,13 @@ void config_init (char *fname, struct audio_s *p_audio_config,
925
926
926
927
p_misc_config -> maxframe_extended = AX25_K_MAXFRAME_EXTENDED_DEFAULT ; /* Max frames to send before ACK. mod 128 "Window" size. */
927
928
928
- p_misc_config -> maxv22 = AX25_N2_RETRY_DEFAULT / 3 ; /* Max SABME before falling back to SABM. */
929
- p_misc_config -> v20_addrs = NULL ; /* Go directly to v2.0 for stations listed. */
929
+ p_misc_config -> maxv22 = AX25_N2_RETRY_DEFAULT / 3 ; /* Send SABME this many times before falling back to SABM. */
930
+ p_misc_config -> v20_addrs = NULL ; /* Go directly to v2.0 for stations listed */
931
+ /* without trying v2.2 first. */
930
932
p_misc_config -> v20_count = 0 ;
931
933
p_misc_config -> noxid_addrs = NULL ; /* Don't send XID to these stations. */
934
+ /* Might work with a partial v2.2 implementation */
935
+ /* on the other end. */
932
936
p_misc_config -> noxid_count = 0 ;
933
937
934
938
/*
@@ -1012,7 +1016,11 @@ void config_init (char *fname, struct audio_s *p_audio_config,
1012
1016
* ADEVICE plughw:1,0 -- same for in and out.
1013
1017
* ADEVICE plughw:2,0 plughw:3,0 -- different in/out for a channel or channel pair.
1014
1018
* ADEVICE1 udp:7355 default -- from Software defined radio (SDR) via UDP.
1015
- *
1019
+ *
1020
+ * New in 1.8: Ability to map to another audio device.
1021
+ * This allows multiple modems (i.e. data speeds) on the same audio interface.
1022
+ *
1023
+ * ADEVICEn = n -- Copy from different already defined channel.
1016
1024
*/
1017
1025
1018
1026
/* Note that ALSA name can contain comma such as hw:1,0 */
@@ -1040,17 +1048,42 @@ void config_init (char *fname, struct audio_s *p_audio_config,
1040
1048
exit (EXIT_FAILURE );
1041
1049
}
1042
1050
1051
+ // Do not allow same adevice to be defined more than once.
1052
+ // Overriding the default for adevice 0 is ok.
1053
+ // In that case definded was 2. That's why we check for 1, not just non-zero.
1054
+
1055
+ if (p_audio_config -> adev [adevice ].defined == 1 ) { // 1 means defined by user.
1056
+ text_color_set (DW_COLOR_ERROR );
1057
+ dw_printf ("Config file: ADEVICE%d can't be defined more than once. Line %d.\n" , adevice , line );
1058
+ continue ;
1059
+ }
1060
+
1043
1061
p_audio_config -> adev [adevice ].defined = 1 ;
1044
-
1045
- /* First channel of device is valid. */
1046
- p_audio_config -> chan_medium [ADEVFIRSTCHAN (adevice )] = MEDIUM_RADIO ;
1047
1062
1048
- strlcpy (p_audio_config -> adev [adevice ].adevice_in , t , sizeof (p_audio_config -> adev [adevice ].adevice_in ));
1049
- strlcpy (p_audio_config -> adev [adevice ].adevice_out , t , sizeof (p_audio_config -> adev [adevice ].adevice_out ));
1063
+ // New case for release 1.8.
1050
1064
1051
- t = split (NULL ,0 );
1052
- if (t != NULL ) {
1065
+ if (strcmp (t , "=" ) == 0 ) {
1066
+ t = split (NULL ,0 );
1067
+ if (t != NULL ) {
1068
+
1069
+ }
1070
+
1071
+ ///////// to be continued.... FIXME
1072
+
1073
+ }
1074
+ else {
1075
+ /* First channel of device is valid. */
1076
+ // This might be changed to UDP or STDIN when the device name is examined.
1077
+ p_audio_config -> chan_medium [ADEVFIRSTCHAN (adevice )] = MEDIUM_RADIO ;
1078
+
1079
+ strlcpy (p_audio_config -> adev [adevice ].adevice_in , t , sizeof (p_audio_config -> adev [adevice ].adevice_in ));
1053
1080
strlcpy (p_audio_config -> adev [adevice ].adevice_out , t , sizeof (p_audio_config -> adev [adevice ].adevice_out ));
1081
+
1082
+ t = split (NULL ,0 );
1083
+ if (t != NULL ) {
1084
+ // Different audio devices for receive and transmit.
1085
+ strlcpy (p_audio_config -> adev [adevice ].adevice_out , t , sizeof (p_audio_config -> adev [adevice ].adevice_out ));
1086
+ }
1054
1087
}
1055
1088
}
1056
1089
@@ -2173,7 +2206,7 @@ void config_init (char *fname, struct audio_s *p_audio_config,
2173
2206
else {
2174
2207
p_audio_config -> achan [channel ].slottime = DEFAULT_SLOTTIME ;
2175
2208
text_color_set (DW_COLOR_ERROR );
2176
- dw_printf ("Line %d: Invalid delay time for persist algorithm. Using %d.\n" ,
2209
+ dw_printf ("Line %d: Invalid delay time for persist algorithm. Using default %d.\n" ,
2177
2210
line , p_audio_config -> achan [channel ].slottime );
2178
2211
}
2179
2212
}
@@ -2197,7 +2230,7 @@ void config_init (char *fname, struct audio_s *p_audio_config,
2197
2230
else {
2198
2231
p_audio_config -> achan [channel ].persist = DEFAULT_PERSIST ;
2199
2232
text_color_set (DW_COLOR_ERROR );
2200
- dw_printf ("Line %d: Invalid probability for persist algorithm. Using %d.\n" ,
2233
+ dw_printf ("Line %d: Invalid probability for persist algorithm. Using default %d.\n" ,
2201
2234
line , p_audio_config -> achan [channel ].persist );
2202
2235
}
2203
2236
}
@@ -2216,6 +2249,19 @@ void config_init (char *fname, struct audio_s *p_audio_config,
2216
2249
}
2217
2250
n = atoi (t );
2218
2251
if (n >= 0 && n <= 255 ) {
2252
+ text_color_set (DW_COLOR_ERROR );
2253
+ if (n == 0 ) {
2254
+ dw_printf ("Line %d: Setting TXDELAY to 0 is a REALLY BAD idea if you want other stations to hear you.\n" ,
2255
+ line );
2256
+ dw_printf ("Line %d: See User Guide, \"Radio Channel - Transmit Timing\" for an explanation.\n" ,
2257
+ line );
2258
+ }
2259
+ if (n >= 100 ) {
2260
+ dw_printf ("Line %d: Keeping with tradition, going back to the 1980s, TXDELAY is in 10 millisecond units.\n" ,
2261
+ line );
2262
+ dw_printf ("Line %d: The value %d would be %.3f seconds which seems rather excessive. Are you sure you want that?\n" ,
2263
+ line , n , (double )n * 10. / 1000. );
2264
+ }
2219
2265
p_audio_config -> achan [channel ].txdelay = n ;
2220
2266
}
2221
2267
else {
@@ -2240,6 +2286,18 @@ void config_init (char *fname, struct audio_s *p_audio_config,
2240
2286
}
2241
2287
n = atoi (t );
2242
2288
if (n >= 0 && n <= 255 ) {
2289
+ if (n == 0 ) {
2290
+ dw_printf ("Line %d: Setting TXTAIL to 0 is a REALLY BAD idea if you want other stations to hear you.\n" ,
2291
+ line );
2292
+ dw_printf ("Line %d: See User Guide, \"Radio Channel - Transmit Timing\" for an explanation.\n" ,
2293
+ line );
2294
+ }
2295
+ if (n >= 50 ) {
2296
+ dw_printf ("Line %d: Keeping with tradition, going back to the 1980s, TXTAIL is in 10 millisecond units.\n" ,
2297
+ line );
2298
+ dw_printf ("Line %d: The value %d would be %.3f seconds which seems rather excessive. Are you sure you want that?\n" ,
2299
+ line , n , (double )n * 10. / 1000. );
2300
+ }
2243
2301
p_audio_config -> achan [channel ].txtail = n ;
2244
2302
}
2245
2303
else {
0 commit comments