Esempio n. 1
0
 public static extern uint waveOutGetPosition(IntPtr hwo, ref MMTIME pmmt, UINT cbmmt);
Esempio n. 2
0
 public static extern uint waveOutGetPosition( IntPtr hwo, ref MMTIME pmmt, UINT cbmmt );
Esempio n. 3
0
        /// 現在の再生位置を取得する。再生中でない場合負の値となる。
        public float get_play_time() {
#if DEBUG
            cadencii.debug.push_log( "WavePlay.get_play_time" );
#endif
            if ( s_playing ) {
                MMTIME mmt = new MMTIME();
                mmt.cb = (uint)sizeof( MMTIME );
                mmt.wType = win32.TIME_MS;
                uint ret = win32.waveOutGetPosition( s_hwave_out, ref mmt, (uint)sizeof( MMTIME ) );
#if DEBUG
                cadencii.debug.push_log( "    ret=" + ret );
#endif
                float ms = 0.0f;
                switch ( mmt.wType ) {
                    case win32.TIME_MS:
                        return mmt.ms * 0.001f;
                    case win32.TIME_SAMPLES:
                        return (float)mmt.sample / (float)s_wave_formatx.nSamplesPerSec;
                    case win32.TIME_BYTES:
                        return (float)mmt.cb / (float)s_wave_formatx.nAvgBytesPerSec;
                    default:
                        return -1.0f;
                }
            } else {
                return -1.0f;
            }
        }