libZPlay documentation (Win32)
IndexReferenceHome
PreviousUpNext
libZPlay.vb
''
''  libzplay - windows ( WIN32 ) multimedia library
 ''
 ''  ver: 2.00
 ''  date: 22. April, 2010.
 ''
 ''  Copyright (C) 2003-2010 Zoran Cindori
 ''
 ''  Author: Zoran Cindori
 ''  Web: http://libzplay.sourceforge.net/
 ''  Email: zcindori@inet.hr
 ''
 ''
 ''  This program is free software; you can redistribute it and/or modify
 ''  it under the terms of the GNU General Public License as published by
 ''  the Free Software Foundation; either version 2 of the License, or
 ''  (at your option) any later version.
 ''
 ''  This program is distributed in the hope that it will be useful,
 ''  but WITHOUT ANY WARRANTY; without even the implied warranty of
 ''  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 ''  GNU General Public License for more details.
 ''
 ''  You should have received a copy of the GNU General Public License
 ''  along with this program; if not, write to the Free Software
 ''  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 ''
 ''
 ''
 '' Supported by:
 ''
 '' ============================================================================
 '' libmad - MPEG audio decoder library
 '' Copyright (C) 2000-2004 Underbit Technologies, Inc. <support@underbit.com>
 '' http://www.underbit.com/products/mad/
 '' GNU General Public License ( GPL.TXT )
 '' ============================================================================
 '' THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2002 
 '' by the Xiph.Org Foundation http://www.xiph.org/
 '' BSD-STYLE SOURCE LICENSE  ( XIPH.TXT )
 '' ============================================================================
 '' LIBA52
 '' free library for decoding ATSC A/52 streams.
 '' It is released under the terms of the GPL license.
 '' ============================================================================
 '' FLAC - Free Lossless Audio Codec
 '' Copyright (C) 2001,2002,2003,2004,2005,2006,2007  Josh Coalson
 '' http://flac.sourceforge.net/
 ''
 '' This file is part the FLAC project.  FLAC is comprised of several
 '' components distributed under difference licenses.  The codec libraries
 '' are distributed under Xiph.Org's BSD-like license (see the file
 '' XIPH.TXT in this distribution).  All other programs, libraries, and
 '' plugins are distributed under the LGPL or GPL (see LGPL.TXT and
 '' GPL.TXT).  The documentation is distributed under the Gnu FDL (see
 '' FDL.TXT).  Each file in the FLAC distribution contains at the top the
 '' terms under which it may be distributed.
 ''
 '' Since this particular file is relevant to all components of FLAC,
 '' it may be distributed under the Xiph.Org license, which is the least
 '' restrictive of those mentioned above.  See the file XIPH.TXT in this
 '' distribution.
 '' ============================================================================
 '' FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
 '' Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com
 ''
 '' This program is free software; you can redistribute it and/or modify
 '' it under the terms of the GNU General Public License as published by
 '' the Free Software Foundation; either version 2 of the License, or
 '' (at your option) any later version.
 ''
 '' This program is distributed in the hope that it will be useful,
 '' but WITHOUT ANY WARRANTY; without even the implied warranty of
 '' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 '' GNU General Public License for more details.
 ''
 '' You should have received a copy of the GNU General Public License
 '' along with this program; if not, write to the Free Software
 '' Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 ''
 '' Any non-GPL usage of this software or parts of this software is strictly
 '' forbidden.
 ''
 '' The "appropriate copyright message" mentioned in section 2c of the GPLv2
 '' must read: "Code from FAAD2 is copyright (c) Nero AG, www.nero.com"
 ''
 '' Commercial non-GPL licensing of this software is possible.
 '' For more info contact Nero AG through Mpeg4AAClicense@nero.com.
 ''
 '' ============================================================================
 '' FAAC - Freeware Advanced Audio Coder Copyright (C) 2001 M. Bakker
 '' This library is free software; you can redistribute it and/or modify it
 '' under the terms of the GNU Lesser General Public License as published by the
 '' Free Software Foundation; either version 2.1 of the License, or
 '' (at your option) any later version. 
 ''
 '' This library is distributed in the hope that it will be useful,
 '' but WITHOUT ANY WARRANTY; without even the implied warranty of
 '' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 '' See the GNU Lesser General Public License for more details. 
 ''
 '' You should have received a copy of the GNU Lesser General Public License
 '' along with this library; if not, write to the Free Software Foundation,
 '' Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 
 ''
 '' ============================================================================
 '' libmp3lame encoder
 '' LAME 3.xx LAME Ain't an MP3 Encoder http://www.mp3dev.org March 2001 
 '' 
 '' Originally developed by Mike Cheng (www.uq.net.au/~zzmcheng).
 '' Now maintained by Mark Taylor (www.mp3dev.org). 
 ''
 '' This code is distributed under the GNU LESSER PUBLIC LICENSE (LGPL, see www.gnu.org)
 '' with the following modification: 
 '' 
 '' If you determine that distribution of LAME requires a patent license,
 '' and you obtain a patent license, you may distribute LAME even though redistribution
 '' of LAME may also require a patent license. 
 ''
 '' You agree not to enforce any patent claims for any aspect of MPEG audio compression,
 '' or any other techniques contained in the LAME source code. 
 ''
 '' Copyrights (c) 1999-1007 by The LAME Project Copyrights (c) 1999,2000,2001
 '' by Mark Taylor Copyrights (c) 1999,2000,2001 by Mark Taylor Copyrights
 '' (c) 1998 by Michael Cheng Copyrights (c) 1995,1996,1997 by Michael Hipp: mpglib
 ''
 '' ============================================================================
 '' SoundTouch library Copyright (c) Olli Parviainen 2002-2009 
 '' http://www.surina.net/soundtouch
 '' GNU Lesser General Public License vesrion 2.1 (LGPL.TXT )
 '' ============================================================================
 '' Center Cut DSP Plugin for Winamp 2.x 
 '' Copyright (C) 2004  Moitah (moitah@yahoo.com)
 '' GNU General Public License ( GPL.TXT )
 '' ============================================================================
 '' Shibatch Super Equalizer ver 0.03 for winamp
 '' written by Naoki Shibata  shibatch@users.sourceforge.net
 '' http://shibatch.sourceforge.net/
 ''
 '' Shibatch Super Equalizer (except FFT part) is distributed under LGPL.
 '' See LGPL.txt for details.
 '' FFT part is a routine made by Mr.Ooura. This routine is a freeware.
 '' Contact Mr.Ooura for details of distributing licenses.
 '' http://momonga.t.u-tokyo.ac.jp/~ooura/fft.html
 '' ============================================================================
 '' The Independent JPEG Group's JPEG software
 '' JPEG decoding library
 '' Copyright (C) 1991-2010, Thomas G. Lane, Guido Vollbeding.
 '' www.ijg.org
 '' ============================================================================
 '' ZLIB DATA COMPRESSION LIBRARY
 '' (C) 1995-2010 Jean-loup Gailly and Mark Adler
 '' http://zlib.net/ 
 '' ============================================================================
 '' libpng library
 '' PNG picture decoding library
 '' Copyright (c) 2004, 2006-2007 Glenn Randers-Pehrson
 '' http://www.libpng.org/
 '' ============================================================================
 ''




Imports System
Imports System.Runtime.InteropServices
Imports System.Drawing


Namespace libZPlay



#Region "Structure and Enum"
    Public Delegate Function TCallbackFunc(ByVal objptr As UInteger, ByVal user_data As Integer, ByVal msg As TCallbackMessage, ByVal param1 As UInteger, ByVal param2 As UInteger) As Integer



    Public Enum TSettingID As Integer
        sidWaveBufferSize = 1
        sidAccurateLength = 2
        sidAccurateSeek = 3
        sidSamplerate = 4
        sidChannelNumber = 5
        sidBitPerSample = 6
        sidBigEndian = 7
    End Enum

    Public Enum TStreamFormat As Integer
        sfUnknown = 0
        sfMp3 = 1
        sfOgg = 2
        sfWav = 3
        sfPCM = 4
        sfFLAC = 5
        sfFLACOgg = 6
        sfAC3 = 7
        sfAacADTS = 8
        sfWaveIn = 9
        sfAutodetect = 1000
    End Enum


    <StructLayout(LayoutKind.Explicit, CharSet:=CharSet.Unicode)> _
    Public Structure TStreamInfo
        <FieldOffset(0)> _
        Public SamplingRate As Integer
        <FieldOffset(4)> _
        Public ChannelNumber As Integer
        <FieldOffset(8)> _
        Public VBR As Boolean
        <FieldOffset(12)> _
        Public Bitrate As Integer
        <FieldOffset(16)> _
        Public Length As TStreamTime
        <FieldOffset(44)> _
        Public Description As String
    End Structure





    <StructLayout(LayoutKind.Explicit, CharSet:=CharSet.Unicode)> _
    Public Structure TWaveOutInfo
        <FieldOffset(0)> _
        Public ManufacturerID As UInteger
        <FieldOffset(4)> _
        Public ProductID As UInteger
        <FieldOffset(8)> _
        Public DriverVersion As UInteger
        <FieldOffset(12)> _
        Public Formats As UInteger
        <FieldOffset(16)> _
        Public Channels As UInteger
        <FieldOffset(20)> _
        Public Support As UInteger
        <FieldOffset(24)> _
        Public ProductName As String
    End Structure


    <StructLayout(LayoutKind.Explicit, CharSet:=CharSet.Unicode)> _
