Exemplo n.º 1
0
        /// <exception cref="NotAvailableException">Channel object is no longer available.</exception>
        /// <exception cref="BassErrorException">
        ///     Some error occur to call a Bass function, check the error code and error message
        ///     to get more error information.
        /// </exception>
        /// <exception cref="BassNotLoadedException">
        ///     Bass DLL not loaded, you must use <see cref="BassManager.Initialize" /> to
        ///     load Bass DLL first.
        /// </exception>
        void IChannelInternal.SetAttribute(ChannelAttributeEx attribute, byte[] value)
        {
            CheckAvailable();

            GCHandle valueHandle = GCHandle.Alloc(value, GCHandleType.Pinned);

            ChannelModule.ChannelSetAttributeExFunction.CheckResult(
                ChannelModule.ChannelSetAttributeExFunction.Delegate(Handle, attribute, valueHandle.AddrOfPinnedObject(),
                    (uint) value.Length));

            valueHandle.Free();
        }
Exemplo n.º 2
0
        /// <exception cref="NotAvailableException">Channel object is no longer available.</exception>
        /// <exception cref="BassErrorException">
        ///     Some error occur to call a Bass function, check the error code and error message
        ///     to get more error information.
        /// </exception>
        /// <exception cref="BassNotLoadedException">
        ///     Bass DLL not loaded, you must use <see cref="BassManager.Initialize" /> to
        ///     load Bass DLL first.
        /// </exception>
        byte[] IChannelInternal.GetAttribute(ChannelAttributeEx attribute)
        {
            CheckAvailable();

            var size =
                ChannelModule.ChannelGetAttributeExFunction.CheckResult(
                    ChannelModule.ChannelGetAttributeExFunction.Delegate(Handle, attribute, IntPtr.Zero, 0));

            byte[] result = new byte[size];

            GCHandle resultHandle = GCHandle.Alloc(result, GCHandleType.Pinned);

            ChannelModule.ChannelGetAttributeExFunction.CheckResult(
                ChannelModule.ChannelGetAttributeExFunction.Delegate(Handle, attribute,
                    resultHandle.AddrOfPinnedObject(), size));

            resultHandle.Free();

            return result;
        }