Skip to content

Commit

Permalink
snd_motu_register_dsp_parameter: add accessor methods for input param…
Browse files Browse the repository at this point in the history
…eters

The cached parameter for register DSP models includes parameters of
inputs.

This commit adds API to refer to the parameters.

Signed-off-by: Takashi Sakamoto <[email protected]>
  • Loading branch information
takaswie committed Nov 17, 2021
1 parent a229960 commit cb4abca
Show file tree
Hide file tree
Showing 3 changed files with 61 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/hinawa.map
Original file line number Diff line number Diff line change
Expand Up @@ -150,4 +150,6 @@ HINAWA_2_4_0 {
"hinawa_snd_motu_register_dsp_parameter_get_headphone_output_paired_assignment";
"hinawa_snd_motu_register_dsp_parameter_get_line_input_boost_flag";
"hinawa_snd_motu_register_dsp_parameter_get_line_input_nominal_level_flag";
"hinawa_snd_motu_register_dsp_parameter_get_input_gain_and_invert";
"hinawa_snd_motu_register_dsp_parameter_get_input_flag";
} HINAWA_2_3_0;
53 changes: 53 additions & 0 deletions src/snd_motu_register_dsp_parameter.c
Original file line number Diff line number Diff line change
Expand Up @@ -301,3 +301,56 @@ void hinawa_snd_motu_register_dsp_parameter_get_line_input_nominal_level_flag(
param = (struct snd_firewire_motu_register_dsp_parameter *)self;
*nominal_level_flag = param->line_input.nominal_level_flag;
}

/**
* hinawa_snd_motu_register_dsp_parameter_get_input_gain_and_invert:
* @self: A #HinawaSndMotuRegisterDspParameter.
* @gain_and_invert: (array fixed-size=10)(out)(transfer none): The array with elements for the data
* of input gain and invert flags.
*
* Get the array with elements for input gain and invert flags. The interpretation of data is
* different in below two groups:
*
* - Ultralite
* - 0x1f: the gain.
* - 0x20: whether to invert phase of the input
* - Audio Express and 4 pre
* - 0x3f: the gain
* - 0x40: whether to invert phase of the input
*/
void hinawa_snd_motu_register_dsp_parameter_get_input_gain_and_invert(
const HinawaSndMotuRegisterDspParameter *self, const guint8 *gain_and_invert[10])
{
struct snd_firewire_motu_register_dsp_parameter *param;

g_return_if_fail(self != NULL);
g_return_if_fail(gain_and_invert != NULL);

param = (struct snd_firewire_motu_register_dsp_parameter *)self;
*gain_and_invert = param->input.gain_and_invert;
}

/**
* hinawa_snd_motu_register_dsp_parameter_get_input_flag:
* @self: A #HinawaSndMotuRegisterDspParameter.
* @flag: (array fixed-size=10)(out)(transfer none): The array with elements for the data of input
* flags.
*
* Get the array with elements for the data of input flags. The data consists of bit flags below:
*
* - 0x01: whether to make paired input
* - 0x02: whether to enable phantom powering
* - 0x04: whether to enable attenuation pad
* - 0x08: whether to detect plug insert to jack
*/
void hinawa_snd_motu_register_dsp_parameter_get_input_flag(
const HinawaSndMotuRegisterDspParameter *self, const guint8 *flag[10])
{
struct snd_firewire_motu_register_dsp_parameter *param;

g_return_if_fail(self != NULL);
g_return_if_fail(flag != NULL);

param = (struct snd_firewire_motu_register_dsp_parameter *)self;
*flag = param->input.flag;
}
6 changes: 6 additions & 0 deletions src/snd_motu_register_dsp_parameter.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,12 @@ void hinawa_snd_motu_register_dsp_parameter_get_line_input_boost_flag(
void hinawa_snd_motu_register_dsp_parameter_get_line_input_nominal_level_flag(
const HinawaSndMotuRegisterDspParameter *self, guint8 *nominal_level_flag);

void hinawa_snd_motu_register_dsp_parameter_get_input_gain_and_invert(
const HinawaSndMotuRegisterDspParameter *self, const guint8 *gain_and_invert[10]);

void hinawa_snd_motu_register_dsp_parameter_get_input_flag(
const HinawaSndMotuRegisterDspParameter *self, const guint8 *flag[10]);

G_END_DECLS

#endif

0 comments on commit cb4abca

Please sign in to comment.