Public Structure TWaveInInfo
        <FieldOffset(0)> _
        Public ManufacturerID As UInteger
        <FieldOffset(4)> _
        Public ProductID As UInteger
        <FieldOffset(8)> _
        Public DriverVersion As UInteger
        <FieldOffset(12)> _
        Public Formats As UInteger
        <FieldOffset(16)> _
        Public Channels As UInteger
        <FieldOffset(20)> _
        Public ProductName As String
    End Structure


    Public Enum TFFTWindow As Integer
        fwRectangular = 1
        fwHamming
        fwHann
        fwCosine
        fwLanczos
        fwBartlett
        fwTriangular
        fwGauss
        fwBartlettHann
        fwBlackman
        fwNuttall
        fwBlackmanHarris
        fwBlackmanNuttall
        fwFlatTop
    End Enum




    Public Enum TTimeFormat As UInteger
        tfMillisecond = 1
        tfSecond = 2
        tfHMS = 4
        tfSamples = 8
    End Enum

    Public Enum TSeekMethod As Integer
        smFromBeginning = 1
        smFromEnd = 2
        smFromCurrentForward = 4
        smFromCurrentBackward = 8
    End Enum

    <StructLayout(LayoutKind.Explicit)> _
    Public Structure TStreamLoadInfo
        <FieldOffset(0)> _
        Public NumberOfBuffers As UInteger
        <FieldOffset(4)> _
        Public NumberOfBytes As UInteger
    End Structure




    <StructLayout(LayoutKind.Explicit)> _
    Public Structure TEchoEffect
        <FieldOffset(0)> _
        Public nLeftDelay As Integer
        <FieldOffset(4)> _
        Public nLeftSrcVolume As Integer
        <FieldOffset(8)> _
        Public nLeftEchoVolume As Integer
        <FieldOffset(12)> _
        Public nRightDelay As Integer
        <FieldOffset(16)> _
        Public nRightSrcVolume As Integer
        <FieldOffset(20)> _
        Public nRightEchoVolume As Integer
    End Structure

    Public Enum TID3Version As Integer
        id3Version1 = 1
        id3Version2 = 2
    End Enum


    Public Enum TFFTGraphHorizontalScale As Integer
        gsLogarithmic = 0
        gsLinear = 1
    End Enum

    Public Enum TFFTGraphParamID As Integer
        gpFFTPoints = 1
        gpGraphType
        gpWindow
        gpHorizontalScale
        gpSubgrid
        gpTransparency
        gpFrequencyScaleVisible
        gpDecibelScaleVisible
        gpFrequencyGridVisible
        gpDecibelGridVisible
        gpBgBitmapVisible
        gpBgBitmapHandle
        gpColor1
        gpColor2
        gpColor3
        gpColor4
        gpColor5
        gpColor6
        gpColor7
        gpColor8
        gpColor9
        gpColor10
        gpColor11
        gpColor12
        gpColor13
        gpColor14
        gpColor15
        gpColor16
    End Enum

    Public Enum TFFTGraphType As Integer
        gtLinesLeftOnTop = 0
        gtLinesRightOnTop
        gtAreaLeftOnTop
        gtAreaRightOnTop
        gtBarsLeftOnTop
        gtBarsRightOnTop
        gtSpectrum
    End Enum



    <StructLayout(LayoutKind.Explicit)> _
    Public Structure TStreamStatus
        <FieldOffset(0)> _
        Public fPlay As Boolean
        <FieldOffset(4)> _
        Public fPause As Boolean
        <FieldOffset(8)> _
        Public fEcho As Boolean
        <FieldOffset(12)> _
        Public fEqualizer As Boolean
        <FieldOffset(16)> _
        Public fVocalCut As Boolean
        <FieldOffset(20)> _
        Public fSideCut As Boolean
        <FieldOffset(24)> _
        Public fChannelMix As Boolean
        <FieldOffset(28)> _
        Public fSlideVolume As Boolean
        <FieldOffset(32)> _
        Public nLoop As Integer
        <FieldOffset(36)> _
        Public fReverse As Boolean
        <FieldOffset(40)> _
        Public nSongIndex As Integer
        <FieldOffset(44)> _
        Public nSongsInQueue As Integer
    End Structure


    <StructLayout(LayoutKind.Explicit)> _
    Public Structure TStreamHMSTime
        <FieldOffset(0)> _
        Public hour As UInteger
        <FieldOffset(4)> _
        Public minute As UInteger
        <FieldOffset(8)> _
        Public second As UInteger
        <FieldOffset(12)> _
        Public millisecond As UInteger
    End Structure

    <StructLayout(LayoutKind.Explicit)> _
    Public Structure TStreamTime
        <FieldOffset(0)> _
        Public sec As UInteger
        <FieldOffset(4)> _
        Public ms As UInteger
        <FieldOffset(8)> _
        Public samples As UInteger
        <FieldOffset(12)> _
        Public hms As TStreamHMSTime
    End Structure


    <StructLayout(LayoutKind.Explicit, CharSet:=CharSet.Unicode)> _
    Public Structure TID3Info
        <FieldOffset(0)> _
        Public Title As String
        <FieldOffset(4)> _
        Public Artist As String
        <FieldOffset(8)> _
        Public Album As String
        <FieldOffset(12)> _
        Public Year As String
        <FieldOffset(16)> _
        Public Comment As String
        <FieldOffset(20)> _
        Public Track As String
        <FieldOffset(24)> _
        Public Genre As String
    End Structure


    Public Structure TID3Picture
        Public PicturePresent As Boolean
        Public PictureType As Integer
        Public Description As String
        Public Bitmap As Bitmap
        Public BitStream As System.IO.MemoryStream
    End Structure


    Public Structure TID3InfoEx
        Public Title As String
        Public Artist As String
        Public Album As String
        Public Year As String
        Public Comment As String
        Public Track As String
        Public Genre As String
        Public AlbumArtist As String
        Public Composer As String
        Public OriginalArtist As String
        Public Copyright As String
        Public URL As String
        Public Encoder As String
        Public Publisher As String
        Public BPM As Integer
        Public Picture As TID3Picture
    End Structure


    Public Enum TBPMDetectionMethod As Integer
        dmPeaks = 0
        dmAutoCorrelation
    End Enum


    Public Enum TFFTGraphSize As Integer
        FFTGraphMinWidth = 100
        FFTGraphMinHeight = 60
    End Enum

    Public Enum TWaveOutMapper As UInteger
        WaveOutWaveMapper = 4294967295
    End Enum

    Public Enum TWaveInMapper As UInteger
        WaveInWaveMapper = 4294967295
    End Enum

    Public Enum TCallbackMessage As Integer
        MsgStopAsync = 1
        MsgPlayAsync = 2
        MsgEnterLoopAsync = 4
        MsgExitLoopAsync = 8
        MsgEnterVolumeSlideAsync = 16
        MsgExitVolumeSlideAsync = 32
        MsgStreamBufferDoneAsync = 64
        MsgStreamNeedMoreDataAsync = 128
        MsgNextSongAsync = 256
        MsgStop = 65536
        MsgPlay = 131072
        MsgEnterLoop = 262144
        MsgExitLoop = 524288
        MsgEnterVolumeSlide = 1048576
        MsgExitVolumeSlide = 2097152
        MsgStreamBufferDone = 4194304
        MsgStreamNeedMoreData = 8388608
        MsgNextSong = 16777216
        MsgWaveBuffer = 33554432
    End Enum


    Public Enum TWaveOutFormat As UInteger
        format_invalid = 0
        format_11khz_8bit_mono = 1
        format_11khz_8bit_stereo = 2
        format_11khz_16bit_mono = 4
        format_11khz_16bit_stereo = 8

        format_22khz_8bit_mono = 16
        format_22khz_8bit_stereo = 32
        format_22khz_16bit_mono = 64
        format_22khz_16bit_stereo = 128

        format_44khz_8bit_mono = 256
        format_44khz_8bit_stereo = 512
        format_44khz_16bit_mono = 1024
        format_44khz_16bit_stereo = 2048
    End Enum

    Public Enum TWaveOutFunctionality As UInteger
        supportPitchControl = 1
        supportPlaybackRateControl = 2
        supportVolumeControl = 4
        supportSeparateLeftRightVolume = 8
        supportSync = 16
        supportSampleAccuratePosition = 32
        supportDirectSound = 6
    End Enum


#End Region
    Public Class ZPlay



#Region "libzplay.dll interface"

        <StructLayout(LayoutKind.Explicit, CharSet:=CharSet.Unicode)> _
Private Structure TStreamInfo_Internal
            <FieldOffset(0)> _
            Public SamplingRate As Integer
            <FieldOffset(4)> _
            Public ChannelNumber As Integer
            <FieldOffset(8)> _
            Public VBR As Boolean
            <FieldOffset(12)> _
            Public Bitrate As Integer
            <FieldOffset(16)> _
            Public Length As TStreamTime
            <FieldOffset(44)> _
            Public Description As IntPtr
        End Structure

        <StructLayout(LayoutKind.Explicit, CharSet:=CharSet.Unicode)> _
Private Structure TWaveOutInfo_Internal
            <FieldOffset(0)> _
            Public ManufacturerID As UInteger
            <FieldOffset(4)> _
            Public ProductID As UInteger
            <FieldOffset(8)> _
            Public DriverVersion As UInteger
            <FieldOffset(12)> _
            Public Formats As UInteger
            <FieldOffset(16)> _
            Public Channels As UInteger
            <FieldOffset(20)> _
            Public Support As UInteger
            <FieldOffset(24)> _
            Public ProductName As IntPtr
        End Structure



        <StructLayout(LayoutKind.Explicit, CharSet:=CharSet.Unicode)> _
