Skip to content

Commit

Permalink
Fix build error
Browse files Browse the repository at this point in the history
  • Loading branch information
Nytra committed Jan 5, 2025
1 parent e03b2a5 commit 3363a34
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
5 changes: 3 additions & 2 deletions ProjectObsidian/Components/Audio/PhaseModulator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using FrooxEngine;
using Elements.Assets;
using Obsidian.Elements;
using Elements.Core;

namespace Obsidian.Components.Audio
{
Expand Down Expand Up @@ -29,7 +30,7 @@ public int ChannelCount
{
get
{
return CarrierSource.Target?.ChannelCount ?? 0;
return MathX.Min(CarrierSource.Target?.ChannelCount ?? 0, ModulatorSource.Target?.ChannelCount ?? 0);
}
}

Expand Down Expand Up @@ -63,7 +64,7 @@ public void Read<S>(Span<S> buffer) where S : unmanaged, IAudioSample<S>

float modulationIndex = ModulationIndex.Value;

Algorithms.PhaseModulation(buffer, carrierBuffer, modulatorBuffer, modulationIndex);
Algorithms.PhaseModulation(buffer, carrierBuffer, modulatorBuffer, modulationIndex, channelCount);
}
}
}
4 changes: 2 additions & 2 deletions ProjectObsidian/Components/Audio/RingModulator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public int ChannelCount
{
get
{
return CarrierSource.Target?.ChannelCount ?? 0;
return MathX.Min(CarrierSource.Target?.ChannelCount ?? 0, ModulatorSource.Target?.ChannelCount ?? 0);
}
}

Expand Down Expand Up @@ -65,7 +65,7 @@ public void Read<S>(Span<S> buffer) where S : unmanaged, IAudioSample<S>

float modulationIndex = ModulationIndex.Value;

Algorithms.RingModulation(buffer, carrierBuffer, modulatorBuffer, modulationIndex);
Algorithms.RingModulation(buffer, carrierBuffer, modulatorBuffer, modulationIndex, channelCount);
}
}
}
4 changes: 2 additions & 2 deletions ProjectObsidian/Components/Audio/SineShapedRingModulator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public int ChannelCount
{
get
{
return CarrierSource.Target?.ChannelCount ?? 0;
return MathX.Min(CarrierSource.Target?.ChannelCount ?? 0, ModulatorSource.Target?.ChannelCount ?? 0);
}
}

Expand Down Expand Up @@ -66,7 +66,7 @@ public void Read<S>(Span<S> buffer) where S : unmanaged, IAudioSample<S>

float modulationIndex = ModulationIndex.Value;

Algorithms.SineShapedRingModulation(buffer, carrierBuffer, modulatorBuffer, modulationIndex);
Algorithms.SineShapedRingModulation(buffer, carrierBuffer, modulatorBuffer, modulationIndex, channelCount);
}
}
}

0 comments on commit 3363a34

Please sign in to comment.