File: freq.h

package info (click to toggle)
lebiniou 3.67.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 3,500 kB
  • sloc: ansic: 28,670; makefile: 1,276; sh: 602; awk: 432; xml: 261; javascript: 23
file content (57 lines) | stat: -rw-r--r-- 2,008 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
/*
 *  Copyright 1994-2022 Olivier Girondel
 *  Copyright 2019-2022 Laurent Marsac
 *
 *  This file is part of lebiniou.
 *
 *  lebiniou is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation, either version 2 of the License, or
 *  (at your option) any later version.
 *
 *  lebiniou is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with lebiniou. If not, see <http://www.gnu.org/licenses/>.
 */

#ifndef __FREQ_H
#define __FREQ_H


static double  length_min = 0.01;
static double  length_max = 0.15;
static double  spectrum_id_factor = 6;
static double  speed = 1;


void
get_parameters_freq(json_t *params)
{
  plugin_parameters_add_double(params, BPP_LENGTH_MIN, length_min, 0.01, 0.2, 0.01, "Minimum length");
  plugin_parameters_add_double(params, BPP_LENGTH_MAX, length_max, 0.02, 10, 0.01, "Maximum length");
  plugin_parameters_add_double(params, BPP_SPECTRUM_ID_FACTOR, spectrum_id_factor, 0, 10, 0.01, "Spectrum id factor");
  plugin_parameters_add_double(params, BPP_SPEED, speed, 0, 10, 0.01, "Speed");
}


void
set_parameters_freq(const Context_t *ctx, const json_t *in_parameters)
{
  double __length_min = length_min, __length_max = length_max;

  plugin_parameter_parse_double_range(in_parameters, BPP_LENGTH_MIN, &__length_min);
  plugin_parameter_parse_double_range(in_parameters, BPP_LENGTH_MAX, &__length_max);
  if (__length_min <= __length_max) {
    length_min = __length_min;
    length_max = __length_max;
  }

  plugin_parameter_parse_double_range(in_parameters, BPP_SPECTRUM_ID_FACTOR, &spectrum_id_factor);
  plugin_parameter_parse_double_range(in_parameters, BPP_SPEED, &speed);
}

#endif /* __FREQ_H */