コード例 #1
0
ファイル: AudioFile.cs プロジェクト: zezba9000/maccore
        public long PacketToByte(long packet, out bool isEstimate)
        {
            AudioBytePacketTranslation buffer;

            buffer.Packet = packet;

            unsafe {
                AudioBytePacketTranslation *p = &buffer;
                int size = Marshal.SizeOf(buffer);
                if (AudioFileGetProperty(handle, AudioFileProperty.PacketToByte, ref size, (IntPtr)p) == 0)
                {
                    isEstimate = (buffer.Flags & 1) == 1;
                    return(buffer.Byte);
                }
                isEstimate = false;
                return(-1);
            }
        }
コード例 #2
0
        public long PacketToByte(long packet, out bool isEstimate)
        {
            AudioBytePacketTranslation buffer;

            buffer.Packet = packet;

            unsafe {
                AudioBytePacketTranslation *p = &buffer;
                int size = sizeof(AudioBytePacketTranslation);
                LastError = AudioFileStreamGetProperty(handle, AudioFileStreamProperty.PacketToByte, ref size, (IntPtr)p);
                if (LastError == 0)
                {
                    isEstimate = (buffer.Flags & BytePacketTranslationFlags.IsEstimate) != 0;
                    return(buffer.Byte);
                }
                isEstimate = false;
                return(-1);
            }
        }
コード例 #3
0
ファイル: AudioFile.cs プロジェクト: zezba9000/maccore
        public long ByteToPacket(long byteval, out int byteOffsetInPacket, out bool isEstimate)
        {
            AudioBytePacketTranslation buffer;

            buffer.Byte = byteval;

            unsafe {
                AudioBytePacketTranslation *p = &buffer;
                int size = Marshal.SizeOf(buffer);
                if (AudioFileGetProperty(handle, AudioFileProperty.ByteToPacket, ref size, (IntPtr)p) == 0)
                {
                    isEstimate         = (buffer.Flags & 1) == 1;
                    byteOffsetInPacket = buffer.ByteOffsetInPacket;
                    return(buffer.Packet);
                }
                byteOffsetInPacket = 0;
                isEstimate         = false;
                return(-1);
            }
        }
コード例 #4
0
        public long ByteToPacket(long byteval, out int byteOffsetInPacket, out bool isEstimate)
        {
            AudioBytePacketTranslation buffer;

            buffer.Byte = byteval;

            unsafe {
                AudioBytePacketTranslation *p = &buffer;
                int size = sizeof(AudioBytePacketTranslation);
                LastError = AudioFileStreamGetProperty(handle, AudioFileStreamProperty.ByteToPacket, ref size, (IntPtr)p);
                if (LastError == 0)
                {
                    isEstimate         = (buffer.Flags & BytePacketTranslationFlags.IsEstimate) != 0;
                    byteOffsetInPacket = buffer.ByteOffsetInPacket;
                    return(buffer.Packet);
                }
                byteOffsetInPacket = 0;
                isEstimate         = false;
                return(-1);
            }
        }