OSDN Git Service

排他モードと共有モードの両方の実相を完了。
[strokestylet/CsWin10Desktop3.git] / FDK24 / メディア / サウンド / WASAPI / Sound.cs
index e4464bd..817bc68 100644 (file)
@@ -12,7 +12,6 @@ namespace FDK.メディア.サウンド.WASAPI
                {
                        get { return this._SampleSource.Length; }
                }
-
                public double 長さsec
                {
                        get { return this._SampleToSec( this.長さsample ); }
@@ -23,7 +22,6 @@ namespace FDK.メディア.サウンド.WASAPI
                        get { return this._SampleSource.Position; }
                        set { this._SampleSource.Position = value; }
                }
-
                public double 位置sec
                {
                        get
@@ -41,15 +39,14 @@ namespace FDK.メディア.サウンド.WASAPI
                        }
                }
                        
-               public WaveFormat WaveFormat
-               {
-                       get { return this._SampleSource.WaveFormat; }
-               }
-
                public CSCore.ISampleSource SampleSource
                {
                        get { return this._SampleSource; }
                }
+               public CSCore.IWaveSource WaveSource
+               {
+                       get { return this._WaveSource; }
+               }
 
                /// <summary>
                /// 音量。0.0(無音)~1.0(原音)。
@@ -116,15 +113,19 @@ namespace FDK.メディア.サウンド.WASAPI
 
                private long _SecToSample( double 時間sec )
                {
-                       long 時間sample = (long) ( 時間sec * this.WaveFormat.SampleRate * this.WaveFormat.Channels + 0.5 ); // +0.5 は四捨五入
-                       時間sample -= ( 時間sample % this.WaveFormat.Channels );    // チャンネル数の倍数にする。
+                       var wf = this.SampleSource.WaveFormat;
+
+                       long 時間sample = (long) ( 時間sec * wf.SampleRate * wf.Channels + 0.5 ); // +0.5 は四捨五入
+                       時間sample -= ( 時間sample % wf.Channels );    // チャンネル数の倍数にする。
 
                        return 時間sample;
                }
 
                private double _SampleToSec( long 時間sample )
                {
-                       return 時間sample / ( this.WaveFormat.Channels * this.WaveFormat.SampleRate );
+                       var wf = this.SampleSource.WaveFormat;
+
+                       return 時間sample / ( wf.Channels * wf.SampleRate );
                }
        }
 }