Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
99eca59
Create sound asset subtypes
arthurkehrwald Feb 8, 2025
c9b3efd
Overhaul music playback
arthurkehrwald Feb 10, 2025
17fa2a4
Separate musc request from player
arthurkehrwald Feb 10, 2025
e379315
Format code
arthurkehrwald Feb 10, 2025
99bc805
Remove unneccessary usings
arthurkehrwald Feb 10, 2025
61a1bfe
Update year in copyright notice
arthurkehrwald Feb 10, 2025
23caa65
Remove resharper warning disable
arthurkehrwald Feb 10, 2025
f3adb68
Add callout sounds
arthurkehrwald Feb 10, 2025
b0f300f
Overhaul callout loop
arthurkehrwald Feb 10, 2025
99da652
Change music request API
arthurkehrwald Feb 12, 2025
625f61d
Only sound effects may be spatial
arthurkehrwald Feb 12, 2025
265b6fd
Always _ before private fields
arthurkehrwald Feb 12, 2025
ff11d27
Update AddRequest comment
arthurkehrwald Feb 12, 2025
e50dc5f
Fix sound effect asset inspector
arthurkehrwald Feb 12, 2025
f3b96e0
Fix looping sound effects
arthurkehrwald Feb 12, 2025
4b5a9f9
Add default audio mixer
arthurkehrwald Feb 12, 2025
4d55f62
Set default volume of music assets to 1
arthurkehrwald Feb 12, 2025
14ead5e
Add ducking to audio mixer
arthurkehrwald Feb 12, 2025
0b06949
Change audio ducking parameters
arthurkehrwald Feb 12, 2025
0232daa
Move sound cooldown from component to asset
arthurkehrwald Feb 12, 2025
d8c2188
Correct comments
arthurkehrwald Feb 12, 2025
9bde265
Destroy music player when audio source destroyed
arthurkehrwald Feb 13, 2025
214be64
Add music and callout coordinators during import
arthurkehrwald Feb 13, 2025
21a8b59
Set default pause on callout coordinator
arthurkehrwald Feb 13, 2025
1f9937c
Assign icons to audio scripts
arthurkehrwald Feb 13, 2025
2aefb30
Add comments
arthurkehrwald Feb 13, 2025
a8ecaec
Make MusicRequest.CompareTo readonly
arthurkehrwald Feb 13, 2025
eb581cd
Get music and callout coordinators in parents
arthurkehrwald Feb 13, 2025
2c7a7a6
Create new game objects for music and callouts
arthurkehrwald Feb 13, 2025
a89fe04
Set correct parent object for music player
arthurkehrwald Feb 13, 2025
c9887fd
Use single game object for callouts
arthurkehrwald Feb 13, 2025
1bf2465
Destroy music game objects when finished
arthurkehrwald Feb 13, 2025
c26fc69
Set name of callout game object to callout name
arthurkehrwald Feb 13, 2025
f189e77
Remove spaces from default file names
arthurkehrwald Feb 13, 2025
00a9342
Rename all voice things to callout
arthurkehrwald Feb 13, 2025
035eef8
Fix compiler errors
arthurkehrwald Feb 13, 2025
2dea5c2
Sound component can play music and callouts (incomplete)
arthurkehrwald Feb 13, 2025
75fc7ac
Format sound code
arthurkehrwald Feb 14, 2025
97b9845
Sound component can play music and callouts
arthurkehrwald Feb 14, 2025
dc95bdb
FIx volume settings
arthurkehrwald Feb 14, 2025
651a774
Add GetRequestStatus to CalloutCoordinator
arthurkehrwald Feb 14, 2025
11d174a
Remove unneccessary else statements
arthurkehrwald Feb 14, 2025
6a1f86c
Add MultiPlayMode setting and refactor
arthurkehrwald Feb 15, 2025
aa4ae43
Do not use MonoBehaviour for SoundComponentSoundPlayer types
arthurkehrwald Feb 15, 2025
8be9332
Event sound plays sound on event by default
arthurkehrwald Feb 25, 2025
e9bbab0
Fix gibberish tooltip
arthurkehrwald Feb 25, 2025
ae228c7
Log error if music or sound coordinator missing
arthurkehrwald Feb 25, 2025
f0577e2
Merge remote-tracking branch 'upstream/master' into sound-upgrades
arthurkehrwald Feb 27, 2025
1edaaf9
Patch packing of sound classes
arthurkehrwald Feb 27, 2025
6cffd1b
sounds: Rename some inspectors for consistency.
freezy Mar 9, 2025
eaacaa5
style: Imports, comments, var names.
freezy Mar 9, 2025
210b179
sounds: Make 'em all packable.
freezy Mar 9, 2025
50a59ee
fix: Menu names.
freezy Mar 9, 2025
aeacca0
packaging: Move asset file refs into external packer class.
freezy Mar 9, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ namespace VisualPinball.Unity.Editor
/// This is the root node of the asset library.
///
/// The data itself is stored in a sub object, <see cref="_db"/>. This sub object contains
/// references to the asset meta data, as well as the categories.
/// references to the asset metadata, as well as the categories.
/// </summary>
[CreateAssetMenu(fileName = "Library", menuName = "Pinball/Asset Library", order = 300)]
public class AssetLibrary : ScriptableObject, ISerializationCallbackReceiver
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,8 @@ public GameObject Convert(bool applyPatch = true, string tableName = null)

ConfigurePlayer(componentLookup);

SetUpAudio();

// patch
if (_applyPatch) {
_patcher?.PostPatch(_tableGo);
Expand Down Expand Up @@ -523,6 +525,12 @@ private void CreateTrough(Dictionary<string, IMainComponent> components)
InstantiateAndPersistPrefab(item, components);
}

