Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow multi-select, pick random sound #6

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

FrozenSake
Copy link

Changes the Sound Effect component to allow multi-selection from the open file dialogue, modifies the PlaySound function to choose a random sound from said list.

Tested with: no sounds, one sound, varying numbers of chosen sounds.

@rtsonneveld
Copy link

Exactly what I wanted! Would be great if this got merged! :)

foreach (String file in fileDialog.FileNames)
{
path = path + "," + file;
}

textBox.Text = path;
callback(path);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a reason we can't return an array of strings here instead?

Copy link
Author

@FrozenSake FrozenSake Jul 10, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, that should work, and would be smoother. I'm currently laid up from Vaxx # 2, but I can look into cleaning that up this weekend hopefully.

Copy link
Author

@FrozenSake FrozenSake Jul 11, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm looking in to it now. It "works", but problems comes up with SettingsHelper. I'm currently fiddling to figure out how to get it to behave correctly, specifically around loading settings and saving empty fields.

{{EDIT: It may actually be the text box data binding that's the issue}}

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was both. I think I handled it now.

Create New Data Bindings to handle array based
Update SettingsHelper calls to translate Arrays to Strings and back
Update PlaySound logic to use Array
Update onsplit call to use array
SettingsHelper.CreateSetting(document, parent, "Pause", Pause) ^
SettingsHelper.CreateSetting(document, parent, "Resume", Resume) ^
SettingsHelper.CreateSetting(document, parent, "StartTimer", StartTimer) ^
SettingsHelper.CreateSetting(document, parent, "Split", string.Join(",", Split)) ^
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we'd want to store the multiple paths as child XML elements instead of having a comma separated list.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm wanting this functionality, but unsure how the SettingsHelper works. Are you suggesting looping over Split and adding each to "Split1", "Split2", or something similar?

Copy link
Author

@FrozenSake FrozenSake Aug 13, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, that's a refactor that I could potentially look in to, but honestly since it takes ~5-6 months per review, and I do not program in C# any more, I've largely given up on this pull request.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I held off on making changes too, in hopes my comment would lead to more info. It seems the maintainers have other plans than getting this and the other PRs ready. Understandable, everyone's busy these days 🤷

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd suggest bumping the PR (by leaving a comment and tagging me) to get quicker reviews. But yeah, I've been pretty busy with other stuff recently.

I was hoping the XML would look something like this:

<Split>
  <Sound>my sound 1</Sound>
  <Sound>my sound 2</Sound>
</Split>

I'm not entirely sure how you do that with the SettingsHelper, but it should be possible. The Splits component might be a good reference, since that component has a list of columns in its settings.

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.

4 participants