;~ About libZPlay UDF ;~ libZPlay UDF 1.0 ;~ Written By Danyfirex ;~ 09/07/2015 ;~ Written for Version libZPlay 2.02 ;~ About libZPlay ;~ For Best Information Look into libzplay.chm ;~ This is multimedia library for playing mp3, mp2, mp1, ogg, flac, ac3, aac, oga, wav and pcm files and streams. ;~ libZPlay is released under GNU GPL license. ;~ AUTHOR: Zoran Cindori ;~ 06. May 2010. Last Update. ;~ Supported Functions ;~ CreateZPlay ;~ GetVersion ;~ OpenFile ;~ GetError ;~ GetErrorW ;~ Play ;~ Pause ;~ Stop ;~ Resume ;~ Close ;~ DestroyZPlay ;~ Seek ;~ SetFFTGraphParam ;~ DrawFFTGraphOnHDC ;~ DrawFFTGraphOnHWND ;~ ReverseMode ;~ SetEchoParam ;~ EnableEcho ;~ EnumerateWaveOut ;~ Position ;~ GetStatus ;~ GetStreamInfo ;~ GetStreamInfoW ;~ GetVUData ;~ GetPlayerVolume ;~ SetPlayerVolume ;~ GetFileFormat ;~ GetFileFormatW ;~ LoadID3 ;~ LoadID3W ;~ GetWaveOutInfoW ;~ GetWaveOutInfo Global Const $WaveOutWaveMapper = 0xFFFFFFFF Global Const $WaveInWaveMapper = 0xFFFFFFFF ;~ TStreamFormat Global Enum $sfUnknown = 0, $sfMp3, $sfOgg, $sfWav, $sfPCM, $sfFLAC, $sfFLACOgg, $sfAC3, $sfAacADTS, $sfWaveIn, $sfAutodetect = 1000 ;~ TFFTGraphSize Global Const $FFTGraphMinWidth = 100 Global Const $FFTGraphMinHeight = 60 ;~ TBMPDetectionMethod Global Enum $dmPeaks, $dmAutoCorrelation ;~ TFFTGraphHorizontalScale Global Enum $gsLogarithmic, $gsLinear ;~ TSeekMethod Global Const $smFromBeginning = 1 Global Const $smFromEnd = 2 Global Const $smFromCurrentForward = 4 Global Const $smFromCurrentBackward = 8 ;~ TTimeFormat Global Const $tfMillisecond = 1 Global Const $tfSecond = 2 Global Const $tfHMS = 4 Global Const $tfSamples = 8 ;~ TStreamHMSTime Global Const $sTagTStreamHMSTime = 'UINT hour;UINT minute;UINT second;UINT milisecond' ;~ TStreamTime Global Const $sTagTStreamTime = 'UINT sec;UINT ms;UINT samples;' & $sTagTStreamHMSTime ;~ TEchoEffect Global Const $sTagTEchoEffect = 'int nLeftDelay;int nLeftSrcVolume;int nLeftEchoVolume;int nRightDelay;int nRightSrcVolume;int nRightEchoVolume' ;~ TWaveOutFormat Global Const $format_invalid = 0 Global Const $format_11khz_8bit_mono = 1 Global Const $format_11khz_8bit_stereo = 2 Global Const $format_11khz_16bit_mono = 4 Global Const $format_11khz_16bit_stereo = 8 Global Const $format_22khz_8bit_mono = 16 Global Const $format_22khz_8bit_stereo = 32 Global Const $format_22khz_16bit_mono = 64 Global Const $format_22khz_16bit_stereo = 128 Global Const $format_44khz_8bit_mono = 256 Global Const $format_44khz_8bit_stereo = 512 Global Const $format_44khz_16bit_mono = 1024 Global Const $format_44khz_16bit_stereo = 2048 ;~ TWaveOutFunctionality Global Const $supportPitchControl = 1 Global Const $supportPlaybackRateControl = 2 Global Const $supportVolumeControl = 4 Global Const $supportSeparateLeftRightVolume = 8 Global Const $supportSync = 16 Global Const $supportSampleAccuratePosition = 32 Global Const $supportDirectSound = 6 ;~ TFFTGraphParamID Global Enum $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 ;~ TFFTGraphType Global Enum $gtLinesLeftOnTop, _ $gtLinesRightOnTop, _ $gtAreaLeftOnTop, _ $gtAreaRightOnTop, _ $gtBarsLeftOnTop, _ $gtBarsRightOnTop, _ $gtSpectrum ;~ TFFTWindow Global Enum $fwRectangular = 1, _ $fwHamming, _ $fwHann, _ $fwCosine, _ $fwLanczos, _ $fwBartlett, _ $fwTriangular, _ $fwGauss, _ $fwBartlettHann, _ $fwBlackman, _ $fwNuttall, _ $fwBlackmanHarris, _ $fwBlackmanNuttall, _ $fwFlatTop ;~ TID3Version Global Const $id3Version1 = 1 Global Const $id3Version2 = 2 ;~ TWaveOutInfo Global Const $sTagTWaveOutInfo = 'UINT ManufacturerID;UINT ProductID;UINT DriverVersion;UINT Formats;UINT Channels;UINT Support;char ProductName[128]' ;~ TWaveOutInfoW; Global Const $sTagTWaveOutInfoW = 'UINT ManufacturerID;UINT ProductID;UINT DriverVersion;UINT Formats;UINT Channels;UINT Support;wchar ProductName[128]' ;~TWaveInInfo; Global Const $sTagTWaveInInfo = 'UINT ManufacturerID;UINT ProductID;UINT DriverVersion;UINT Formats;UINT Channels;char ProductName[128]' ;~ TWaveInInfoW; Global Const $sTagTWaveInInfoW = 'UINT ManufacturerID;UINT ProductID;UINT DriverVersion;UINT Formats;UINT Channels;wchar ProductName[128]' ;~ TStreamStatus; Global Const $sTagTStreamStatus = 'int fPlay;int fPause;int fEcho;int fEqualizer;int fVocalCut;int fSideCut;int fChannelMix;int fSlideVolume;int nLoop;int fReverse;int nSongIndex;int nSongsInQueue' ;~ TStreamInfo; Global Const $sTagTStreamInfo = 'int SamplingRate;int ChannelNumber;int VBR;int Bitrate;' & $sTagTStreamTime & ';char Description[128]' Global Const $sTagTStreamInfoW = 'int SamplingRate;int ChannelNumber;int VBR;int Bitrate;' & $sTagTStreamTime & ';wchar Description[128]' ;~ Will be Updated ;~ TID3Picture ;~ Global Const $sTagTID3Picture='uint PicturePresent;' & _ ;~ 'uint CanDrawPicture;' & _ ;~ 'ptr MIMEType;' & _ ;~ 'int PictureType;' & _ ;~ 'ptr Description;' & _ ;~ 'ptr PictureData;' & _ ;~ 'uint PictureDataSize;' & _ ;~ 'ptr hBitmap;' & _ ;~ 'uint Width;' & _ ;~ 'uint Height;' & _ ;~ 'char reserved[128];' ;~ TID3InfoEx; ;~ Global Const $sTagTID3InfoEx='ptr Title;' & _ ;~ 'ptr Artist;' & _ ;~ 'ptr Album;' & _ ;~ 'ptr Year;' & _ ;~ 'ptr Comment;' & _ ;~ 'ptr TrackNum;' & _ ;~ 'ptr Genre;' & _ ;~ 'ptr AlbumArtist;' & _ ;~ 'ptr Composer;' & _ ;~ 'ptr OriginalArtist;' & _ ;~ 'ptr Copyright;' & _ ;~ 'ptr URL;' & _ ;~ 'ptr Encoder;' & _ ;~ 'ptr Publisher;' & _ ;~ 'uint BPM;' & _ ;~ $sTagTID3Picture & _ ;~ 'char reserved[128]' ;~ TID3PictureW ;~ Global Const $sTagTID3PictureW='uint PicturePresent;' & _ ;~ 'uint CanDrawPicture;' & _ ;~ 'ptr MIMEType;' & _ ;~ 'int PictureType;' & _ ;~ 'ptr Description;' & _ ;~ 'ptr PictureData;' & _ ;~ 'uint PictureDataSize;' & _ ;~ 'ptr hBitmap;' & _ ;~ 'uint Width;' & _ ;~ 'uint Height;' & _ ;~ 'wchar reserved[128];' ;~ TID3InfoExW; ;~ Global Const $sTagTID3InfoExw='ptr Title;' & _ ;~ 'ptr Artist;' & _ ;~ 'ptr Album;' & _ ;~ 'ptr Year;' & _ ;~ 'ptr Comment;' & _ ;~ 'ptr TrackNum;' & _ ;~ 'ptr Genre;' & _ ;~ 'ptr AlbumArtist;' & _ ;~ 'ptr Composer;' & _ ;~ 'ptr OriginalArtist;' & _ ;~ 'ptr Copyright;' & _ ;~ 'ptr URL;' & _ ;~ 'ptr Encoder;' & _ ;~ 'ptr Publisher;' & _ ;~ 'uint BPM;' & _ ;~ $sTagTID3Picture & _ ;~ 'wchar reserved[128]' ;~ TID3Info; Global Const $sTagTID3Info = 'ptr Title;' & _ 'ptr Artist;' & _ 'ptr Album;' & _ 'ptr Year;' & _ 'ptr Comment;' & _ 'ptr TrackNum; ' & _ 'ptr Genre;ptr[7]' ;~ TID3InfoW; Global Const $sTagTID3InfoW = 'wchar Title[256];' & _ 'wchar Artist[256];' & _ 'wchar Album[256];' & _ 'wchar Year[256];' & _ 'wchar Comment[256];' & _ 'wchar TrackNum[256]; ' & _ 'wchar Genre[256];ptr[7]' ;~ Global $ZPLAY_HANDLE = 0 Global Const $LibZplayName = 'LibZplay.dll' Global $LibZplay = 0 Func CreateZPlay() $LibZplay = DllOpen($LibZplayName) Local $Ret = DllCall($LibZplay, 'DWORD', 'zplay_CreateZPlay') If @error Then Return SetError(@error, @extended, 0) ;~ $ZPLAY_HANDLE = $Ret[0] Return $Ret[0] EndFunc ;==>CreateZPlay Func GetVersion($ZPLAY_HANDLE) Local $Ret = DllCall($LibZplay, 'int', 'zplay_GetVersion', 'DWORD', $ZPLAY_HANDLE) If @error Then Return SetError(@error, @extended, 0) Return $Ret[0] EndFunc ;==>GetVersion Func OpenFile($sFileName, $nFormat, $ZPLAY_HANDLE) Local $Ret = DllCall($LibZplay, 'dword', 'zplay_OpenFile', 'DWORD', $ZPLAY_HANDLE, 'str', $sFileName, 'dword', $nFormat) If @error Then Return SetError(@error, @extended, 0) Return $Ret[0] EndFunc ;==>OpenFile Func GetError($ZPLAY_HANDLE) Local $Ret = DllCall($LibZplay, 'str', 'zplay_GetError', 'DWORD', $ZPLAY_HANDLE) If @error Then Return SetError(@error, @extended, 0) Return $Ret[0] EndFunc ;==>GetError Func GetErrorW($ZPLAY_HANDLE) Local $Ret = DllCall($LibZplay, 'wstr', 'zplay_GetError', 'DWORD', $ZPLAY_HANDLE) If @error Then Return SetError(@error, @extended, 0) Return $Ret[0] EndFunc ;==>GetErrorW Func Play($ZPLAY_HANDLE) Local $Ret = DllCall($LibZplay, 'dword', 'zplay_Play', 'DWORD', $ZPLAY_HANDLE) If @error Then Return SetError(@error, @extended, 0) Return $Ret[0] EndFunc ;==>Play Func Pause($ZPLAY_HANDLE) Local $Ret = DllCall($LibZplay, 'dword', 'zplay_Pause', 'DWORD', $ZPLAY_HANDLE) If @error Then Return SetError(@error, @extended, 0) Return $Ret[0] EndFunc ;==>Pause Func Stop($ZPLAY_HANDLE) Local $Ret = DllCall($LibZplay, 'dword', 'zplay_Stop', 'DWORD', $ZPLAY_HANDLE) If @error Then Return SetError(@error, @extended, 0) Return $Ret[0] EndFunc ;==>Stop Func Resume($ZPLAY_HANDLE) Local $Ret = DllCall($LibZplay, 'dword', 'zplay_Resume', 'DWORD', $ZPLAY_HANDLE) If @error Then Return SetError(@error, @extended, 0) Return $Ret[0] EndFunc ;==>Resume Func Close($ZPLAY_HANDLE) Local $Ret = DllCall($LibZplay, 'dword', 'zplay_Close', 'DWORD', $ZPLAY_HANDLE) If @error Then Return SetError(@error, @extended, 0) DllClose($LibZplay) Return $Ret[0] EndFunc ;==>Close Func DestroyZPlay($ZPLAY_HANDLE) Local $Ret = DllCall($LibZplay, 'dword', 'zplay_DestroyZPlay', 'DWORD', $ZPLAY_HANDLE) If @error Then Return SetError(@error, @extended, 0) Return $Ret[0] EndFunc ;==>DestroyZPlay