Private Structure TWaveInInfo_Internal
            <FieldOffset(0)> _
            Public ManufacturerID As UInteger
            <FieldOffset(4)> _
            Public ProductID As UInteger
            <FieldOffset(8)> _
            Public DriverVersion As UInteger
            <FieldOffset(12)> _
            Public Formats As UInteger
            <FieldOffset(16)> _
            Public Channels As UInteger
            <FieldOffset(20)> _
            Public ProductName As IntPtr
        End Structure

        <StructLayout(LayoutKind.Explicit, CharSet:=CharSet.Unicode)> _
            Private Structure TID3Info_Internal
            <FieldOffset(0)> _
            Public Title As IntPtr
            <FieldOffset(4)> _
            Public Artist As IntPtr
            <FieldOffset(8)> _
            Public Album As IntPtr
            <FieldOffset(12)> _
            Public Year As IntPtr
            <FieldOffset(16)> _
            Public Comment As IntPtr
            <FieldOffset(20)> _
            Public Track As IntPtr
            <FieldOffset(24)> _
            Public Genre As IntPtr
        End Structure


        <StructLayout(LayoutKind.Explicit, CharSet:=CharSet.Unicode)> _
            Private Structure TID3InfoEx_Internal
            <FieldOffset(0)> _
            Public Title As IntPtr
            <FieldOffset(4)> _
            Public Artist As IntPtr
            <FieldOffset(8)> _
            Public Album As IntPtr
            <FieldOffset(12)> _
            Public Year As IntPtr
            <FieldOffset(16)> _
            Public Comment As IntPtr
            <FieldOffset(20)> _
            Public Track As IntPtr
            <FieldOffset(24)> _
            Public Genre As IntPtr
            <FieldOffset(28)> _
            Public AlbumArtist As IntPtr
            <FieldOffset(32)> _
            Public Composer As IntPtr
            <FieldOffset(36)> _
            Public OriginalArtist As IntPtr
            <FieldOffset(40)> _
            Public Copyright As IntPtr
            <FieldOffset(44)> _
            Public URL As IntPtr
            <FieldOffset(48)> _
            Public Encoder As IntPtr
            <FieldOffset(52)> _
            Public Publisher As IntPtr
            <FieldOffset(56)> _
            Public BPM As Integer
            <FieldOffset(60)> _
            Public PicturePresent As Integer
            <FieldOffset(64)> _
            Public CanDrawPicture As Integer
            <FieldOffset(68)> _
            Public MIMEType As IntPtr
            <FieldOffset(72)> _
            Public PictureType As Integer
            <FieldOffset(76)> _
            Public Description As IntPtr
            <FieldOffset(80)> _
            Public PictureData As IntPtr
            <FieldOffset(84)> _
            Public PictureDataSize As Integer
            <FieldOffset(88)> _
            Public hBitmap As IntPtr
            <FieldOffset(92)> _
            Public Width As Integer
            <FieldOffset(96)> _
            Public Height As Integer
            <FieldOffset(356)> _
            Public reserved As IntPtr
        End Structure

        <System.Runtime.InteropServices.DllImport("libzplay.dll", EntryPoint:="zplay_CreateZPlay", ExactSpelling:=True, CharSet:=System.Runtime.InteropServices.CharSet.Ansi, SetLastError:=True)> _
        Private Shared Function zplay_CreateZPlay() As UInteger
        End Function

        <System.Runtime.InteropServices.DllImport("libzplay.dll", EntryPoint:="zplay_DestroyZPlay", ExactSpelling:=True, CharSet:=System.Runtime.InteropServices.CharSet.Ansi, SetLastError:=True)> _
        Private Shared Function zplay_DestroyZPlay(ByVal objptr As UInteger) As Integer
        End Function

        <System.Runtime.InteropServices.DllImport("libzplay.dll", EntryPoint:="zplay_SetSettings", ExactSpelling:=True, CharSet:=System.Runtime.InteropServices.CharSet.Ansi, SetLastError:=True)> _
        Private Shared Function zplay_SetSettings(ByVal objptr As UInteger, ByVal nSettingID As Integer, ByVal value As Integer) As Integer
        End Function

        <System.Runtime.InteropServices.DllImport("libzplay.dll", EntryPoint:="zplay_GetSettings", ExactSpelling:=True, CharSet:=System.Runtime.InteropServices.CharSet.Ansi, SetLastError:=True)> _
        Private Shared Function zplay_GetSettings(ByVal objptr As UInteger, ByVal nSettingID As Integer) As Integer
        End Function


        <System.Runtime.InteropServices.DllImport("libzplay.dll", EntryPoint:="zplay_GetError", ExactSpelling:=True, CharSet:=System.Runtime.InteropServices.CharSet.Ansi, SetLastError:=True)> _
        Private Shared Function zplay_GetError(ByVal objptr As UInteger) As IntPtr
        End Function

        <System.Runtime.InteropServices.DllImport("libzplay.dll", EntryPoint:="zplay_GetErrorW", ExactSpelling:=True, CharSet:=System.Runtime.InteropServices.CharSet.Unicode, SetLastError:=True)> _
        Private Shared Function zplay_GetErrorW(ByVal objptr As UInteger) As IntPtr
        End Function

        <System.Runtime.InteropServices.DllImport("libzplay.dll", EntryPoint:="zplay_GetVersion", ExactSpelling:=True, CharSet:=System.Runtime.InteropServices.CharSet.Ansi, SetLastError:=True)> _
        Private Shared Function zplay_GetVersion(ByVal objptr As UInteger) As Integer
        End Function

        <System.Runtime.InteropServices.DllImport("libzplay.dll", EntryPoint:="zplay_GetFileFormat", ExactSpelling:=True, CharSet:=System.Runtime.InteropServices.CharSet.Ansi, SetLastError:=True)> _
        Private Shared Function zplay_GetFileFormat(ByVal objptr As UInteger, <MarshalAs(UnmanagedType.LPStr)> ByVal pchFileName As String) As Integer
        End Function

        <System.Runtime.InteropServices.DllImport("libzplay.dll", EntryPoint:="zplay_GetFileFormatW", ExactSpelling:=True, CharSet:=System.Runtime.InteropServices.CharSet.Unicode, SetLastError:=True)> _
        Private Shared Function zplay_GetFileFormatW(ByVal objptr As UInteger, <MarshalAs(UnmanagedType.LPWStr)> ByVal pchFileName As String) As Integer
        End Function

        <System.Runtime.InteropServices.DllImport("libzplay.dll", EntryPoint:="zplay_OpenFile", ExactSpelling:=True, CharSet:=System.Runtime.InteropServices.CharSet.Ansi, SetLastError:=True)> _
        Private Shared Function zplay_OpenFile(ByVal objptr As UInteger, <MarshalAs(UnmanagedType.LPStr)> ByVal sFileName As String, ByVal nFormat As Integer) As Integer
        End Function

        <System.Runtime.InteropServices.DllImport("libzplay.dll", EntryPoint:="zplay_AddFile", ExactSpelling:=True, CharSet:=System.Runtime.InteropServices.CharSet.Ansi, SetLastError:=True)> _
        Private Shared Function zplay_AddFile(ByVal objptr As UInteger, <MarshalAs(UnmanagedType.LPStr)> ByVal sFileName As String, ByVal nFormat As Integer) As Integer
        End Function

        <System.Runtime.InteropServices.DllImport("libzplay.dll", EntryPoint:="zplay_OpenFileW", ExactSpelling:=True, CharSet:=System.Runtime.InteropServices.CharSet.Unicode, SetLastError:=True)> _
        Private Shared Function zplay_OpenFileW(ByVal objptr As UInteger, <MarshalAs(UnmanagedType.LPWStr)> ByVal sFileName As String, ByVal nFormat As Integer) As Integer
        End Function

        <System.Runtime.InteropServices.DllImport("libzplay.dll", EntryPoint:="zplay_AddFileW", ExactSpelling:=True, CharSet:=System.Runtime.InteropServices.CharSet.Unicode, SetLastError:=True)> _
        Private Shared Function zplay_AddFileW(ByVal objptr As UInteger, <MarshalAs(UnmanagedType.LPWStr)> ByVal sFileName As String, ByVal nFormat As Integer) As Integer
        End Function

        <System.Runtime.InteropServices.DllImport("libzplay.dll", EntryPoint:="zplay_OpenStream", ExactSpelling:=True, CharSet:=System.Runtime.InteropServices.CharSet.Ansi, SetLastError:=True)> _
        Private Shared Function zplay_OpenStream(ByVal objptr As UInteger, ByVal fBuffered As Integer, ByVal fManaged As Integer, <[In]()> ByVal sMemStream() As Byte, ByVal nStreamSize As UInteger, ByVal nFormat As Integer) As Integer
        End Function

        <System.Runtime.InteropServices.DllImport("libzplay.dll", EntryPoint:="zplay_PushDataToStream", ExactSpelling:=True, CharSet:=System.Runtime.InteropServices.CharSet.Ansi, SetLastError:=True)> _
        Private Shared Function zplay_PushDataToStream(ByVal objptr As UInteger, <[In]()> ByVal sMemNewData() As Byte, ByVal nNewDataize As UInteger) As Integer
        End Function


        <System.Runtime.InteropServices.DllImport("libzplay.dll", EntryPoint:="zplay_Close", ExactSpelling:=True, CharSet:=System.Runtime.InteropServices.CharSet.Ansi, SetLastError:=True)> _
        Private Shared Function zplay_Close(ByVal objptr As UInteger) As Integer
        End Function

        <System.Runtime.InteropServices.DllImport("libzplay.dll", EntryPoint:="zplay_Play", ExactSpelling:=True, CharSet:=System.Runtime.InteropServices.CharSet.Ansi, SetLastError:=True)> _
        Private Shared Function zplay_Play(ByVal objptr As UInteger) As Integer
        End Function

        <System.Runtime.InteropServices.DllImport("libzplay.dll", EntryPoint:="zplay_Stop", ExactSpelling:=True, CharSet:=System.Runtime.InteropServices.CharSet.Ansi, SetLastError:=True)> _
        Private Shared Function zplay_Stop(ByVal objptr As UInteger) As Integer
        End Function

        <System.Runtime.InteropServices.DllImport("libzplay.dll", EntryPoint:="zplay_Pause", ExactSpelling:=True, CharSet:=System.Runtime.InteropServices.CharSet.Ansi, SetLastError:=True)> _
        Private Shared Function zplay_Pause(ByVal objptr As UInteger) As Integer
        End Function

        <System.Runtime.InteropServices.DllImport("libzplay.dll", EntryPoint:="zplay_Resume", ExactSpelling:=True, CharSet:=System.Runtime.InteropServices.CharSet.Ansi, SetLastError:=True)> _
        Private Shared Function zplay_Resume(ByVal objptr As UInteger) As Integer
        End Function

        <System.Runtime.InteropServices.DllImport("libzplay.dll", EntryPoint:="zplay_IsStreamDataFree", ExactSpelling:=True, CharSet:=System.Runtime.InteropServices.CharSet.Ansi, SetLastError:=True)> _
        Private Shared Function zplay_IsStreamDataFree(ByVal objptr As UInteger, <[In]()> ByVal sMemNewData() As Byte) As Integer
        End Function

        <System.Runtime.InteropServices.DllImport("libzplay.dll", EntryPoint:="zplay_GetDynamicStreamLoad", ExactSpelling:=True, CharSet:=System.Runtime.InteropServices.CharSet.Ansi, SetLastError:=True)> _
        Private Shared Sub zplay_GetDynamicStreamLoad(ByVal objptr As UInteger, ByRef pStreamLoadInfo As TStreamLoadInfo)
        End Sub

        <System.Runtime.InteropServices.DllImport("libzplay.dll", EntryPoint:="zplay_GetPosition", ExactSpelling:=True, CharSet:=System.Runtime.InteropServices.CharSet.Ansi, SetLastError:=True)> _
        Private Shared Sub zplay_GetPosition(ByVal objptr As UInteger, ByRef pTime As TStreamTime)
        End Sub

        <System.Runtime.InteropServices.DllImport("libzplay.dll", EntryPoint:="zplay_PlayLoop", ExactSpelling:=True, CharSet:=System.Runtime.InteropServices.CharSet.Ansi, SetLastError:=True)> _
        Private Shared Function zplay_PlayLoop(ByVal objptr As UInteger, ByVal fFormatStartTime As Integer, ByRef pStartTime As TStreamTime, ByVal fFormatEndTime As Integer, ByRef pEndTime As TStreamTime, ByVal nNumOfCycles As UInteger, ByVal fContinuePlaying As UInteger) As Integer
        End Function

        <System.Runtime.InteropServices.DllImport("libzplay.dll", EntryPoint:="zplay_Seek", ExactSpelling:=True, CharSet:=System.Runtime.InteropServices.CharSet.Ansi, SetLastError:=True)> _
        Private Shared Function zplay_Seek(ByVal objptr As UInteger, ByVal fFormat As TTimeFormat, ByRef pTime As TStreamTime, ByVal nMoveMethod As TSeekMethod) As Integer
        End Function

        <System.Runtime.InteropServices.DllImport("libzplay.dll", EntryPoint:="zplay_ReverseMode", ExactSpelling:=True, CharSet:=System.Runtime.InteropServices.CharSet.Ansi, SetLastError:=True)> _
        Private Shared Function zplay_ReverseMode(ByVal objptr As UInteger, ByVal fEnable As Integer) As Integer
        End Function

        <System.Runtime.InteropServices.DllImport("libzplay.dll", EntryPoint:="zplay_SetMasterVolume", ExactSpelling:=True, CharSet:=System.Runtime.InteropServices.CharSet.Ansi, SetLastError:=True)> _
        Private Shared Function zplay_SetMasterVolume(ByVal objptr As UInteger, ByVal nLeftVolume As Integer, ByVal nRightVolume As Integer) As Integer
        End Function

        <System.Runtime.InteropServices.DllImport("libzplay.dll", EntryPoint:="zplay_SetPlayerVolume", ExactSpelling:=True, CharSet:=System.Runtime.InteropServices.CharSet.Ansi, SetLastError:=True)> _
        Private Shared Function zplay_SetPlayerVolume(ByVal objptr As UInteger, ByVal nLeftVolume As Integer, ByVal nRightVolume As Integer) As Integer
        End Function

        <System.Runtime.InteropServices.DllImport("libzplay.dll", EntryPoint:="zplay_GetMasterVolume", ExactSpelling:=True, CharSet:=System.Runtime.InteropServices.CharSet.Ansi, SetLastError:=True)> _
        Private Shared Sub zplay_GetMasterVolume(ByVal objptr As UInteger, ByRef nLeftVolume As Integer, ByRef nRightVolume As Integer)
        End Sub

        <System.Runtime.InteropServices.DllImport("libzplay.dll", EntryPoint:="zplay_GetPlayerVolume", ExactSpelling:=True, CharSet:=System.Runtime.InteropServices.CharSet.Ansi, SetLastError:=True)> _
        Private Shared Sub zplay_GetPlayerVolume(ByVal objptr As UInteger, ByRef nLeftVolume As Integer, ByRef nRightVolume As Integer)
        End Sub

        <System.Runtime.InteropServices.DllImport("libzplay.dll", EntryPoint:="zplay_GetBitrate", ExactSpelling:=True, CharSet:=System.Runtime.InteropServices.CharSet.Ansi, SetLastError:=True)> _
        Private Shared Function zplay_GetBitrate(ByVal objptr As UInteger, ByVal fAverage As Integer) As Integer
        End Function

        <System.Runtime.InteropServices.DllImport("libzplay.dll", EntryPoint:="zplay_GetStatus", ExactSpelling:=True, CharSet:=System.Runtime.InteropServices.CharSet.Ansi, SetLastError:=True)> _
        Private Shared Sub zplay_GetStatus(ByVal objptr As UInteger, ByRef pStatus As TStreamStatus)
        End Sub

        <System.Runtime.InteropServices.DllImport("libzplay.dll", EntryPoint:="zplay_MixChannels", ExactSpelling:=True, CharSet:=System.Runtime.InteropServices.CharSet.Ansi, SetLastError:=True)> _
        Private Shared Function zplay_MixChannels(ByVal objptr As UInteger, ByVal fEnable As Integer, ByVal nLeftPercent As UInteger, ByVal nRightPercent As UInteger) As Integer
        End Function

        <System.Runtime.InteropServices.DllImport("libzplay.dll", EntryPoint:="zplay_GetVUData", ExactSpelling:=True, CharSet:=System.Runtime.InteropServices.CharSet.Ansi, SetLastError:=True)> _
        Private Shared Sub zplay_GetVUData(ByVal objptr As UInteger, ByRef pnLeftChannel As Integer, ByRef pnRightChannel As Integer)
        End Sub

        <System.Runtime.InteropServices.DllImport("libzplay.dll", EntryPoint:="zplay_SlideVolume", ExactSpelling:=True, CharSet:=System.Runtime.InteropServices.CharSet.Ansi, SetLastError:=True)> _
        Private Shared Function zplay_SlideVolume(ByVal objptr As UInteger, ByVal fFormatStart As TTimeFormat, ByRef pTimeStart As TStreamTime, ByVal nStartVolumeLeft As Integer, ByVal nStartVolumeRight As Integer, ByVal fFormatEnd As TTimeFormat, ByRef pTimeEnd As TStreamTime, ByVal nEndVolumeLeft As Integer, ByVal nEndVolumeRight As Integer) As Integer
        End Function

        <System.Runtime.InteropServices.DllImport("libzplay.dll", EntryPoint:="zplay_EnableEqualizer", ExactSpelling:=True, CharSet:=System.Runtime.InteropServices.CharSet.Ansi, SetLastError:=True)> _
        Private Shared Function zplay_EnableEqualizer(ByVal objptr As UInteger, ByVal fEnable As Integer) As Integer
        End Function

        <System.Runtime.InteropServices.DllImport("libzplay.dll", EntryPoint:="zplay_SetEqualizerPoints", ExactSpelling:=True, CharSet:=System.Runtime.InteropServices.CharSet.Ansi, SetLastError:=True)> _
        Private Shared Function zplay_SetEqualizerPoints(ByVal objptr As UInteger, <[In]()> ByVal pnFreqPoint() As Integer, ByVal nNumOfPoints As Integer) As Integer
        End Function

        <System.Runtime.InteropServices.DllImport("libzplay.dll", EntryPoint:="zplay_GetEqualizerPoints", ExactSpelling:=True, CharSet:=System.Runtime.InteropServices.CharSet.Ansi, SetLastError:=True)> _
        Private Shared Function zplay_GetEqualizerPoints(ByVal objptr As UInteger, <[In](), Out()> ByVal pnFreqPoint() As Integer, ByVal nNumOfPoints As Integer) As Integer
        End Function

        <System.Runtime.InteropServices.DllImport("libzplay.dll", EntryPoint:="zplay_SetEqualizerParam", ExactSpelling:=True, CharSet:=System.Runtime.InteropServices.CharSet.Ansi, SetLastError:=True)> _
        Private Shared Function zplay_SetEqualizerParam(ByVal objptr As UInteger, ByVal nPreAmpGain As Integer, <[In]()> ByVal pnBandGain() As Integer, ByVal nNumberOfBands As Integer) As Integer
        End Function


        <System.Runtime.InteropServices.DllImport("libzplay.dll", EntryPoint:="zplay_GetEqualizerParam", ExactSpelling:=True, CharSet:=System.Runtime.InteropServices.CharSet.Ansi, SetLastError:=True)> _
        Private Shared Function zplay_GetEqualizerParam(ByVal objptr As UInteger, ByRef nPreAmpGain As Integer, <[In](), Out()> ByVal pnBandGain() As Integer, ByVal nNumberOfBands As Integer) As Integer
        End Function

        <System.Runtime.InteropServices.DllImport("libzplay.dll", EntryPoint:="zplay_SetEqualizerPreampGain", ExactSpelling:=True, CharSet:=System.Runtime.InteropServices.CharSet.Ansi, SetLastError:=True)> _
        Private Shared Function zplay_SetEqualizerPreampGain(ByVal objptr As UInteger, ByVal nGain As Integer) As Integer
        End Function

        <System.Runtime.InteropServices.DllImport("libzplay.dll", EntryPoint:="zplay_GetEqualizerPreampGain", ExactSpelling:=True, CharSet:=System.Runtime.InteropServices.CharSet.Ansi, SetLastError:=True)> _
        Private Shared Function zplay_GetEqualizerPreampGain(ByVal objptr As UInteger) As Integer
        End Function

        <System.Runtime.InteropServices.DllImport("libzplay.dll", EntryPoint:="zplay_SetEqualizerBandGain", ExactSpelling:=True, CharSet:=System.Runtime.InteropServices.CharSet.Ansi, SetLastError:=True)> _
        Private Shared Function zplay_SetEqualizerBandGain(ByVal objptr As UInteger, ByVal nBandIndex As Integer, ByVal nGain As Integer) As Integer
        End Function

        <System.Runtime.InteropServices.DllImport("libzplay.dll", EntryPoint:="zplay_GetEqualizerBandGain", ExactSpelling:=True, CharSet:=System.Runtime.InteropServices.CharSet.Ansi, SetLastError:=True)> _
        Private Shared Function zplay_GetEqualizerBandGain(ByVal objptr As UInteger, ByVal nBandIndex As Integer) As Integer
        End Function

        <System.Runtime.InteropServices.DllImport("libzplay.dll", EntryPoint:="zplay_EnableEcho", ExactSpelling:=True, CharSet:=System.Runtime.InteropServices.CharSet.Ansi, SetLastError:=True)> _
        Private Shared Function zplay_EnableEcho(ByVal objptr As UInteger, ByVal fEnable As Integer) As Integer
        End Function

        <System.Runtime.InteropServices.DllImport("libzplay.dll", EntryPoint:="zplay_StereoCut", ExactSpelling:=True, CharSet:=System.Runtime.InteropServices.CharSet.Ansi, SetLastError:=True)> _
        Private Shared Function zplay_StereoCut(ByVal objptr As UInteger, ByVal fEnable As Integer, ByVal fOutputCenter As Integer, ByVal fBassToSides As Integer) As Integer
        End Function


        <System.Runtime.InteropServices.DllImport("libzplay.dll", EntryPoint:="zplay_SetEchoParam", ExactSpelling:=True, CharSet:=System.Runtime.InteropServices.CharSet.Ansi, SetLastError:=True)> _
        Private Shared Function zplay_SetEchoParam(ByVal objptr As UInteger, <[In]()> ByVal pEchoEffect() As TEchoEffect, ByVal nNumberOfEffects As Integer) As Integer
        End Function

        <System.Runtime.InteropServices.DllImport("libzplay.dll", EntryPoint:="zplay_GetEchoParam", ExactSpelling:=True, CharSet:=System.Runtime.InteropServices.CharSet.Ansi, SetLastError:=True)> _
        Private Shared Function zplay_GetEchoParam(ByVal objptr As UInteger, <[In](), Out()> ByVal pEchoEffect() As TEchoEffect, ByVal nNumberOfEffects As Integer) As Integer
        End Function

        <System.Runtime.InteropServices.DllImport("libzplay.dll", EntryPoint:="zplay_GetFFTData", ExactSpelling:=True, CharSet:=System.Runtime.InteropServices.CharSet.Ansi, SetLastError:=True)> _
        Private Shared Function zplay_GetFFTData(ByVal objptr As UInteger, ByVal nFFTPoints As Integer, ByVal nFFTWindow As Integer, ByRef pnHarmonicNumber As Integer, <[In](), Out()> ByVal pnHarmonicFreq() As Integer, <[In](), Out()> ByVal pnLeftAmplitude() As Integer, <[In](), Out()> ByVal pnRightAmplitude() As Integer, <[In](), Out()> ByVal pnLeftPhase() As Integer, <[In](), Out()> ByVal pnRightPhase() As Integer) As Integer
        End Function

        <System.Runtime.InteropServices.DllImport("libzplay.dll", EntryPoint:="zplay_SetRate", ExactSpelling:=True, CharSet:=System.Runtime.InteropServices.CharSet.Ansi, SetLastError:=True)> _
        Private Shared Function zplay_SetRate(ByVal objptr As UInteger, ByVal nRate As Integer) As Integer
        End Function

        <System.Runtime.InteropServices.DllImport("libzplay.dll", EntryPoint:="zplay_GetRate", ExactSpelling:=True, CharSet:=System.Runtime.InteropServices.CharSet.Ansi, SetLastError:=True)> _
        Private Shared Function zplay_GetRate(ByVal objptr As UInteger) As Integer
        End Function

        <System.Runtime.InteropServices.DllImport("libzplay.dll", EntryPoint:="zplay_SetPitch", ExactSpelling:=True, CharSet:=System.Runtime.InteropServices.CharSet.Ansi, SetLastError:=True)> _
        Private Shared Function zplay_SetPitch(ByVal objptr As UInteger, ByVal nPitch As Integer) As Integer
        End Function

        <System.Runtime.InteropServices.DllImport("libzplay.dll", EntryPoint:="zplay_GetPitch", ExactSpelling:=True, CharSet:=System.Runtime.InteropServices.CharSet.Ansi, SetLastError:=True)> _
        Private Shared Function zplay_GetPitch(ByVal objptr As UInteger) As Integer
        End Function

        <System.Runtime.InteropServices.DllImport("libzplay.dll", EntryPoint:="zplay_SetTempo", ExactSpelling:=True, CharSet:=System.Runtime.InteropServices.CharSet.Ansi, SetLastError:=True)> _
        Private Shared Function zplay_SetTempo(ByVal objptr As UInteger, ByVal nTempo As Integer) As Integer
        End Function

        <System.Runtime.InteropServices.DllImport("libzplay.dll", EntryPoint:="zplay_GetTempo", ExactSpelling:=True, CharSet:=System.Runtime.InteropServices.CharSet.Ansi, SetLastError:=True)> _
        Private Shared Function zplay_GetTempo(ByVal objptr As UInteger) As Integer
        End Function

        <System.Runtime.InteropServices.DllImport("libzplay.dll", EntryPoint:="zplay_DrawFFTGraphOnHDC", ExactSpelling:=True, CharSet:=System.Runtime.InteropServices.CharSet.Ansi, SetLastError:=True)> _
        Private Shared Function zplay_DrawFFTGraphOnHDC(ByVal objptr As UInteger, ByVal hdc As System.IntPtr, ByVal nX As Integer, ByVal nY As Integer, ByVal nWidth As Integer, ByVal nHeight As Integer) As Integer
        End Function

        <System.Runtime.InteropServices.DllImport("libzplay.dll", EntryPoint:="zplay_DrawFFTGraphOnHWND", ExactSpelling:=True, CharSet:=System.Runtime.InteropServices.CharSet.Ansi, SetLastError:=True)> _
        Private Shared Function zplay_DrawFFTGraphOnHWND(ByVal objptr As UInteger, ByVal hwnd As System.IntPtr, ByVal nX As Integer, ByVal nY As Integer, ByVal nWidth As Integer, ByVal nHeight As Integer) As Integer
        End Function

        <System.Runtime.InteropServices.DllImport("libzplay.dll", EntryPoint:="zplay_SetFFTGraphParam", ExactSpelling:=True, CharSet:=System.Runtime.InteropServices.CharSet.Ansi, SetLastError:=True)> _
        Private Shared Function zplay_SetFFTGraphParam(ByVal objptr As UInteger, ByVal nParamID As Integer, ByVal nParamValue As Integer) As Integer
        End Function

        <System.Runtime.InteropServices.DllImport("libzplay.dll", EntryPoint:="zplay_GetFFTGraphParam", ExactSpelling:=True, CharSet:=System.Runtime.InteropServices.CharSet.Ansi, SetLastError:=True)> _
        Private Shared Function zplay_GetFFTGraphParam(ByVal objptr As UInteger, ByVal nParamID As Integer) As Integer
        End Function


        <System.Runtime.InteropServices.DllImport("libzplay.dll", EntryPoint:="zplay_LoadID3W", ExactSpelling:=True, CharSet:=System.Runtime.InteropServices.CharSet.Ansi, SetLastError:=True)> _
        Private Shared Function zplay_LoadID3W(ByVal objptr As UInteger, ByVal nId3Version As Integer, ByRef pId3Info As TID3Info_Internal) As Integer
        End Function


        <System.Runtime.InteropServices.DllImport("libzplay.dll", EntryPoint:="zplay_LoadFileID3W", ExactSpelling:=True, CharSet:=System.Runtime.InteropServices.CharSet.Unicode, SetLastError:=True)> _
        Private Shared Function zplay_LoadFileID3W(ByVal objptr As UInteger, <MarshalAs(UnmanagedType.LPWStr)> ByVal pchFileName As String, ByVal nFormat As Integer, ByVal nId3Version As Integer, ByRef pId3Info As TID3Info_Internal) As Integer
        End Function


        <System.Runtime.InteropServices.DllImport("libzplay.dll", EntryPoint:="zplay_DetectBPM", ExactSpelling:=True, CharSet:=System.Runtime.InteropServices.CharSet.Ansi, SetLastError:=True)> _
        Private Shared Function zplay_DetectBPM(ByVal objptr As UInteger, ByVal nMethod As UInteger) As Integer
        End Function

        <System.Runtime.InteropServices.DllImport("libzplay.dll", EntryPoint:="zplay_DetectFileBPM", ExactSpelling:=True, CharSet:=System.Runtime.InteropServices.CharSet.Ansi, SetLastError:=True)> _
        Private Shared Function zplay_DetectFileBPM(ByVal objptr As UInteger, <MarshalAs(UnmanagedType.LPStr)> ByVal sFileName As String, ByVal nFormat As Integer, ByVal nMethod As UInteger) As Integer
        End Function

        <System.Runtime.InteropServices.DllImport("libzplay.dll", EntryPoint:="zplay_DetectFileBPMW", ExactSpelling:=True, CharSet:=System.Runtime.InteropServices.CharSet.Unicode, SetLastError:=True)> _
        Private Shared Function zplay_DetectFileBPMW(ByVal objptr As UInteger, <MarshalAs(UnmanagedType.LPWStr)> ByVal sFileName As String, ByVal nFormat As Integer, ByVal nMethod As UInteger) As Integer
        End Function

        <System.Runtime.InteropServices.DllImport("libzplay.dll", EntryPoint:="zplay_SetCallbackFunc", ExactSpelling:=True, CharSet:=System.Runtime.InteropServices.CharSet.Ansi, SetLastError:=True)> _
        Private Shared Function zplay_SetCallbackFunc(ByVal objptr As UInteger, <MarshalAs(UnmanagedType.FunctionPtr)> ByVal pCallbackFunc As TCallbackFunc, ByVal nMessage As TCallbackMessage, ByVal user_data As Integer) As Integer
        End Function

        <System.Runtime.InteropServices.DllImport("libzplay.dll", EntryPoint:="zplay_EnumerateWaveIn", ExactSpelling:=True, CharSet:=System.Runtime.InteropServices.CharSet.Ansi, SetLastError:=True)> _
        Private Shared Function zplay_EnumerateWaveIn(ByVal objptr As UInteger) As Integer
        End Function

        <System.Runtime.InteropServices.DllImport("libzplay.dll", EntryPoint:="zplay_GetWaveInInfoW", ExactSpelling:=True, CharSet:=System.Runtime.InteropServices.CharSet.Ansi, SetLastError:=True)> _
        Private Shared Function zplay_GetWaveInInfoW(ByVal objptr As UInteger, ByVal nIndex As UInteger, ByRef pWaveInInfo As TWaveInInfo_Internal) As Integer
        End Function


        <System.Runtime.InteropServices.DllImport("libzplay.dll", EntryPoint:="zplay_SetWaveInDevice", ExactSpelling:=True, CharSet:=System.Runtime.InteropServices.CharSet.Ansi, SetLastError:=True)> _
        Private Shared Function zplay_SetWaveInDevice(ByVal objptr As UInteger, ByVal nIndex As UInteger) As Integer
        End Function


        <System.Runtime.InteropServices.DllImport("libzplay.dll", EntryPoint:="zplay_EnumerateWaveOut", ExactSpelling:=True, CharSet:=System.Runtime.InteropServices.CharSet.Ansi, SetLastError:=True)> _
        Private Shared Function zplay_EnumerateWaveOut(ByVal objptr As UInteger) As Integer
        End Function

        <System.Runtime.InteropServices.DllImport("libzplay.dll", EntryPoint:="zplay_GetWaveOutInfoW", ExactSpelling:=True, CharSet:=System.Runtime.InteropServices.CharSet.Unicode, SetLastError:=True)> _
        Private Shared Function zplay_GetWaveOutInfoW(ByVal objptr As UInteger, ByVal nIndex As UInteger, ByRef pWaveOutInfo As TWaveOutInfo_Internal) As Integer
        End Function


        <System.Runtime.InteropServices.DllImport("libzplay.dll", EntryPoint:="zplay_SetWaveOutDevice", ExactSpelling:=True, CharSet:=System.Runtime.InteropServices.CharSet.Ansi, SetLastError:=True)> _
        Private Shared Function zplay_SetWaveOutDevice(ByVal objptr As UInteger, ByVal nIndex As UInteger) As Integer
        End Function


        <System.Runtime.InteropServices.DllImport("libzplay.dll", EntryPoint:="zplay_GetStreamInfoW", ExactSpelling:=True, CharSet:=System.Runtime.InteropServices.CharSet.Unicode, SetLastError:=True)> _
        Private Shared Function zplay_GetStreamInfoW(ByVal objptr As UInteger, ByRef pInfo As TStreamInfo_Internal) As Integer
        End Function


        <System.Runtime.InteropServices.DllImport("libzplay.dll", EntryPoint:="zplay_LoadID3ExW", ExactSpelling:=True, CharSet:=System.Runtime.InteropServices.CharSet.Unicode, SetLastError:=True)> _
        Private Shared Function zplay_LoadID3ExW(ByVal objptr As UInteger, ByRef pInfo As TID3InfoEx_Internal, ByVal fDecodeEmbededPicture As Integer) As Integer
        End Function

        <System.Runtime.InteropServices.DllImport("libzplay.dll", EntryPoint:="zplay_LoadFileID3ExW", ExactSpelling:=True, CharSet:=System.Runtime.InteropServices.CharSet.Unicode, SetLastError:=True)> _
        Private Shared Function zplay_LoadFileID3ExW(ByVal objptr As UInteger, <MarshalAs(UnmanagedType.LPWStr)> ByVal sFileName As String, ByVal nFormat As Integer, ByRef pInfo As TID3InfoEx_Internal, ByVal fDecodeEmbededPicture As Integer) As Integer
        End Function


        <System.Runtime.InteropServices.DllImport("libzplay.dll", EntryPoint:="zplay_SetWaveOutFileW", ExactSpelling:=True, CharSet:=System.Runtime.InteropServices.CharSet.Unicode, SetLastError:=True)> _
       Private Shared Function zplay_SetWaveOutFileW(ByVal objptr As UInteger, <MarshalAs(UnmanagedType.LPWStr)> ByVal sFileName As String, ByVal nFormat As Integer, ByVal fOutputToSoundcard As Integer) As Integer
        End Function



 



