Skip to content

conf: refine check for snd_config_is_array - #158

Closed
ranj063 wants to merge 1 commit into
alsa-project:masterfrom
ranj063:fix/config_is_array
Closed

ranj063 wants to merge 1 commit into
alsa-project:masterfrom
ranj063:fix/config_is_array

Conversation

@ranj063

@ranj063 ranj063 commented Jun 15, 2021

Copy link
Copy Markdown

Apart from checking the index, also check if the
node is not compound to qualify a config as an array.

For ex:

mixer [
"mixer1"
]

is an array but

mixer.0 {
name "mixer 1"
}

is not an array even though the id is 0.

Signed-off-by: Ranjani Sridharan [email protected]

Apart from checking the index, also check if the
node is not compound to qualify a config as an array.

For ex:

mixer [
	"mixer1"
]

is an array but

mixer.0 {
	name	"mixer 1"
}

is not an array even though the id is 0.

Signed-off-by: Ranjani Sridharan <[email protected]>
@perexg

perexg commented Jun 16, 2021

Copy link
Copy Markdown
Member

It's valid array:

mixer.0 {
	name	"mixer 1"
}

# equal to

mixer [
        name "mixer 1"
]

@ranj063

ranj063 commented Jun 16, 2021 •

Copy link
Copy Markdown
Author

It's valid array:

mixer.0 {
	name	"mixer 1"
}

# equal to

mixer [
        name "mixer 1"
]

@Perex is there a way for me to avoid a config like this being called an array
mixer.0 {
name "mixer 1"
}

so when I merge the the config below with snd_config_merge()
mixer.0 {
max 32
},

I get the compound with an integer and a string config as below:
mixer.0 {
name "mixer 1"
max 32
}

instead of an array with 2 strings?
mixer [
name "mixer 1"
max 32
]

@perexg

perexg commented Jun 16, 2021

Copy link
Copy Markdown
Member

Just add a dummy id to the mixer compound:

mixer.comment "Something"
mixer.0.name "mixer 1"
mixer.0.max 32

@ranj063

ranj063 commented Jun 16, 2021

Copy link
Copy Markdown
Author

Just add a dummy id to the mixer compound:

mixer.comment "Something"
mixer.0.name "mixer 1"
mixer.0.max 32

Thanks @Perex. I got around the problem by starting my mixer ID's with a 1 instead of starting with a 0.

@ranj063 ranj063 closed this Jun 16, 2021
@perexg

perexg commented Jun 16, 2021

Copy link
Copy Markdown
Member

Yes, it's another option.

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.

2 participants