1 // Copyright (c) <2012> <Leif Asbrink> 2 // 3 // Permission is hereby granted, free of charge, to any person 4 // obtaining a copy of this software and associated documentation 5 // files (the "Software"), to deal in the Software without restriction, 6 // including without limitation the rights to use, copy, modify, 7 // merge, publish, distribute, sublicense, and/or sell copies of 8 // the Software, and to permit persons to whom the Software is 9 // furnished to do so, subject to the following conditions: 10 // 11 // The above copyright notice and this permission notice shall be 12 // included in all copies or substantial portions of the Software. 13 // 14 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 15 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 16 // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 17 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 18 // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 19 // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 20 // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE 21 // OR OTHER DEALINGS IN THE SOFTWARE. 22 23 24 #include "globdef.h" 25 #include "txdef.h" 26 27 28 int tx_disk_mode; 29 30 int tx_onoff_flag; 31 double tg_basebfreq; 32 int mic_key_pa; 33 int mic_key_px; 34 int screen_count; 35 int tx_lowest_bin; 36 int tx_highest_bin; 37 char *clipfft_mute; 38 char *cliptimf_mute; 39 char *alctimf_mute; 40 float *tx_mic_key; 41 float micfft_winfac; 42 int tg_old_y1; 43 int tg_old_y2; 44 int tg_old_x1; 45 int tg_old_x2; 46 float tx_ssbproc_fqshift; 47 float tx_hware_fqshift; 48 int mic_key_bufsiz; 49 int mic_key_block; 50 int mic_key_mask; 51 int tx_indicator_first_pixel; 52 int old_cw_rise_time; 53 double tx_daout_cos; 54 double tx_daout_sin; 55 double tx_daout_phstep_sin; 56 double tx_daout_phstep_cos; 57 int mic_key_indicator_block; 58 float rg_old_time; 59 float rg_old_gain; 60 float rg_old_zero; 61 62 63 int tx_flag; 64 int tx_graph_scro; 65 int txmem_size; 66 int tx_ad_maxamp; 67 int tx_input_mode; 68 float tx_ideal_delay; 69 float tx_ssb_resamp_block_factor; 70 float tx_resamp_ampfac1; 71 float tx_resamp_ampfac2; 72 MEMREF_T *txmem_handle; 73 int tx_audio_in; 74 int tx_audio_out; 75 short int *txtrace; 76 float txad_hz_per_bin; 77 float txtrace_gain; 78 int txtrace_height; 79 float micfft_bin_minpower_ref; 80 float micfft_bin_minpower; 81 float micfft_minpower_ref; 82 float micfft_minpower; 83 float *mic_filter; 84 int *tx_out_int; 85 86 short int *tx_out_shi; 87 float tx_agc_factor; 88 float tx_agc_decay; 89 float txpwr_decay; 90 float tx_forwardpwr; 91 float tx_backpwr; 92 int tx_output_flag; 93 int tx_ph1; 94 float tx_resample_ratio; 95 float new_tx_resample_ratio; 96 float tx_output_upsample; 97 int tx_resamp_pa; 98 int tx_resamp_px; 99 int tx_filter_ia1; 100 int tx_filter_ia2; 101 int tx_filter_ia3; 102 int tx_filter_ib1; 103 int tx_filter_ib2; 104 int tx_filter_ib3; 105 char display_color[MAX_DISPLAY_TYPES]={0,10,11}; 106 int tx_pre_resample; 107 int tx_wrblock_no; 108 int tx_output_mode; 109 int tx_show_siz; 110 int tx_wsamps; 111 float tx_wttim; 112 float tx_wttim_sum; 113 float tx_wttim_ref; 114 float tx_wttim_diff; 115 int tx_setup_flag; 116 117 float tx_pilot_tone; 118 float tx_output_amplitude; 119 int txout_pa; 120 int txout_px; 121 float mic_key_fx; 122 float *txout_waveform; 123 int max_tx_cw_waveform_points; 124 int tx_cw_waveform_points; 125 int tone_key, tot_key; 126 int tx_waveform_pointer; 127 int old_rxtx_state; 128 int rxtx_state; 129 int rxtx_wait; 130 int tx_mode; 131 132 float *radar_pulse_ston; 133 float *radar_pulse_noise_floor; 134 int *radar_pulse_bin; 135 int *radar_pulse_pointer; 136 MEMREF_T *radar_handle; 137 float *radar_average; 138 int radar_graph_scro; 139 int rg_old_x1; 140 int rg_old_x2; 141 int rg_old_y1; 142 int rg_old_y2; 143 int radar_bins; 144 int radar_maxlines; 145 int radar_lines; 146 int pulse_sep; 147 int pulse_bin; 148 float radar_decayfac; 149 int radar_redraw_count; 150 int radar_update_cnt; 151 float rg_cfac; 152 float rg_czer; 153 int radar_first_bin; 154 int radar_last_bin; 155 int radar_show_bins; 156 157 158 159 160 161 162 163 // *************************************************** 164 // Transform sizes and associated variables. 165 // 166 // *************************************************** 167 // The first time function, data from the soundcard. The transform 168 // size is set for the data to span a suitable time in order to 169 // get a frequency resolution and an associated time delay that 170 // is independent of the microphone input sampling speed. 171 // Size is micsize. 172 short int *mictimf_shi; 173 int *mictimf_int; 174 int micsize; 175 int micn; 176 int mictimf_pa; 177 int mictimf_px; 178 int mictimf_block; 179 int mictimf_bufsiz; 180 int mictimf_mask; 181 float *mic_win; 182 COSIN_TABLE *mic_table; 183 unsigned short int *mic_permute; 184 float *mic_tmp; 185 // *************************************************** 186 // The first FFT. The transforms are likely to span a far too large 187 // frequency range. Only the minimum required to represent the passband 188 // of interest is used for the output of mic_fft 189 // Size is mic_fftsize. 190 float *micfft; 191 int mic_fftsize; 192 int mic_fftn; 193 int mic_fftsize_start; 194 int mic_fftn_start; 195 int mic_sizhalf; 196 int micfft_pa; 197 int micfft_px; 198 int micfft_block; 199 int micfft_bufsiz; 200 int micfft_mask; 201 COSIN_TABLE *micfft_table; 202 unsigned short int *micfft_permute; 203 float *micfft_win; 204 int micfft_indicator_block; 205 // *************************************************** 206 // The second time function. Here we will do clipping. 207 // Size is mic_fftsize. 208 float *cliptimf; 209 int cliptimf_pa; 210 int cliptimf_px; 211 // *************************************************** 212 // The second FFT. Used to clean up the spectrum. 213 // Size is mic_fftsize. 214 float *clipfft; 215 int clipfft_pa; 216 int clipfft_px; 217 // *************************************************** 218 // The third time function. Used for ALC. 219 // We will use this time function for resampling to a new sampling speed 220 // that will be equal to the output speed or a power of two faster or 221 // slower. 222 // The fractional resampler needs an oversampled input and therefore 223 // we first upsample by a power of two here. 224 // Size is alc_fftsize. 225 int alc_fftsize; 226 int alc_fftn; 227 int alc_sizhalf; 228 float *alctimf; 229 float *alctimf_pwrf; 230 float *alctimf_pwrd; 231 int alctimf_pa; 232 int alctimf_pb; 233 float alctimf_fx; 234 int alc_block; 235 int alc_bufsiz; 236 int alc_mask; 237 COSIN_TABLE *alc_table; 238 unsigned short int *alc_permute; 239 float *alc_win; 240 // *************************************************** 241 // The fourth time function, the output from the fractional resampler. 242 // Size is alc_fftsize. 243 // We use transforms one by one so no buffer pointer is needed. 244 // The third FFT is computed in place and the size of the transform 245 // is changed in place to txout_fftsize. 246 float *tx_resamp; 247 float *resamp_tmp; 248 // *************************************************** 249 // The fifth time function. 250 // Size is txout_fftsize. 251 int txout_fftsize; 252 int txout_fftn; 253 int txout_sizhalf; 254 float *txout; 255 float *txout_tmp; 256 COSIN_TABLE *txout_table; 257 unsigned short int *txout_permute; 258 // **************************************************** 259 260 261 char ssbproc_filename[14]="par_ssbproc00"; 262 char cwproc_filename[13]="par_cwproc00"; 263 char *txproc_filename; 264