private void TestMisc() { WMReaderStatistics ps = new WMReaderStatistics(); ps.cbSize = Marshal.SizeOf(typeof(WMReaderStatistics)); m_read.GetStatistics(ps); Debug.Assert(ps.wQuality == 100); m_read.NotifyLateDelivery(1000); m_read.DeliverTime(1000); int i; m_read.GetMaxOutputSampleSize(1, out i); Debug.Assert(i != 0); m_read.GetMaxStreamSampleSize(1, out i); Debug.Assert(i != 0); WMReaderClientInfo w = new WMReaderClientInfo(); w.cbSize = Marshal.SizeOf(typeof(WMReaderClientInfo)); m_read.SetClientInfo(w); }
private void SetStreams(string sName) { // First find the mapping between the output name and // the stream number IWMProfile pProfile = m_pReader as IWMProfile; int iCount; pProfile.GetStreamCount(out iCount); short[] sss = new short[iCount]; StreamSelection[] ss = new StreamSelection[iCount]; StringBuilder sSName; for (short j = 0; j < iCount; j++) { IWMStreamConfig pConfig; pProfile.GetStream(j, out pConfig); try { pConfig.GetStreamNumber(out sss[j]); short iSName = 0; sSName = null; pConfig.GetConnectionName(sSName, ref iSName); sSName = new StringBuilder(iSName); pConfig.GetConnectionName(sSName, ref iSName); } finally { Marshal.ReleaseComObject(pConfig); } // Turn the stream on or off depending on whether // this is the one that matches the output we're // looking for if (sSName.ToString() == sName) { ss[j] = StreamSelection.On; } else { ss[j] = StreamSelection.Off; } } // Use the array we've built to specify the streams we want IWMReaderAdvanced ra = m_pReader as IWMReaderAdvanced; ra.SetStreamsSelected((short)iCount, sss, ss); // Learn the maximum sample size that will be send to OnSample ra.GetMaxOutputSampleSize(m_dwAudioOutputNum, out m_MaxSampleSize); // Have the Samples allocated using IWMReaderCallbackAdvanced::AllocateForOutput ra.SetAllocateForOutput(m_dwAudioOutputNum, true); }