add unit test
This commit is contained in:
parent
757df84bdb
commit
1267a9715a
16 changed files with 1018 additions and 589 deletions
|
@ -15,7 +15,8 @@
|
|||
<e p="RectangularSelection.cs" t="Include" />
|
||||
<e p="SpectrumGenerator.cs" t="Include" />
|
||||
<e p="UnitTest" t="Include">
|
||||
<e p="UnitTest_ParameterResponder.cs" t="Include" />
|
||||
<e p="UnitTest_ChangeObserver.cs" t="Include" />
|
||||
<e p="UnitTest_SpectrumGenerator.cs" t="Include" />
|
||||
</e>
|
||||
</e>
|
||||
<e p="Resources" t="Include">
|
||||
|
@ -32,16 +33,17 @@
|
|||
</e>
|
||||
</e>
|
||||
<e p="Scripts" t="Include">
|
||||
<e p="DataModel" t="Include">
|
||||
<e p="Parameter.cs" t="Include" />
|
||||
</e>
|
||||
<e p="PdConnection" t="Include">
|
||||
<e p="FFTArrayContainer.cs" t="Include" />
|
||||
<e p="PdArray.cs" t="Include" />
|
||||
<e p="PdBackend.cs" t="Include" />
|
||||
<e p="PdConstant.cs" t="Include" />
|
||||
<e p="PdProcess.cs" t="Include" />
|
||||
<e p="PdSocket.cs" t="Include" />
|
||||
<e p="PdSpectrumBind.cs" t="Include" />
|
||||
<e p="UdpSender.cs" t="Include" />
|
||||
</e>
|
||||
<e p="TemplateLibrary" t="Include">
|
||||
<e p="ChangeObserver.cs" t="Include" />
|
||||
</e>
|
||||
<e p="Versioning" t="Include">
|
||||
<e p="VersionToggleBehaviour.cs" t="Include" />
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -64,6 +64,7 @@
|
|||
<Compile Include="Assets\Editor\RectangularSelection.cs" />
|
||||
<Compile Include="Assets\Editor\SpectrumGenerator.cs" />
|
||||
<Compile Include="Assets\Editor\UnitTest\UnitTest_ChangeObserver.cs" />
|
||||
<Compile Include="Assets\Editor\UnitTest\UnitTest_SpectrumGenerator.cs" />
|
||||
<Compile Include="Assets\Scripts\VideoInput\Editor\UnitTest\ComponentFactoryTestCase.cs" />
|
||||
<Compile Include="Assets\Scripts\VideoInput\Editor\UnitTest\KinectSensorTestCase.cs" />
|
||||
<Compile Include="Assets\ThridParty\Editor\KinectCopyPluginDataHelper.cs" />
|
||||
|
|
|
@ -44,8 +44,6 @@ namespace cylvester
|
|||
pdBackend_.mainPatch = GUILayout.TextField(pdBackend_.mainPatch, 30);
|
||||
GUILayout.EndHorizontal();
|
||||
|
||||
pdBackend_.inchannels = EditorGUILayout.Popup("Number of input channels", pdBackend_.inchannels, channels_);
|
||||
|
||||
if (Application.isPlaying)
|
||||
{
|
||||
RenderSamplePlayback();
|
||||
|
|
|
@ -19,7 +19,6 @@ namespace cylvester
|
|||
private SerializedProperty selectionProperty_;
|
||||
private SerializedProperty pdBackendProperty_;
|
||||
|
||||
|
||||
public void OnEnable()
|
||||
{
|
||||
spectrumGenerator_ = new SpectrumGenerator(TextureWidth, TextureHeight);
|
||||
|
@ -27,7 +26,6 @@ namespace cylvester
|
|||
|
||||
pdBackendProperty_ = serializedObject.FindProperty("pdBackend");
|
||||
selectionProperty_ = serializedObject.FindProperty("selection");
|
||||
|
||||
}
|
||||
|
||||
public override void OnInspectorGUI()
|
||||
|
@ -40,13 +38,11 @@ namespace cylvester
|
|||
|
||||
RenderSpectrumExtractor(behaviour);
|
||||
serializedObject.ApplyModifiedProperties();
|
||||
|
||||
}
|
||||
|
||||
private void RenderSpectrumExtractor(IPdSpectrumBind behaviour)
|
||||
{
|
||||
UpdateSelection(behaviour);
|
||||
|
||||
RenderSelection();
|
||||
GUILayout.Space(5);
|
||||
GUILayout.Label("Spectrum Extractor", EditorStyles.boldLabel);
|
||||
|
||||
|
@ -63,32 +59,36 @@ namespace cylvester
|
|||
GUI.DrawTexture(paintSpace_, spectrumGenerator_.Spectrum);
|
||||
}
|
||||
|
||||
GUILayout.BeginHorizontal();
|
||||
GUILayout.Label("Extracted Energy", EditorStyles.boldLabel);
|
||||
GUILayout.Label(behaviour.Energy.ToString());
|
||||
GUILayout.EndHorizontal();
|
||||
|
||||
Repaint();
|
||||
RenderExtractedEnergy(behaviour.Energy);
|
||||
|
||||
}
|
||||
|
||||
private void UpdateSelection(IPdSpectrumBind behaviour)
|
||||
private void RenderSelection()
|
||||
{
|
||||
if (Event.current.isMouse && Event.current.button == 0)
|
||||
if (!Event.current.isMouse || Event.current.button != 0) return;
|
||||
switch (Event.current.type)
|
||||
{
|
||||
switch (Event.current.type)
|
||||
case EventType.MouseDown:
|
||||
{
|
||||
case EventType.MouseDown:
|
||||
{
|
||||
rectangularSelection_.Start(Event.current.mousePosition);
|
||||
break;
|
||||
}
|
||||
case EventType.MouseDrag:
|
||||
{
|
||||
selectionProperty_.rectValue = rectangularSelection_.Update(Event.current.mousePosition, ref paintSpace_);
|
||||
break;
|
||||
}
|
||||
rectangularSelection_.Start(Event.current.mousePosition);
|
||||
break;
|
||||
}
|
||||
case EventType.MouseDrag:
|
||||
{
|
||||
selectionProperty_.rectValue = rectangularSelection_.Update(Event.current.mousePosition, ref paintSpace_);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void RenderExtractedEnergy(int energy)
|
||||
{
|
||||
GUILayout.BeginHorizontal();
|
||||
GUILayout.Label("Extracted Energy", EditorStyles.boldLabel);
|
||||
GUILayout.Label(energy.ToString());
|
||||
GUILayout.EndHorizontal();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,20 +10,19 @@ namespace cylvester
|
|||
|
||||
public class SpectrumGenerator : ISpectrumGenerator
|
||||
{
|
||||
private Texture2D texture_;
|
||||
public Texture2D Spectrum => texture_;
|
||||
public Texture2D Spectrum { get; }
|
||||
|
||||
public SpectrumGenerator(int width, int height)
|
||||
{
|
||||
texture_ = new Texture2D(width, height);
|
||||
Spectrum = new Texture2D(width, height);
|
||||
}
|
||||
|
||||
public int Update(IPdArray pdArray, Rect selectionRect)
|
||||
{
|
||||
var numPixels = 0;
|
||||
for (var x = 0; x < texture_.width; x++)
|
||||
for (var x = 0; x < Spectrum.width; x++)
|
||||
{
|
||||
for (var y = 0; y < texture_.height; y++)
|
||||
for (var y = 0; y < Spectrum.height; y++)
|
||||
{
|
||||
var color = Color.black;
|
||||
var validPixel = false;
|
||||
|
@ -35,23 +34,28 @@ namespace cylvester
|
|||
color = validPixel ? Color.green : Color.black;
|
||||
}
|
||||
|
||||
var mY = texture_.height - selectionRect.y;
|
||||
if ((selectionRect.x < x && x < (selectionRect.x + selectionRect.width)) &&
|
||||
(mY - selectionRect.height < y && y < mY))
|
||||
if (IsInSelection(x, y, ref selectionRect))
|
||||
{
|
||||
color.a = 1f;
|
||||
if (validPixel)
|
||||
numPixels++;
|
||||
}
|
||||
else
|
||||
{
|
||||
color.a = 0.2f;
|
||||
}
|
||||
texture_.SetPixel(x, y, color);
|
||||
|
||||
Spectrum.SetPixel(x, y, color);
|
||||
}
|
||||
}
|
||||
texture_.Apply();
|
||||
Spectrum.Apply();
|
||||
return numPixels;
|
||||
}
|
||||
|
||||
private bool IsInSelection(int x, int y, ref Rect selectionRect)
|
||||
{
|
||||
var inRectHorizontally = selectionRect.x < x && x < selectionRect.x + (selectionRect.width-1);
|
||||
var mY = Spectrum.height - selectionRect.y;
|
||||
var inRectVertically = mY - (selectionRect.height-1) < y && y < mY;
|
||||
return inRectHorizontally && inRectVertically;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,87 @@
|
|||
using NUnit.Framework;
|
||||
using NSubstitute;
|
||||
using UnityEngine;
|
||||
|
||||
namespace cylvester
|
||||
{
|
||||
[TestFixture]
|
||||
public class UnitTest_SpectrumGenerator
|
||||
{
|
||||
private IPdArray pdArray_;
|
||||
private Rect selectionRect_;
|
||||
private float[] dummyData_;
|
||||
private Color standardColor_;
|
||||
private Color selectedColor_;
|
||||
|
||||
[SetUp]
|
||||
public void SetUp()
|
||||
{
|
||||
pdArray_ = Substitute.For<IPdArray>();
|
||||
selectionRect_ = new Rect {x = 9, y = 9, width = 3, height = 3};
|
||||
dummyData_ = new float[100];
|
||||
|
||||
for (var i = 0; i < dummyData_.Length; ++i)
|
||||
{
|
||||
dummyData_[i] = i / (float)dummyData_.Length;
|
||||
}
|
||||
|
||||
standardColor_ = new Color(0f, 0f, 0f, 0.2f);
|
||||
selectedColor_ = new Color(0f, 0f, 0f, 1f);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Construction()
|
||||
{
|
||||
var spectrumGenerator = new SpectrumGenerator(100, 101);
|
||||
|
||||
Assert.AreEqual(100, spectrumGenerator.Spectrum.width);
|
||||
Assert.AreEqual(101, spectrumGenerator.Spectrum.height);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Update_array_available()
|
||||
{
|
||||
var spectrumGenerator = new SpectrumGenerator(100, 100);
|
||||
spectrumGenerator.Update(pdArray_, selectionRect_);
|
||||
|
||||
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Update_array_unavailable()
|
||||
{
|
||||
var noSelection = new Rect {width = 0, height = 0};
|
||||
var spectrumGenerator = new SpectrumGenerator(100, 100);
|
||||
var validPixels = spectrumGenerator.Update(null, noSelection);
|
||||
|
||||
Assert.AreEqual(0, validPixels);
|
||||
var texture = spectrumGenerator.Spectrum;
|
||||
var pixels = texture.GetPixels();
|
||||
|
||||
foreach (var pixel in pixels)
|
||||
Assert.AreEqual(standardColor_, pixel);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Update_array_unavailable_with_selection()
|
||||
{
|
||||
var spectrumGenerator = new SpectrumGenerator(100, 100);
|
||||
var validPixels = spectrumGenerator.Update(null, selectionRect_);
|
||||
|
||||
Assert.AreEqual(0, validPixels);
|
||||
var texture = spectrumGenerator.Spectrum;
|
||||
|
||||
for (var x = 0; x < 100; x++)
|
||||
{
|
||||
for (var y = 0; y < 100; y++)
|
||||
{
|
||||
if(x == 10 && y == 90) // because vertically inverted
|
||||
Assert.AreEqual(selectedColor_, texture.GetPixel(x, y));
|
||||
else
|
||||
Assert.AreEqual(standardColor_, texture.GetPixel(x, y));
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,3 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 569cb1b5c266408cb26f97a8e7510191
|
||||
timeCreated: 1569957130
|
259
UnityProject/Assets/Plugins/NSubstitute.XML
Normal file
259
UnityProject/Assets/Plugins/NSubstitute.XML
Normal file
|
@ -0,0 +1,259 @@
|
|||
<?xml version="1.0"?>
|
||||
<doc>
|
||||
<assembly>
|
||||
<name>NSubstitute</name>
|
||||
</assembly>
|
||||
<members>
|
||||
<member name="T:NSubstitute.Arg">
|
||||
<summary>
|
||||
Argument matchers used for specifying calls to substitutes.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:NSubstitute.Arg.Any``1">
|
||||
<summary>
|
||||
Match any argument value compatible with type <typeparamref name="T"/>.
|
||||
</summary>
|
||||
<typeparam name="T"></typeparam>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:NSubstitute.Arg.Is``1(``0)">
|
||||
<summary>
|
||||
Match argument that is equal to <paramref name="value"/>.
|
||||
</summary>
|
||||
<typeparam name="T"></typeparam>
|
||||
<param name="value"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:NSubstitute.Arg.Is``1(System.Linq.Expressions.Expression{System.Predicate{``0}})">
|
||||
<summary>
|
||||
Match argument that satisfies <paramref name="predicate"/>.
|
||||
If the <paramref name="predicate"/> throws an exception for an argument it will be treated as non-matching.
|
||||
</summary>
|
||||
<typeparam name="T"></typeparam>
|
||||
<param name="predicate"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:NSubstitute.Arg.Invoke">
|
||||
<summary>
|
||||
Invoke any <see cref="T:System.Action"/> argument as soon as a matching call is made to the substitute.
|
||||
</summary>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:NSubstitute.Arg.Invoke``1(``0)">
|
||||
<summary>
|
||||
Invoke any <see cref="T:System.Action`1"/> argument with specified argument as soon as a matching call is made to the substitute.
|
||||
</summary>
|
||||
<typeparam name="T"></typeparam>
|
||||
<param name="arg"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:NSubstitute.Arg.Invoke``2(``0,``1)">
|
||||
<summary>
|
||||
Invoke any <see cref="T:System.Action`2"/> argument with specified arguments as soon as a matching call is made to the substitute.
|
||||
</summary>
|
||||
<typeparam name="T1"></typeparam>
|
||||
<typeparam name="T2"></typeparam>
|
||||
<param name="arg1"></param>
|
||||
<param name="arg2"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:NSubstitute.Arg.Invoke``3(``0,``1,``2)">
|
||||
<summary>
|
||||
Invoke any <see cref="T:System.Action`3"/> argument with specified arguments as soon as a matching call is made to the substitute.
|
||||
</summary>
|
||||
<typeparam name="T1"></typeparam>
|
||||
<typeparam name="T2"></typeparam>
|
||||
<typeparam name="T3"></typeparam>
|
||||
<param name="arg1"></param>
|
||||
<param name="arg2"></param>
|
||||
<param name="arg3"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:NSubstitute.Arg.Invoke``4(``0,``1,``2,``3)">
|
||||
<summary>
|
||||
Invoke any <see cref="T:System.Action`4"/> argument with specified arguments as soon as a matching call is made to the substitute.
|
||||
</summary>
|
||||
<typeparam name="T1"></typeparam>
|
||||
<typeparam name="T2"></typeparam>
|
||||
<typeparam name="T3"></typeparam>
|
||||
<typeparam name="T4"></typeparam>
|
||||
<param name="arg1"></param>
|
||||
<param name="arg2"></param>
|
||||
<param name="arg3"></param>
|
||||
<param name="arg4"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:NSubstitute.Arg.InvokeDelegate``1(System.Object[])">
|
||||
<summary>
|
||||
Invoke any <typeparamref name="TDelegate"/> argument with specified arguments as soon as a matching call is made to the substitute.
|
||||
</summary>
|
||||
<typeparam name="TDelegate"></typeparam>
|
||||
<param name="arguments">Arguments to pass to delegate.</param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:NSubstitute.Arg.Do``1(System.Action{``0})">
|
||||
<summary>
|
||||
Capture any argument compatible with type <typeparamref name="T"/> and use it to call the <paramref name="useArgument"/> function
|
||||
as soon as a matching call is made to the substitute.
|
||||
</summary>
|
||||
<typeparam name="T"></typeparam>
|
||||
<param name="useArgument"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="T:NSubstitute.IArgumentMatcher">
|
||||
<summary>
|
||||
Provides a specification for arguments for use with <see ctype="Arg.Matches (IArgumentMatcher)" />.
|
||||
Can additionally implement <see ctype="IDescribeNonMatches" /> to give descriptions when arguments do not match.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:NSubstitute.IArgumentMatcher.IsSatisfiedBy(System.Object)">
|
||||
<summary>
|
||||
Checks whether the <paramref name="argument"/> satisfies the condition of the matcher.
|
||||
If this throws an exception the argument will be treated as non-matching.
|
||||
</summary>
|
||||
<param name="argument"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:NSubstitute.IDescribeNonMatches.DescribeFor(System.Object)">
|
||||
<summary>
|
||||
Describes how the <paramref name="argument"/> does not match the condition specified by this class, or <see cref="F:System.String.Empty"/>
|
||||
if a detailed description can not be provided for the argument.
|
||||
</summary>
|
||||
<param name="argument"></param>
|
||||
<returns>Description of the non-match, or <see cref="F:System.String.Empty"/> if no description can be provided.</returns>
|
||||
</member>
|
||||
<member name="M:NSubstitute.Core.Extensions.Zip``3(System.Collections.Generic.IEnumerable{``0},System.Collections.Generic.IEnumerable{``1},System.Func{``0,``1,``2})">
|
||||
<summary>
|
||||
Combines two enumerables into a new enumerable using the given selector.
|
||||
</summary>
|
||||
<typeparam name="TFirst"></typeparam>
|
||||
<typeparam name="TSecond"></typeparam>
|
||||
<typeparam name="TResult"></typeparam>
|
||||
<param name="first"></param>
|
||||
<param name="second"></param>
|
||||
<param name="selector"></param>
|
||||
<returns></returns>
|
||||
<remarks>
|
||||
This implementation was sanity-checked against the
|
||||
<a href="http://msmvps.com/blogs/jon_skeet/archive/2011/01/14/reimplementing-linq-to-objects-part-35-zip.aspx">Edulinq implementation</a> and
|
||||
<a href="http://blogs.msdn.com/b/ericlippert/archive/2009/05/07/zip-me-up.aspx">Eric Lippert's implementation</a>.
|
||||
</remarks>
|
||||
</member>
|
||||
<member name="M:NSubstitute.Core.Extensions.IsCompatibleWith(System.Object,System.Type)">
|
||||
<summary>
|
||||
Checks if the instance can be used when a <paramref name="type"/> is expected.
|
||||
</summary>
|
||||
<param name="instance"></param>
|
||||
<param name="type"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:NSubstitute.Core.Extensions.Join(System.Collections.Generic.IEnumerable{System.String},System.String)">
|
||||
<summary>
|
||||
Join the <paramref name="strings"/> using <paramref name="seperator"/>.
|
||||
</summary>
|
||||
<param name="strings"></param>
|
||||
<param name="seperator"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="T:NSubstitute.Core.RobustThreadLocal`1">
|
||||
<summary>
|
||||
Delegates to ThreadLocal<T>, but wraps Value property access in try/catch to swallow ObjectDisposedExceptions.
|
||||
These can occur if the Value property is accessed from the finalizer thread. Because we can't detect this, we'll
|
||||
just swallow the exception (the finalizer thread won't be using any of the values from thread local storage anyway).
|
||||
</summary>
|
||||
<typeparam name="T"></typeparam>
|
||||
</member>
|
||||
<member name="T:NSubstitute.IArgumentMatcher`1">
|
||||
<summary>
|
||||
Provides a specification for arguments for use with <see ctype="Arg.Matches < T >(IArgumentMatcher)" />.
|
||||
Can additionally implement <see ctype="IDescribeNonMatches" /> to give descriptions when arguments do not match.
|
||||
</summary>
|
||||
<typeparam name="T">Matches arguments of type <typeparamref name="T"/> or compatible type.</typeparam>
|
||||
</member>
|
||||
<member name="M:NSubstitute.IArgumentMatcher`1.IsSatisfiedBy(`0)">
|
||||
<summary>
|
||||
Checks whether the <paramref name="argument"/> satisfies the condition of the matcher.
|
||||
If this throws an exception the argument will be treated as non-matching.
|
||||
</summary>
|
||||
<param name="argument"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:NSubstitute.Raise.EventWith``1(System.Object,``0)">
|
||||
<summary>
|
||||
Raise an event for an <c>EventHandler<TEventArgs></c> event with the provided <paramref name="sender"/> and <paramref name="eventArgs"/>.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:NSubstitute.Raise.EventWith``1(``0)">
|
||||
<summary>
|
||||
Raise an event for an <c>EventHandler<TEventArgs></c> event with the substitute as the sender and the provided <paramref name="eventArgs" />.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:NSubstitute.Raise.EventWith``1">
|
||||
<summary>
|
||||
Raise an event for an <c>EventHandler<EventArgsT></c> event with the substitute as the sender
|
||||
and with a default instance of <typeparamref name="TEventArgs" />.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:NSubstitute.Raise.Event">
|
||||
<summary>
|
||||
Raise an event for an <c>EventHandler</c> or <c>EventHandler<EventArgs></c> event with the substitute
|
||||
as the sender and with empty <c>EventArgs</c>.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:NSubstitute.Raise.Event``1(System.Object[])">
|
||||
<summary>
|
||||
Raise an event of type <typeparamref name="THandler" /> with the provided arguments. If no arguments are provided
|
||||
NSubstitute will try and provide reasonble defaults.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:NSubstitute.Substitute">
|
||||
<summary>
|
||||
Create a substitute for one or more types. For example: <c>Substitute.For<ISomeType>()</c>
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:NSubstitute.Substitute.For``1(System.Object[])">
|
||||
<summary>
|
||||
Substitute for an interface or class.
|
||||
<para>Be careful when specifying a class, as all non-virtual members will actually be executed. Only virtual members
|
||||
can be recorded or have return values specified.</para>
|
||||
</summary>
|
||||
<typeparam name="T">The type of interface or class to substitute.</typeparam>
|
||||
<param name="constructorArguments">Arguments required to construct a class being substituted. Not required for interfaces or classes with default constructors.</param>
|
||||
<returns>A substitute for the interface or class.</returns>
|
||||
</member>
|
||||
<member name="M:NSubstitute.Substitute.For``2(System.Object[])">
|
||||
<summary>
|
||||
<para>Substitute for multiple interfaces or a class that implements an interface. At most one class can be specified.</para>
|
||||
<para>Be careful when specifying a class, as all non-virtual members will actually be executed. Only virtual members
|
||||
can be recorded or have return values specified.</para>
|
||||
</summary>
|
||||
<typeparam name="T1">The type of interface or class to substitute.</typeparam>
|
||||
<typeparam name="T2">An additional interface or class (maximum of one class) the substitute should implement.</typeparam>
|
||||
<param name="constructorArguments">Arguments required to construct a class being substituted. Not required for interfaces or classes with default constructors.</param>
|
||||
<returns>A substitute of type T1, that also implements T2.</returns>
|
||||
</member>
|
||||
<member name="M:NSubstitute.Substitute.For``3(System.Object[])">
|
||||
<summary>
|
||||
<para>Substitute for multiple interfaces or a class that implements multiple interfaces. At most one class can be specified.</para>
|
||||
If additional interfaces are required use the <see cref="M:For(System.Type[], System.Object[])" /> overload.
|
||||
<para>Be careful when specifying a class, as all non-virtual members will actually be executed. Only virtual members
|
||||
can be recorded or have return values specified.</para>
|
||||
</summary>
|
||||
<typeparam name="T1">The type of interface or class to substitute.</typeparam>
|
||||
<typeparam name="T2">An additional interface or class (maximum of one class) the substitute should implement.</typeparam>
|
||||
<typeparam name="T3">An additional interface or class (maximum of one class) the substitute should implement.</typeparam>
|
||||
<param name="constructorArguments">Arguments required to construct a class being substituted. Not required for interfaces or classes with default constructors.</param>
|
||||
<returns>A substitute of type T1, that also implements T2 and T3.</returns>
|
||||
</member>
|
||||
<member name="M:NSubstitute.Substitute.For(System.Type[],System.Object[])">
|
||||
<summary>
|
||||
<para>Substitute for multiple interfaces or a class that implements multiple interfaces. At most one class can be specified.</para>
|
||||
<para>Be careful when specifying a class, as all non-virtual members will actually be executed. Only virtual members
|
||||
can be recorded or have return values specified.</para>
|
||||
</summary>
|
||||
<param name="typesToProxy">The types of interfaces or a type of class and multiple interfaces the substitute should implement.</param>
|
||||
<param name="constructorArguments">Arguments required to construct a class being substituted. Not required for interfaces or classes with default constructors.</param>
|
||||
<returns>A substitute implementing the specified types.</returns>
|
||||
</member>
|
||||
</members>
|
||||
</doc>
|
7
UnityProject/Assets/Plugins/NSubstitute.XML.meta
Normal file
7
UnityProject/Assets/Plugins/NSubstitute.XML.meta
Normal file
|
@ -0,0 +1,7 @@
|
|||
fileFormatVersion: 2
|
||||
guid: bdc35bfcd6b707f4fb1a603ebd847600
|
||||
TextScriptImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
Binary file not shown.
|
@ -202,7 +202,13 @@ MonoBehaviour:
|
|||
m_Script: {fileID: 11500000, guid: 54ab37d032df403e881d6a7a78141815, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
pdBackend: {fileID: 987772533}
|
||||
pdBackend: {fileID: 0}
|
||||
selection:
|
||||
serializedVersion: 2
|
||||
x: 297.75885
|
||||
y: 55
|
||||
width: 101.67376
|
||||
height: 102
|
||||
--- !u!1 &267275365
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
|
@ -315,7 +321,7 @@ MonoBehaviour:
|
|||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
mainPatch: analyzer.pd
|
||||
inchannels: 2
|
||||
samplePlayback: 0
|
||||
--- !u!4 &987772534
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
|
|
|
@ -6,10 +6,9 @@ namespace cylvester
|
|||
public class PdBackend : MonoBehaviour
|
||||
{
|
||||
public string mainPatch = "analyzer.pd";
|
||||
public int inchannels = 2;
|
||||
public int samplePlayback = 0;
|
||||
public PdArray levelMeterArray;
|
||||
public FftArrayContainer fftArrayContainer;
|
||||
public IFftArrayContainer fftArrayContainer;
|
||||
|
||||
private IChangeObserver<int> samplePlaybackObserver_;
|
||||
private Action onSamplePlaybackChanged_;
|
||||
|
@ -18,7 +17,7 @@ namespace cylvester
|
|||
|
||||
private void Start()
|
||||
{
|
||||
PdProcess.Instance.Start(mainPatch, inchannels);
|
||||
PdProcess.Instance.Start(mainPatch);
|
||||
levelMeterArray = new PdArray("levelmeters", PdConstant.NumMaxInputChannels);
|
||||
fftArrayContainer = new FftArrayContainer();
|
||||
pdSocket_ = new PdSocket(PdConstant.ip, PdConstant.port);
|
||||
|
@ -27,7 +26,7 @@ namespace cylvester
|
|||
|
||||
onSamplePlaybackChanged_ = () =>
|
||||
{
|
||||
var bytes = new byte[]{(byte)PdMessage.SampleSound, (byte)samplePlayback};
|
||||
var bytes = new[]{(byte)PdMessage.SampleSound, (byte)samplePlayback};
|
||||
pdSocket_.Send(bytes);
|
||||
};
|
||||
|
||||
|
@ -48,7 +47,6 @@ namespace cylvester
|
|||
levelMeterArray.Update();
|
||||
|
||||
fftArrayContainer.Update();
|
||||
|
||||
samplePlaybackObserver_.Value = samplePlayback;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,8 +10,5 @@ namespace cylvester
|
|||
public static readonly int NumMaxInputChannels = 16;
|
||||
public static readonly string ip = "127.0.0.1";
|
||||
public static readonly int port = 54345;
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
|
@ -6,14 +6,7 @@ using Debug = UnityEngine.Debug;
|
|||
|
||||
namespace cylvester
|
||||
{
|
||||
interface IPdProcess
|
||||
{
|
||||
void Start(string mainPatch, int numInputChannels);
|
||||
void Stop();
|
||||
bool Running { get; }
|
||||
}
|
||||
|
||||
public class PdProcess : IPdProcess
|
||||
public class PdProcess
|
||||
{
|
||||
private static PdProcess instance_ = null;
|
||||
private Process pdProcess_;
|
||||
|
@ -22,10 +15,9 @@ namespace cylvester
|
|||
{
|
||||
} // cannot be instantiate normally
|
||||
|
||||
|
||||
public static PdProcess Instance => instance_ ?? (instance_ = new PdProcess());
|
||||
|
||||
public void Start(string mainPatch, int numInputChannels)
|
||||
public void Start(string mainPatch)
|
||||
{
|
||||
|
||||
if (pdProcess_ != null)
|
||||
|
@ -41,7 +33,7 @@ namespace cylvester
|
|||
pdProcess_.StartInfo.FileName = Application.streamingAssetsPath + "/pd/win/pd.com";
|
||||
|
||||
var path = Application.streamingAssetsPath + "/pd/patch/" + mainPatch;
|
||||
pdProcess_.StartInfo.Arguments = "-nogui -rt -inchannels " + numInputChannels + " " + path;
|
||||
pdProcess_.StartInfo.Arguments = "-nogui -rt " + path;
|
||||
|
||||
if (!pdProcess_.Start())
|
||||
{
|
||||
|
@ -59,7 +51,6 @@ namespace cylvester
|
|||
pdProcess_.Kill();
|
||||
pdProcess_ = null;
|
||||
Debug.Log("Pd Process stopped");
|
||||
|
||||
}
|
||||
|
||||
public bool Running
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
|
||||
<s:String x:Key="/Default/Environment/AssemblyExplorer/XmlDocument/@EntryValue"><AssemblyExplorer>
|
||||
<Assembly Path="C:\Users\chikashi\Development\Soundvision\UnityProject\Assets\Plugins\NSubstitute.dll" />
|
||||
</AssemblyExplorer></s:String>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=Kinect/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=Shmem/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>
|
Loading…
Reference in a new issue