#End Region

#Region "Members"

#End Region

#Region "Helper functions"

        Private objptr As UInteger

#End Region

#Region "Constructor and destructor"

        Public Sub New()
            objptr = zplay_CreateZPlay()
            If objptr = 0 Then
                Throw New Exception("Can't create libZPlay interface.")
            End If

            If GetVersion() < 190 Then
                Throw New Exception("Need libZPlay.dll version 1.90 and above.")
            End If
        End Sub

        Protected Overrides Sub Finalize()
            zplay_DestroyZPlay(objptr)
        End Sub
#End Region

#Region "Version"
        Public Function GetVersion() As Integer
            Return zplay_GetVersion(objptr)
        End Function

#End Region

#Region "Error handling"
        Public Function GetError() As String
            Return Marshal.PtrToStringUni(zplay_GetErrorW(objptr))
        End Function


#End Region

#Region "Open and close stream"

        Public Function GetFileFormat(ByVal FileName As String) As TStreamFormat
            Return CType(zplay_GetFileFormatW(objptr, FileName), TStreamFormat)
        End Function

        Public Function OpenFile(ByVal FileName As String, ByVal Format As TStreamFormat) As Boolean
            Return zplay_OpenFileW(objptr, FileName, CInt(Format)) = 1
        End Function


        Public Function SetWaveOutFile(ByVal FileName As String, ByVal Format As TStreamFormat, ByRef fOutputToSoundcard As Boolean) As Boolean
            Dim s As Integer = 0
            If fOutputToSoundcard Then
                s = 1
            End If
            Return zplay_SetWaveOutFileW(objptr, FileName, CInt(Format), s) = 1
        End Function


        Public Function AddFile(ByVal FileName As String, ByVal Format As TStreamFormat) As Boolean
            Return zplay_AddFileW(objptr, FileName, CInt(Format)) = 1
        End Function


        Public Function OpenStream(ByVal Buffered As Boolean, ByVal Dynamic As Boolean, ByRef MemStream() As Byte, ByVal StreamSize As UInteger, ByVal nFormat As TStreamFormat) As Boolean
            Dim b As Integer = 0
            Dim m As Integer = 0
            If Buffered Then
                b = 1
            End If
            If Dynamic Then
                m = 1
            End If
            Return zplay_OpenStream(objptr, b, m, MemStream, StreamSize, CInt(nFormat)) = 1
        End Function


        Public Function PushDataToStream(ByRef MemNewData() As Byte, ByVal NewDatSize As UInteger) As Boolean
            Return zplay_PushDataToStream(objptr, MemNewData, NewDatSize) = 1
        End Function

        Public Function IsStreamDataFree(ByRef MemNewData() As Byte) As Boolean
            Return zplay_IsStreamDataFree(objptr, MemNewData) = 1
        End Function

        Public Function Close() As Boolean
            Return zplay_Close(objptr) = 1
        End Function

