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

feat(Sounds): Added Preserve Audio Channels Capability. #3329

Conversation

mitchell-foote
Copy link
Contributor

@mitchell-foote mitchell-foote commented Sep 17, 2023

Description

I've added the ability to preserve the audio channels for 5.1 and above sound files. @alexanderson1993 your comments in the Thorium discord made the fix pretty simple. 👍 Let me know if you see any issues with the change.

Related Issue

#3328

Screenshots (if appropriate):

Screen Shot 2023-09-16 at 9 15 31 PM
  • I submitted a pull request or created an issue for documenting this
    feature on the Thorium Docs
    repo. (Include the issue or pull request url below.)

@mitchell-foote
Copy link
Contributor Author

I've tested it locally on my machine (as far as I could), but I would love to test this on one of the sim computers. Is there a way for me to build a test version of Thorium? I saw some electrum scripts, but I didn't want to do something that could break any released versions.

@mitchell-foote mitchell-foote marked this pull request as draft September 17, 2023 16:24
Copy link
Member

@alexanderson1993 alexanderson1993 left a comment

Choose a reason for hiding this comment

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

I've not tested this yet, but the code looks good, with a few preferred adjustments.

@@ -97,6 +97,14 @@ function PlaySound({updateArgs, args, stations, clients, playSound}) {
value={sound.channel}
onChange={e => updateSound("channel", e.target.value.split(","))}
/>
<div style={{ display: "flex", gap: '1rem', padding: '20px' }}>
<Label>Preserve Audio Channels <small>Advanced</small> </Label>
Copy link
Member

Choose a reason for hiding this comment

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

I would change this to "Preserve Surround Channels Advanced" to make it a little bit clear what its purpose is.

Copy link
Contributor Author

@mitchell-foote mitchell-foote Sep 18, 2023

Choose a reason for hiding this comment

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

How would you feel about me adding a popover with some help text about what these options (Channels and Preserve Surround Channels) do?

Copy link
Member

Choose a reason for hiding this comment

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

Fine with me.

@@ -97,6 +97,14 @@ function PlaySound({updateArgs, args, stations, clients, playSound}) {
value={sound.channel}
onChange={e => updateSound("channel", e.target.value.split(","))}
Copy link
Member

Choose a reason for hiding this comment

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

This input should be disabled/hidden if preserveChannels is true, since it won't have any effect. I would actually move the preserveChannels checkbox above this one to have users select it before editing the channel input.

@@ -10,5 +10,6 @@ export default class Sound {
this.playbackRate = params.playbackRate || 1;
this.channel = params.channel || [0, 1];
this.looping = params.looping || false;
this.preserveChannels = params.preserveChannels || false;
Copy link
Member

Choose a reason for hiding this comment

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

This can default to true, since it will only apply to new sounds. I think this behavior is more expected than the channel down mixing / adjusting behavior.

Suggested change
this.preserveChannels = params.preserveChannels || false;
this.preserveChannels = params.preserveChannels === false ? false : true;

@alexanderson1993
Copy link
Member

I wasn't able to properly test this. Thought I could rig up a virtual 5.1 system, but it didn't pan out how I expected, though it did behave exactly as I expected when the checkbox was ticked - eg. playing the sound through Thorium had the same effect as playing the sound through QuickTime Player..

No matter. If you've managed to test it and it's working as expected in the simulators, we can consider this good to go.

@mitchell-foote mitchell-foote marked this pull request as ready for review October 4, 2023 17:41
@mitchell-foote
Copy link
Contributor Author

@alexanderson1993, alright. PR is ready for final review. I pushed up the tooltips and the disabled states after you approved.

I also noticed the codeclimate check failed due to some duplicate code. Let me know if that's something you want me to dig in and take care of.

@alexanderson1993 alexanderson1993 merged commit c385c68 into Thorium-Sim:develop Oct 4, 2023
1 check failed
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