Exemplo n.º 1
0
        /// <summary>
        /// Readies all or part of the buffer for a data write and returns pointers to which data can be written.
        /// </summary>
        /// <param name="offset">Offset, in bytes, from the start of the buffer to the point where the lock begins. This parameter is ignored if <see cref="DSBLock.FromWriteCursor"/> is specified in the <paramref name="lockFlags"/> parameter.</param>
        /// <param name="bytes">Size, in bytes, of the portion of the buffer to lock. The buffer is conceptually circular, so this number can exceed the number of bytes between <paramref name="offset"/> and the end of the buffer.</param>
        /// <param name="audioPtr1">Receives a pointer to the first locked part of the buffer.</param>
        /// <param name="audioBytes1">Receives the number of bytes in the block at <paramref name="audioPtr1"/>. If this value is less than <paramref name="bytes"/>, the lock has wrapped and <paramref name="audioPtr2"/> points to a second block of data at the beginning of the buffer.</param>
        /// <param name="audioPtr2">Receives a pointer to the second locked part of the capture buffer. If <see cref="IntPtr.Zero"/> is returned, the <paramref name="audioPtr1"/> parameter points to the entire locked portion of the capture buffer.</param>
        /// <param name="audioBytes2">Receives the number of bytes in the block at <paramref name="audioPtr2"/>. If <paramref name="audioPtr2"/> is <see cref="IntPtr.Zero"/>, this value is zero.</param>
        /// <param name="lockFlags">Flags modifying the lock event.</param>
        public void Lock(int offset, int bytes, out IntPtr audioPtr1, out int audioBytes1,
                         out IntPtr audioPtr2, out int audioBytes2, DSBLock lockFlags)
        {
            var result = LockNative(offset, bytes, out audioPtr1, out audioBytes1, out audioPtr2, out audioBytes2,
                                    lockFlags);

            DirectSoundException.Try(result, InterfaceName, "Lock");
        }
Exemplo n.º 2
0
        public DSResult Lock(int offset, int bytes, out IntPtr audioPtr1, out int audioBytes1,
                             out IntPtr audioPtr2, out int audioBytes2, DSBLock lockFlags)
        {
            fixed(void *pAudioPtr1 = &audioPtr1, pAudioPtr2 = &audioPtr2)
            {
                fixed(void *pAudioBytes1 = &audioBytes1, pAudioBytes2 = &audioBytes2)
                {
                    var result = InteropCalls.CalliMethodPtr(_basePtr, offset, bytes,
                                                             pAudioPtr1, pAudioBytes1, pAudioPtr2, pAudioBytes2, unchecked ((int)lockFlags),
                                                             ((void **)(*(void **)_basePtr))[11]);

                    return(result);
                }
            }
        }
Exemplo n.º 3
0
 public DSResult Lock(int offset, int bytes, out IntPtr audioPtr1, out int audioBytes1,
                      out IntPtr audioPtr2, out int audioBytes2, DSBLock lockFlags)
 {
     fixed (void* pAudioPtr1 = &audioPtr1, pAudioPtr2 = &audioPtr2)
     {
         fixed (void* pAudioBytes1 = &audioBytes1, pAudioBytes2 = &audioBytes2)
         {
             var result = InteropCalls.CalliMethodPtr(_basePtr, offset, bytes,
                                 pAudioPtr1, pAudioBytes1, pAudioPtr2, pAudioBytes2, unchecked((int)lockFlags),
                                 ((void**)(*(void**)_basePtr))[11]);
             return result;
         }
     }
 }
Exemplo n.º 4
0
 /// <summary>
 /// Readies all or part of the buffer for a data write and returns pointers to which data can be written. 
 /// </summary>
 /// <param name="offset">Offset, in bytes, from the start of the buffer to the point where the lock begins. This parameter is ignored if <see cref="DSBLock.FromWriteCursor"/> is specified in the <paramref name="lockFlags"/> parameter.</param>
 /// <param name="bytes">Size, in bytes, of the portion of the buffer to lock. The buffer is conceptually circular, so this number can exceed the number of bytes between <paramref name="offset"/> and the end of the buffer.</param>
 /// <param name="audioPtr1">Receives a pointer to the first locked part of the buffer.</param>
 /// <param name="audioBytes1">Receives the number of bytes in the block at <paramref name="audioPtr1"/>. If this value is less than <paramref name="bytes"/>, the lock has wrapped and <paramref name="audioPtr2"/> points to a second block of data at the beginning of the buffer.</param>
 /// <param name="audioPtr2">Receives a pointer to the second locked part of the capture buffer. If <see cref="IntPtr.Zero"/> is returned, the <paramref name="audioPtr1"/> parameter points to the entire locked portion of the capture buffer.</param>
 /// <param name="audioBytes2">Receives the number of bytes in the block at <paramref name="audioPtr2"/>. If <paramref name="audioPtr2"/> is <see cref="IntPtr.Zero"/>, this value is zero.</param>
 /// <param name="lockFlags">Flags modifying the lock event.</param>
 public void Lock(int offset, int bytes, out IntPtr audioPtr1, out int audioBytes1,
     out IntPtr audioPtr2, out int audioBytes2, DSBLock lockFlags)
 {
     var result = LockNative(offset, bytes, out audioPtr1, out audioBytes1, out audioPtr2, out audioBytes2,
         lockFlags);
     DirectSoundException.Try(result, InterfaceName, "Lock");
 }