#End Region

#Region "Position and Seek"



        Public Sub GetPosition(ByRef time As TStreamTime)
            zplay_GetPosition(objptr, time)
        End Sub


        Public Function Seek(ByVal TimeFormat As TTimeFormat, ByRef Position As TStreamTime, ByVal MoveMethod As TSeekMethod) As Boolean
            Return zplay_Seek(objptr, TimeFormat, Position, MoveMethod) = 1
        End Function



#End Region

#Region "Play, Pause, Loop, Reverse"



        Public Function ReverseMode(ByVal Enable As Boolean) As Boolean
            If Enable Then
                Return zplay_ReverseMode(objptr, 1) = 1
            Else
                Return zplay_ReverseMode(objptr, 0) = 1
            End If

        End Function

        Public Function PlayLoop(ByVal TimeFormatStart As TTimeFormat, ByRef StartPosition As TStreamTime, ByVal TimeFormatEnd As TTimeFormat, ByRef EndPosition As TStreamTime, ByVal NumberOfCycles As UInteger, ByVal ContinuePlaying As Boolean) As Boolean
            Dim continueplay As UInteger
            If (ContinuePlaying) Then
                continueplay = 1
            Else
                continueplay = 0
            End If

            Return zplay_PlayLoop(objptr, CInt(Fix(TimeFormatStart)), StartPosition, CInt(Fix(TimeFormatEnd)), EndPosition, NumberOfCycles, continueplay) = 1
        End Function

        Public Function StartPlayback() As Boolean
            Return zplay_Play(objptr) = 1
        End Function

        Public Function StopPlayback() As Boolean
            Return zplay_Stop(objptr) = 1
        End Function

        Public Function PausePlayback() As Boolean
            Return zplay_Pause(objptr) = 1
        End Function

        Public Function ResumePlayback() As Boolean
            Return zplay_Resume(objptr) = 1
        End Function



