Exemplo n.º 1
0
        OpenPcmInputStreamOfManagedAudioMediaFlattened(DelegateAudioPcmStreamFound del, bool openSecondaryStream)
        {
#if USE_NORMAL_LIST
            StreamWithMarkers?
#else
            StreamWithMarkers
#endif //USE_NORMAL_LIST
            val = OpenPcmInputStreamOfManagedAudioMedia(openSecondaryStream);

            if (val != null)
            {
                if (del != null)
                {
                    del.Invoke(
                        val.
#if USE_NORMAL_LIST
                        GetValueOrDefault().
#endif //USE_NORMAL_LIST
                        m_Stream.Length
                        );
                }
                return(val);
            }

#if USE_NORMAL_LIST
            List
#else
            LightLinkedList
#endif //USE_NORMAL_LIST
            <StreamWithMarkers> listStreamsWithMarkers = new
#if USE_NORMAL_LIST
                                                         List
#else
                                                         LightLinkedList
#endif //USE_NORMAL_LIST
                                                         <StreamWithMarkers>();

            for (int index = 0; index < mChildren.Count; index++)
            {
                TreeNode node = mChildren.Get(index);

#if USE_NORMAL_LIST
                StreamWithMarkers?
#else
                StreamWithMarkers
#endif //USE_NORMAL_LIST
                childVal = node.OpenPcmInputStreamOfManagedAudioMediaFlattened(del, openSecondaryStream);

                if (childVal != null)
                {
                    listStreamsWithMarkers.Add(
                        childVal
#if USE_NORMAL_LIST
                        .GetValueOrDefault()
#endif //USE_NORMAL_LIST
                        );
                }
            }

            if (listStreamsWithMarkers.Count == 0)
            {
                return(null);
            }

            StreamWithMarkers returnVal = new StreamWithMarkers();

            returnVal.m_SubStreamMarkers = new
#if USE_NORMAL_LIST
                                           List
#else
                                           LightLinkedList
#endif //USE_NORMAL_LIST
                                           <TreeNodeAndStreamDataLength>();

#if USE_NORMAL_LIST
            List
#else
            LightLinkedList
#endif //USE_NORMAL_LIST
            <Stream> listStreams = new

#if USE_NORMAL_LIST
                                   List
#else
                                   LightLinkedList
#endif //USE_NORMAL_LIST
                                   <Stream>();

#if USE_NORMAL_LIST
            List
#else
            LightLinkedList
#endif //USE_NORMAL_LIST
            <Stream> listSecondaryStreams =

                openSecondaryStream ?
                new

#if USE_NORMAL_LIST
                List
#else
                LightLinkedList
#endif //USE_NORMAL_LIST
                <Stream>() : null;


#if USE_NORMAL_LIST
            foreach (StreamWithMarkers strct in listStreamsWithMarkers)
            {
                listStreams.Add(strct.m_Stream);
                if (openSecondaryStream)
                {
                    listSecondaryStreams.Add(strct.m_SecondaryStream);
                }

                returnVal.m_SubStreamMarkers.AddRange(strct.m_SubStreamMarkers);
                strct.m_SubStreamMarkers.Clear();
            }
#else
            LightLinkedList <StreamWithMarkers> .Item current = listStreamsWithMarkers.m_First;
            while (current != null)
            {
                StreamWithMarkers swm = current.m_data;

                listStreams.Add(swm.m_Stream);
                if (openSecondaryStream)
                {
                    listSecondaryStreams.Add(swm.m_SecondaryStream);
                }

                returnVal.m_SubStreamMarkers.AddRange(swm.m_SubStreamMarkers);
                swm.m_SubStreamMarkers.Clear();

                current = current.m_nextItem;
            }
#endif //USE_NORMAL_LIST

            returnVal.m_Stream = new SequenceStream(listStreams);
            if (openSecondaryStream)
            {
                returnVal.m_SecondaryStream = new SequenceStream(listSecondaryStreams);
            }

            listStreamsWithMarkers.Clear();
            listStreamsWithMarkers = null;

            return(returnVal);
        }
Exemplo n.º 2
0
 OpenPcmInputStreamOfManagedAudioMediaFlattened(DelegateAudioPcmStreamFound del)
 {
     return(OpenPcmInputStreamOfManagedAudioMediaFlattened(del, false));
 }