Exemplo n.º 1
0
        /// <summary>
        /// Designates a new set of submix or mastering voices to receive the output of the voice.
        /// </summary>
        /// <param name="outputVoices">[in]  Array of <see cref="VoiceSendDescriptor"/> structure pointers to destination voices. If outputVoices is NULL, the voice will send its output to the current mastering voice. To set the voice to not send its output anywhere set an array of length 0. All of the voices in a send list must have the same input sample rate, see {{XAudio2 Sample Rate Conversions}} for additional information. </param>
        /// <returns>No documentation.</returns>
        /// <unmanaged>HRESULT IXAudio2Voice::SetOutputVoices([In, Optional] const XAUDIO2_VOICE_SENDS* pSendList)</unmanaged>
        public void SetOutputVoices(params VoiceSendDescriptor[] outputVoices)
        {
            unsafe
            {
                if (outputVoices != null)
                {
                    var tempSendDescriptor = new VoiceSendDescriptors {
                        SendCount = outputVoices.Length
                    };

                    if (outputVoices.Length > 0)
                    {
                        fixed(void *pVoiceSendDescriptors = &outputVoices[0])
                        {
                            tempSendDescriptor.SendPointer = (IntPtr)pVoiceSendDescriptors;
                            SetOutputVoices(tempSendDescriptor);
                        }
                    }
                    else
                    {
                        tempSendDescriptor.SendPointer = IntPtr.Zero;
                    }
                }
                else
                {
                    SetOutputVoices((VoiceSendDescriptors?)null);
                }
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Designates a new set of submix or mastering voices to receive the output of the voice.
        /// </summary>
        /// <param name="outputVoices">[in]  Array of <see cref="VoiceSendDescriptor"/> structure pointers to destination voices. If outputVoices is NULL, the voice will send its output to the current mastering voice. To set the voice to not send its output anywhere set an array of length 0. All of the voices in a send list must have the same input sample rate, see {{XAudio2 Sample Rate Conversions}} for additional information. </param>
        /// <returns>No documentation.</returns>
        /// <unmanaged>HRESULT IXAudio2Voice::SetOutputVoices([In, Optional] const XAUDIO2_VOICE_SENDS* pSendList)</unmanaged>
        public void SetOutputVoices(params VoiceSendDescriptor[] outputVoices)
        {
            unsafe
            {
                if (outputVoices != null)
                {
                    var tempSendDescriptor = new VoiceSendDescriptors {
                        SendCount = outputVoices.Length
                    };

                    if (outputVoices.Length > 0)
                    {
                        var nativeDescriptors = new VoiceSendDescriptor.__Native[outputVoices.Length];

                        for (int i = 0; i < outputVoices.Length; i++)
                        {
                            outputVoices[i].__MarshalTo(ref nativeDescriptors[i]);
                        }

                        fixed(void *pVoiceSendDescriptors = &nativeDescriptors[0])
                        {
                            tempSendDescriptor.SendPointer = (IntPtr)pVoiceSendDescriptors;
                            SetOutputVoices(tempSendDescriptor);
                        }
                    }
                    else
                    {
                        tempSendDescriptor.SendPointer = IntPtr.Zero;
                    }
                }
                else
                {
                    SetOutputVoices((VoiceSendDescriptors?)null);
                }
            }
        }