コード例 #1
0
    bool _ProcessPackets()
    {
        //check if we have packets
        if (!_Process())
        {
            return(false);            //no packets available
        }
        else
        {
            AudioPacket p;
            uint        channelsCount = 2;

            lock (_dataMutex) {
                p             = GetExistingPacket();
                channelsCount = Grabber.GetChannels();
            }

            //Broadcast the grabbed audio packets to the attached players
            foreach (var player in AttachedPlayers)
            {
                AudioSamples samples = new AudioSamples();
                samples.channels   = channelsCount;
                samples.startIndex = p.startIndex;
                samples.samples    = p.data;
                player.AddAudioPacket(samples);
            }
        }
        return(true);
    }
コード例 #2
0
    bool _ProcessPackets()
    {
        //check if we have packets
        while (_Process())
        {
            AudioSamples p;

            lock (_dataMutex) {
                p          = GetExistingPacket();
                p.channels = (int)Grabber.GetChannels();
            }

            //Broadcast the grabbed audio packets to the attached players
            foreach (var player in AttachedPlayers)              /*
                                                                  * AudioSamples samples = new AudioSamples ();
                                                                  * samples.channels = channelsCount;
                                                                  * samples.startIndex = p.startIndex;
                                                                  * samples.samples = p.data;*/
            {
                player.AddAudioPacket(p);
            }
        }
        return(true);
    }