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); }
private void TestAllocateForOutput() { bool b; m_read.SetAllocateForOutput(1, true); m_read.GetAllocateForOutput(1, out b); Debug.Assert(b); }