예제 #1
0
        void AudioOutputStreamClosedCallback(IntPtr nativeClient, IntPtr nativeAudioOutputStreamIdentifier)
        {
            // This method is fired for every client, ignore events meant for other clients
            if (nativeClient != _nativeClient)
            {
                return;
            }

            AudioOutputStream audioOutputStreamToClose = null;

            foreach (AudioOutputStream audioOutputStream in _audioOutputStreams)
            {
                // Find the matching audio output stream.
                if (audioOutputStream.AudioOutputStreamMatchesIdentifier(nativeAudioOutputStreamIdentifier))
                {
                    audioOutputStreamToClose = audioOutputStream;
                    break;
                }
            }

            if (audioOutputStreamToClose != null)
            {
                // Fire event
                if (audioOutputStreamClosed != null)
                {
                    audioOutputStreamClosed(this, audioOutputStreamToClose);
                }

                // Dispose of AudioOutputStream
                _audioOutputStreams.Remove(audioOutputStreamToClose);
                audioOutputStreamToClose.Dispose();
            }
        }
예제 #2
0
        void AudioOutputStreamCreatedCallback(IntPtr nativeClient, IntPtr nativeAudioOutputStream, IntPtr nativeAudioOutputStreamIdentifier)
        {
            // This method is fired for every client, ignore events meant for other clients
            if (nativeClient != _nativeClient)
            {
                return;
            }

            AudioOutputStream audioOutputStream = new AudioOutputStream(nativeAudioOutputStream, nativeAudioOutputStreamIdentifier);

            _audioOutputStreams.Add(audioOutputStream);

            // Fire event
            if (audioOutputStreamCreated != null)
            {
                audioOutputStreamCreated(this, audioOutputStream);
            }
        }