#End Region

#Region "Equalizer"



        Public Function SetEqualizerParam(ByVal PreAmpGain As Integer, ByRef BandGain() As Integer, ByVal NumberOfBands As Integer) As Boolean
            Return zplay_SetEqualizerParam(objptr, PreAmpGain, BandGain, NumberOfBands) = 1
        End Function



        Public Function GetEqualizerParam(ByRef PreAmpGain As Integer, ByRef BandGain() As Integer) As Integer
            Dim tempnPreAmpGain1 As Integer = 0
            Dim size As Integer = zplay_GetEqualizerParam(objptr, tempnPreAmpGain1, Nothing, 0)
            Array.Resize(BandGain, size)
            Return zplay_GetEqualizerParam(objptr, PreAmpGain, BandGain, size)
        End Function


        Public Function EnableEqualizer(ByVal Enable As Boolean) As Boolean
            If Enable Then
                Return zplay_EnableEqualizer(objptr, 1) = 1
            End If
            Return zplay_EnableEqualizer(objptr, 0) = 1
        End Function

        Public Function SetEqualizerPreampGain(ByVal Gain As Integer) As Boolean
            Return zplay_SetEqualizerPreampGain(objptr, Gain) = 1
        End Function

        Public Function GetEqualizerPreampGain() As Integer
            Return zplay_GetEqualizerPreampGain(objptr)
        End Function

        Public Function SetEqualizerBandGain(ByVal BandIndex As Integer, ByVal Gain As Integer) As Boolean
            Return zplay_SetEqualizerBandGain(objptr, BandIndex, Gain) = 1
        End Function

        Public Function GetEqualizerBandGain(ByVal BandIndex As Integer) As Integer
            Return zplay_GetEqualizerBandGain(objptr, BandIndex)
        End Function

        Public Function SetEqualizerPoints(ByRef FreqPointArray() As Integer, ByVal NumberOfPoints As Integer) As Boolean
            Return zplay_SetEqualizerPoints(objptr, FreqPointArray, NumberOfPoints) = 1
        End Function

        Public Function GetEqualizerPoints(ByRef FreqPointArray() As Integer) As Integer
            Dim size As Integer = zplay_GetEqualizerPoints(objptr, Nothing, 0)
            Array.Resize(FreqPointArray, size)
            Return zplay_GetEqualizerPoints(objptr, FreqPointArray, size)
        End Function
#End Region

#Region "Echo"


        Public Function EnableEcho(ByVal Enable As Boolean) As Boolean
            If Enable Then
                Return zplay_EnableEcho(objptr, 1) = 1
            End If
            Return zplay_EnableEcho(objptr, 0) = 1
        End Function


        Public Function SetEchoParam(ByRef EchoEffectArray() As TEchoEffect, ByVal NumberOfEffects As Integer) As Boolean
            Return zplay_SetEchoParam(objptr, EchoEffectArray, NumberOfEffects) = 1
        End Function

        Public Function GetEchoParam(ByRef EchoEffectArray() As TEchoEffect) As Integer
            Dim size As Integer = zplay_GetEchoParam(objptr, Nothing, 0)
            Array.Resize(EchoEffectArray, size)
            Return zplay_GetEchoParam(objptr, EchoEffectArray, size)
        End Function
#End Region

#Region "Volume and Fade"
        Public Function SetMasterVolume(ByVal LeftVolume As Integer, ByVal RightVolume As Integer) As Boolean
            Return zplay_SetMasterVolume(objptr, LeftVolume, RightVolume) = 1
        End Function

        Public Function SetPlayerVolume(ByVal LeftVolume As Integer, ByVal RightVolume As Integer) As Boolean
            Return zplay_SetPlayerVolume(objptr, LeftVolume, RightVolume) = 1
        End Function


        Public Sub GetMasterVolume(ByRef LeftVolume As Integer, ByRef RightVolume As Integer)
            zplay_GetMasterVolume(objptr, LeftVolume, RightVolume)
        End Sub

        Public Sub GetPlayerVolume(ByRef LeftVolume As Integer, ByRef RightVolume As Integer)
            zplay_GetPlayerVolume(objptr, LeftVolume, RightVolume)
        End Sub


        Public Function SlideVolume(ByVal TimeFormatStart As TTimeFormat, ByRef TimeStart As TStreamTime, ByVal StartVolumeLeft As Integer, ByVal StartVolumeRight As Integer, ByVal TimeFormatEnd As TTimeFormat, ByRef TimeEnd As TStreamTime, ByVal EndVolumeLeft As Integer, ByVal EndVolumeRight As Integer) As Boolean
            Return zplay_SlideVolume(objptr, TimeFormatStart, TimeStart, StartVolumeLeft, StartVolumeRight, TimeFormatEnd, TimeEnd, EndVolumeLeft, EndVolumeRight) = 1
        End Function

#End Region

#Region "Pitch, tempo, rate"
        Public Function SetPitch(ByVal Pitch As Integer) As Boolean
            Return zplay_SetPitch(objptr, Pitch) = 1
        End Function

        Public Function GetPitch() As Integer
            Return zplay_GetPitch(objptr)
        End Function

        Public Function SetRate(ByVal Rate As Integer) As Boolean
            Return zplay_SetRate(objptr, Rate) = 1
        End Function

        Public Function GetRate() As Integer
            Return zplay_GetRate(objptr)
        End Function

        Public Function SetTempo(ByVal Tempo As Integer) As Boolean
            Return zplay_SetTempo(objptr, Tempo) = 1
        End Function

        Public Function GetTempo() As Integer
            Return zplay_GetTempo(objptr)
        End Function
#End Region

#Region "Bitrate"
        Public Function GetBitrate(ByVal Average As Boolean) As Integer
            If Average Then
                Return zplay_GetBitrate(objptr, 1)
            Else
                Return zplay_GetBitrate(objptr, 0)
            End If

        End Function

#End Region

#Region "ID3 Info"

        Public Function LoadID3(ByVal Id3Version As TID3Version, ByRef Info As TID3Info) As Boolean
            Dim tmp As TID3Info_Internal
            If zplay_LoadID3W(objptr, CInt(Fix(Id3Version)), tmp) = 1 Then
                Info.Album = Marshal.PtrToStringUni(tmp.Album)
                Info.Artist = Marshal.PtrToStringUni(tmp.Artist)
                Info.Comment = Marshal.PtrToStringUni(tmp.Comment)
                Info.Genre = Marshal.PtrToStringUni(tmp.Genre)
                Info.Title = Marshal.PtrToStringUni(tmp.Title)
                Info.Track = Marshal.PtrToStringUni(tmp.Track)
                Info.Year = Marshal.PtrToStringUni(tmp.Year)
                Return True
            Else
                Return False
            End If
        End Function

        Public Function LoadID3Ex(ByRef Info As TID3InfoEx, ByVal fDecodePicture As Boolean) As Boolean
            Dim tmp As TID3InfoEx_Internal

            If zplay_LoadID3ExW(objptr, tmp, 0) = 1 Then
                Info.Album = Marshal.PtrToStringUni(tmp.Album)
                Info.Artist = Marshal.PtrToStringUni(tmp.Artist)
                Info.Comment = Marshal.PtrToStringUni(tmp.Comment)
                Info.Genre = Marshal.PtrToStringUni(tmp.Genre)
                Info.Title = Marshal.PtrToStringUni(tmp.Title)
                Info.Track = Marshal.PtrToStringUni(tmp.Track)
                Info.Year = Marshal.PtrToStringUni(tmp.Year)

                Info.AlbumArtist = Marshal.PtrToStringUni(tmp.AlbumArtist)
                Info.Composer = Marshal.PtrToStringUni(tmp.Composer)
                Info.OriginalArtist = Marshal.PtrToStringUni(tmp.OriginalArtist)
                Info.Copyright = Marshal.PtrToStringUni(tmp.Copyright)
                Info.Encoder = Marshal.PtrToStringUni(tmp.Encoder)
                Info.Publisher = Marshal.PtrToStringUni(tmp.Publisher)
                Info.BPM = tmp.BPM
                Info.Picture.PicturePresent = False

                If fDecodePicture Then
                    Try
                        If tmp.PicturePresent = 1 Then
                            Dim stream_data(CInt(tmp.PictureDataSize)) As Byte
                            Marshal.Copy(tmp.PictureData, stream_data, 0, tmp.PictureDataSize)
                            Info.Picture.BitStream = New System.IO.MemoryStream
                            Info.Picture.BitStream.Write(stream_data, 0, tmp.PictureDataSize)
                            Info.Picture.Bitmap = New Bitmap(Info.Picture.BitStream)
                            Info.Picture.PictureType = tmp.PictureType
                            Info.Picture.Description = Marshal.PtrToStringUni(tmp.Description)
                            Info.Picture.PicturePresent = True
                        Else
                            Info.Picture.Bitmap = New Bitmap(1, 1)
                        End If
                        Return True

                    Catch
                        Info.Picture.PicturePresent = False
                    End Try
                End If
            Else
                Return False
            End If
        End Function

     
        Public Function LoadFileID3(ByVal FileName As String, ByVal Format As TStreamFormat, ByVal Id3Version As TID3Version, ByRef Info As TID3Info) As Boolean
            Dim tmp As TID3Info_Internal
            If zplay_LoadFileID3W(objptr, FileName, CInt(Format), CInt(Fix(Id3Version)), tmp) = 1 Then
                Info.Album = Marshal.PtrToStringUni(tmp.Album)
                Info.Artist = Marshal.PtrToStringUni(tmp.Artist)
                Info.Comment = Marshal.PtrToStringUni(tmp.Comment)
                Info.Genre = Marshal.PtrToStringUni(tmp.Genre)
                Info.Title = Marshal.PtrToStringUni(tmp.Title)
                Info.Track = Marshal.PtrToStringUni(tmp.Track)
                Info.Year = Marshal.PtrToStringUni(tmp.Year)
                Return True
            Else
                Return False
            End If

            Return False
        End Function


        Public Function LoadFileID3Ex(ByVal FileName As String, ByVal Format As TStreamFormat, ByRef Info As TID3InfoEx, ByVal fDecodePicture As Boolean) As Boolean
            Dim tmp As TID3InfoEx_Internal

            If zplay_LoadFileID3ExW(objptr, FileName, CInt(Format), tmp, 0) = 1 Then
                Info.Album = Marshal.PtrToStringUni(tmp.Album)
                Info.Artist = Marshal.PtrToStringUni(tmp.Artist)
                Info.Comment = Marshal.PtrToStringUni(tmp.Comment)
                Info.Genre = Marshal.PtrToStringUni(tmp.Genre)
                Info.Title = Marshal.PtrToStringUni(tmp.Title)
                Info.Track = Marshal.PtrToStringUni(tmp.Track)
                Info.Year = Marshal.PtrToStringUni(tmp.Year)

                Info.AlbumArtist = Marshal.PtrToStringUni(tmp.AlbumArtist)
                Info.Composer = Marshal.PtrToStringUni(tmp.Composer)
                Info.OriginalArtist = Marshal.PtrToStringUni(tmp.OriginalArtist)
                Info.Copyright = Marshal.PtrToStringUni(tmp.Copyright)
                Info.Encoder = Marshal.PtrToStringUni(tmp.Encoder)
                Info.Publisher = Marshal.PtrToStringUni(tmp.Publisher)
                Info.BPM = tmp.BPM

                Info.Picture.PicturePresent = False
                If fDecodePicture Then
                    Try
                        If tmp.PicturePresent = 1 Then
                            Dim stream_data(CInt(tmp.PictureDataSize)) As Byte
                            Marshal.Copy(tmp.PictureData, stream_data, 0, tmp.PictureDataSize)
                            Info.Picture.BitStream = New System.IO.MemoryStream
                            Info.Picture.BitStream.Write(stream_data, 0, tmp.PictureDataSize)
                            Info.Picture.Bitmap = New Bitmap(Info.Picture.BitStream)
                            Info.Picture.PictureType = tmp.PictureType
                            Info.Picture.Description = Marshal.PtrToStringUni(tmp.Description)
                            Info.Picture.PicturePresent = True
                        Else
                            Info.Picture.Bitmap = New Bitmap(1, 1)
                        End If
                        Return True

                    Catch
                        Info.Picture.PicturePresent = False
                    End Try
                End If
            Else
                Return False
            End If

            Return False
        End Function


#End Region

#Region "Callback"
        Public Function SetCallbackFunc(ByVal CallbackFunc As TCallbackFunc, ByVal Messages As TCallbackMessage, ByVal UserData As Integer) As Boolean
            Return zplay_SetCallbackFunc(objptr, CallbackFunc, Messages, UserData) = 1
        End Function
#End Region

#Region "Beat-Per-Minute"
        Public Function DetectBPM(ByVal Method As TBPMDetectionMethod) As Integer
            Return zplay_DetectBPM(objptr, CUInt(Method))
        End Function

        Public Function DetectFileBPM(ByVal FileName As String, ByVal Format As TStreamFormat, ByVal Method As TBPMDetectionMethod) As Integer
            Return zplay_DetectFileBPMW(objptr, FileName, CInt(Format), CUInt(Method))
        End Function
#End Region

#Region "FFT Graph and FFT values"


        Public Function GetFFTData(ByVal FFTPoints As Integer, ByVal FFTWindow As TFFTWindow, ByRef HarmonicNumber As Integer, ByRef HarmonicFreq() As Integer, ByRef LeftAmplitude() As Integer, ByRef RightAmplitude() As Integer, ByRef LeftPhase() As Integer, ByRef RightPhase() As Integer) As Boolean
            Return zplay_GetFFTData(objptr, FFTPoints, CInt(Fix(FFTWindow)), HarmonicNumber, HarmonicFreq, LeftAmplitude, RightAmplitude, LeftPhase, RightPhase) = 1
        End Function

        Public Function DrawFFTGraphOnHDC(ByVal hdc As System.IntPtr, ByVal X As Integer, ByVal Y As Integer, ByVal Width As Integer, ByVal Height As Integer) As Boolean
            Return zplay_DrawFFTGraphOnHDC(objptr, hdc, X, Y, Width, Height) = 1
        End Function

        Public Function DrawFFTGraphOnHWND(ByVal hwnd As System.IntPtr, ByVal X As Integer, ByVal Y As Integer, ByVal Width As Integer, ByVal Height As Integer) As Boolean
            Return zplay_DrawFFTGraphOnHWND(objptr, hwnd, X, Y, Width, Height) = 1
        End Function


        Public Function SetFFTGraphParam(ByVal ParamID As TFFTGraphParamID, ByVal ParamValue As Integer) As Boolean
            Return zplay_SetFFTGraphParam(objptr, CInt(Fix(ParamID)), ParamValue) = 1
        End Function

        Public Function GetFFTGraphParam(ByVal ParamID As TFFTGraphParamID) As Integer
            Return zplay_GetFFTGraphParam(objptr, CInt(Fix(ParamID)))
        End Function

#End Region

#Region "Center and side cut"

        Public Function StereoCut(ByVal Enable As Boolean, ByVal OutputCenter As Boolean, ByVal BassToSides As Boolean) As Boolean
            Dim fOutputCenter As Integer = 0
            Dim fBassToSides As Integer = 0
            Dim fEnable As Integer = 0
            If OutputCenter Then
                fOutputCenter = 1
            End If
            If BassToSides Then
                fBassToSides = 1
            End If
            If Enable Then
                fEnable = 1
            End If
            Return zplay_StereoCut(objptr, fEnable, fOutputCenter, fBassToSides) = 1
        End Function

#End Region

#Region "Channel mixing"


        Public Function MixChannels(ByVal Enable As Boolean, ByVal LeftPercent As UInteger, ByVal RightPercent As UInteger) As Boolean
            If Enable Then
                Return zplay_MixChannels(objptr, 1, LeftPercent, RightPercent) = 1
            Else
                Return zplay_MixChannels(objptr, 0, LeftPercent, RightPercent) = 1
            End If

        End Function
#End Region

#Region "VU Data"

        Public Sub GetVUData(ByRef LeftChannel As Integer, ByRef RightChannel As Integer)
            zplay_GetVUData(objptr, LeftChannel, RightChannel)
        End Sub

#End Region

#Region "Status and Info"

        Public Sub GetStreamInfo(ByRef info As TStreamInfo)
            Dim tmp As TStreamInfo_Internal
            zplay_GetStreamInfoW(objptr, tmp)

            info.Bitrate = tmp.Bitrate
            info.ChannelNumber = tmp.ChannelNumber
            info.SamplingRate = tmp.SamplingRate
            info.VBR = tmp.VBR
            info.Length = tmp.Length
            info.Description = Marshal.PtrToStringUni(tmp.Description)

        End Sub


        Public Sub GetStatus(ByRef status As TStreamStatus)
            zplay_GetStatus(objptr, status)
        End Sub


        Public Sub GetDynamicStreamLoad(ByRef StreamLoadInfo As TStreamLoadInfo)
            zplay_GetDynamicStreamLoad(objptr, StreamLoadInfo)
        End Sub
#End Region

#Region "Wave Out and Wave In Info"

        Public Function EnumerateWaveOut() As Integer
            Return zplay_EnumerateWaveOut(objptr)
        End Function

        Public Function GetWaveOutInfo(ByVal Index As UInteger, ByRef Info As TWaveOutInfo) As Boolean
            Dim tmp As TWaveOutInfo_Internal
            If zplay_GetWaveOutInfoW(objptr, Index, tmp) = 0 Then
                Return False
            End If
            Info.Channels = tmp.Channels
            Info.DriverVersion = tmp.DriverVersion
            Info.Formats = tmp.Formats
            Info.ManufacturerID = tmp.ManufacturerID
            Info.ProductID = tmp.ProductID
            Info.Support = tmp.Support
            Info.ProductName = Marshal.PtrToStringUni(tmp.ProductName)
            Return True
        End Function

        Public Function SetWaveOutDevice(ByVal Index As UInteger) As Boolean
            Return zplay_SetWaveOutDevice(objptr, Index) = 1
        End Function


        Public Function EnumerateWaveIn() As Integer
            Return zplay_EnumerateWaveIn(objptr)
        End Function

        Public Function GetWaveInInfo(ByVal Index As UInteger, ByRef Info As TWaveInInfo) As Boolean
            Dim tmp As TWaveInInfo_Internal
            If zplay_GetWaveInInfoW(objptr, Index, tmp) = 0 Then
                Return False
            End If
            Info.Channels = tmp.Channels
            Info.DriverVersion = tmp.DriverVersion
            Info.Formats = tmp.Formats
            Info.ManufacturerID = tmp.ManufacturerID
            Info.ProductID = tmp.ProductID
            Info.ProductName = Marshal.PtrToStringUni(tmp.ProductName)
            Return True
        End Function

        Public Function SetWaveInDevice(ByVal Index As UInteger) As Boolean
            Return zplay_SetWaveInDevice(objptr, Index) = 1
        End Function

#End Region


#Region "Settings"

        Public Function SetSettings(ByVal SettingID As TSettingID, ByVal Value As Integer) As Integer
            Return zplay_SetSettings(objptr, SettingID, Value)
        End Function


        Public Function GetSettings(ByVal SettingID As TSettingID) As Integer
            Return zplay_GetSettings(objptr, SettingID)
        End Function

#End Region

    End Class

End Namespace

 

Copyright (c) 2010. Zoran Cindori - All rights reserved.

Web: http://libzplay.sourceforge.net/

Email: zcindori@inet.hr