private void SetUpAudio()
{
_tableGo.AddComponent<CalloutCoordinator>();
_tableGo.AddComponent<MusicCoordinator>();
}

private void CreateFileHierarchy()
{
if (!Directory.Exists("Assets/Tables/")) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
// Visual Pinball Engine
// Copyright (C) 2025 freezy and VPE Team
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.

using UnityEditor;
using UnityEngine;
using UnityEngine.UIElements;

namespace VisualPinball.Unity.Editor
{
[CanEditMultipleObjects]
public class BinaryEventSoundInspector : SoundComponentInspector
{
[SerializeField]
private VisualTreeAsset binaryEventSoundInspectorXml;

public override VisualElement CreateInspectorGUI()
{
var root = base.CreateInspectorGUI();
var inspectorUi = binaryEventSoundInspectorXml.Instantiate();
root.Add(inspectorUi);
return root;
}
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<ui:UXML xmlns:ui="UnityEngine.UIElements" xmlns:uie="UnityEditor.UIElements" xsi="http://www.w3.org/2001/XMLSchema-instance" engine="UnityEngine.UIElements" editor="UnityEditor.UIElements" noNamespaceSchemaLocation="../UIElementsSchema/UIElements.xsd" editor-extension-mode="True">
<uie:PropertyField binding-path="StartWhen" label="Start When" tooltip="When to start playing the sound" />
<uie:PropertyField binding-path="StopWhen" label="Stop When" tooltip="When to stop playing the sound" />
</ui:UXML>

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
// Visual Pinball Engine
// Copyright (C) 2025 freezy and VPE Team
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.

// ReSharper disable InconsistentNaming

using UnityEditor;
using UnityEngine;
using UnityEngine.UIElements;

namespace VisualPinball.Unity.Editor
{
[CustomEditor(typeof(CalloutAsset)), CanEditMultipleObjects]
public class CalloutAssetInspector : SoundAssetInspector
{
[SerializeField]
private VisualTreeAsset _calloutAssetInspector;

public override VisualElement CreateInspectorGUI()
{
var root = new VisualElement();
var baseUi = base.CreateInspectorGUI();
root.Add(baseUi);
var subUi = _calloutAssetInspector.Instantiate();
root.Add(subUi);
return root;
}
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<ui:UXML xmlns:ui="UnityEngine.UIElements" xmlns:uie="UnityEditor.UIElements" xsi="http://www.w3.org/2001/XMLSchema-instance" engine="UnityEngine.UIElements" editor="UnityEditor.UIElements" noNamespaceSchemaLocation="../../../../../UIElementsSchema/UIElements.xsd" editor-extension-mode="True">
<uie:PropertyField binding-path="_volume" label="Volume" />
</ui:UXML>

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Visual Pinball Engine
// Copyright (C) 2023 freezy and VPE Team
// Copyright (C) 2025 freezy and VPE Team
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
Expand All @@ -23,15 +23,15 @@
namespace VisualPinball.Unity.Editor
{
[CustomEditor(typeof(CoilSoundComponent)), CanEditMultipleObjects]
public class CoilSoundComponentInspector : SoundComponentInspector
public class CoilSoundInspector : BinaryEventSoundInspector
{
[SerializeField]
private VisualTreeAsset inspectorXml;
private VisualTreeAsset coilSoundInspectorXml;

public override VisualElement CreateInspectorGUI()
{
var root = base.CreateInspectorGUI();
var inspectorUi = inspectorXml.Instantiate();
var inspectorUi = coilSoundInspectorXml.Instantiate();
root.Add(inspectorUi);
var coilNameDropdown = root.Q<DropdownField>("coil-name");
var coilNameProp = serializedObject.FindProperty(nameof(CoilSoundComponent.CoilName));
Expand All @@ -43,7 +43,11 @@ public override VisualElement CreateInspectorGUI()
private Dictionary<string, string> GetAvailableCoils()
{
var targetComponent = target as Component;
if (targetComponent != null && targetComponent.TryGetComponent<ICoilDeviceComponent>(out var coilDevice)) {
if (
targetComponent != null
&& targetComponent.TryGetComponent<ICoilDeviceComponent>(out var coilDevice)
)
{
return coilDevice.AvailableCoils.ToDictionary(
i => i.Id,
i => string.IsNullOrWhiteSpace(i.Description) ? i.Id : i.Description
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
// Visual Pinball Engine
// Copyright (C) 2025 freezy and VPE Team
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.

using UnityEditor;
using UnityEngine;
using UnityEngine.UIElements;

namespace VisualPinball.Unity.Editor
{
[CustomEditor(typeof(MusicAsset)), CanEditMultipleObjects]
public class MusicAssetInspector : SoundAssetInspector
{
[SerializeField]
private VisualTreeAsset _musicAssetInspectorAsset;

public override VisualElement CreateInspectorGUI()
{
var root = new VisualElement();
var baseUi = base.CreateInspectorGUI();
root.Add(baseUi);
var subUi = _musicAssetInspectorAsset.Instantiate();
root.Add(subUi);
return root;
}
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<ui:UXML xmlns:ui="UnityEngine.UIElements" xmlns:uie="UnityEditor.UIElements" xsi="http://www.w3.org/2001/XMLSchema-instance" engine="UnityEngine.UIElements" editor="UnityEditor.UIElements" noNamespaceSchemaLocation="../../../../../UIElementsSchema/UIElements.xsd" editor-extension-mode="True">
<uie:PropertyField binding-path="_volume" label="Volume" />
</ui:UXML>

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading