Skip to content

Commit ef31be9

Browse files
committed
Fix an amplitude or pulse modulation bug
A change was made to improve the resolution. But some file wasn't been updated.
1 parent 1692cc1 commit ef31be9

3 files changed

Lines changed: 14 additions & 11 deletions

File tree

cpp_version/params_input_mnemos.cpp

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -537,12 +537,15 @@ string input_params_mnemos_2_action::FreqDelay_strings_2_val(unsigned long&value
537537
// step 6:
538538
switch ( post_proc )
539539
{
540-
case 1:
540+
case 0:
541541
// Used by amplitude modulation frequency
542-
the_val *= 16777216.0 / ( 48000.0 * 4.0 );
542+
the_val *= 16777216.0 * 2.0 / ( 48000.0 * 4.0 );
543543
break;
544-
case 4:
544+
case 2:
545545
// Used by pulse modulation frequency
546+
the_val *= 16777216.0 / ( 48000.0 * 4.0 * 2.0 );
547+
break;
548+
case 4:
546549
// Used by base frequency
547550
the_val *= 16777216.0 / ( 48000.0 * 4.0 * 4.0 );
548551
break;
@@ -780,10 +783,10 @@ input_params_mnemos_2_action::input_params_mnemos_2_action( ostream&out_info_str
780783
return Mode_strings_2_val( value, numeric_limits<unsigned long>::max() );}},
781784
{"af",[&](unsigned long&value,signals_param_action::action_list&act)->string{
782785
act=signals_param_action::ampl_modul_freq;
783-
return FreqDelay_strings_2_val(value,true,1);}},
786+
return FreqDelay_strings_2_val(value,true,0);}},
784787
{"bf",[&](unsigned long&value,signals_param_action::action_list&act)->string{
785788
act=signals_param_action::pulse_freq;
786-
return FreqDelay_strings_2_val(value,true,4);}},
789+
return FreqDelay_strings_2_val(value,true,2);}},
787790
{"bh",[&](unsigned long&value,signals_param_action::action_list&act)->string{
788791
act=signals_param_action::pulse_high_hold;
789792
return FreqDelay_strings_2_val(value,false,-2);}},

cpp_version/params_output_mnemos.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ void output_params_mnemos::export_next_event(const unsigned long&absolute_TS,
5757
out_line << "S" << "\t% slew-rate" << endl;
5858
break;
5959
case signals_param_action::ampl_modul_freq:
60-
val_float = (float)action.value * 48000.0 * 4.0 / 16777216.0;
60+
val_float = (float)action.value * 48000.0 * 4.0 / ( 16777216.0 * 2.0 );
6161
out_line << "AF " << val_float;
6262
out_line << "Hz " << "\t% amplitude modulation frequency" << endl;
6363
break;
@@ -66,7 +66,7 @@ void output_params_mnemos::export_next_event(const unsigned long&absolute_TS,
6666
out_line << "% " << "\t% amplitude modulation depth" << endl;
6767
break;
6868
case signals_param_action::pulse_freq:
69-
val_float = (float)action.value * 48000.0 * 4.0 * 4.0 / 16777216.0;
69+
val_float = (float)action.value * 48000.0 * 4.0 * 2.0 / 16777216.0;
7070
out_line << "BF " << val_float;
7171
out_line << "Hz " << "\t% pulse modulation frequency" << endl;
7272
break;

cpp_version/params_output_txt.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -81,19 +81,19 @@ void output_params_txt::export_next_event(const unsigned long&absolute_TS,
8181
out_line << ")" << endl;
8282
break;
8383
case signals_param_action::ampl_modul_freq:
84-
val_float = (float)action.value * 48000.0 * 4.0 / 16777216.0;
84+
val_float = (float)action.value * 48000.0 * 4.0 / ( 16777216.0 * 2.0 );
8585
out_line << "Sets the amplitude modulation frequency " << hex << action.value;
8686
out_line << ", means: " << val_float;
87-
out_line << "Hz (step: " << (48000.0 * 4.0 / 16777216.0) << ")" << endl;
87+
out_line << "Hz (step: " << (48000.0 * 4.0 / ( 16777216.0 * 2.0)) << ")" << endl;
8888
break;
8989
case signals_param_action::ampl_modul_depth:
9090
out_line << "Sets the amplitude modulation depth " << hex << action.value;
9191
out_line << ", means: " << dec << action.value << " (0-255)"<<endl;
9292
break;
9393
case signals_param_action::pulse_freq:
94-
val_float = (float)action.value * 48000.0 * 4.0 * 4.0 / 16777216.0;
94+
val_float = (float)action.value * 48000.0 * 4.0 * 2.0 / 16777216.0;
9595
out_line << "Set pulse frequency " << hex << action.value << ", means: " << val_float;
96-
out_line << "Hz (step: " << (2.0 * 48000.0 * 4.0 * 4.0 / 16777216.0) << ")" << endl;
96+
out_line << "Hz (step: " << (2.0 * 48000.0 * 4.0 * 2.0 / 16777216.0) << ")" << endl;
9797
break;
9898
case signals_param_action::pulse_high_hold:
9999
val_float = (float)action.value * 16.0 * 2.0 / 48000.0;

0 commit comments

Comments
 (0)