From 2ff95b66f88eb65270aa197fd6652b1e3d602781 Mon Sep 17 00:00:00 2001 From: AutumnSky1010 <66455966+AutumnSky1010@users.noreply.github.com> Date: Thu, 19 Sep 2024 21:52:19 +0900 Subject: [PATCH] :+1: Remove obsoletes --- src/SoundMaker/Sounds/IWave.cs | 12 --------- src/SoundMaker/Sounds/MonauralWave.cs | 3 --- src/SoundMaker/Sounds/StereoWave.cs | 9 ------- .../Sounds/WaveTypes/LowBitNoiseWave.cs | 7 ----- .../Sounds/WaveTypes/PseudoTriangleWave.cs | 7 ----- src/SoundMaker/Sounds/WaveTypes/SquareWave.cs | 7 ----- .../Sounds/WaveTypes/TriangleWave.cs | 7 ----- .../Sounds/WaveTypes/WaveTypeBase.cs | 26 ------------------- .../Sounds/WaveTypes/TestLowBitNoiseWave.cs | 3 +-- .../WaveTypes/TestPseudoTriangleWave.cs | 3 +-- .../Sounds/WaveTypes/TestSquareWave.cs | 3 +-- .../Sounds/WaveTypes/TestTriangleWave.cs | 3 +-- 12 files changed, 4 insertions(+), 86 deletions(-) diff --git a/src/SoundMaker/Sounds/IWave.cs b/src/SoundMaker/Sounds/IWave.cs index e9a170c..79e54b1 100644 --- a/src/SoundMaker/Sounds/IWave.cs +++ b/src/SoundMaker/Sounds/IWave.cs @@ -4,18 +4,6 @@ /// public interface IWave { - /// - /// volume of mixed wave.(0 ~ 100) ミックス済みの波形の音量 - /// - [Obsolete] - int Volume { get; } - - /// - /// length of wave at initialization. if stereo wave, return the longer length in the array at initialization. 初期化時の波形データの配列の長さ。ステレオの場合、左右で長い方の長さを返す。 - /// - [Obsolete("if you want to get length of bytes, call GetLengthOfBytes()")] - int Length { get; } - /// /// get length of bytes of wave data. 波形データのバイト列の長さを取得するメソッド。 /// diff --git a/src/SoundMaker/Sounds/MonauralWave.cs b/src/SoundMaker/Sounds/MonauralWave.cs index ad3c2f4..06b1b51 100644 --- a/src/SoundMaker/Sounds/MonauralWave.cs +++ b/src/SoundMaker/Sounds/MonauralWave.cs @@ -23,9 +23,6 @@ public MonauralWave(IReadOnlyCollection wave) public int Volume { get; private set; } = 100; - [Obsolete("if you want to get length of bytes, call GetLengthOfBytes()")] - public int Length => Wave.Length; - /// /// change volume this. 音量を変更するメソッド /// diff --git a/src/SoundMaker/Sounds/StereoWave.cs b/src/SoundMaker/Sounds/StereoWave.cs index 9c1ce5b..a47a944 100644 --- a/src/SoundMaker/Sounds/StereoWave.cs +++ b/src/SoundMaker/Sounds/StereoWave.cs @@ -33,19 +33,10 @@ public StereoWave(IReadOnlyCollection rightWave, IReadOnlyCollection - /// volume of the wave. 波形データの音量 - /// - [Obsolete] - public int Volume { get; private set; } = 100; - public int RightVolume { get; private set; } = 100; public int LeftVolume { get; private set; } = 100; - [Obsolete("if you want to get length of bytes, call GetLengthOfBytes()")] - public int Length => GetMaxAndMinWaveLength().Max; - /// /// change the volume this. 音量を変更するメソッド。 /// diff --git a/src/SoundMaker/Sounds/WaveTypes/LowBitNoiseWave.cs b/src/SoundMaker/Sounds/WaveTypes/LowBitNoiseWave.cs index 76905a7..c4195d4 100644 --- a/src/SoundMaker/Sounds/WaveTypes/LowBitNoiseWave.cs +++ b/src/SoundMaker/Sounds/WaveTypes/LowBitNoiseWave.cs @@ -4,13 +4,6 @@ /// public class LowBitNoiseWave : WaveTypeBase { - [Obsolete("Use 'GenerateWave(SoundFormat format, int length, int volume, double hertz)'")] - public override short[] GenerateWave(SoundFormat format, int tempo, int length, int volume, double hertz) - { - CheckGenerateWaveArgs(tempo, length, volume, hertz); - return GenerateWave(format, length, volume, hertz); - } - public override short[] GenerateWave(SoundFormat format, int length, int volume, double hertz) { var result = new List(length); diff --git a/src/SoundMaker/Sounds/WaveTypes/PseudoTriangleWave.cs b/src/SoundMaker/Sounds/WaveTypes/PseudoTriangleWave.cs index b3ed276..76956b0 100644 --- a/src/SoundMaker/Sounds/WaveTypes/PseudoTriangleWave.cs +++ b/src/SoundMaker/Sounds/WaveTypes/PseudoTriangleWave.cs @@ -13,13 +13,6 @@ public class PseudoTriangleWave : WaveTypeBase 4095, 8191, 12287, 16383, 20479, 24575, 28671, short.MaxValue, short.MaxValue, 28671, 24575, 20479, 16383, 12287, 8191, 4095 }; - [Obsolete("Use 'GenerateWave(SoundFormat format, int length, int volume, double hertz)'")] - public override short[] GenerateWave(SoundFormat format, int tempo, int length, int volume, double hertz) - { - CheckGenerateWaveArgs(tempo, length, volume, hertz); - return GenerateWave(format, length, volume, hertz); - } - public override short[] GenerateWave(SoundFormat format, int length, int volume, double hertz) { CheckGenerateWaveArgs(length, volume, hertz); diff --git a/src/SoundMaker/Sounds/WaveTypes/SquareWave.cs b/src/SoundMaker/Sounds/WaveTypes/SquareWave.cs index bf0f10c..091368c 100644 --- a/src/SoundMaker/Sounds/WaveTypes/SquareWave.cs +++ b/src/SoundMaker/Sounds/WaveTypes/SquareWave.cs @@ -27,13 +27,6 @@ public SquareWave(SquareWaveRatio squareWaveRatio) (0.5, 0.5), }; - [Obsolete("Use 'GenerateWave(SoundFormat format, int length, int volume, double hertz)'")] - public override short[] GenerateWave(SoundFormat format, int tempo, int length, int volume, double hertz) - { - CheckGenerateWaveArgs(tempo, length, volume, hertz); - return GenerateWave(format, length, volume, hertz); - } - public override short[] GenerateWave(SoundFormat format, int length, int volume, double hertz) { var result = new List(length); diff --git a/src/SoundMaker/Sounds/WaveTypes/TriangleWave.cs b/src/SoundMaker/Sounds/WaveTypes/TriangleWave.cs index 38e72c3..226be12 100644 --- a/src/SoundMaker/Sounds/WaveTypes/TriangleWave.cs +++ b/src/SoundMaker/Sounds/WaveTypes/TriangleWave.cs @@ -4,13 +4,6 @@ /// public class TriangleWave : WaveTypeBase { - [Obsolete("Use 'GenerateWave(SoundFormat format, int length, int volume, double hertz)'")] - public override short[] GenerateWave(SoundFormat format, int tempo, int length, int volume, double hertz) - { - CheckGenerateWaveArgs(tempo, length, volume, hertz); - return GenerateWave(format, length, volume, hertz); - } - public override short[] GenerateWave(SoundFormat format, int length, int volume, double hertz) { CheckGenerateWaveArgs(length, volume, hertz); diff --git a/src/SoundMaker/Sounds/WaveTypes/WaveTypeBase.cs b/src/SoundMaker/Sounds/WaveTypes/WaveTypeBase.cs index e168dd3..a9304df 100644 --- a/src/SoundMaker/Sounds/WaveTypes/WaveTypeBase.cs +++ b/src/SoundMaker/Sounds/WaveTypes/WaveTypeBase.cs @@ -4,22 +4,6 @@ /// public abstract class WaveTypeBase { - /// - /// generate array of wave data. 波形データの配列を生成する。 - /// - /// format of the sound. 音のフォーマット - /// quarter note/rest per minute. 一分間の四分音符・休符の数 - /// length of the array. 配列の長さ - /// volume 音量(0 ~ 100) - /// hertz of the sound. 音の周波数 - /// the array of wave data. : short[] - /// Tempo must be non-negative and greater than 0. - /// Length must be non-negative. - /// Hertz must be non-negative and greater than 0. - /// Volume must be below than 100 and more than 0. - [Obsolete("Use 'GenerateWave(SoundFormat format, int length, int volume, double hertz)'")] - public abstract short[] GenerateWave(SoundFormat format, int tempo, int length, int volume, double hertz); - /// /// generate array of wave data. 波形データの配列を生成する。 /// @@ -33,16 +17,6 @@ public abstract class WaveTypeBase /// Volume must be below than 100 and more than 0. public abstract short[] GenerateWave(SoundFormat format, int length, int volume, double hertz); - [Obsolete("Use 'CheckGenerateWaveArgs(int length, int volume, double hertz)'")] - protected void CheckGenerateWaveArgs(int tempo, int length, int volume, double hertz) - { - if (tempo <= 0) - { - throw new ArgumentOutOfRangeException(nameof(tempo), "'tempo' must be non-negative and greater than 0."); - } - CheckGenerateWaveArgs(length, volume, hertz); - } - protected void CheckGenerateWaveArgs(int length, int volume, double hertz) { if (length < 0) diff --git a/test/UnitTests/Sounds/WaveTypes/TestLowBitNoiseWave.cs b/test/UnitTests/Sounds/WaveTypes/TestLowBitNoiseWave.cs index e0d62e8..269d93c 100644 --- a/test/UnitTests/Sounds/WaveTypes/TestLowBitNoiseWave.cs +++ b/test/UnitTests/Sounds/WaveTypes/TestLowBitNoiseWave.cs @@ -5,7 +5,6 @@ namespace SoundMakerTests.UnitTests.Sounds.WaveTypes; public class TestLowBitNoiseWave { [Fact(DisplayName = "指定した長さの波形データが生成されるかのテスト")] - [Obsolete] public void GenerateWaveTest() { var waveType = new LowBitNoiseWave(); @@ -14,7 +13,7 @@ public void GenerateWaveTest() var volume = 100; double hertz = 100; var format = new SoundFormat(SamplingFrequencyType.FourtyEightKHz, BitRateType.SixteenBit, ChannelType.Stereo); - var wave = waveType.GenerateWave(format, tempo, length, volume, hertz); + var wave = waveType.GenerateWave(format, tempo, length, hertz); Assert.Equal(length, wave.Length); wave = waveType.GenerateWave(format, length, volume, hertz); Assert.Equal(length, wave.Length); diff --git a/test/UnitTests/Sounds/WaveTypes/TestPseudoTriangleWave.cs b/test/UnitTests/Sounds/WaveTypes/TestPseudoTriangleWave.cs index f9e85d4..0ad8987 100644 --- a/test/UnitTests/Sounds/WaveTypes/TestPseudoTriangleWave.cs +++ b/test/UnitTests/Sounds/WaveTypes/TestPseudoTriangleWave.cs @@ -5,7 +5,6 @@ namespace SoundMakerTests.UnitTests.Sounds.WaveTypes; public class TestPseudoTriangleWave { [Fact(DisplayName = "指定した長さの波形データが生成されるかのテスト")] - [Obsolete] public void GenerateWaveTest() { var waveType = new PseudoTriangleWave(); @@ -14,7 +13,7 @@ public void GenerateWaveTest() var volume = 100; double hertz = 100; var format = new SoundFormat(SamplingFrequencyType.FourtyEightKHz, BitRateType.SixteenBit, ChannelType.Stereo); - var wave = waveType.GenerateWave(format, tempo, length, volume, hertz); + var wave = waveType.GenerateWave(format, tempo, length, hertz); Assert.Equal(length, wave.Length); wave = waveType.GenerateWave(format, length, volume, hertz); Assert.Equal(length, wave.Length); diff --git a/test/UnitTests/Sounds/WaveTypes/TestSquareWave.cs b/test/UnitTests/Sounds/WaveTypes/TestSquareWave.cs index f9491e6..7bf98fb 100644 --- a/test/UnitTests/Sounds/WaveTypes/TestSquareWave.cs +++ b/test/UnitTests/Sounds/WaveTypes/TestSquareWave.cs @@ -6,7 +6,6 @@ namespace SoundMakerTests.UnitTests.Sounds.WaveTypes; public class TestSquareWave { [Fact(DisplayName = "指定した長さの波形データが生成されるかのテスト")] - [Obsolete] public void GenerateWaveTest() { var waveType = new SquareWave(SquareWaveRatio.Point25); @@ -15,7 +14,7 @@ public void GenerateWaveTest() var volume = 100; double hertz = 100; var format = new SoundFormat(SamplingFrequencyType.FourtyEightKHz, BitRateType.SixteenBit, ChannelType.Stereo); - var wave = waveType.GenerateWave(format, tempo, length, volume, hertz); + var wave = waveType.GenerateWave(format, tempo, length, hertz); Assert.Equal(length, wave.Length); wave = waveType.GenerateWave(format, length, volume, hertz); Assert.Equal(length, wave.Length); diff --git a/test/UnitTests/Sounds/WaveTypes/TestTriangleWave.cs b/test/UnitTests/Sounds/WaveTypes/TestTriangleWave.cs index 0241e2a..c670d0c 100644 --- a/test/UnitTests/Sounds/WaveTypes/TestTriangleWave.cs +++ b/test/UnitTests/Sounds/WaveTypes/TestTriangleWave.cs @@ -5,7 +5,6 @@ namespace SoundMakerTests.UnitTests.Sounds.WaveTypes; public class TestTriangleWave { [Fact(DisplayName = "指定した長さの波形データが生成されるかのテスト")] - [Obsolete] public void GenerateWaveTest() { var waveType = new TriangleWave(); @@ -14,7 +13,7 @@ public void GenerateWaveTest() var volume = 100; double hertz = 100; var format = new SoundFormat(SamplingFrequencyType.FourtyEightKHz, BitRateType.SixteenBit, ChannelType.Stereo); - var wave = waveType.GenerateWave(format, tempo, length, volume, hertz); + var wave = waveType.GenerateWave(format, tempo, length, hertz); Assert.Equal(length, wave.Length); wave = waveType.GenerateWave(format, length, volume, hertz); Assert.Equal(length, wave.Length);