Skip to content

Commit

Permalink
Added Sound.spatialize. Made ClatterManager.adjustAudioSettings and C…
Browse files Browse the repository at this point in the history
…latterManager.auto static fields.
  • Loading branch information
alters-mit committed Jul 10, 2023
1 parent cf80dd2 commit eed7095
Show file tree
Hide file tree
Showing 11 changed files with 655 additions and 650 deletions.
2 changes: 1 addition & 1 deletion Clatter/Clatter.CommandLine/Clatter.CommandLine.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<RootNamespace>Clatter.CommandLine</RootNamespace>
<Company>MIT</Company>
<Product>clatter</Product>
<AssemblyVersion>0.1.3</AssemblyVersion>
<AssemblyVersion>0.1.4</AssemblyVersion>
<AssemblyName>clatter</AssemblyName>
</PropertyGroup>

Expand Down
4 changes: 2 additions & 2 deletions Clatter/Clatter.Core/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.1.3")]
[assembly: AssemblyFileVersion("0.1.3")]
[assembly: AssemblyVersion("0.1.4")]
[assembly: AssemblyFileVersion("0.1.4")]
10 changes: 5 additions & 5 deletions Clatter/Clatter.Unity/ClatterManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,11 @@ public class ClatterManager : MonoBehaviour
/// <summary>
/// If true, automatically update by calling Awake(), Update(), and FixedUpdate() (like an ordinary MonoBehaviour object). If this is false, you must manually update instead by calling instance.Awake(), instance.OnUpdate(), and instance.OnFixedUpdate().
/// </summary>
public bool auto = true;
public static bool auto = true;
/// <summary>
/// If true, adjust the global audio settings for better-quality audio.
/// </summary>
public static bool adjustAudioSettings = true;
/// <summary>
/// If true, generate a new random seed.
/// </summary>
Expand All @@ -54,10 +58,6 @@ public class ClatterManager : MonoBehaviour
/// </summary>
public int seed;
/// <summary>
/// If true, adjust the global audio settings for better-quality audio.
/// </summary>
public bool adjustAudioSettings = true;
/// <summary>
/// The audio generator.
/// </summary>
public AudioGenerator generator;
Expand Down
4 changes: 2 additions & 2 deletions Clatter/Clatter.Unity/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.1.3")]
[assembly: AssemblyFileVersion("0.1.3")]
[assembly: AssemblyVersion("0.1.4")]
[assembly: AssemblyFileVersion("0.1.4")]
9 changes: 8 additions & 1 deletion Clatter/Clatter.Unity/Sound.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ public abstract class Sound : MonoBehaviour
/// </summary>
public static Action<Sound, AudioSource> onCreate;
/// <summary>
/// If true, spatialize each AudioSource.
/// </summary>
public static bool spatialize = true;
/// <summary>
/// Invoked when the audio ends.
/// </summary>
public Action<int> onEnd;
Expand Down Expand Up @@ -76,7 +80,10 @@ public static T Create<T>(Samples samples, Vector3d position, int id)
sound.id = id;
sound.samples = samples;
sound.source = go.AddComponent<AudioSource>();
sound.source.spatialize = true;
if (spatialize)
{
sound.source.spatialize = true;
}
// Set the audio clip.
sound.Play(sound.samples.ToFloats());
// Announce creation.
Expand Down
1 change: 0 additions & 1 deletion Clatter/doc_code_examples/Marbles.cs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ private void Awake()
// Add the ClatterManager.
GameObject go = new GameObject("ClatterManager");
ClatterManager cm = go.AddComponent<ClatterManager>();
cm.auto = true;
cm.OnAwake();
}
}
1,254 changes: 625 additions & 629 deletions ClatterUnityExamples/Assembly-CSharp.csproj

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ private void Awake()
clatterObject.amp = 0.2;
// Add the ClatterManager.
ClatterManager clatterManager = new GameObject("ClatterManager").AddComponent<ClatterManager>();
clatterManager.auto = true;
clatterManager.OnAwake();
}
}
1 change: 0 additions & 1 deletion ClatterUnityExamples/Assets/Marbles/Marbles.cs
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@ private void Awake()
// Add the ClatterManager.
GameObject go = new GameObject("ClatterManager");
ClatterManager cm = go.AddComponent<ClatterManager>();
cm.auto = true;
cm.OnAwake();
}
}
14 changes: 7 additions & 7 deletions ClatterUnityExamples/ClatterUnityExamples.sln
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Assembly-CSharp", "Assembly-CSharp.csproj", "{606D97F0-30D5-CB7E-18C8-5FAAAB128105}"
Microsoft Visual Studio Solution File, Format Version 11.00
# Visual Studio 2010
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Assembly-CSharp", "Assembly-CSharp.csproj", "{f0976d60-d530-7ecb-18c8-5faaab128105}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{606D97F0-30D5-CB7E-18C8-5FAAAB128105}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{606D97F0-30D5-CB7E-18C8-5FAAAB128105}.Debug|Any CPU.Build.0 = Debug|Any CPU
{606D97F0-30D5-CB7E-18C8-5FAAAB128105}.Release|Any CPU.ActiveCfg = Release|Any CPU
{606D97F0-30D5-CB7E-18C8-5FAAAB128105}.Release|Any CPU.Build.0 = Release|Any CPU
{f0976d60-d530-7ecb-18c8-5faaab128105}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{f0976d60-d530-7ecb-18c8-5faaab128105}.Debug|Any CPU.Build.0 = Debug|Any CPU
{f0976d60-d530-7ecb-18c8-5faaab128105}.Release|Any CPU.ActiveCfg = Release|Any CPU
{f0976d60-d530-7ecb-18c8-5faaab128105}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
5 changes: 5 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
# 0.1.4

- `ClatterManager.auto` and `ClatterManager.adjustAudioSettings` are now static fields.
- Added: `Sound.spatialize`

# 0.1.3

- Added: `ScrapeMaterialData.roughnessRatioExponent` An exponent for each scrape material's roughness ratio. A lower value will cause all scrape audio to be louder relative to impact audio.
Expand Down

0 comments on commit eed7095

Please sign in to comment.