Example #1
0
        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);
        }
Example #2
0
        private void TestStreamsSelected()
        {
            short[]           psn = new short[2];
            StreamSelection[] pss = new StreamSelection[2];

            psn[0] = 1;
            psn[1] = 2;

            pss[0] = StreamSelection.CleanPointOnly;
            pss[1] = StreamSelection.Off;

            m_read.SetStreamsSelected(2, psn, pss);

            StreamSelection ps;

            m_read.GetStreamSelected(1, out ps);
            Debug.Assert(ps == StreamSelection.CleanPointOnly);

            m_read.GetStreamSelected(2, out ps);
            Debug.Assert(ps == StreamSelection.Off);
        }
Example #3
0
        private void ChangeSelected(IWMReaderAdvanced ra)
        {
            short[] ss = new short[2];
            ss[0] = 1;
            ss[1] = 2;

            StreamSelection[] sss = new StreamSelection[2];

            if (m_loop == 0)
            {
                sss[0] = StreamSelection.Off;
                sss[1] = StreamSelection.On;
                m_loop = 1;
            }
            else
            {
                sss[1] = StreamSelection.Off;
                sss[0] = StreamSelection.On;
                m_loop = 0;
            }
            ra.SetStreamsSelected(2, ss, sss);
        }