Skip to content

Conversation

@ranj063
Copy link
Contributor

@ranj063 ranj063 commented Jan 24, 2023

No description provided.

…asses

Make in mandatory for all class definitions to include the instance
attribute. This will ensure that the objects instantiation is uniform
irrespective of the type of object. For example, a widget can be
instantiated as

Object.Widget.gain.1 {}

And a pipeline can be instantiated as

Object.Pipeline.volume-capture.1 {}

Additionally, when including conf files with its own object
instantiations, this will allow for the alsatplg compiler pre-processor
to uniquify the instance IDs for that there are no clashes. This is done
in the next patch.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
@ranj063
Copy link
Contributor Author

ranj063 commented Jan 24, 2023

@perexg conflicts fixed now.

Included conf files could contain additional object instantiations with
the same instance ID as the top-level conf file. For example, the
top-level conf file could contain a PCM object as below:
Object.PCM {
    pcm.10 {
		name    "ssp-capture"
    }
}

If the included conf file could contain a PCM object with the same
instance ID of 1 like:
Object.PCM {
        pcm.10 {
                name    "DMIC"
        }
}

In this case when merging the above conf file with the top-level file,
the first PCM object with name "ssp-capture" will get overridden with the
new one "DMIC". To prevent this and add 2  separate PCM instance, this
function makes sure that the instance ID for the PCM object in the
included file does not clash with the top-level object instances. So the
new conf node will modified to automatically increment the instance ID
to be larger than the largest ID in the top-level conf as below before
getting merged.

Object.PCM {
        pcm.11 {
                name    "DMIC"
        }
}

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
@ranj063
Copy link
Contributor Author

ranj063 commented Feb 2, 2023

@perexg Could I please bother you to have a look at this PR? This will help us simplify included conf files.

@perexg
Copy link
Member

perexg commented Feb 3, 2023

For me, this solution is really complicated, error-prone and very specific. The alsa-lib's conf code can merge arrays, thus if you need a sequence where the identifiers do not play a role, you should use arrays:

Main file:

Object.PCM.pcm [
   {
      definition pcm-first
   }
   {
     definition pcm-second
   }
]

Included file:

Object.PCM.pcm [
  {
     definition pcm-third-included
  }
]

The internal tree (after merge) will look like:

Object.PCM.pcm {
  0 { definition pcm-first }
  1 { definition pcm-second }
  2 { definition pcm-third-included }
}

The snd_config_merge function does merge the arrays.

@ranj063
Copy link
Contributor Author

ranj063 commented Feb 6, 2023

The snd_config_merge function does merge the arrays.

@perexg Thanks for the suggestion. Let me try the arrays and get this working with snd_config_merge().

@ranj063
Copy link
Contributor Author

ranj063 commented Feb 9, 2023

The snd_config_merge function does merge the arrays.

@perexg Thanks for the suggestion. Let me try the arrays and get this working with snd_config_merge().

@perexg using arrays was an awesome suggestion. I dont even need to handle this in the compiler anymore. Thanks again!

@ranj063 ranj063 closed this Feb 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants