Skip to content

Commit

Permalink
feat: [クラスラッパー]音声の設置位置、速度を設定できるように
Browse files Browse the repository at this point in the history
  • Loading branch information
automatic9045 committed Sep 12, 2023
1 parent 8924d33 commit 4737b37
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 0 deletions.
29 changes: 29 additions & 0 deletions Libs/BveTypes/ClassWrappers/Public/Sound.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using System.Text;
using System.Threading.Tasks;

using SlimDX;
using SlimDX.DirectSound;

using FastMember;
Expand All @@ -24,6 +25,12 @@ private static void Initialize(BveTypeSet bveTypes)
Constructor1 = members.GetSourceConstructor(new Type[] { typeof(TimeManager), typeof(CameraLocation), typeof(SecondarySoundBuffer), typeof(double), typeof(SoundPosition) });
Constructor2 = members.GetSourceConstructor(new Type[] { typeof(TimeManager), typeof(CameraLocation), typeof(SecondarySoundBuffer[]), typeof(double), typeof(SoundPosition) });

PositionInBlockGetMethod = members.GetSourcePropertyGetterOf(nameof(PositionInBlock));
PositionInBlockSetMethod = members.GetSourcePropertySetterOf(nameof(PositionInBlock));

SpeedInBlockGetMethod = members.GetSourcePropertyGetterOf(nameof(SpeedInBlock));
SpeedInBlockSetMethod = members.GetSourcePropertySetterOf(nameof(SpeedInBlock));

PlayMethod1 = members.GetSourceMethodOf(nameof(Play), new Type[] { typeof(double), typeof(double), typeof(int) });
PlayMethod2 = members.GetSourceMethodOf(nameof(Play), new Type[] { typeof(double), typeof(double), typeof(int), typeof(int) });
PlayLoopingMethod = members.GetSourceMethodOf(nameof(PlayLooping));
Expand Down Expand Up @@ -58,6 +65,28 @@ public Sound(TimeManager timeManager, CameraLocation cameraLocation, SecondarySo
{
}

private static FastMethod PositionInBlockGetMethod;
private static FastMethod PositionInBlockSetMethod;
/// <summary>
/// 現在自列車が走行しているマップ ブロックの原点に対する、この音声の再生位置の位置ベクトル [m] を取得します。
/// </summary>
public Vector3 PositionInBlock
{
get => PositionInBlockGetMethod.Invoke(Src, null);
set => PositionInBlockSetMethod.Invoke(Src, new object[] { value });
}

private static FastMethod SpeedInBlockGetMethod;
private static FastMethod SpeedInBlockSetMethod;
/// <summary>
/// 現在自列車が走行しているマップ ブロックに対する、この音声の速度ベクトル [m/s] を取得します。
/// </summary>
public Vector3 SpeedInBlock
{
get => SpeedInBlockGetMethod.Invoke(Src, null);
set => SpeedInBlockSetMethod.Invoke(Src, new object[] { value });
}

private static FastMethod PlayMethod1;
/// <summary>
/// 音声を冒頭から再生します。
Expand Down
9 changes: 9 additions & 0 deletions Libs/BveTypes/WrapTypes/5.8.7554.391.xml
Original file line number Diff line number Diff line change
Expand Up @@ -865,6 +865,15 @@
<Enum Wrapper="SoundPosition" Original="a"/>
</Children>

<Property Wrapper="PositionInBlock">
<Getter Original="a"/>
<Setter Original="b"/>
</Property>
<Property Wrapper="SpeedInBlock">
<Getter Original="c"/>
<Setter Original="a"/>
</Property>

<Method Wrapper="Play" WrapperParams="System.Double; System.Double; System.Int32" Original="a"/>
<Method Wrapper="Play" WrapperParams="System.Double; System.Double; System.Int32; System.Int32" Original="a"/>
<Method Wrapper="PlayLooping" WrapperParams="System.Double; System.Double; System.Int32; System.Int32" Original="b"/>
Expand Down
9 changes: 9 additions & 0 deletions Libs/BveTypes/WrapTypes/6.0.7554.619.xml
Original file line number Diff line number Diff line change
Expand Up @@ -865,6 +865,15 @@
<Enum Wrapper="SoundPosition" Original="a"/>
</Children>

<Property Wrapper="PositionInBlock">
<Getter Original="a"/>
<Setter Original="b"/>
</Property>
<Property Wrapper="SpeedInBlock">
<Getter Original="c"/>
<Setter Original="a"/>
</Property>

<Method Wrapper="Play" WrapperParams="System.Double; System.Double; System.Int32" Original="a"/>
<Method Wrapper="Play" WrapperParams="System.Double; System.Double; System.Int32; System.Int32" Original="a"/>
<Method Wrapper="PlayLooping" WrapperParams="System.Double; System.Double; System.Int32; System.Int32" Original="b"/>
Expand Down

0 comments on commit 4737b37

Please sign in to comment.