예제 #1
0
        /// <summary>
        ///     Gets the volume level of each channel of the final output for the voice. These channels are mapped to the input
        ///     channels of a specified destination voice.
        /// </summary>
        /// <param name="destinationVoice">The destination <see cref="XAudio2Voice" /> to retrieve the output matrix for.</param>
        /// <param name="sourceChannels">
        ///     Confirms the output channel count of the voice. This is the number of channels that are
        ///     produced by the last effect in the chain.
        /// </param>
        /// <param name="destinationChannels">Confirms the input channel count of the destination voice.</param>
        /// <param name="levelMatrix">
        ///     Array of [SourceChannels ?DestinationChannels] volume levels sent to the destination voice.
        ///     The level sent from source channel S to destination channel D is specified in the form levelMatrix[SourceChannels ?        ///     D + S].
        ///     For more details see
        ///     http://msdn.microsoft.com/en-us/library/windows/desktop/microsoft.directx_sdk.ixaudio2voice.ixaudio2voice.getoutputmatrix(v=vs.85).aspx.
        /// </param>
        public void GetOutputMatrix(XAudio2Voice destinationVoice, int sourceChannels,
                                    int destinationChannels, float[] levelMatrix)
        {
            int result = GetOutputMatrixNative(destinationVoice, sourceChannels, destinationChannels, levelMatrix);

            XAudio2Exception.Try(result, InterfaceName, "GetOutputMatrix");
        }
예제 #2
0
        /// <summary>
        ///     Returns the filter parameters from one of this voice's sends.
        /// </summary>
        /// <param name="destinationVoice">The destination voice of the send whose filter parameters will be read.</param>
        /// <returns><see cref="AudioSharp.XAudio2.FilterParameters" /> structure containing the filter information.</returns>
        public FilterParameters GetOutputFilterParameters(XAudio2Voice destinationVoice)
        {
            FilterParameters value;

            XAudio2Exception.Try(GetOutputFilterParametersNative(destinationVoice, out value), InterfaceName,
                                 "GetOutputFilterParameters");
            return(value);
        }
예제 #3
0
        /// <summary>
        ///     Sets the filter parameters on one of this voice's sends.
        /// </summary>
        /// <param name="destinationVoice">The destination voice of the send whose filter parameters will be set.</param>
        /// <param name="filterParameters">
        ///     <see cref="AudioSharp.XAudio2.FilterParameters" /> structure containing the filter
        ///     information.
        /// </param>
        /// <param name="operationSet">
        ///     Identifies this call as part of a deferred batch. For more information see
        ///     http://msdn.microsoft.com/en-us/library/windows/desktop/ee415807(v=vs.85).aspx.
        /// </param>
        /// <returns>HRESULT</returns>
        public unsafe int SetOutputFilterParametersNative(XAudio2Voice destinationVoice,
                                                          FilterParameters filterParameters,
                                                          int operationSet)
        {
            IntPtr pVoice = destinationVoice == null ? IntPtr.Zero : destinationVoice.BasePtr;

            return(LocalInterop.Calli(UnsafeBasePtr, (void *)pVoice, &filterParameters, operationSet,
                                      ((void **)(*(void **)UnsafeBasePtr))[10]));
        }
예제 #4
0
        /// <summary>
        ///     Gets the volume level of each channel of the final output for the voice. These channels are mapped to the input
        ///     channels of a specified destination voice.
        /// </summary>
        /// <param name="destinationVoice">The destination <see cref="XAudio2Voice" /> to retrieve the output matrix for.</param>
        /// <param name="sourceChannels">
        ///     Confirms the output channel count of the voice. This is the number of channels that are
        ///     produced by the last effect in the chain.
        /// </param>
        /// <param name="destinationChannels">Confirms the input channel count of the destination voice.</param>
        /// <param name="levelMatrix">
        ///     Array of [SourceChannels ?DestinationChannels] volume levels sent to the destination voice.
        ///     The level sent from source channel S to destination channel D is specified in the form levelMatrix[SourceChannels ?        ///     D + S].
        ///     For more details see
        ///     http://msdn.microsoft.com/en-us/library/windows/desktop/microsoft.directx_sdk.ixaudio2voice.ixaudio2voice.getoutputmatrix(v=vs.85).aspx.
        /// </param>
        /// <returns>HRESULT</returns>
        public unsafe int GetOutputMatrixNative(XAudio2Voice destinationVoice, int sourceChannels,
                                                int destinationChannels, float[] levelMatrix)
        {
            IntPtr pVoice = destinationVoice == null ? IntPtr.Zero : destinationVoice.BasePtr;

            fixed(void *p = &levelMatrix[0])
            {
                return(LocalInterop.Calli(UnsafeBasePtr, (void *)pVoice, sourceChannels, destinationChannels, p,
                                          ((void **)(*(void **)UnsafeBasePtr))[17]));
            }
        }
