Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#28 Remove obsoletes #29

Merged
merged 1 commit into from
Sep 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 0 additions & 12 deletions src/SoundMaker/Sounds/IWave.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,6 @@
/// </summary>
public interface IWave
{
/// <summary>
/// volume of mixed wave.(0 ~ 100) ミックス済みの波形の音量
/// </summary>
[Obsolete]
int Volume { get; }

/// <summary>
/// length of wave at initialization. if stereo wave, return the longer length in the array at initialization. 初期化時の波形データの配列の長さ。ステレオの場合、左右で長い方の長さを返す。
/// </summary>
[Obsolete("if you want to get length of bytes, call GetLengthOfBytes()")]
int Length { get; }

/// <summary>
/// get length of bytes of wave data. 波形データのバイト列の長さを取得するメソッド。
/// </summary>
Expand Down
3 changes: 0 additions & 3 deletions src/SoundMaker/Sounds/MonauralWave.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,6 @@ public MonauralWave(IReadOnlyCollection<short> wave)

public int Volume { get; private set; } = 100;

[Obsolete("if you want to get length of bytes, call GetLengthOfBytes()")]
public int Length => Wave.Length;

/// <summary>
/// change volume this. 音量を変更するメソッド
/// </summary>
Expand Down
9 changes: 0 additions & 9 deletions src/SoundMaker/Sounds/StereoWave.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,19 +33,10 @@ public StereoWave(IReadOnlyCollection<short> rightWave, IReadOnlyCollection<shor

private short[] LeftWave { get; set; }

/// <summary>
/// volume of the wave. 波形データの音量
/// </summary>
[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;

/// <summary>
/// change the volume this. 音量を変更するメソッド。
/// </summary>
Expand Down
7 changes: 0 additions & 7 deletions src/SoundMaker/Sounds/WaveTypes/LowBitNoiseWave.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,6 @@
/// </summary>
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<short>(length);
Expand Down
7 changes: 0 additions & 7 deletions src/SoundMaker/Sounds/WaveTypes/PseudoTriangleWave.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
7 changes: 0 additions & 7 deletions src/SoundMaker/Sounds/WaveTypes/SquareWave.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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<short>(length);
Expand Down
7 changes: 0 additions & 7 deletions src/SoundMaker/Sounds/WaveTypes/TriangleWave.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,6 @@
/// </summary>
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);
Expand Down
26 changes: 0 additions & 26 deletions src/SoundMaker/Sounds/WaveTypes/WaveTypeBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,6 @@
/// </summary>
public abstract class WaveTypeBase
{
/// <summary>
/// generate array of wave data. 波形データの配列を生成する。
/// </summary>
/// <param name="format">format of the sound. 音のフォーマット</param>
/// <param name="tempo">quarter note/rest per minute. 一分間の四分音符・休符の数</param>
/// <param name="length">length of the array. 配列の長さ</param>
/// <param name="volume">volume 音量(0 ~ 100)</param>
/// <param name="hertz">hertz of the sound. 音の周波数</param>
/// <returns>the array of wave data. : short[]</returns>
/// <exception cref="ArgumentOutOfRangeException">Tempo must be non-negative and greater than 0.</exception>
/// <exception cref="ArgumentOutOfRangeException">Length must be non-negative.</exception>
/// <exception cref="ArgumentOutOfRangeException">Hertz must be non-negative and greater than 0.</exception>
/// <exception cref="ArgumentOutOfRangeException">Volume must be below than 100 and more than 0.</exception>
[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);

/// <summary>
/// generate array of wave data. 波形データの配列を生成する。
/// </summary>
Expand All @@ -33,16 +17,6 @@ public abstract class WaveTypeBase
/// <exception cref="ArgumentOutOfRangeException">Volume must be below than 100 and more than 0.</exception>
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)
Expand Down
3 changes: 1 addition & 2 deletions test/UnitTests/Sounds/WaveTypes/TestLowBitNoiseWave.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ namespace SoundMakerTests.UnitTests.Sounds.WaveTypes;
public class TestLowBitNoiseWave
{
[Fact(DisplayName = "指定した長さの波形データが生成されるかのテスト")]
[Obsolete]
public void GenerateWaveTest()
{
var waveType = new LowBitNoiseWave();
Expand All @@ -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);
Expand Down
3 changes: 1 addition & 2 deletions test/UnitTests/Sounds/WaveTypes/TestPseudoTriangleWave.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ namespace SoundMakerTests.UnitTests.Sounds.WaveTypes;
public class TestPseudoTriangleWave
{
[Fact(DisplayName = "指定した長さの波形データが生成されるかのテスト")]
[Obsolete]
public void GenerateWaveTest()
{
var waveType = new PseudoTriangleWave();
Expand All @@ -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);
Expand Down
3 changes: 1 addition & 2 deletions test/UnitTests/Sounds/WaveTypes/TestSquareWave.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ namespace SoundMakerTests.UnitTests.Sounds.WaveTypes;
public class TestSquareWave
{
[Fact(DisplayName = "指定した長さの波形データが生成されるかのテスト")]
[Obsolete]
public void GenerateWaveTest()
{
var waveType = new SquareWave(SquareWaveRatio.Point25);
Expand All @@ -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);
Expand Down
3 changes: 1 addition & 2 deletions test/UnitTests/Sounds/WaveTypes/TestTriangleWave.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ namespace SoundMakerTests.UnitTests.Sounds.WaveTypes;
public class TestTriangleWave
{
[Fact(DisplayName = "指定した長さの波形データが生成されるかのテスト")]
[Obsolete]
public void GenerateWaveTest()
{
var waveType = new TriangleWave();
Expand All @@ -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);
Expand Down
Loading