예제 #5
0
        /// <summary>
        ///     Returns the filter parameters from one of this voice's sends.
        /// </summary>
        /// <param name="destinationVoice">The destination voice of the send whose filter parameters will be read.</param>
        /// <param name="filterParameters">
        ///     <see cref="AudioSharp.XAudio2.FilterParameters" /> structure containing the filter
        ///     information.
        /// </param>
        /// <returns>HRESULT</returns>
        public unsafe int GetOutputFilterParametersNative(XAudio2Voice destinationVoice,
                                                          out FilterParameters filterParameters)
        {
            filterParameters = default(FilterParameters);

            IntPtr pVoice = destinationVoice == null ? IntPtr.Zero : destinationVoice.BasePtr;

            fixed(void *p = &filterParameters)
            {
                return(LocalInterop.Calli(UnsafeBasePtr, (void *)pVoice, p, ((void **)(*(void **)UnsafeBasePtr))[11]));
            }
        }
예제 #6
0
 /// <summary>
 ///     Creates a new instance of the <see cref="VoiceSendDescriptor" /> structure.
 /// </summary>
 /// <param name="flags">The <see cref="VoiceSendFlags"/>. Must be either <see cref="VoiceSendFlags.None"/> or <see cref="VoiceSendFlags.UseFilter"/>.</param>
 /// <param name="outputVoice">The destination voice. Must not be null.</param>
 public VoiceSendDescriptor(VoiceSendFlags flags, XAudio2Voice outputVoice)
 {
     if (flags != VoiceSendFlags.None && flags != VoiceSendFlags.UseFilter)
     {
         throw new InvalidEnumArgumentException("flags", (int)flags, typeof(VoiceSendFlags));
     }
     if (outputVoice == null)
     {
         throw new ArgumentNullException("outputVoice");
     }
     Flags          = flags;
     OutputVoicePtr = outputVoice.BasePtr;
 }
예제 #7
0
 /// <summary>
 ///     Sets the volume level of each channel of the final output for the voice. These channels are mapped to the input
 ///     channels of a specified destination voice.
 /// </summary>
 /// <param name="destinationVoice">
 ///     Destination <see cref="XAudio2Voice" /> for which to set volume levels.
 ///     If the voice sends to a single target voice then specifying null will cause SetOutputMatrix to operate on that
 ///     target voice.
 /// </param>
 /// <param name="sourceChannels">
 ///     Confirms the output channel count of the voice. This is the number of channels that are
 ///     produced by the last effect in the chain.
 /// </param>
 /// <param name="destinationChannels">Confirms the input channel count of the destination voice.</param>
 /// <param name="levelMatrix">
 ///     Array of [SourceChannels ?DestinationChannels] volume levels sent to the destination voice.
 ///     The level sent from source channel S to destination channel D is specified in the form levelMatrix[SourceChannels ?        ///     D + S].
 ///     For more details see
 ///     http://msdn.microsoft.com/en-us/library/windows/desktop/microsoft.directx_sdk.ixaudio2voice.ixaudio2voice.setoutputmatrix(v=vs.85).aspx.
 /// </param>
 public void SetOutputMatrix(XAudio2Voice destinationVoice, int sourceChannels,
                             int destinationChannels, float[] levelMatrix)
 {
     SetOutputMatrix(destinationVoice, sourceChannels, destinationChannels, levelMatrix, 0);
 }
예제 #8
0
 /// <summary>
 ///     Sets the filter parameters on one of this voice's sends.
 /// </summary>
 /// <param name="destinationVoice">The destination voice of the send whose filter parameters will be set.</param>
 /// <param name="filterParameters">
 ///     <see cref="AudioSharp.XAudio2.FilterParameters" /> structure containing the filter
 ///     information.
 /// </param>
 public void SetOutputFilterParameters(XAudio2Voice destinationVoice, FilterParameters filterParameters)
 {
     SetOutputFilterParameters(destinationVoice, filterParameters, 0);
 }
예제 #9
0
 /// <summary>
 ///     Sets the filter parameters on one of this voice's sends.
 /// </summary>
 /// <param name="destinationVoice">The destination voice of the send whose filter parameters will be set.</param>
 /// <param name="filterParameters">
 ///     <see cref="AudioSharp.XAudio2.FilterParameters" /> structure containing the filter
 ///     information.
 /// </param>
 /// <param name="operationSet">
 ///     Identifies this call as part of a deferred batch. For more information see
 ///     http://msdn.microsoft.com/en-us/library/windows/desktop/ee415807(v=vs.85).aspx.
 /// </param>
 public void SetOutputFilterParameters(XAudio2Voice destinationVoice, FilterParameters filterParameters,
                                       int operationSet)
 {
     XAudio2Exception.Try(SetOutputFilterParametersNative(destinationVoice, filterParameters, operationSet), InterfaceName,
                          "SetOutputFilterParameters");
 }