[ Music Files Tag Editor written in Autohotkey ]

Post your working scripts, libraries and tools for AHK v1.1 and older
User avatar
rEX
Posts: 25
Joined: 26 Jan 2014, 10:30

[ Music Files Tag Editor written in Autohotkey ]

26 Jul 2014, 00:23

Image

Description


IDTE is a full featured tag editor which supports tagging of FLAC,APE,ID3V1.x/2.x,WAV CHUNKS,WMA,MP4 ATOMS,LYRICS,VORBIS Tags.
Not Just Only tag editing but ,it also allows the playback of 40+ various lossy and lossless Music formats such as FLAC,ALAC,OGG,APE,MP3 etc.
With its highly capability of editing tags and playback support ,It can rename files based on the tag information, export tag information, create playlists , Search for Incomplete Tags on Internet, Fetch Lyrics , Supports CUE Sheet , Can Process Multiple Files At Same Time ,Allows Batch File Processing , Supports SFX and Much More...



Features

Allows Reading/Editing of WMA,FLAC,Lyrics,Vorbis,ID3,APE,MP4,WAV chunk Tags
Organise Music Folders and Libraries Based upon Tag Information
Jewel case cover art display in order to view the Cover art of a file in real-time tag editing
Embeded Music Player & Very Fast Tag Retriving Time Through Audiogenie.dll
Windows CMD For Advance Users in Order To Add Tags Themselves Using command line tool "IDTE"
IDTE Online Search Make It Possible to Search Incomplete Tags with MuzicBrainz,Google etc.
Export Tag Information To Whatever Format You Want
More Playlists Options For Keeping Music Collection Always Arranged.
CUE,PLS,WPL And M3U Playlist Support
Wine Compatibility , For Linux Users
Just Install & Run , No External Settings Required
Support 40+ Various Lossy and Lossless formats for playback such as mp3,FLAC,ALAC,APE etc
Multiple GUI Options In Order to Fit For A Paricular Environment
Quick Pick Buttons For Fast Editing
Batch File Processing
More User Friendly
Supports Force ID3 Tag Editing To Any File
Can Be Used as a Simple Music Player with SFX Options
AutoScroll Lyrics Option (While Using IDTE as a Music player)
Fetch Cover art from Internet
Fetch Lyrics From Internet (From A-Z lyrics and lyrics.com)
Can Be Used as a Advance Music Player with SFX,Visualizations and much more..
Quick tag editing mode for those, who wants to edit tags without much hassel
Mini Player Mode for Easy Plaback
Case Conversion for both filenames and tags


Download IDTE Here (Source Code Included in SRC Folder) -->http://sourceforge.net/projects/idteid3tagedito/

Image

ANY SUGGESTIONS REGARDING IDTE ARE ALWAYS WELCOME. :D
aka Rajat
User avatar
joedf
Posts: 8937
Joined: 29 Sep 2013, 17:08
Location: Canada
Contact:

Re: [ Music Files Tag Editor written in Autohotkey ]

26 Jul 2014, 00:46

Seems to be very interesting!
Image Image Image Image Image
Windows 10 x64 Professional, Intel i5-8500, NVIDIA GTX 1060 6GB, 2x16GB Kingston FURY Beast - DDR4 3200 MHz | [About Me] | [About the AHK Foundation] | [Courses on AutoHotkey]
[ASPDM - StdLib Distribution] | [Qonsole - Quake-like console emulator] | [LibCon - Autohotkey Console Library]
User avatar
rEX
Posts: 25
Joined: 26 Jan 2014, 10:30

Re: [ Music Files Tag Editor written in Autohotkey ]

26 Jul 2014, 01:05

joedf wrote:Seems to be very interesting!
Thanks Joedf. Please do review and provide your suggestions on IDTE .
aka Rajat
toralf
Posts: 868
Joined: 27 Apr 2014, 21:08
Location: Germany

Re: [ Music Files Tag Editor written in Autohotkey ]

26 Jul 2014, 21:46

(Source Code Included in SRC Folder)
I could not find the current source code. Neither in any download file nor in the SRC folder on sourceforge.
ciao
toralf
User avatar
noname
Posts: 515
Joined: 19 Nov 2013, 09:15

Re: [ Music Files Tag Editor written in Autohotkey ]

27 Jul 2014, 00:19

Image

Could not get past this error when loading a folder or starting the player.

The mini player's volume change will also moves the "timeline" slider.

Tested on winXP and ahk_l 1.1.13.01.

I am impressed even if i could not test it but the miniplayer needs some visual refinement :) IMHO.
User avatar
rEX
Posts: 25
Joined: 26 Jan 2014, 10:30

Re: [ Music Files Tag Editor written in Autohotkey ]

27 Jul 2014, 00:51

toralf wrote:
(Source Code Included in SRC Folder)
I could not find the current source code. Neither in any download file nor in the SRC folder on sourceforge.
Sorry for that. Here --> https://github.com/Rajatkosh/IDTESRC
aka Rajat
User avatar
rEX
Posts: 25
Joined: 26 Jan 2014, 10:30

Re: [ Music Files Tag Editor written in Autohotkey ]

27 Jul 2014, 00:58

noname wrote:Could not get past this error when loading a folder or starting the player.

The mini player's volume change will also moves the "timeline" slider.

Tested on winXP and ahk_l 1.1.13.01.

I am impressed even if i could not test it but the miniplayer needs some visual refinement :) IMHO.
Please will you include some more Screen shots because this error is not encountering in my System. Are you building IDTE from source ?

Also, It works fine on Windows XP Sp3,7,8 & 8.1. I've tested Recently. Also, Please suggest something in order to solve the slider problem because i've tried everything but it is still buggy. :cry: :cry:
aka Rajat
User avatar
noname
Posts: 515
Joined: 19 Nov 2013, 09:15

Re: [ Music Files Tag Editor written in Autohotkey ]

27 Jul 2014, 04:32

The program is installed by the installer here:C:\Program Files\IDTE-ID3 Tag Editor\
It is the original program downloaded yesterday.

This is the zipped dir so you can check it for its content.

https://dl.dropboxusercontent.com/u/141 ... Editor.zip


These are two error screenshots ,the IDTE icon does not load at startup , the menu error displays when i select a list entry or load a folder ( i guess when the main gui Updates)

https://dl.dropboxusercontent.com/u/14147708/error1.jpg

https://dl.dropboxusercontent.com/u/14147708/error2.jpg


I can only give a gdip solution for the volume/timeline but ofcourse this involves a total different GUI.
User avatar
rEX
Posts: 25
Joined: 26 Jan 2014, 10:30

Re: [ Music Files Tag Editor written in Autohotkey ]

27 Jul 2014, 05:41

noname wrote: These are two error screenshots ,the IDTE icon does not load at startup , the menu error displays when i select a list entry or load a folder ( i guess when the main gui Updates)

https://dl.dropboxusercontent.com/u/14147708/error1.jpg

https://dl.dropboxusercontent.com/u/14147708/error2.jpg
Thanks For Uploading The Screenshots. I've Tried your Zipped Version and It worked Fine on my Machine (Both on W 7 and 8). It looks like as if it is the admin rights issue because, IDTE.ico is present in the Installed Folder of IDTE but the program is unable to load it (according to your machine) maybe the program do not have the rights to access it. Please try to run in admin mode and if the problem still presists please let me know. Anyway thanks for reporting your bugs.
noname wrote: I can only give a gdip solution for the volume/timeline but ofcourse this involves a total different GUI.
OK i guess i have to change the gui of player. Will you please provide me some script in order to deal with this in Gdip .
Thanks Again.
aka Rajat
User avatar
noname
Posts: 515
Joined: 19 Nov 2013, 09:15

Re: [ Music Files Tag Editor written in Autohotkey ]

27 Jul 2014, 07:17

Both errors were solved by replacing the IDTE.ico with one from another program.I guess winXP has some problems with resizing it to the correct resolution.( I could not see the ico displayed in explorer either)

:)
User avatar
noname
Posts: 515
Joined: 19 Nov 2013, 09:15

Re: [ Music Files Tag Editor written in Autohotkey ]

27 Jul 2014, 13:07

Image


Gdip demo for sliders timeline and volume.The mp3 demo file is hardcoded so it will only play that one unless you add some code :)
Also next and prev are not coded only play/stop alt+esc will exit.

download zip with gdip and bass library
https://dl.dropboxusercontent.com/u/141 ... player.zip
toralf
Posts: 868
Joined: 27 Apr 2014, 21:08
Location: Germany

Re: [ Music Files Tag Editor written in Autohotkey ]

27 Jul 2014, 22:12

Hi Rajat,

I just browsed through your code.
For me to be able to read and understand the code, I would need more indentation. Sorry, but your code is really bad in this respect. :|

Anyway, I'll start with some comments on the code:
(I have not run your code, since I usually want to know what I execute)

There are some #include commands in included files. That made it difficult for me to find out what is realy needed.

I also noticed that you have hardcoded the ini/config file in nearly every line of IniRead/Write. That makes it difficult to change it (for the user, if he would like to have it placed somewhere else)

I saw that you included my wrapper for bass as a file, even though you do not seem to use it anywhere. I guess because you needed more features of BASS that my wrapper made available. Is there a reason why you didn't extend the wrapper?

And why didn't you use/create a wrapper for AudioGenie. Is there a reason for it? If you would create a wrapper it could be used by more users for their purpose. If you do not have a wrapper for it, let me know, I have one written years ago, but maybe have not posted it yet. And you could extend it, because I never finished it to work with all internal AudioGenie functionalities.

From what I saw you store all the file data only in the LV. So I guess there is no possibility to filter the files, right? IMHO that might be ok for a tag editor, but from the comments in the forum it looks like it is getting more to become also a player. Then I would suggest to store the data in an object/array and allow filter funtions.

I will stop now, time to sleep. Will continue when I will find the time again. Thanks for sharing the source.

PS: I hope I did not came across too harsh. I realy think you did a great job by coding all this (~12000 lines). I hope you can take these comments as constructive feedback.
ciao
toralf
User avatar
rEX
Posts: 25
Joined: 26 Jan 2014, 10:30

Re: [ Music Files Tag Editor written in Autohotkey ]

28 Jul 2014, 12:38

toralf wrote:Hi Rajat,

I just browsed through your code.
For me to be able to read and understand the code, I would need more indentation. Sorry, but your code is really bad in this respect. :|
Hi Torlaf,
I do want to recode line by line in order to make it perfect for everybody and also extensible for everyone (i've done once which causes hell lot of bugs and errors and i end up in screwing all the code and IDTE). But, the problem is that i've coded it when i was nearly learning the AHK and don't have any kind of experience in coding.
toralf wrote: Anyway, I'll start with some comments on the code:
(I have not run your code, since I usually want to know what I execute)

There are some #include commands in included files. That made it difficult for me to find out what is realy needed.
I know, i don't execute anything unless i know what i am doing. so, if you are interested in this project then please pls pls help me in commenting and indentation :roll: (Don't worry u will added as a admin/developer in IDTE for your work)
I know i m asking for more :oops: but, i don't have much time for this project due to my college work and all that stuff so, i just fix some major/minor bugs and introduce some new features on the same previous code and it still working on my side.

Every Menu Bar Option (e.g. - file,Edit,view etc.) are separated into different file (e.g filemenu.ahk , editmenu.ahk, viewmenu.ahk etc.) therefore it is required to #include every file in Main Script i.e. IDTE.ahk.

You may also check out my C++ code as, it is completely Commented (Except some parts which are not yet implemented).
toralf wrote: I saw that you included my wrapper for bass as a file, even though you do not seem to use it anywhere. I guess because you needed more features of BASS that my wrapper made available. Is there a reason why you didn't extend the wrapper?

And why didn't you use/create a wrapper for AudioGenie. Is there a reason for it? If you would create a wrapper it could be used by more users for their purpose. If you do not have a wrapper for it, let me know, I have one written years ago, but maybe have not posted it yet. And you could extend it, because I never finished it to work with all internal AudioGenie functionalities.
There were no working wrapper available for Bass (As all the links were dead on AHK.net) so i've designed it specifically for
IDTE (In reality --> for myself not for IDTE) I don't know where i included yours :? . Also it didn't occur to me to design a audiogenie.dll wrapper :idea: (I'll keep it as a suggestion). However, IDTE do make use of some extended features of Audiogenie and Bass (e.g. Extended Tags,Information gathering,Mpeg Protection, Vizualization etc.)

toralf wrote: I also noticed that you have hardcoded the ini/config file in nearly every line of IniRead/Write. That makes it difficult to change it (for the user, if he would like to have it placed somewhere else)
It was important to hard code the ini configuration for some internal use of IDTE and also user don't have to worry about it as, configuration option of IDTE allows the user to set it according to the his/her need.

Ini-read was required everytime a new call is made because nobody knows when user gonna change the configuration and in which part of code execution so it's better to read the current configuration before taking the action (Some actions critically depends on the configuration and can really mess up the tags).
toralf wrote: From what I saw you store all the file data only in the LV. So I guess there is no possibility to filter the files, right? IMHO that might be ok for a tag editor, but from the comments in the forum it looks like it is getting more to become also a player. Then I would suggest to store the data in an object/array and allow filter funtions.
The LV data is stored in a special text file therefore IDTE restores the files everytime a new run is made. Also in intermediately steps some operation do make use of this text file. however your suggestion of storing the data in object/array is great. File is present in My documents/IDTE_Data/LastDB containing LV Data.
toralf wrote: PS: I hope I did not came across too harsh. I realy think you did a great job by coding all this (~12000 lines).
No definitely not, you instead suggested some great improvements on IDTE. However, on the part of coding -> It's all got messed up with time and features so, once again please help me in making this thing more of a code and less of a cryptic text :).

Also, it's not a great job by coding all these (~12000 lines) as it was just a time passing way which was evolved into Software like IDTE.
aka Rajat
toralf
Posts: 868
Joined: 27 Apr 2014, 21:08
Location: Germany

Re: [ Music Files Tag Editor written in Autohotkey ]

28 Jul 2014, 12:56

For nice indentation I once wrote auto-syntax-tidy. Don't know if it would work on your code because it will not know recently added commands. But it's worth a trial. Could save you several hours.
ciao
toralf
User avatar
noname
Posts: 515
Joined: 19 Nov 2013, 09:15

Re: [ Music Files Tag Editor written in Autohotkey ]

29 Jul 2014, 08:59

Image

Is there a way to save the tags in unicode?I can read the tags but not change/save them as unicode.

I could not find anything on the website of audiogenie.
I tried it with this code but all i get was ??? using ahk_l unicode.

Code: Select all

SetWorkingDir, %a_scriptdir%

hAudioGenie3 := DllCall( "LoadLibrary", Str,"AudioGenie3.dll" )     ;load AudioGenie3

File := "C:\cam\to you.mp3"
AG3_Open(File)   

title:=DllCall("AudioGenie3\AUDIOGetTitleW","Str")
msgbox %title%

title:="ガサラキ"
DllCall("AudioGenie3\AUDIOSetTitleW", Str,title,"str")
AG3_Save() 
sleep 2000

AG3_Open(File)   
title:=DllCall("AudioGenie3\AUDIOGetTitleW","Str")
msgbox %title%
Return
User avatar
rEX
Posts: 25
Joined: 26 Jan 2014, 10:30

Re: [ Music Files Tag Editor written in Autohotkey ]

29 Jul 2014, 11:44

You are forgetting one thing that is to set Encoding Bit in ID3 tags Frame.
bw IDTE can save it for you.

Here's the code (Working on AHK_L Unicode32)

Note - This only works for ID3v2 Tags

Code: Select all

SetWorkingDir, %a_scriptdir%

hAudioGenie3 := DllCall( "LoadLibrary", Str,"AudioGenie3.dll" )     ;load AudioGenie3

File := "C:\cam\to you.mp3"
AG3_Open(File)   

title:=DllCall("AudioGenie3\AUDIOGetTitleW","Str")
msgbox %title%

title:="ガサラキ"

DllCall("AudioGenie3\ID3V2SetFormatAndEncodingW", uint, 0,uint,1) ; Set Encoding Bit

DllCall("AudioGenie3\AUDIOSetTitleW", Str,title,"str")
AG3_Save() 
sleep 2000

AG3_Open(File)   
title:=DllCall("AudioGenie3\AUDIOGetTitleW","Str")
msgbox %title%
Return
B/w Audiogenie is no more available on audiogenie.net as the project is no more maintained by their developers.
However you can check it out on Source forge.
aka Rajat
User avatar
noname
Posts: 515
Joined: 19 Nov 2013, 09:15

Re: [ Music Files Tag Editor written in Autohotkey ]

29 Jul 2014, 12:24

bw IDTE can save it for you.
How do i set IDTE to save as unicode?

Thanks for the code :) perfect!

I have many problems using IDTE on my winXP mostly it crashes when selecting a file.

example screenshot:
https://dl.dropboxusercontent.com/u/14147708/error5.jpg

Have you tried it on a fully patched uptodate winXP?I wonder if the latest windows updates are to blame.I only need it for altering the title tags and inserting a cover art so i will just use these code snippets as standalone programs.

btw here i a wrapper for audiogenie that i found in my backup files unfortunately the author is not mentioned i guess it is deleted on the ahk website.May Toralf recognize this?

Code: Select all

#NoEnv
#SingleInstance Force
SetBatchLines, -1
OnExit, Exit

SetWorkingDir, %a_scriptdir%
OnExit, Exit
If !pToken := Gdip_Startup()
  {
    MsgBox, 48, gdiplus Error!, Gdiplus failed to start. Please ensure you have gdiplus on your system
    ExitApp
  }                                                 ;include GDI+
hAudioGenie3 := DllCall( "LoadLibrary", Str,"AudioGenie3.dll" )     ;load AudioGenie3


;specify all ID3 text or URL frameIDs you are interested in (APIC will be added at the end automatically)
ListOfFrames = TALB,TIT2,TIT3,TPE1,COMM
Language = Eng                ;set language (DEU or ENG)
FilePath := "e:\songs\"   ;specify path to some mp3 files


                ;start AudioGenie3 und GDI+
AG3_LogFile("AG3.log")    ;set log file

;get list of files and add it to listbox
Loop, %FilePath%*.mp3                
  ListFileNames .= A_LoopFileName . "|"
Gui, 1:Add, ListBox, w200 r32 vLsbFileName gLsbFileName , %ListFileNames%

;create for each frameID a text field with description in specified language
;Plus a text field for the picture type
Loop, Parse, ListOfFrames, `,     
  {
    Option := A_Index = 1 ? "ym" : ""
    Gui, 1:Add, Text, %Option% vTxtFrame%A_LoopField%, % AG3_FrameIDName(A_LoopField, Language)
  }
Gui, 1:Add, Text, vTxtFrameAPIC, % AG3_PictureTypeName(3, Language) 

;create for each frameID an ReadOnly edit control on GUI for the content of the FrameID
;Plus a picture control for the first picture
Loop, Parse, ListOfFrames, `,
  {
    Option := A_Index = 1 ? "ym" : ""
    Gui, 1:Add, Edit, %Option% w200 r1 vEdtFrame%A_LoopField% ReadOnly , 
  }
SS_BITMAP = 0xE
Gui, 1:Add, Picture, w100 h100 %SS_BITMAP% vPctAPIC HwndhPctAPIC, 

Gui, 1:Show, AutoSize Restore, AudioGenie3 Wrapper Demo         ;show GUI
Return

;user selected a file in listbox
LsbFileName:
  Gui, 1:Submit,NoHide             ;get file name
  AG3_Open(FilePath LsbFileName)   ;open it with AudioGenie3
  g:=DllCall("AudioGenie3\AUDIOGetCommentW","Str")
  msgbox %g%
  Loop, Parse, ListOfFrames, `,    ;get content of all FrameIDs
    GuiControl, 1:, EdtFrame%A_LoopField%, % AG3_ID3TFrame(A_LoopField)
  If AG3_GetID3PictureCount(){     ;check if picture available
    AG3_ShowID3Picture(hPctAPIC, 1)   ;show picture and adjust picture type name
    GuiControl, 1:, TxtFrameAPIC, % AG3_PictureTypeName(AG3_GetID3PictureType(1), Language)
  }Else{
    AG3_ShowID3Picture(hPctAPIC)      ;remove any shown picture from control
    GuiControl, 1:Move, PctAPIC, W100 H100   ;resize control
    GuiControl, 1:, TxtFrameAPIC, % AG3_PictureTypeName(3, Language)  ;reset text info
  }
Return

Esc::
GuiClose:
Exit:
  AG3_Stop()    ;stop AudiGenie3 und GDI+
  ExitApp
Return
; AG3_Open(File)                                ;opens a media file for analysis; ErrorLevel holds info on any Error
; AG3_LogFile(File)                             ;specifies file to log actions
; AG3_FoundTags()                               ;returns comma separated list of found tags in file (ID3v2,ID3v1,APE,LYRICS)
; AG3_AllID3Tags()                              ;returns comma separated list of all ID3v2 frame IDs in file (TALB,APIC,TIT1,COMM...) 
; AG3_FrameCount(FrameID)                       ;returns number of frames for specified frame ID in ID3v2 tag
; 
; AG3_ID3TFrame(FrameID [, String])             ;sets or returns text and URL frame contents for ID3v2 tags 
; AG3_Artist([String])                          ;sets or returns artist, regardless of tag type (WMA,OGG,APE,ID3,LYRICS)
; AG3_Album([String])                           ;sets or returns Album, regardless of tag type (WMA,OGG,APE,ID3,LYRICS)
; AG3_Title([String])                           ;sets or returns Title, regardless of tag type (WMA,OGG,APE,ID3,LYRICS)
; AG3_Track([String])                           ;sets or returns Track (e.g. 4 or 4/20), regardless of tag type (WMA,OGG,APE,ID3,LYRICS)
; AG3_Year([String])                            ;sets or returns Year (4 digits), regardless of tag type (WMA,OGG,APE,ID3,LYRICS)
; AG3_Genre([String])                           ;sets or returns Genre, regardless of tag type (WMA,OGG,APE,ID3,LYRICS)
; AG3_Comment([String])                         ;sets or returns a comment, regardless of tag type (WMA,OGG,APE,ID3,LYRICS)
; AG3_CommentEx(LanguageOrIndex [, Description, Text])  ;sets or returns one comment of ID3v2 tag; returns formated string [Lang.`nDesc.`nText]
; AG3_PlayCounter([Counter])                            ;sets or returns play counter of ID3v2 tag
; AG3_Popularimeter(EmailOrIndex [, Rating, Counter])   ;sets or returns one Popularimeter of ID3v2 tag; returns formated string [Email`nRating`nCounter]
; AG3_Lyric(LanguageOrIndex [, Description, Text])      ;sets or returns one Lyric of ID3v2 tag; returns formated string [Lang.`nDesc.`nText] 
; 
; AG3_GetID3PictureCount()                          ;returns number of pictures in ID3v2 tag
; AG3_GetWMAPictureCount()                          ;returns number of pictures in WMA tag
; AG3_GetMP4PictureCount()                          ;returns number of pictures in MP4 tag
; AG3_GetID3PictureMime(Index)                      ;returns MIME type of one picture in ID3v2 tag
; AG3_GetID3PictureType(Index)                      ;returns picture type of one picture in ID3v2 tag
; AG3_GetID3PictureDescription(Index)               ;returns describtion of one picture in ID3v2 tag
; AG3_GetWMAPictureMime(Index)                      ;returns MIME type of one picture in WMA tag    
; AG3_GetWMAPictureType(Index)                      ;returns picture type of one picture in WMA tag 
; AG3_GetWMAPictureDescription(Index)               ;returns describtion of one picture in WMA tag
; AG3_ShowID3Picture(hPctControl [, Index])         ;shows/removes picture of one APIC ID3 frame in/from a picture control
; AG3_ShowWMAPicture(hPctControl [, Index])         ;shows/removes one picture of an WMA tag in/from a picture control
; AG3_ShowMP4Picture(hPctControl [, Index])         ;shows/removes one picture of an MP4 tag in/from a picture control
; AG3_ShowID3CommercialLogo(hPctControl [, Index])  ;shows/removes picture of one COMR ID3 frame in/from a picture control
; 
; AG3_GetID3Picture(File, Index)                    ;saves picture of one APIC ID3 frame to file
; AG3_GetWMAPicture(File, Index)                    ;saves one picture of WMA tag to file
; AG3_GetMP4Picture(File, Index)                    ;saves one picture of MP4 tag to file
; AG3_AddID3Picture(File, Description, PictureType)         ;adds picture from file to new APIC ID3 frame
; AG3_AddWMAPicture(File, Description, PictureType, Index)  ;adds picture from file to WMA tag
; AG3_AddMP4Picture(File)                                   ;adds picture from file to MP4 tag
; 
; AG3_DeleteFrame(FrameID [, Index])    ;deletes all ID3 frames with same FrameID or one specific of several  
;
; AG3_RemoveID3v2Tag([File])            ;removes ID3v2 tag from currently opened file or from file
; AG3_RemoveID3v1Tag([File])            ;removes ID3v1 tag from currently opened file or from file
; AG3_RemoveAPETag([File])              ;removes APE tag from currently opened file or from file
; AG3_RemoveLYRICSTag([File])           ;removes LYRICS tag from currently opened file or from file
; AG3_RemoveOGGTag([File])              ;removes OGG tag from currently opened file or from file
; 
; AG3_Save([File])           ;saves all changes of currently opened file or to file, regardless of tag type (WMA,OGG,APE,ID3,LYRICS)
; AG3_SaveID3V2([File])      ;saves all ID3v2 tag changes of currently opened file or to file
; AG3_SaveID3V1([File])      ;saves all ID3v1 tag changes of currently opened file or to file
; AG3_SaveWMA([File])        ;saves all WMA tag changes of currently opened file or to file
; AG3_SaveMP4([File])        ;saves all MP4 tag changes of currently opened file or to file
; AG3_SaveAPE([File])        ;saves all APE tag changes of currently opened file or to file
; AG3_SaveLYRICS([File])     ;saves all LYRICS tag changes of currently opened file or to file
; AG3_SaveOGG([File])        ;saves all OGG tag changes of currently opened file or to file
; AG3_SaveFLAC([File])       ;saves all FLAC tag changes of currently opened file or to file
; 
; AG3_PictureTypeName(PicType [, Language])  ;returns picture type description in specified language (default: ENG)
;                                            ;valid for WMA and ID3 V2.4.0, V2.3.0 and V2.2.0
; AG3_FrameIDName(FrameID [, Language])      ;returns FrameID description in specified language (default: ENG)
;                                            ;valid for ID3 V2.4.0, V2.3.0 (4 characters) and V2.2.0 (3 characters)
; 
; AG3(Func [, FrameIDOrStringOrIndex, StringOrIndex])  ;execution of 356 AudioGenie3 functions 
;                                                      ;more info on functions in AudioGenie3 documentation
; 
; 72 functions of AudioGenie3 are not yet wrapped.
; 
; #################################
; ##  List of private functions  ##
; #################################
; AG3_OpenReturnValue(ReturnValue)
; AG3_ShowPicture(Type, hPctControl, Index)
; AG3_AddGetPicture(Func, File [, DescOrIndex, PictureType])
; AG3_RemoveTag(Func [, File])
; AG3_SaveChanges(Func [, File])
;
AG3_Init(ag3_path,Modus=""){
  static hAudioGenie3,pGDIPToken,savedModus    ;remember handles for stop
  savedModus := Modus
  If (Modus = "Stop"){
    DllCall("FreeLibrary", UInt, hAudioGenie3)       ;free AudioGenie
    DllCall("gdiplus\GdiplusShutdown", "UInt", pGDIPToken)    ;stop GDI+  ;  = Gdip_Shutdown(pGDIPToken) 
    If hModule := DllCall("GetModuleHandle", "Str", "gdiplus")            ;    - " -
      DllCall("FreeLibrary", "UInt", hModule)                             ;    - " -
  }Else{
    hAudioGenie3 := DllCall( "LoadLibrary", Str,ag3_path )  ;load AudioGenie
    SetTimer, ForceNag, -1                                           ;force Nag
    If !DllCall("GetModuleHandle", "Str", "gdiplus")                 ;start GDI+     ;  = If (!pGDIPToken := Gdip_Startup()){
      DllCall("LoadLibrary", "Str", "gdiplus")                                       ;    - " -
    VarSetCapacity(si, 16, 0), si := Chr(1)                                          ;    - " -
    DllCall("gdiplus\GdiplusStartup", "UInt*", pGDIPToken, "UInt", &si, "UInt", 0)   ;    - " -
    If !pGDIPToken{                                                                  ;    - " -
    	MsgBox, 48, gdiplus error!, Gdiplus failed to start. Please ensure you have gdiplus on your system
    	Return 
    }
  }
  Return 
  
  ForceNag:                                               ;force Nag
    If InStr(savedModus,"HideNag")                        ;use AG3_Init("HideNag") to hide Nag
      SetTimer, HideNag, -1
    DllCall( "AudioGenie3\AUDIOAnalyzeFileW", Str,Dummy ) ;Dummy Call for SplashText
  Return
  
  HideNag:
   SetWinDelay, -1                                         ;hide Nag
   WinWait, ahk_class #32770, This Project uses the Freeware AudioGenie, 1
;    WinHide, ahk_class #32770, This Project uses the Freeware AudioGenie    ;but sets GUI to background and disables it for 3 seconds
;    WinMove, ahk_class #32770, This Project uses the Freeware AudioGenie, -230, -120   ;but disables GUI for 3 seconds
   WinSet, Transparent, 0, ahk_class #32770, This Project uses the Freeware AudioGenie   ;but disables GUI for 3 seconds
  Return
}
AG3_Stop(){
  AG3_Init("Stop")
}

AG3_Open(File){
  Return Ret := DllCall( "AudioGenie3\AUDIOAnalyzeFileW", Str,File ), ErrorLevel := AG3_OpenReturnValue(Ret)            
}
AG3_OpenReturnValue(ReturnValue){
  static ReturnValues := 
          (LTrim
            "0 unknown Format
            1 MP3
            2 WMA
            3 MONKEY
            4 FLAC
            5 WAV
            6 OGG VORBIS
            7 MPP
            8 AAC
            9 MP4/M4A
            10 TTA"
          )
  Needle := "m`n)^" i " (?<Translation>.*)$"
  RegExMatch(ReturnValues, Needle, Return)
  Return ReturnTranslation
}

AG3_LogFile(File){
  Return DllCall("AudioGenie3\SetLogFileW", Str,File,"Str")
}
; SetLogFileW (LPCWSTR fileName)

AG3_FoundTags(){
   Tags := Abs(DllCall("AudioGenie3\ID3V2ExistsW")) ? "ID3v2," : ""
         . Abs(DllCall("AudioGenie3\ID3V1ExistsW")) ? "ID3v1," : ""
         . Abs(DllCall("AudioGenie3\APEExistsW"))   ? "APE," : ""
         . Abs(DllCall("AudioGenie3\LYRICSExistsW")) ? "LYRICS," : ""
   Return SubStr(Tags,1,-1)
}
; LYRICSExistsW ()
; ID3V2ExistsW  ()
; APEExistsW    ()
; ID3V1ExistsW  ()

AG3_AllID3Tags(){
  Return DllCall("AudioGenie3\ID3V2GetAllFrameIDsW","Str")
}
; ID3V2GetAllFrameIDsW ()

AG3_FrameCount(FrameID){
  Return DllCall( "AudioGenie3\ID3V2GetFrameCountW", Int,"0x" . AscToHex(FrameID))
}
; ID3V2GetAllFrameIDsW (u32 FrameID)

AG3_ID3TFrame(FrameID, String="EIIK§ÐŠTUik"){
  Func := (SubStr(FrameID,1,1) = "T" ? "TextFrameW"
        : (SubStr(FrameID,1,1) = "W" ? "URLFrameW" : ""))
  If !Func OR StrLen(FrameID) <> 4
    Return
  FrameIDH := "0x" . AscToHex(FrameID)
  If (String <> "EIIK§ÐŠTUik"){
    Return DllCall("AudioGenie3\ID3V2Set" Func, Int,FrameIDH, Str,String,"Str")
  }Else
    Return DllCall("AudioGenie3\ID3V2Get" Func, Int,FrameIDH,"Str")
}
; ID3V2SetURLFrameW         (u32 FrameID, LPCWSTR textString)
; ID3V2SetTextFrameW        (u32 FrameID, LPCWSTR textString)
; ID3V2GetURLFrameW         (u32 FrameID)
; ID3V2GetTextFrameW        (u32 FrameID)


AG3_Artist(String="EIIK§ÐŠTUik"){
  If (String <> "EIIK§ÐŠTUik"){
    Return DllCall("AudioGenie3\AUDIOSetArtistW", Str,String,"Str")
  }Else
    Return DllCall("AudioGenie3\AUDIOGetArtistW","Str")
}
; AUDIOGetArtistW          ()
; AUDIOSetArtistW          (LPCWSTR textString)

AG3_Album(String="EIIK§ÐŠTUik"){
  If (String <> "EIIK§ÐŠTUik"){
    Return DllCall("AudioGenie3\AUDIOSetAlbumW", Str,String,"Str")
  }Else
    Return DllCall("AudioGenie3\AUDIOGetAlbumW","Str")
}
; AUDIOGetAlbumW           ()
; AUDIOSetAlbumW           (LPCWSTR textString)

AG3_Title(String="EIIK§ÐŠTUik"){
  If (String <> "EIIK§ÐŠTUik"){
    Return DllCall("AudioGenie3\AUDIOSetTitleW", Str,String,"Str")
  }Else
    Return DllCall("AudioGenie3\AUDIOGetTitleW","Str")
}
; AUDIOGetTitleW           ()
; AUDIOSetTitleW           (LPCWSTR textString)

AG3_Track(String="EIIK§ÐŠTUik"){
  If (String <> "EIIK§ÐŠTUik"){
    Return DllCall("AudioGenie3\AUDIOSetArtistW", Str,String,"Str")
  }Else
    Return DllCall("AudioGenie3\AUDIOGetTrackW","Str")
}
; AUDIOGetTrackW           ()
; AUDIOSetTrackW           (LPCWSTR textString)

AG3_Year(String="EIIK§ÐŠTUik"){
  If (String <> "EIIK§ÐŠTUik"){
    Return DllCall("AudioGenie3\AUDIOSetYearW", Str,String,"Str")
  }Else
    Return DllCall("AudioGenie3\AUDIOGetYearW","Str")
}
; AUDIOGetYearW            ()
; AUDIOSetYearW            (LPCWSTR textString)

AG3_Genre(String="EIIK§ÐŠTUik"){
  If (String <> "EIIK§ÐŠTUik"){
    Return DllCall("AudioGenie3\AUDIOSetGenreW", Str,String,"Str")
  }Else
    Return DllCall("AudioGenie3\AUDIOGetGenreW","Str")
}
; AUDIOGetGenreW           ()
; AUDIOSetGenreW           (LPCWSTR textString)

AG3_Comment(String="EIIK§ÐŠTUik"){
  If (String <> "EIIK§ÐŠTUik"){
    Return DllCall("AudioGenie3\AUDIOSetCommentW", Str,String,"Str")
  }Else
    Return DllCall("AudioGenie3\AUDIOGetCommentW","Str")
}
; AUDIOGetCommentW         ()
; AUDIOSetCommentW         (LPCWSTR textString)

AG3_CommentEx(LanguageOrIndex, Description="", Text=""){
  If (RegExMatch(LanguageOrIndex,"[a-zA-Z]{3}")){
    Return DllCall("AudioGenie3\ID3V2AddCommentW", Str,Language, Str,Description, Str,Text)
  }Else If LanguageOrIndex is number
    If LanguageOrIndex > 0
      Return DllCall("AudioGenie3\ID3V2GetCommentLanguageW", Short,LanguageOrIndex,"Str")
      . "`n" DllCall("AudioGenie3\ID3V2GetCommentDescriptionW", Short,LanguageOrIndex,"Str")
      . "`n" DllCall("AudioGenie3\ID3V2GetCommentW", Short,LanguageOrIndex,"Str")
}
; ID3V2AddCommentW              (LPCWSTR Language, LPCWSTR Description, LPCWSTR Text)
; ID3V2GetCommentW              (short Index)
; ID3V2GetCommentLanguageW      (short Index)
; ID3V2GetCommentDescriptionW   (short Index)

AG3_PlayCounter(Counter=""){
  If (Counter = "")
    Return DllCall("AudioGenie3\ID3V2GetPlayCounterW")
  Else If Counter is number
    Return DllCall("AudioGenie3\ID3V2SetPlayCounterW", Int,Counter) ;return type not documented
}
; ID3V2SetPlayCounterW          (long counter)
; ID3V2GetPlayCounterW          ()

AG3_Popularimeter(EmailOrIndex, Rating="", Counter=""){
  If EmailOrIndex is number
    Return DllCall("AudioGenie3\ID3V2GetPopularimeterEmailW", Int,EmailOrIndex,"Str")
    . "`n" DllCall("AudioGenie3\ID3V2GetPopularimeterRatingW", Int,EmailOrIndex,"Str")
    . "`n" DllCall("AudioGenie3\ID3V2GetPopularimeterCounterW", Int,EmailOrIndex,"Str")
  Else If EmailOrIndex{
    Return DllCall("AudioGenie3\ID3V2AddCommentW", Str,Email, Short,Rating, Int,Counter)
  }
}
; ID3V2GetPopularimeterRatingW  (short Index)
; ID3V2GetPopularimeterCounterW (short Index)
; ID3V2GetPopularimeterEmailW   (short Index)
; ID3V2AddPopularimeterW        (LPCWSTR Email, short Rating, long Counter)

AG3_Lyric(LanguageOrIndex, Description="", Text=""){
  If (RegExMatch(LanguageOrIndex,"[a-zA-Z]{3}")){
    Return DllCall("AudioGenie3\ID3V2AddLyricW", Str,Language, Str,Description, Str,Text)
  }Else If LanguageOrIndex is number
    If LanguageOrIndex > 0
      Return DllCall("AudioGenie3\ID3V2GetLyricLanguageW", Short,LanguageOrIndex,"Str")
      . "`n" DllCall("AudioGenie3\ID3V2GetLyricDescriptionW", Short,LanguageOrIndex,"Str")
      . "`n" DllCall("AudioGenie3\ID3V2GetLyricW", Short,LanguageOrIndex,"Str")
}
; ID3V2AddLyricW            (LPCWSTR Language, LPCWSTR Description, LPCWSTR Text)
; ID3V2GetLyricW            (short Index)
; ID3V2GetLyricDescriptionW (short Index)
; ID3V2GetLyricLanguageW    (short Index)

AG3_GetID3PictureCount(){
  Return AG3_FrameCount("APIC")
}
AG3_GetWMAPictureCount(){
  Return DllCall( "AudioGenie3\WMAGetPictureCountW")
}
AG3_GetMP4PictureCount(){
  Return DllCall( "AudioGenie3\MP4GetPictureCountW")
}
; WMAGetPictureCountW ()
; MP4GetPictureCountW ()

AG3_GetID3PictureMime(Index){
  Return DllCall( "AudioGenie3\ID3V2GetPictureMimeW", Short,Index,"Str")
}
AG3_GetID3PictureType(Index){
  Return Ret := DllCall( "AudioGenie3\ID3V2GetPictureTypeW", Short,Index), ErrorLevel := AG3_PictureTypeName(Ret)
}
AG3_GetID3PictureDescription(Index){
  Return DllCall( "AudioGenie3\ID3V2GetPictureDescriptionW", Short,Index,"Str")
}
AG3_GetWMAPictureMime(Index){
  Return DllCall( "AudioGenie3\WMAGetPictureMimeW", Short,Index,"Str")
}
AG3_GetWMAPictureType(Index){
  Return Ret := DllCall( "AudioGenie3\WMAGetPictureTypeW", Short,Index), ErrorLevel := AG3_PictureTypeName(Ret) 
}
AG3_GetWMAPictureDescription(Index){
  Return DllCall( "AudioGenie3\WMAGetPictureDescriptionW", Short,Index,"Str")
}
; ID3V2GetPictureMimeW        (short Index)
; ID3V2GetPictureTypeW        (short Index)
; ID3V2GetPictureDescriptionW (short Index)
; WMAGetPictureMimeW          (short Index)
; WMAGetPictureTypeW          (short Index)
; WMAGetPictureDescriptionW   (short Index)

AG3_ShowID3Picture(hPctControl, Index=""){
  Return AG3_ShowPicture("ID3V2", hPctControl, Index)
}
AG3_ShowMP4Picture(hPctControl, Index=""){
  Return AG3_ShowPicture("MP4", hPctControl, Index)
}
AG3_ShowWMAPicture(hPctControl, Index=""){
  Return AG3_ShowPicture("WMA", hPctControl, Index)
}
AG3_ShowID3CommercialLogo(hPctControl, Index=""){
  Return AG3_ShowPicture("Logo", hPctControl, Index)
}
; MP4GetPictureArrayW              (BYTE *arr, u32 maxLen, short Index)
; WMAGetPictureArrayW              (BYTE *arr, u32 maxLen, short Index)
; ID3V2GetPictureArrayW            (BYTE *arr, u32 maxLen, short Index)
; ID3V2GetCommercialFramePictureW  (BYTE *arr, u32 maxLen, short Index)
AG3_ShowPicture(Type, hPctControl, Index){
  ControlGetPos , CX, CY, CWidth, CHeight, ,ahk_id %hPctControl%
  If !Index {           ;remove picture
    bc := DllCall("GetSysColor", "Int", COLOR_3DFACE:=15)  
    DllCall("gdiplus\GdipCreateSolidFill", "Int"        ;  = pBrushClear := Gdip_BrushCreateSolid(0xff000000 | (bc >> 16 | bc & 0xff00 | (bc & 0xff) << 16))
      , ARGB := 0xff000000 | (bc >> 16 | bc & 0xff00 | (bc & 0xff) << 16), "UInt*", pBrushClear)
  }Else{                ;show picture
    Func := Type . "GetPictureArrayW"
    Func := Type = "Logo" ? "ID3V2GetCommercialFramePictureW" : Func
    
    MaxLen = 5000000                             ;size of array in bytes; assume large picture
    VarSetCapacity(PicAsBin, MaxLen, 0)
    nSize := DllCall("AudioGenie3\" Func, UInt,&PicAsBin, Int,MaxLen, Int,Index)
    If nSize < 0                                 ;when something goes wrong, set ErrorLevel
      Return 0, ErrorLevel :=  DllCall("AudioGenie3\AUDIOGetLastErrorTextW"),"Str" 
    VarSetCapacity(PicAsBin, -1)                 ;adjust size
    
    ;create Bitmap from binary array
    hData := DllCall("GlobalAlloc", UInt,2, UInt,nSize)              
    pData := DllCall("GlobalLock", UInt,hData)
    DllCall("RtlMoveMemory", UInt,pData, UInt,&PicAsBin, UInt,nSize)
    DllCall("GlobalUnlock", UInt,hData)
    DllCall("ole32\CreateStreamOnHGlobal", UInt,hData, Int,1, UIntP,pStream)  ;Use COM
    DllCall( "gdiplus\GdipCreateBitmapFromStream", UInt,pStream, UIntP,pBitmap )
    DllCall( NumGet(NumGet(1*pStream)+8 ), UInt,pStream )                     ;Release COM
  
    ;calculate new hight and width by keeping aspect ratio
    DllCall("gdiplus\GdipGetImageWidth", "UInt", pBitmap, "UInt*", OriginalWidth)    ;  = OriginalWidth := Gdip_GetImageWidth(pBitmap)
    DllCall("gdiplus\GdipGetImageHeight", "UInt", pBitmap, "UInt*", OriginalHeight)  ;  = OriginalHeight := Gdip_GetImageHeight(pBitmap)
    RatioWidth := CWidth/OriginalWidth, RatioHeight := CHeight/OriginalHeight
    Ration := RatioWidth < RatioHeight ? RatioWidth : RatioHeight
    NewWidth := OriginalWidth * Ration
    NewHeight := OriginalHeight * Ration
  }  

  DllCall("gdiplus\GdipCreateBitmapFromScan0", "Int",CWidth, "Int",CHeight                 ;  = NewpBitmap := Gdip_CreateBitmap(CWidth, CHeight)
        , "Int",0, "Int",Format:=0x26200A, "UInt",0, "UInt*", NewpBitmap)
  DllCall("gdiplus\GdipGetImageGraphicsContext", "UInt", NewpBitmap, "UInt*", NewG)        ;  = NewG := Gdip_GraphicsFromImage(NewpBitmap)

  If !Index {           ;remove picture
    DllCall("gdiplus\GdipFillRectangle", "UInt", NewG, "Int", pBrushClear                  ;  = Gdip_FillRectangle(NewG, pBrushClear, 0, 0, CWidth, CHeight)
          , "Float", x:=0, "Float", y:=0, "Float", CWidth, "Float", CHeight)
  }Else{                ;show picture
    ;scale bitmap
    DllCall("gdiplus\GdipSetInterpolationMode", "UInt", NewG, "Int", InterpolationMode:=7)   ;  = Gdip_SetInterpolationMode(NewG, 7)
    DllCall("gdiplus\GdipDrawImageRectRect", "UInt", NewG, "UInt", pBitmap                   ;  = Gdip_DrawImage(NewG, pBitmap, 0, 0, NewWidth, NewHeight, 0, 0, OriginalWidth, OriginalHeight)
        	, "Float", dx:=0, "Float", dy:=0, "Float", NewWidth, "Float", NewHeight
        	, "Float", sx:=0, "Float", sy:=0, "Float", OriginalWidth, "Float", OriginalHeight
        	, "Int", 2, "UInt", ImageAttr:=0, "UInt", 0, "UInt", 0)
  }  

  ;set image to control
  DllCall("gdiplus\GdipCreateHBITMAPFromBitmap", "UInt", NewpBitmap            ;  = hBitmap := Gdip_CreateHBITMAPFromBitmap(NewpBitmap)
                  , "UInt*", hBitmap, "Int", Background:=0xffffffff)

	SendMessage, (STM_SETIMAGE:=0x172), (IMAGE_BITMAP:=0x0), hBitmap,, ahk_id %hPctControl%    ;  = SetImage(hPctControl, hBitmap)
  DllCall("DeleteObject", "UInt", ErrorLevel)                                                ;    - " -
  
  ; The bitmaps from the image may be deleted
  If !Index {           ;remove picture
    DllCall("gdiplus\GdipDeleteBrush", "UInt", pBrush)     ; =  Gdip_DeleteBrush(pBrushClear)
  }Else{                ;show picture
    DllCall("gdiplus\GdipDisposeImage", "UInt", pBitmap)   ; =  Gdip_DisposeImage(pBitmap)
  }
  DllCall("gdiplus\GdipDeleteGraphics", "UInt", NewG)      ; =  Gdip_DeleteGraphics(NewG)
  DllCall("gdiplus\GdipDisposeImage", "UInt", NewpBitmap)  ; =  Gdip_DisposeImage(NewpBitmap)
  DllCall("DeleteObject", "UInt", hBitmap)                 ; =  DeleteObject(hBitmap)
  Return 1
}

AG3_GetID3Picture(File, Index){
  Return AG3_AddGetPicture("ID3V2Get", File, Index)
}
AG3_GetWMAPicture(File, Index){
  Return AG3_AddGetPicture("WMAGet", File, Index)
}
AG3_GetMP4Picture(File, Index){
  Return AG3_AddGetPicture("MP4Get", File, Index)
}
AG3_AddID3Picture(File, Description, PictureType){
  Return AG3_AddGetPicture("ID3V2Add", File, Description, PictureType)
}
AG3_AddWMAPicture(File, Description, PictureType){
  Return AG3_AddGetPicture("WMAAdd", File, Description, PictureType)
}
AG3_AddMP4Picture(File){
  Return AG3_AddGetPicture("MP4Add", File)
}
AG3_AddGetPicture(Func, File, DescOrIndex="", PictureType=""){
  Func .= "PictureFileW"
  If InStr(Func,"Get") {
    Return DllCall( "AudioGenie3\" Func, Str,File, Short,DescOrIndex )
  }Else {
    If InStr(Func,"MP4")
      Return DllCall( "AudioGenie3\" Func, Str,File)
    Else If InStr(Func,"ID3") ;add as file not as link
      Return DllCall( "AudioGenie3\" Func, Str,FileU, Str,Description, Short,PictureType, Short,0 )
    Else  ;add at the end; do not overwrite
      Return DllCall( "AudioGenie3\" Func, Str,FileU, Str,Description, Short,PictureType, Short,1+AG3_GetWMAPictureCount() )
  }
}
; WMAGetPictureFileW   (LPCWSTR FileName, short Index)
; ID3V2GetPictureFileW (LPCWSTR FileName, short Index)
; MP4GetPictureFileW   (LPCWSTR FileName, short Index)
; WMAAddPictureFileW   (LPCWSTR FileName, LPCWSTR Description, short PictureType, short Index)
; ID3V2AddPictureFileW (LPCWSTR FileName, LPCWSTR Description, short PictureType, short asLink)
; MP4AddPictureFileW   (LPCWSTR FileName)

AG3_DeleteFrame(FrameID, Index=0){
  FrameIDH := "0x" . AscToHex(FrameID)
  If Index=0
    Return DllCall("AudioGenie3\ID3V2DeleteAllFramesW", Int,FrameIDH)
  Else If Index is number
    If Index > 0
      Return DllCall("AudioGenie3\ID3V2DeleteSelectedFrameW", Int,FrameIDH , Short,Index )
}
; ID3V2DeleteSelectedFrameW (u32 FrameID, short Index)
; ID3V2DeleteAllFramesW     (u32 FrameID)

AG3_RemoveID3v2Tag(File=""){
  Return AG3_RemoveTag("ID3v2", File)  
}
AG3_RemoveID3v1Tag(File=""){
  Return AG3_RemoveTag("ID3v1", File)  
}
AG3_RemoveAPETag(File=""){
  Return AG3_RemoveTag("APE", File)  
}
AG3_RemoveLYRICSTag(File=""){
  Return AG3_RemoveTag("LYRICS", File)  
}
AG3_RemoveOGGTag(File=""){
  Return AG3_RemoveTag("OGG", File)  
}
AG3_RemoveTag(Func, File=""){
  Func .= "RemoveTag"
  If File {
    Return DllCall( "AudioGenie3\" Func "FromFileW", Str,File )
  }Else {
    Return DllCall( "AudioGenie3\" Func "W" )
  }
}
; ID3V2RemoveTagW          ()
; ID3V2RemoveTagFromFileW  (LPCWSTR FileName)
; ID3V1RemoveTagW          ()
; ID3V1RemoveTagFromFileW  (LPCWSTR FileName)
; APERemoveTagW            ()
; APERemoveTagFromFileW    (LPCWSTR FileName)
; LYRICSRemoveTagW         ()
; LYRICSRemoveTagFromFileW (LPCWSTR FileName)
; OGGRemoveTagW            ()
; OGGRemoveTagFromFileW    (LPCWSTR FileName)

AG3_Save(File=""){
  Return AG3_SaveChanges("AUDIO", File)
}
AG3_SaveID3V2(File=""){
  Return AG3_SaveChanges("ID3V2", File)
}
AG3_SaveID3V1(File=""){
  Return AG3_SaveChanges("ID3V1", File)
}
AG3_SaveWMA(File=""){
  Return AG3_SaveChanges("WMA", File)
}
AG3_SaveMP4(File=""){
  Return AG3_SaveChanges("MP4", File)
}
AG3_SaveAPE(File=""){
  Return AG3_SaveChanges("APE", File)
}
AG3_SaveLYRICS(File=""){
  Return AG3_SaveChanges("LYRICS", File)
}
AG3_SaveOGG(File=""){
  Return AG3_SaveChanges("OGG", File)
}
AG3_SaveFLAC(File=""){
  Return AG3_SaveChanges("FLAC", File)
}
AG3_SaveChanges(Func, File=""){
  Func .= "SaveChanges"
  If File {
    Return DllCall( "AudioGenie3\" Func "ToFileW", Str,File )
  }Else {
    Return DllCall( "AudioGenie3\" Func "W" )
  }
}
; ID3V2SaveChangesW        ()
; ID3V2SaveChangesToFileW  (LPCWSTR FileName)
; WMASaveChangesW          ()
; WMASaveChangesToFileW    (LPCWSTR FileName)
; OGGSaveChangesW          ()
; OGGSaveChangesToFileW    (LPCWSTR FileName)
; MP4SaveChangesW          ()
; MP4SaveChangesToFileW    (LPCWSTR FileName)
; LYRICSSaveChangesW       ()
; LYRICSSaveChangesToFileW (LPCWSTR FileName)
; APESaveChangesW          ()
; APESaveChangesToFileW    (LPCWSTR FileName)
; ID3V1SaveChangesW        ()
; ID3V1SaveChangesToFileW  (LPCWSTR FileName)
; AUDIOSaveChangesW        ()
; AUDIOSaveChangesToFileW  (LPCWSTR FileName)
; FLACSaveChangesW         ()
; FLACSaveChangesToFileW   (LPCWSTR FileName)

AG3_PictureTypeName(PicType, Language="ENG"){    ;for WMA and ID3 V2.4.0, V2.3.0 and V2.2.0
  static KnownTypesENG :=
          (LTrim
           "0 Other                                          
            1 32x32 pixels 'file icon' (PNG only)            
            2 Other file icon                                
            3 Cover (front)                                  
            4 Cover (back)                                   
            5 Leaflet page                                   
            6 Media (e.g. lable side of CD)                  
            7 Lead artist/lead performer/soloist             
            8 Artist/performer                               
            9 Conductor                                      
            10 Band/Orchestra                                 
            11 Composer                                       
            12 Lyricist/text writer                           
            13 Recording Location                             
            14 During recording                               
            15 During performance                             
            16 Movie/video screen capture                     
            17 A bright coloured fish                         
            18 Illustration                                   
            19 Band/artist logotype                           
            20 Publisher/Studio logotype"                     
          )
  static KnownTypesDEU :=
          (LTrim
           "0 Anders                                          
            1 32x32 pixel 'Dateisymbol' (nur PNG)            
            2 Anderes Dateisymbol                                
            3 Hülle (Front)                                  
            4 Hülle (Rückseite)                                   
            5 Broschürenseite                                   
            6 Medie (z.B. bedruckte Seite der CD)                  
            7 Hauptkünstler/Hauptdarsteller/Soloist             
            8 Artist/Darsteller                               
            9 Dirigent                                      
            10 Band/Orchester                                 
            11 Komponist                                       
            12 Liedtextschreiber                           
            13 Aufnahmeort                             
            14 Während der Aufnahme                               
            15 Während der Aufführung                             
            16 Film/Video Schnappschuß                     
            17 Ein hell leuchtender Fisch                         
            18 Illustration                                   
            19 Band/Künstler Logo                           
            20 Verlag/Studio Logo"                     
          )
  Needle := "m`n)" PicType " (?P<Value>.*)$"
  RegExMatch(KnownTypes%Language%,Needle,Return)
  Return ReturnValue                                                                                                             
}

;Returns Description of Frame ID or Translates between FrameIDs                                                                                                                        
AG3_FrameIDName(FrameID, Language="ENG"){    ;for ID3 V2.2.0, V2.3.0 and V2.4.0                                                                                            
  static KnownTagsENG :=                                                                                                    
          (LTrim
           ";V2.3 V2.2 Description
             AENC CRA Audio encryption                                 
             APIC PIC Attached picture                                   
             COMM COM Comments                                         
             COMR     Commercial frame                                                      
             ENCR CRM Encryption method registration    ????  ;ToDo: is this identical between 2.2 and 2.3?                       
             EQUA EQU Equalization                                                   
             ETCO ETC Event timing codes                                                                      
             GEOB GEO General encapsulated object                         
             GRID     Group identification registration                   
             IPLS IPL Involved people list                             
             LINK LNK Linked information                                                      
             MCDI MCI Music CD identifier                              
             MLLT MLL MPEG location lookup table                         
             OWNE     Ownership frame                                                      
             PRIV     Private frame                                                
             PCNT CNT Play counter                                                                        
             POPM POP Popularimeter                                        
             POSS     Position synchronisation frame                       
             RBUF BUF Recommended buffer size                                                             
             RVAD RVA Relative volume adjustment                                       
             RVRB REV Reverb                                                                               
             SYLT SLT Synchronized lyric/text                          
             SYTC STC Synchronized tempo codes                         
             TALB TAL Album/Movie/Show title                           
             TBPM TBP BPM (beats per minute)                           
             TCOM TCM Composer                                                                     
             TCON TCO Content type                                          
             TCOP TCR Copyright message                                     
             TDAT TDA Date                                             
             TDLY TDY Playlist delay                                                                 
             TENC TEN Encoded by                                                       
             TEXT TXT Lyricist/Text writer                                          
             TFLT TFT File type                                        
             TIME TIM Time                                             
             TIT1 TT1 Content group description                                                                  
             TIT2 TT2 Title/songname/content description                             
             TIT3 TT3 Subtitle/Description refinement                                  
             TKEY TKE Initial key                                                    
             TLAN TLA Language(s)                                                 
             TLEN TLE Length                                                      
             TMED TMT Media type                                       
             TOAL TOT Original album/movie/show title                                              
             TOFN TOF Original filename                                                                
             TOLY TOL Original lyricist(s)/text writer(s)                          
             TOPE TOA Original artist(s)/performer(s)                                                          
             TORY TOR Original release year                            
             TOWN     File owner/licensee                              
             TPE1 TP1 Lead performer(s)/Soloist(s)                                                       
             TPE2 TP2 Band/orchestra/accompaniment                                                                     
             TPE3 TP3 Conductor/performer refinement                                                                   
             TPE4 TP4 Interpreted, remixed, or otherwise modified by                                        
             TPOS TPA Part of a set                                                 
             TPUB TPB Publisher                                                                  
             TRCK TRK Track number/Position in set                                                        
             TRDA TRD Recording dates                                  
             TRSN     Internet radio station name                      
             TRSO     Internet radio station owner                            
             TSIZ TSI Size                                             
             TSRC TRC ISRC (international standard recording code)                                                          
             TSSE TSS Software/Hardware and settings used for encoding                           
             TYER TYE Year                                             
             TXXX TXX User defined text information frame              
             UFID UFI Unique file identifier                                       
             USER     Terms of use                                         
             USLT ULT Unsychronized lyric/text transcription           
             WCOM WCM Commercial information                           
             WCOP WCP Copyright/Legal information                      
             WOAF WAF Official audio file webpage                      
             WOAR WAR Official artist/performer webpage                
             WOAS WAS Official audio source webpage                    
             WORS     Official internet radio station homepage         
             WPAY     Payment                                          
             WPUB WPB Publishers official webpage                                  
             WXXX WXX User defined URL link frame
             ;new in 2.4.0              
             TSOA     Album sort order      
             TSOP     Performer sort order  
             TSOT     Title sort order      
             TSST     Set subtitle          
             TDEN     Encoding time         
             TDOR     Original release time 
             TDRC     Recording time        
             TDRL     Release time          
             TDTG     Tagging time          
             TIPL     Involved people list  
             TMCL     Musician credits list 
             TMOO     Mood                  
             SEEK     Seek frame            
             SIGN     Signature frame       
             TPRO     Produced notice       
             ASPI     Audio seek point index"                                 
          )                                                                                                                                       
  static KnownTagsDEU :=                                                                                                    
          (LTrim
           ";V2.3 V2.2 Description
             AENC CRA Audio Verschlüsselung                                 
             APIC PIC Angefügtes Bild                                   
             COMM COM Kommentare                                         
             COMR     Kommerzieller Frame                                                      
             ENCR CRM Verschlüsselungs Method                      
             EQUA EQU Equalization                                                   
             ETCO ETC Event timing codes                                                                      
             GEOB GEO General encapsulated object                         
             GRID     Group identification registration                   
             IPLS IPL Liste involvierter Menschen                             
             LINK LNK Verknüpfte Information                                                      
             MCDI MCI Musik CD Identifikator                              
             MLLT MLL MPEG location lookup table                         
             OWNE     Eigentumsframe                                                      
             PRIV     Privater Frame                                                
             PCNT CNT Abspielzähler                                                                        
             POPM POP Beliebtheitsmeter                                        
             POSS     Position synchronisation frame                       
             RBUF BUF Empfohlene Buffergröße                                                             
             RVAD RVA Relative Lautstärkenanpassung                                       
             RVRB REV Hall                                                                               
             SYLT SLT Synchronisierter Liedtext                          
             SYTC STC Synchronized tempo codes                         
             TALB TAL Album-/Film-/Showtitel                           
             TBPM TBP BPM (Schläge pro Minute)                           
             TCOM TCM Komponist                                                                     
             TCON TCO Inhaltstyp                                          
             TCOP TCR Urheberrechtsnachricht                                     
             TDAT TDA Datum                                             
             TDLY TDY Abspiellistenverzögerung                                                                 
             TENC TEN Encoded von                                                       
             TEXT TXT Liedtextschreiber                                          
             TFLT TFT Dateityp                                        
             TIME TIM Zeit                                             
             TIT1 TT1 Gruppeninhaltsbeschreibung                                                                  
             TIT2 TT2 Titel/Liedname/Inhaltsbeschreibung                             
             TIT3 TT3 Untertitel/Verfeinerte Beschreibung                                  
             TKEY TKE Initialer Notenschlüssel                                                    
             TLAN TLA Sprache(n)                                                 
             TLEN TLE Länge                                                      
             TMED TMT Medientyp                                       
             TOAL TOT Originaler Album-/Film-/Showtitel                                              
             TOFN TOF Originaler Dateiname                                                                
             TOLY TOL Originale(r) Liedtextschreiber                          
             TOPE TOA Originale(r) Künstler/Darsteller                                                          
             TORY TOR Originales Veröffentlichungsjahr                            
             TOWN     Dateibesitzer/Lizenz                              
             TPE1 TP1 Hauptdarsteller/Soloist(en)                                                       
             TPE2 TP2 Band/Orchester/Begleitung                                                                     
             TPE3 TP3 Dirigent/Verfeinerte Darsteller                                                                   
             TPE4 TP4 Interpretiert, remixed, oder anderart modifiziert von                                        
             TPOS TPA Teil eines Sets                                                 
             TPUB TPB Verlag                                                                  
             TRCK TRK Titelnumber/Position im Set                                                        
             TRDA TRD Aufnahmedatum                                  
             TRSN     Internetradiostationsname                      
             TRSO     Internetradiostationsbesitzer                            
             TSIZ TSI Größe                                             
             TSRC TRC ISRC (international standard recording code)                                                          
             TSSE TSS Software/Hardware und benutzte Einstellungen für das Encoding                           
             TYER TYE Jahr                                             
             TXXX TXX Benutzer definierter Textinformationsframe              
             UFID UFI Einzigartiger Dateiidentifikator                                       
             USER     Nutzungsbedingungen                                         
             USLT ULT Unsychronisierte Liedtextübersetzung           
             WCOM WCM Kommerzielle Information                           
             WCOP WCP Urheberrecht/Impressum                     
             WOAF WAF Offizielle Audiodatei Webpage                      
             WOAR WAR Offizielle Künstler/Darsteller Webpage                
             WOAS WAS Offizielle Audioquellen Webpage                    
             WORS     Offizielle Internetradiostationshomepage         
             WPAY     Bezahlung                                          
             WPUB WPB Offizielle Verlagswebpage                                  
             WXXX WXX Benutzerdefinierter URL Frame
             ;new in 2.4.0              
             TSOA     Album Sortierreihenfolge      
             TSOP     Darsteller Sortierreihenfolge  
             TSOT     Titel Sortierreihenfolge      
             TSST     Setuntertitel          
             TDEN     Encodingdatum         
             TDOR     Originale Veröffentlichung 
             TDRC     Aufnahmedatum        
             TDRL     Veröffentlichungsdatum          
             TDTG     Tagging Datum          
             TIPL     Liste involvierter Menschen  
             TMCL     Liste mitwirkender Musiker 
             TMOO     Stimmung                  
             SEEK     Seek frame            
             SIGN     Signaturenframe       
             TPRO     Produktionsnotiz       
             ASPI     Audio seek point index"                                 
          )                                                                                                                                       
  If (StrLen(FrameID) = 4)
    Needle := "mS`n)^" FrameID " .{3} (?P<Value>.*)$"
  Else
    Needle := "mS`n)^.{4} " FrameID " (?P<Value>.*)$"
  RegExMatch(KnownTags%Language%,Needle,Return)                                                                                 
  Return ReturnValue                                                                                                             
}                                                                                                                         

AG3(Func, FrameIDOrStringOrIndex="", StringOrIndex=""){
  static WithFrame := "MP4SetTextFrameW,WAVSetTextFrameW,MP4GetTextFrameW,WAVGetTextFrameW"
  static WithIndex :=
    (Ltrim Join,
      "ID3V1GetGenreItemW,ID3V1SetGenreIDW,ID3V2GetUserTextDescriptionW
      ID3V2GetLinkedInformationFrameIdentifierW,ID3V2GetUserFrameLanguageW
      ID3V2GetUserTextW,ID3V2GetPrivateFrameURLW,ID3V2GetRelativeVolumeAdjustmentIdentifierW
      ID3V2GetUserFrameW,ID3V2GetUserURLDescriptionW,ID3V2GetUserURLW
      ID3V2GetEqualisationIdentificationW,ID3V2GetAudioEncryptionPreviewStartW
      ID3V2GetGroupIdentificationURLW,ID3V2GetLinkedInformationAdditionalDataW
      ID3V2GetLinkedInformationURLW,ID3V2GetGeneralObjectMimeW,ID3V2GetCommercialFrameSellerNameW
      ID3V2GetGeneralObjectDescriptionW,ID3V2GetGeneralObjectFilenameW
      ID3V2GetCommercialFramePriceW,ID3V2GetCommercialFrameValidUntilW
      ID3V2GetEncryptionURLW,ID3V2GetSyncLyricContentTypeW,ID3V2GetAudioEncryptionPreviewLengthW
      ID3V2GetSignatureFrameGroupSymbolW,ID3V2GetSyncLyricTimeFormatW,ID3V2GetCommercialFramePictureMimeW
      ID3V2GetCommercialFrameContactURLW,ID3V2GetAudioEncryptionURLW
      ID3V2GetCommercialFrameDescriptionW,ID3V2GetSyncLyricDescriptionW
      ID3V2GetSyncLyricLanguageW,ID3V2GetGroupIdentificationSymbolW,WMADeletePictureW
      ID3V2GetSyncLyricW,ID3V2GetUniqueFileIdentifierOwnerW,ID3V2GetEqualisationInterpolationW
      ID3V2GetEqualisationAdjustmentBitsW,ID3V2GetEncryptionSymbolW
      ID3V2GetCommercialFrameReceivedAsW"
    ) 
  static WithString :=
    (Ltrim Join,
      "APESetAlbumW,APESetArtistW,APESetTrackW,APESetYearW,ID3V1SetYearW,APESetCopyrightW
      APESetCommentW,ID3V1SetArtistW,FLACSetOrganizationW,FLACSetVendorW,FLACSetLocationW
      APESetTitleW,APESetGenreW,ID3V1SetAlbumW,FLACSetPerformerW,ID3V1SetGenreW
      WMASetBeatsPerMinuteW,WMASetAlbumW,WMASetAuthorURLW,WMASetArtistW,OGGSetISRCW
      WMASetCategoryW,WMASetAlbumArtistW,WMASetCommentW,ID3V1SetTrackW,ID3V1SetTitleW
      WMASetPartOfSetW,WMASetParentalRatingW,LYRICSSetAuthorW,WMASetPeriodW
      WMASetPublisherW,WMASetTitleW,WMASetProducerW,WMASetRatingW,WMASetToolVersionW
      WMASetYearW,WMASetTrackNumberW,ID3V2SetGenreW,WMASetWriterW,LYRICSSetArtistW
      LYRICSSetAlbumW,WMASetUserWebURLW,WMASetToolNameW,FLACSetCopyrightW,FLACSetContactW
      FLACSetAlbumW,FLACSetCommentW,FLACSetTitleW,FLACSetVersionW,FLACSetLicenseW
      FLACSetTrackW,FLACSetDateW,ID3V1SetCommentW,WMASetProviderW,WMASetPromotionURLW
      FLACSetGenreW,FLACSetArtistW,FLACSetDescriptionW,FLACSetISRCW,OGGSetGenreW
      OGGSetCommentW,OGGSetArtistW,OGGSetDateW,WMASetLanguageW,LYRICSSetIndicationW
      LYRICSSetInformationW,WMASetContentGroupDescriptionW,OGGSetVendorW,OGGSetTrackW
      WMASetConductorW,OGGSetVersionW,WMASetMoodW,OGGSetCopyrightW,WMASetLyricsW
      LYRICSSetGenreW,LYRICSSetImageLinkW,WMASetEncodedByW,WMASetEncodingSettingsW
      WMASetEncodingTimeW,WMASetComposerW,WMASetInitialKeyW,WMASetISRCW,WMASetGenreW
      OGGSetTitleW,OGGSetAlbumW,WMASetCopyrightW,MP4SetGenreW,MP4SetTrackW
      OGGSetPerformerW,OGGSetOrganizationW,OGGSetDescriptionW,OGGSetLocationW
      OGGSetLicenseW,OggSetContactW,WMASetDistributorW,LYRICSSetTitleW,LYRICSSetLyricsW
      OGGGetUserItemW,FLACGetUserItemW,WMAGetUserItemW,SetPopupKeyW,APEGetUserItemW
      ID3V2GetChapterEndTimeW,ID3V2GetAddendumTypeW,ID3V2GetTOCIsOrderedW
      ID3V2GetChapterStartTimeW,ID3V2GetAddendumTitleW,ID3V2GetSubFramesW
      ID3V2GetAddendumDescriptionW,ID3V2GetChildElementsW,GetMD5ValueFromFileW,ID3V2ImportCueFileW"    
    )
  static WithoutParam :=
    (Ltrim Join,
      "ID3V2GetSynchronizedTempoFormatW,ID3V2GetReverbFeedbackRightToRightW
      ID3V2GetReverbLeftW,ID3V2GetReverbPremixLeftToRightW,ID3V2GetReverbFeedbackLeftToRightW
      ID3V2GetReverbFeedbackRightToLeftW,ID3V2GetReverbBouncesRightW
      ID3V2GetPositionSynchronisationTimestampFormatW,ID3V2GetRecommendedBufferSizeFlagW
      ID3V2GetReverbBouncesLeftW,ID3V2GetEventTimingCodesTimestampFormatW,WMAGetDistributorW
      WMAGetEncodedByW,WMAGetContentGroupDescriptionW,WMAGetISRCW,WMAGetProducerW
      WMAGetParentalRatingW,WMAGetPartOfSetW,WMAGetEncodingTimeW,ID3V2GetReverbPremixRightToLeftW
      ID3V2GetReverbRightW,WMAGetEncodingSettingsW,WMAGetCopyrightW,WMAGetGenreW
      WMAGetInitialKeyW,MONKEYGetSamplesW,MPEGIsOriginalW,MPEGIsPaddingW,MPEGIsPrivateW
      MPEGIsCopyrightedW,MPEGGetFramePositionW,MPEGGetFrameSizeW,LYRICSGetStartPositionW
      MPPGetFramesW,MONKEYGetFramesW,MONKEYGetSamplesPerFrameW,MPEGGetFramesW
      MPPGetStreamVersionW,MPEGIsVBRW,ID3V2GetReverbFeedbackLeftToLeftW,MONKEYGetBitsW
      WAVGetFormatIDW,MPEGIsProtectedW,WMAGetPeriodW,ID3V2GetAudioSeekPointNumberW
      FLACGetSamplesW,ID3V2GetAudioSeekPointBitsPerIndexpointW,ID3V2GetAudioSeekPointLengthW
      WMAGetUserWebURLW,WMAGetToolNameW,WMAGetToolVersionW,FLACGetMinFrameSizeW
      ID3V2GetMpegLocationLookupTableBytesDeviationW,ID3V2GetMpegLocationLookupTableBytesW
      ID3V2GetMpegLocationLookupTableFramesW,ID3V2GetAudioSeekPointStartW,MONKEYGetPeakW
      FLACGetCompressionRatioW,MONKEYGetCompressionRatioW,WMAGetYearW,WMAGetProviderW
      WMAGetPublisherW,WMAGetTrackNumberW,WMAGetTitleW,APEGetSizeW,WMAGetWriterW
      WMAGetRatingW,OGGGetLocationW,OGGGetOrganizationW,OGGGetVersionW,OGGGetTitleW
      WMAGetCommentW,WMAGetAlbumArtistW,OGGGetPerformerW,WMAGetMoodW,WMAGetItemKeysW
      WMAGetLanguageW,WMAGetLyricsW,WAVGetFormatW,OGGGetTrackW,OGGGetVendorW
      FLACGetBitsPerSampleW,FLACGetMaxBlockSizeW,WMAGetPromotionURLW,FLACGetMinBlockSizeW
      FLACGetMaxFrameSizeW,WMAGetComposerW,WMAGetConductorW,WMAGetCategoryW,WMAGetArtistW
      WMAGetAuthorURLW,WMAGetBeatsPerMinuteW,WMAGetAlbumW,ID3V2GetPositionSynchronisationValueW
      LYRICSGetTitleW,LYRICSGetLyricsW,LYRICSGetVersionW,OGGGetCopyrightW,OGGGetGenreW
      OGGGetDateW,OggGetContactW,MP4GetGenreW,MPEGGetEmphasisW,MP4GetTrackW,MPEGGetEncoderW
      OGGGetISRCW,MONKEYGetCompressionW,AACGetHeaderTypeW,FLACGetGenreW,FLACGetISRCW
      FLACGetLocationW,AACGetBitRateTypeW,FLACGetItemKeysW,FLACGetLicenseW,FLACGetPerformerW
      OGGGetDescriptionW,FLACGetOrganizationW,FLACGetTrackW,FLACGetVendorW,FLACGetTitleW
      LYRICSGetAuthorW,LYRICSGetArtistW,LYRICSGetGenreW,APEGetCommentW,APEGetYearW
      APEGetTrackW,APEGetVersionW,LYRICSGetAlbumW,ID3V2GetVersionW,APEGetArtistW
      LYRICSGetIndicationW,LYRICSGetImageLinkW,APEGetAlbumW,MPEGGetLayerW,MPEGGetVersionW
      LYRICSGetInformationW,OGGGetAlbumW,AACGetProfileW,OGGGetArtistW,OGGGetCommentW
      APEGetCopyrightW,ID3V2GetTOCRootIDW,OGGGetItemKeysW,OGGGetLicenseW,APEGetItemKeysW
      APEGetTitleW,APEGetGenreW,ID3V1GetTitleW,OGGGetBitRateNominalW,WAVGetBitsPerSampleW
      WAVGetBytesPerSecondW,ID3V1GetGenresW,WAVGetBlockAlignW,FLACGetAlbumW
      ID3V2GetOwnershipDateW,ID3V2GetOwnershipSellerW,WAVGetChannelsW,WAVGetHeaderSizeW
      LYRICSGetSizeW,ID3V2GetRecommendedBufferSizeValueW,ID3V2GetSeekOffsetW,ID3V2GetSizeW
      ID3V2GetRecommendedBufferSizeOffsetW,ID3V2GetMpegLocationLookupTableMillisecondsW
      ID3V1GetGenreIDW,ID3V2GetGenreW,ID3V1GetArtistW,ID3V1GetCommentW,WMADeletePicturesW
      ID3V2GetPossibleCHAPIDW,ID3V1GetVersionW,ID3V1GetYearW,ID3V1GetTrackW,ID3V1GetGenreW
      ID3V1GetAlbumW,FLACGetVersionW,GetAudioGenieVersionW,FLACGetCopyrightW,FLACGetCommentW
      FLACGetContactW,FLACGetDescriptionW,ID3V2GetOwnershipPriceW,FLACGetArtistW
      FLACGetDateW,ID3V2GetPossibleTOCIDW,AUDIOGetLastErrorNumberW,AUDIOGetSampleRateW
      AUDIOGetBitrateW,AUDIOGetChannelsW,AUDIOGetDurationW,AUDIOGetDurationMillisW
      AUDIOGetFileSizeW,AUDIOIsValidFormatW,AUDIOGetMD5ValueW,AUDIOGetVersionW
      AUDIOGetChannelModeW,AUDIOGetLastErrorTextW,AUDIOGetLastFileW
      ID3V2GetMpegLocationLookupTableMillisecondsDeviationW"
    )
  If Func in WithoutParam
    Return DllCall("AudioGenie3\" Func,"Str")
  Else If Func in WithIndex
    Return DllCall("AudioGenie3\" Func, Short,FrameIDOrStringOrIndex,"Str")
  Else If Func in WithString
  {
    Return DllCall("AudioGenie3\" Func, Str,String,"Str")
  }
  Else If Func in WithFrame
  {
    FrameIDH := "0x" . AscToHex(FrameIDOrStringOrIndex)
    If InStr(Func, "Set"){
      Return DllCall("AudioGenie3\" Func, Int,FrameIDH , Str,String,"Str")
    }Else If InStr(Func, "Sel") 
      Return DllCall("AudioGenie3\" Func, Int,FrameIDH , Short,StringOrIndex)
    Else
      Return DllCall("AudioGenie3\" Func, Int,FrameIDH ,"Str")
  }Else
    Return -1, ErrorLevel := "Not yet supported AudioGenie Function"
}

;WithFrame
; MP4SetTextFrameW          (u32 FrameID, LPCWSTR textString)
; WAVSetTextFrameW          (u32 FrameID, LPCWSTR textString)
; MP4GetTextFrameW          (u32 FrameID)
; WAVGetTextFrameW          (u32 FrameID)

;WithIndex
; ID3V1GetGenreItemW                          (short number)
; ID3V1SetGenreIDW                            (short nNewValue)
; ID3V2GetUserTextDescriptionW                (short Index)
; ID3V2GetLinkedInformationFrameIdentifierW   (short Index)
; ID3V2GetUserFrameLanguageW                  (short Index)
; ID3V2GetUserTextW                           (short Index)
; ID3V2GetPrivateFrameURLW                    (short Index)
; ID3V2GetRelativeVolumeAdjustmentIdentifierW (short Index)
; ID3V2GetUserFrameW                          (short Index)
; ID3V2GetUserURLDescriptionW                 (short Index)
; ID3V2GetUserURLW                            (short Index)
; ID3V2GetEqualisationIdentificationW         (short Index)
; ID3V2GetGroupIdentificationURLW             (short Index)
; ID3V2GetLinkedInformationAdditionalDataW    (short Index)
; ID3V2GetLinkedInformationURLW               (short Index)
; ID3V2GetGeneralObjectMimeW                  (short Index)
; ID3V2GetCommercialFrameSellerNameW          (short Index)
; ID3V2GetGeneralObjectDescriptionW           (short Index)
; ID3V2GetGeneralObjectFilenameW              (short Index)
; ID3V2GetCommercialFramePriceW               (short Index)
; ID3V2GetCommercialFrameValidUntilW          (short Index)
; ID3V2GetEncryptionURLW                      (short Index)
; ID3V2GetSyncLyricContentTypeW               (short Index)
; ID3V2GetAudioEncryptionPreviewLengthW       (short Index)
; ID3V2GetSignatureFrameGroupSymbolW          (short Index)
; ID3V2GetSyncLyricTimeFormatW                (short Index)
; ID3V2GetCommercialFramePictureMimeW         (short Index)
; ID3V2GetCommercialFrameContactURLW          (short Index)
; ID3V2GetAudioEncryptionURLW                 (short Index)
; ID3V2GetCommercialFrameDescriptionW         (short Index)
; ID3V2GetSyncLyricDescriptionW               (short Index)
; ID3V2GetSyncLyricLanguageW                  (short Index)
; ID3V2GetGroupIdentificationSymbolW          (short Index)
; ID3V2GetSyncLyricW                          (short Index)
; ID3V2GetUniqueFileIdentifierOwnerW          (short Index)
; ID3V2GetEqualisationInterpolationW          (short Index)
; ID3V2GetEqualisationAdjustmentBitsW         (short Index)
; ID3V2GetEncryptionSymbolW                   (short Index)
; ID3V2GetCommercialFrameReceivedAsW          (short Index)
; ID3V2GetAudioEncryptionPreviewStartW        (short Index)
; WMADeletePictureW                           (short Index)

;WithString
; APESetAlbumW                   (LPCWSTR textString)
; APESetArtistW                  (LPCWSTR textString)
; APESetTrackW                   (LPCWSTR textString)
; APESetYearW                    (LPCWSTR textString)
; ID3V1SetYearW                  (LPCWSTR textString)
; APESetCopyrightW               (LPCWSTR textString)
; APESetCommentW                 (LPCWSTR textString)
; ID3V1SetArtistW                (LPCWSTR textString)
; FLACSetOrganizationW           (LPCWSTR textString)
; FLACSetVendorW                 (LPCWSTR textString)
; FLACSetLocationW               (LPCWSTR textString)
; APESetTitleW                   (LPCWSTR textString)
; APESetGenreW                   (LPCWSTR textString)
; ID3V1SetAlbumW                 (LPCWSTR textString)
; FLACSetPerformerW              (LPCWSTR textString)
; ID3V1SetGenreW                 (LPCWSTR textString)
; WMASetBeatsPerMinuteW          (LPCWSTR textString)
; WMASetAlbumW                   (LPCWSTR textString)
; WMASetAuthorURLW               (LPCWSTR textString)
; WMASetArtistW                  (LPCWSTR textString)
; OGGSetISRCW                    (LPCWSTR textString)
; WMASetCategoryW                (LPCWSTR textString)
; WMASetAlbumArtistW             (LPCWSTR textString)
; WMASetCommentW                 (LPCWSTR textString)
; ID3V1SetTrackW                 (LPCWSTR textString)
; ID3V1SetTitleW                 (LPCWSTR textString)
; WMASetPartOfSetW               (LPCWSTR textString)
; WMASetParentalRatingW          (LPCWSTR textString)
; LYRICSSetAuthorW               (LPCWSTR textString)
; WMASetPeriodW                  (LPCWSTR textString)
; WMASetPublisherW               (LPCWSTR textString)
; WMASetTitleW                   (LPCWSTR textString)
; WMASetProducerW                (LPCWSTR textString)
; WMASetRatingW                  (LPCWSTR textString)
; WMASetToolVersionW             (LPCWSTR textString)
; WMASetYearW                    (LPCWSTR textString)
; WMASetTrackNumberW             (LPCWSTR textString)
; ID3V2SetGenreW                 (LPCWSTR textString)
; WMASetWriterW                  (LPCWSTR textString)
; LYRICSSetArtistW               (LPCWSTR textString)
; LYRICSSetAlbumW                (LPCWSTR textString)
; WMASetUserWebURLW              (LPCWSTR textString)
; WMASetToolNameW                (LPCWSTR textString)
; FLACSetCopyrightW              (LPCWSTR textString)
; FLACSetContactW                (LPCWSTR textString)
; FLACSetAlbumW                  (LPCWSTR textString)
; FLACSetCommentW                (LPCWSTR textString)
; FLACSetTitleW                  (LPCWSTR textString)
; FLACSetVersionW                (LPCWSTR textString)
; FLACSetLicenseW                (LPCWSTR textString)
; FLACSetTrackW                  (LPCWSTR textString)
; FLACSetDateW                   (LPCWSTR textString)
; ID3V1SetCommentW               (LPCWSTR textString)
; WMASetProviderW                (LPCWSTR textString)
; WMASetPromotionURLW            (LPCWSTR textString)
; FLACSetGenreW                  (LPCWSTR textString)
; FLACSetArtistW                 (LPCWSTR textString)
; FLACSetDescriptionW            (LPCWSTR textString)
; FLACSetISRCW                   (LPCWSTR textString)
; OGGSetGenreW                   (LPCWSTR textString)
; OGGSetCommentW                 (LPCWSTR textString)
; OGGSetArtistW                  (LPCWSTR textString)
; OGGSetDateW                    (LPCWSTR textString)
; WMASetLanguageW                (LPCWSTR textString)
; LYRICSSetIndicationW           (LPCWSTR textString)
; LYRICSSetInformationW          (LPCWSTR textString)
; WMASetContentGroupDescriptionW (LPCWSTR textString)
; OGGSetVendorW                  (LPCWSTR textString)
; OGGSetTrackW                   (LPCWSTR textString)
; WMASetConductorW               (LPCWSTR textString)
; OGGSetVersionW                 (LPCWSTR textString)
; WMASetMoodW                    (LPCWSTR textString)
; OGGSetCopyrightW               (LPCWSTR textString)
; WMASetLyricsW                  (LPCWSTR textString)
; LYRICSSetGenreW                (LPCWSTR textString)
; LYRICSSetImageLinkW            (LPCWSTR textString)
; WMASetEncodedByW               (LPCWSTR textString)
; WMASetEncodingSettingsW        (LPCWSTR textString)
; WMASetEncodingTimeW            (LPCWSTR textString)
; WMASetComposerW                (LPCWSTR textString)
; WMASetInitialKeyW              (LPCWSTR textString)
; WMASetISRCW                    (LPCWSTR textString)
; WMASetGenreW                   (LPCWSTR textString)
; OGGSetTitleW                   (LPCWSTR textString)
; OGGSetAlbumW                   (LPCWSTR textString)
; WMASetCopyrightW               (LPCWSTR textString)
; MP4SetGenreW                   (LPCWSTR textString)
; MP4SetTrackW                   (LPCWSTR textString)
; OGGSetPerformerW               (LPCWSTR textString)
; OGGSetOrganizationW            (LPCWSTR textString)
; OGGSetDescriptionW             (LPCWSTR textString)
; OGGSetLocationW                (LPCWSTR textString)
; OGGSetLicenseW                 (LPCWSTR textString)
; OggSetContactW                 (LPCWSTR textString)
; WMASetDistributorW             (LPCWSTR textString)
; LYRICSSetTitleW                (LPCWSTR textString)
; LYRICSSetLyricsW               (LPCWSTR textString)
; OGGGetUserItemW                (LPCWSTR ItemKey)
; FLACGetUserItemW               (LPCWSTR ItemKey)
; WMAGetUserItemW                (LPCWSTR ItemKey)
; SetPopupKeyW                   (LPCWSTR keyValue)
; APEGetUserItemW                (LPCWSTR Key)
; ID3V2GetChapterEndTimeW        (LPCWSTR ID)
; ID3V2GetAddendumTypeW          (LPCWSTR ID)
; ID3V2GetTOCIsOrderedW          (LPCWSTR ID)
; ID3V2GetChapterStartTimeW      (LPCWSTR ID)
; ID3V2GetAddendumTitleW         (LPCWSTR ID)
; ID3V2DeleteAddendumW           (LPCWSTR ID)
; ID3V2GetSubFramesW             (LPCWSTR ID)
; ID3V2GetAddendumDescriptionW   (LPCWSTR ID)
; ID3V2GetChildElementsW         (LPCWSTR ID)
; GetMD5ValueFromFileW           (LPCWSTR FileName)
; ID3V2ImportCueFileW            (LPCWSTR FileName)
                              
;WithoutParam                              
; ID3V2GetSynchronizedTempoFormatW                ()
; ID3V2GetReverbFeedbackRightToRightW             ()
; ID3V2GetReverbLeftW                             ()
; ID3V2GetReverbPremixLeftToRightW                ()
; ID3V2GetReverbFeedbackLeftToRightW              ()
; ID3V2GetReverbFeedbackRightToLeftW              ()
; ID3V2GetReverbBouncesRightW                     ()
; ID3V2GetPositionSynchronisationTimestampFormatW ()
; ID3V2GetRecommendedBufferSizeFlagW              ()
; ID3V2GetReverbBouncesLeftW                      ()
; ID3V2GetEventTimingCodesTimestampFormatW        ()
; WMAGetDistributorW                              ()
; WMAGetEncodedByW                                ()
; WMAGetContentGroupDescriptionW                  ()
; WMAGetISRCW                                     ()
; WMAGetProducerW                                 ()
; WMAGetParentalRatingW                           ()
; WMAGetPartOfSetW                                ()
; WMAGetEncodingTimeW                             ()
; ID3V2GetReverbPremixRightToLeftW                ()
; ID3V2GetReverbRightW                            ()
; WMAGetEncodingSettingsW                         ()
; WMAGetCopyrightW                                ()
; WMAGetGenreW                                    ()
; WMAGetInitialKeyW                               ()
; MONKEYGetSamplesW                               ()
; MPEGIsOriginalW                                 ()
; MPEGIsPaddingW                                  ()
; MPEGIsPrivateW                                  ()
; MPEGIsCopyrightedW                              ()
; MPEGGetFramePositionW                           ()
; MPEGGetFrameSizeW                               ()
; LYRICSGetStartPositionW                         ()
; MPPGetFramesW                                   ()
; MONKEYGetFramesW                                ()
; MONKEYGetSamplesPerFrameW                       ()
; MPEGGetFramesW                                  ()
; MPPGetStreamVersionW                            ()
; MPEGIsVBRW                                      ()
; ID3V2GetReverbFeedbackLeftToLeftW               ()
; MONKEYGetBitsW                                  ()
; WAVGetFormatIDW                                 ()
; MPEGIsProtectedW                                ()
; WMAGetPeriodW                                   ()
; ID3V2GetAudioSeekPointNumberW                   ()
; FLACGetSamplesW                                 ()
; ID3V2GetAudioSeekPointBitsPerIndexpointW        ()
; ID3V2GetAudioSeekPointLengthW                   ()
; WMAGetUserWebURLW                               ()
; WMAGetToolNameW                                 ()
; WMAGetToolVersionW                              ()
; FLACGetMinFrameSizeW                            ()
; ID3V2GetMpegLocationLookupTableBytesDeviationW  ()
; ID3V2GetMpegLocationLookupTableBytesW           ()
; ID3V2GetMpegLocationLookupTableFramesW          ()
; ID3V2GetAudioSeekPointStartW                    ()
; MONKEYGetPeakW                                  ()
; FLACGetCompressionRatioW                        ()
; MONKEYGetCompressionRatioW                      ()
; WMAGetYearW                                     ()
; WMAGetProviderW                                 ()
; WMAGetPublisherW                                ()
; WMAGetTrackNumberW                              ()
; WMAGetTitleW                                    ()
; APEGetSizeW                                     ()
; WMAGetWriterW                                   ()
; WMAGetRatingW                                   ()
; OGGGetLocationW                                 ()
; OGGGetOrganizationW                             ()
; OGGGetVersionW                                  ()
; OGGGetTitleW                                    ()
; WMAGetCommentW                                  ()
; WMAGetAlbumArtistW                              ()
; OGGGetPerformerW                                ()
; WMAGetMoodW                                     ()
; WMAGetItemKeysW                                 ()
; WMAGetLanguageW                                 ()
; WMAGetLyricsW                                   ()
; WAVGetFormatW                                   ()
; OGGGetTrackW                                    ()
; OGGGetVendorW                                   ()
; FLACGetBitsPerSampleW                           ()
; FLACGetMaxBlockSizeW                            ()
; WMAGetPromotionURLW                             ()
; FLACGetMinBlockSizeW                            ()
; FLACGetMaxFrameSizeW                            ()
; WMAGetComposerW                                 ()
; WMAGetConductorW                                ()
; WMAGetCategoryW                                 ()
; WMAGetArtistW                                   ()
; WMAGetAuthorURLW                                ()
; WMAGetBeatsPerMinuteW                           ()
; WMAGetAlbumW                                    ()
; ID3V2GetPositionSynchronisationValueW           ()
; LYRICSGetTitleW                                 ()
; LYRICSGetLyricsW                                ()
; LYRICSGetVersionW                               ()
; OGGGetCopyrightW                                ()
; OGGGetGenreW                                    ()
; OGGGetDateW                                     ()
; OggGetContactW                                  ()
; MP4GetGenreW                                    ()
; MPEGGetEmphasisW                                ()
; MP4GetTrackW                                    ()
; MPEGGetEncoderW                                 ()
; OGGGetISRCW                                     ()
; MONKEYGetCompressionW                           ()
; AACGetHeaderTypeW                               ()
; FLACGetGenreW                                   ()
; FLACGetISRCW                                    ()
; FLACGetLocationW                                ()
; AACGetBitRateTypeW                              ()
; FLACGetItemKeysW                                ()
; FLACGetLicenseW                                 ()
; FLACGetPerformerW                               ()
; OGGGetDescriptionW                              ()
; FLACGetOrganizationW                            ()
; FLACGetTrackW                                   ()
; FLACGetVendorW                                  ()
; FLACGetTitleW                                   ()
; LYRICSGetAuthorW                                ()
; LYRICSGetArtistW                                ()
; LYRICSGetGenreW                                 ()
; APEGetCommentW                                  ()
; APEGetYearW                                     ()
; APEGetTrackW                                    ()
; APEGetVersionW                                  ()
; LYRICSGetAlbumW                                 ()
; ID3V2GetVersionW                                ()
; APEGetArtistW                                   ()
; LYRICSGetIndicationW                            ()
; LYRICSGetImageLinkW                             ()
; APEGetAlbumW                                    ()
; MPEGGetLayerW                                   ()
; MPEGGetVersionW                                 ()
; LYRICSGetInformationW                           ()
; OGGGetAlbumW                                    ()
; AACGetProfileW                                  ()
; OGGGetArtistW                                   ()
; OGGGetCommentW                                  ()
; APEGetCopyrightW                                ()
; ID3V2GetTOCRootIDW                              ()
; OGGGetItemKeysW                                 ()
; OGGGetLicenseW                                  ()
; APEGetItemKeysW                                 ()
; APEGetTitleW                                    ()
; APEGetGenreW                                    ()
; ID3V1GetTitleW                                  ()
; OGGGetBitRateNominalW                           ()
; WAVGetBitsPerSampleW                            ()
; WAVGetBytesPerSecondW                           ()
; ID3V1GetGenresW                                 ()
; WAVGetBlockAlignW                               ()
; FLACGetAlbumW                                   ()
; ID3V2GetOwnershipDateW                          ()
; ID3V2GetOwnershipSellerW                        ()
; WAVGetChannelsW                                 ()
; WAVGetHeaderSizeW                               ()
; LYRICSGetSizeW                                  ()
; ID3V2GetRecommendedBufferSizeValueW             ()
; ID3V2GetSeekOffsetW                             ()
; ID3V2GetSizeW                                   ()
; ID3V2GetRecommendedBufferSizeOffsetW            ()
; ID3V2GetMpegLocationLookupTableMillisecondsW    ()
; ID3V1GetGenreIDW                                ()
; ID3V2GetGenreW                                  ()
; ID3V1GetArtistW                                 ()
; ID3V1GetCommentW                                ()
; ID3V2GetPossibleCHAPIDW                         ()
; ID3V1GetVersionW                                ()
; ID3V1GetYearW                                   ()
; ID3V1GetTrackW                                  ()
; ID3V1GetGenreW                                  ()
; ID3V1GetAlbumW                                  ()
; FLACGetVersionW                                 ()
; GetAudioGenieVersionW                           ()
; FLACGetCopyrightW                               ()
; FLACGetCommentW                                 ()
; FLACGetContactW                                 ()
; FLACGetDescriptionW                             ()
; ID3V2GetOwnershipPriceW                         ()
; FLACGetArtistW                                  ()
; FLACGetDateW                                    ()
; ID3V2GetPossibleTOCIDW                          ()
; AUDIOGetLastErrorNumberW                        ()
; AUDIOGetSampleRateW                             ()
; AUDIOGetBitrateW                                ()
; AUDIOGetChannelsW                               ()
; AUDIOGetDurationW                               ()
; AUDIOGetDurationMillisW                         ()
; AUDIOGetFileSizeW                               ()
; AUDIOIsValidFormatW                             ()
; AUDIOGetMD5ValueW                               ()
; AUDIOGetVersionW                                ()
; AUDIOGetChannelModeW                            ()
; AUDIOGetLastErrorTextW                          ()
; AUDIOGetLastFileW                               ()
; WMADeletePicturesW                              ()


;###############################################################################
;###    General functions
;###############################################################################

; ASCII to Hex
; www.autohotkey.com/forum/viewtopic.php?p=199220#199220
; by Laszlo
AscToHex(S){
  Return S="" ? "":Chr((*&S>>4)+48) Chr((x:=*&S&15)+48+(x>9)*7) AscToHex(SubStr(S,2))
}

      
    
User avatar
rEX
Posts: 25
Joined: 26 Jan 2014, 10:30

Re: [ Music Files Tag Editor written in Autohotkey ]

29 Jul 2014, 12:44

noname wrote: Have you tried it on a fully patched uptodate winXP?I wonder if the latest windows updates are to blame.I only need it for altering the title tags and inserting a cover art so i will just use these code snippets as standalone programs.
Yes i do. I've tested IDTE on XPsp3 update build 5501 .
B/w Microsoft has ended the support for XP. so i am not damn sure whether its final one or not. But it still working f9.

Anyway, By default IDTE saves Unicode data into music files so, there is no need to set IDTE for this (Check Attachment i've just altered the Title and Album of "The Wolves - Ben Howard" song with some unicode characters) .
Attachments
Capture.PNG
it's working without any settings
aka Rajat
User avatar
noname
Posts: 515
Joined: 19 Nov 2013, 09:15

Re: [ Music Files Tag Editor written in Autohotkey ]

29 Jul 2014, 13:47

I tried it again but it always ends up with ????? instead of the title.
Also when i click a file in the listview twice (not a doubleclick but after going to a menu) IDTE crashes.
If i select the Quick tag editing menu i get this error:
Image

So something is not compatible on my system with IDTE.
The created playlist is also not in unicode so i can not use it for the player i have.
I can use your code from your post to set the unicode title and find some more code to set the cover art.(I will take a look at your code for it :) )
User avatar
rEX
Posts: 25
Joined: 26 Jan 2014, 10:30

Re: [ Music Files Tag Editor written in Autohotkey ]

30 Jul 2014, 01:54

noname wrote: So something is not compatible on my system with IDTE.
The created playlist is also not in unicode so i can not use it for the player i have.
I can use your code from your post to set the unicode title and find some more code to set the cover art.(I will take a look at your code for it :) )
Hi noname :P ,
I know it's very frustrating that IDTE is not running well.
But Here's a script i've written for you which might solves your purpose . It's just a minimalistic version of tag editing
with the support of Multiple Cover art and Text Information Editing.
I Hope This Helps. Download the attachments as it contains the script and audiogenie3.dll file.
Let me know if anything goes wrong :) .
Here's the screenshot :-
Capture.PNG
and Here's the Script

Code: Select all

;_____________________________________
; A Very Simple Version Of tag Editor with minimalistic Requirements and interface
; Good Example of Audiogenie 
; Author - Rajat Kosh
; Email - [email protected]
;_______________________________
;Add Gui Element
Gui, Add, Edit, x12 y9 w340 h20 ReadOnly vfile_dir, 
Gui, Add, Button, x252 y39 w100 h20 , Browse
Gui, Add, Text, x12 y69 w40 h30 , Artist
Gui, Add, Text, x12 y99 w40 h30 , Album
Gui, Add, Text, x12 y129 w40 h30 , Track
Gui, Add, Text, x12 y159 w40 h30 , Title
Gui, Add, Text, x12 y189 w40 h30 , Year
Gui, Add, Text, x12 y219 w40 h30 , Genre
Gui, Add, Text, x12 y249 w40 h30 , Comm
Gui, Add, Edit, x52 y69 w290 h20 vArtist, 
Gui, Add, Edit, x52 y99 w290 h20 vAlbum, 
Gui, Add, Edit, x52 y129 w290 h20 vTrack,
Gui, Add, Edit, x52 y159 w290 h20 vTitle, 
Gui, Add, Edit, x52 y189 w290 h20 vYear, 
Gui, Add, Edit, x52 y219 w290 h20 vGenre, 
Gui, Add, Edit, x52 y249 w290 h20 vComments, 
Gui, Add, Button, x142 y389 w100 h30 , Save
Gui, Add, pic, x12 y279 w90 h90 vAlb_art,
Gui, Add, GroupBox, x12 y279 w110 h100 , Album Art
Gui, Add, Button, x132 y289 w110 h20 , Add Album Art
Gui, Add, Button, x132 y319 w110 h20 , Remove Album Art
Gui, Add, Text, x132 y344 w150 h30 vcovertype, 0/0 No Cover

; Multiple cover navigation Symbols
Symbollft := Chr(9664)
Symbolrit := Chr(9654)
; Add them to GUI as Button
Gui, Add, button , x132 y370 w17 h17 vprcov gupdwn ,%Symbollft%	;Up down
Gui, Add, button , x149 y370 w17 h17 vnxcov gupupn ,%Symbolrit%	;Up Next
;Disable them (by default)
GuiControl , disable, prcov
GuiControl , disable, nxcov
;Show the GUI
Gui, Show, w364 h441, Tag
library := DllCall( "LoadLibrary", Str,"AudioGenie3.dll" )
DllCall( "AudioGenie3\AUDIOAnalyzeFileW", Str,Dummy ) ; Dummy Call
return

;################################################   OPEN FILE #################################################
ButtonBrowse: ;Prompt User For Opening the file
FileSelectFile ,ChooseFile, , , Select Your Music File(s) (Do Not Add Video Files for Tagging), All Supported Type (*.mp3;*.mp2;*.mp1;*.ogg;*.oga;*.wav;*.aif;*.aiff;*.aifc;*.flac;*.wma;*.wmv;*.wmp;*.asf;*.aac;*.mp4;*.m4a;*.m4b;*.m4p;*.wv;*.wvc;*.ape;*.mpc;*.mpp;*.mp+;*.ac3;*.spx;*.tta;*.opus;)

if Choosefile=  ; IF no file is selected
	{
		return
	}
reload_same_file: ;Jump here in case of refreshing the data 
GuiControl , , file_dir , %ChooseFile%
loop , %ChooseFile%
{
  DllCall("AudioGenie3.dll\AUDIOAnalyzeFileW", Str,A_LoopFileFullPath )
}  
SplitPath, Choosefile,,, FileExtn  ; Get Extension

;Get Information in Fields According to file type 
if FileExtn in MP3,AAC,MPP,TTA 
{
   Trackinfo :=  DllCall("AudioGenie3\ID3V2GetTextFrameW", uint, 1414677323,wstr) 
   Titleinfo  :=  DllCall("AudioGenie3\ID3V2GetTextFrameW", uint, 1414091826,wstr) 
   Artistinfo :=  DllCall("AudioGenie3\ID3V2GetTextFrameW", uint, 1414546737,wstr) 
   Albuminfo  :=  DllCall("AudioGenie3\ID3V2GetTextFrameW", uint, 1413565506,wstr) 
   Genreinfo  :=  DllCall("AudioGenie3\ID3V2GetTextFrameW", uint, 1413697358,wstr) 
   Yearinfo  :=  DllCall("AudioGenie3\ID3V2GetTextFrameW", uint, 1415136594,wstr)  
   Composerinfo  :=  DllCall("AudioGenie3\ID3V2GetTextFrameW", uint, 1413697357,wstr) 
   Commentinfo  :=  DllCall("AudioGenie3\ID3V2GetTextFrameW", uint, 1129270605,wstr)

} else {
			Artistinfo  :=  DllCall("AudioGenie3\AUDIOGetArtistW",wstr)
			Albuminfo  :=  DllCall("AudioGenie3\AUDIOGetAlbumW",wstr)
			Yearinfo  :=  DllCall("AudioGenie3\AUDIOGetYearW",wstr)
			Genreinfo  :=  DllCall("AudioGenie3\AUDIOGetGenreW",wstr)
			Trackinfo  :=  DllCall("AudioGenie3\AUDIOGetTrackW",wstr)
			Titleinfo  :=  DllCall("AudioGenie3\AUDIOGetTitleW" ,wstr)
			Commentinfo  :=  DllCall("AudioGenie3\AUDIOGetCommentW", wstr)
			Composerinfo :=  DllCall("AudioGenie3\AUDIOGetComposerW",wstr)
		}    

;Set Data into the fields 
GuiControl,, Title, %Titleinfo%
GuiControl,, Artist, %Artistinfo%
GuiControl,, Album, %Albuminfo%
GuiControl,, Year, %Yearinfo%
GuiControl,, Track, %Trackinfo%
GuiControl,, Comments, %Commentinfo%
GuiControl,, Genre, %Genreinfo%

;Check for Cover Art in temp folder, Delete if already exists
IfExist , %A_Temp%\AlbumArt.jpg
FileDelete , %A_Temp%\AlbumArt.jpg
IfExist , %A_Temp%\AlbumArt.png
FileDelete , %A_Temp%\AlbumArt.png

;Retrieve the cover art from the file
;Check all possible cover art and extract them into the temp folder for showing onto GUI

;###########################  MP4   ########################
Mime := DllCall("AudioGenie3\MP4GetPictureMimeW",uint, 01,wstr)
	IfInString , Mime , jpg
		DllCall("AudioGenie3\MP4GetPictureFileW", wstr , A_Temp "\AlbumArt.jpg", uint, 01)
	else 
		DllCall("AudioGenie3\MP4GetPictureFileW", wstr , A_Temp "\AlbumArt.png", uint, 01)

;###########################  FLAC   ########################
Mime := DllCall("AudioGenie3\FLACGetPictureMimeW",uint, 01,wstr)
	IfInString , Mime, jpeg
		DllCall("AudioGenie3\FLACGetPictureFileW", wstr , A_Temp "\AlbumArt.jpg", uint, 01)
	else 
		DllCall("AudioGenie3\FLACGetPictureFileW", wstr , A_Temp "\AlbumArt.png", uint, 01)

;###########################  MP3   ########################
Mime := DllCall("AudioGenie3\ID3V2GetPictureMimeW",uint, 01,wstr)
	IfInString , Mime, jpeg
		DllCall("AudioGenie3\ID3V2GetPictureFileW", wstr , A_Temp "\AlbumArt.jpg", uint, 01)
	else 
		DllCall("AudioGenie3\ID3V2GetPictureFileW", wstr , A_Temp "\AlbumArt.png", uint, 01)

;###########################  WMA   ########################
Mime := DllCall("AudioGenie3\WMAGetPictureMimeW",uint, 01,wstr)
	if(Mime = jpg)
		DllCall("AudioGenie3\WMAGetPictureFileW", wstr , A_Temp "\AlbumArt.jpg", uint, 01)
	else (Mime = png)
		DllCall("AudioGenie3\WMAGetPictureFileW", wstr , A_Temp "\AlbumArt.png", uint, 01)

; Set Extracted Cover Art onto the GUI

IfExist , %A_Temp%\AlbumArt.png 	; Check if PNG
 GuiControl,, Alb_art, *w90 *h90 %A_Temp%\AlbumArt.png
	IfNotExist , %A_Temp%\AlbumArt.png	;If not PNG
	{
		IfExist , %A_Temp%\AlbumArt.jpg	;Check JPG
			GuiControl,, Alb_art, *w90 *h90 %A_Temp%\AlbumArt.jpg
		else	;If not JPG then Set Empty
			GuiControl,, Alb_art, *w90 *h90 empty.png
	}

;Now Check For Cover Description info and Total No. of Covers
; First CHeck For MP3
covertypeinfo:= DllCall("AudioGenie3\ID3V2GetPictureTypeTextW", uint, 1,wstr) 
coverSize:=  DllCall("AudioGenie3\ID3V2GetPictureSizeW", uint, 1) 
PicNum := DllCall("AudioGenie3\ID3V2GetFrameCountW", uint, 1095780675)

if covertypeinfo=	;If Not in MP3
{
;Check in FLAC
Covertypeinfo:=DllCall("AudioGenie3\FLACGetPictureTypeTextW",uint ,01,wstr)
coverSize:=  DllCall("AudioGenie3\FLACGetPictureSizeW", uint, 1) 
Picnum := DllCall("AudioGenie3\FLACGetPictureCountW", uint, 1, uint)
Picnum := Picnum - 9568256

	if covertypeinfo=	;If not in FLAC , check for mp4
		{
			Covertypeinfo= No Description
			coverSize:=  DllCall("AudioGenie3\MP4GetPictureSizeW", uint, 1) 
			Picnum := DllCall("AudioGenie3\MP4GetPictureCountW", uint, 1)

			if coverSize=	;Else check in WMA
				{
					coverSize:=  DllCall("AudioGenie3\WMAGetPictureSizeW", uint, 1) 
					Picnum := DllCall("AudioGenie3\WMAGetPictureCountW", uint, 1)
				}
		}
}
Updown := 1	;Set Value of Current (Default) Cover Art index to 1
;Set information of cover Art
GuiControl, , covertype,%Updown%/%Picnum% %Covertypeinfo% - %coverSize% Bytes


if (Picnum <= 1) ;PicNum = Total Number of Pictures in Tag
	{
		GuiControl , disable, prcov
		GuiControl , disable, nxcov
		if (Picnum < 1)
			{
				Updown := 0
			}
	}else{
			GuiControl , enable, prcov
			GuiControl , enable, nxcov
		}

return

;########################################  Change Album Art ##############################################################

ButtonAddAlbumArt:
Gui +OwnDialogs  ; Forces user to dismiss the following dialog before using main window.
FileSelectFile , CoverFile , 3, , Choose Your Cover Art, Image Files(*.jpg;*.jpeg;*.png;) ; Select Cover File
if CoverFile=	; IF Empty, then return
    return

;Else Set Cover Art according to supproted format type
; Note - A Random no. is required in order to create a unique ID because No two frames of cover Art (Multiple Art)
; 		 Can have the same Description
CoverType = 3 ; Default Index For Front Cover

 Random , uniq , 102 , 345622
if FileExtn in MP3,AAC,MPP,TTA
{
    CoverDes = Added Using IDTE - Id3 Tag Editor [Unique ID = %uniq%]  
	DllCall("AudioGenie3\ID3V2AddPictureFileW",str,Coverfile,str,CoverDes,Uint,CoverType,Int,1)
     errorcode := DllCall("AudioGenie3\AUDIOSaveChangesW") 
}
	else if FileExtn in FLAC
		{
			CoverDes = Added Using IDTE - Id3 Tag Editor [Unique ID = %uniq%]  
			DllCall("AudioGenie3\FLACAddPictureFileW",str,Coverfile,str,CoverDes,Uint,CoverType,Int,1)
			errorcode := DllCall("AudioGenie3\AUDIOSaveChangesW")
		}
			else if FileExtn in MP4,M4A,M4B,M4P
				{
					DllCall("AudioGenie3\MP4AddPictureFileW",str,Coverfile)
					errorcode := DllCall("AudioGenie3\AUDIOSaveChangesW")
				}
					else if FileExtn in WMA,ASF
						{
							CoverDes = Added Using IDTE - Id3 Tag Editor [Unique ID = %uniq%]  
							DllCall("AudioGenie3\WMAAddPictureFileW",str,Coverfile,str,CoverDes,Uint,CoverType,Int,1)
							errorcode := DllCall("AudioGenie3\AUDIOSaveChangesW")
						}

; Check if Added Sucessfully
if(errorcode<>-1)
	MsgBox , An Error is encountered while adding Album Art
	else
		MsgBox , Album Art Added Sucessfully
	;Refresh Changes
gosub , reload_same_file
return

;################################################ REMOVE ALBUM ART #######################################

ButtonRemoveAlbumArt:
    Gui +OwnDialogs  ; Forces user to dismiss the following dialog before using main window.
MsgBox ,36, Wait..,Are You Sure?`n	;Prompt First
	IfMsgBox , No
		return
	
	;Analyze file
loop , %ChooseFile%
{
  DllCall("AudioGenie3.dll\AUDIOAnalyzeFileW", Str,A_LoopFileFullPath )
}  

;Remove Cover According to Supported Type
; Note - Only One Cover at a Time is removed therefore in case of multiple coverarts a repeatedly action 
;        Should be applied.

if FileExtn in MP3,AAC,MPP,TTA
{ 
  DllCall("AudioGenie3\ID3V2DeleteSelectedFrameW",uint,1095780675,uint,Updown)
  errorcode := DllCall("AudioGenie3\AUDIOSaveChangesW") 
}
 else if FileExtn in FLAC
	{
		DllCall("AudioGenie3\FLACDeletePictureW",Uint,Updown)
		errorcode := DllCall("AudioGenie3\AUDIOSaveChangesW")
	}
	else if FileExtn in MP4,M4A,M4B,M4P
		{
			DllCall("AudioGenie3\MP4DeletePictureW",Uint,Updown)
			errorcode := DllCall("AudioGenie3\AUDIOSaveChangesW")
		}
		else if FileExtn in WMA,WMV,WMP,ASF
			{
				DllCall("AudioGenie3\WMADeletePictureW",Uint,Updown)
				errorcode := DllCall("AudioGenie3\AUDIOSaveChangesW")
			}

if(errorcode<>-1)
		MsgBox , 16 , Error , Error Occured While Processing Tag `n%error%
	else
		MsgBox , Album Art Removed Sucessfully

;Refresh Changes
gosub , reload_same_file
return

;#######################################################  Save Tag ###########################################

ButtonSave:
Gui,submit ,NoHide

;Save According to the extension type
if FileExtn in MP3,AAC,MPP,TTA
{
; Set Encoding Information = Unicode
 DllCall("AudioGenie3\ID3V2SetFormatAndEncodingW", uint, 0,uint,1)
; Save Tag 
 Trackinfo :=  DllCall("AudioGenie3\ID3V2SetTextFrameW", uint, 1414677323,wstr,Track) 
   Titleinfo  := DllCall("AudioGenie3\ID3V2SetTextFrameW", uint, 1414091826,wstr,Title) 
   Artistinfo :=  DllCall("AudioGenie3\ID3V2SetTextFrameW", uint, 1414546737,wstr,Artist) 
   Albuminfo  :=  DllCall("AudioGenie3\ID3V2SetTextFrameW", uint, 1413565506,wstr,Album) 
   Genreinfo  :=  DllCall("AudioGenie3\ID3V2SetTextFrameW", uint, 1413697358,wstr,Genre) 
   Yearinfo  :=  DllCall("AudioGenie3\ID3V2SetTextFrameW", uint, 1415136594,wstr,Year) 
   
   ;Get Language and Description of Comment 
   ;Note - there can be multiple Comments frame but with different description.
   lang := DllCall("AudioGenie3\ID3V2GetCommentLanguageW", uint, 1,wstr) 
   Desc := DllCall("AudioGenie3\ID3V2GetCommentDescriptionW", uint, 1,wstr) 
   Commentinfo  := DllCall("AudioGenie3\ID3V2AddCommentW", wstr,lang,wstr,Desc,wstr ,Comments)
   
   ;Get Error info (if any)
   errorcode := DllCall("AudioGenie3\ID3V2SaveChangesW")
	
}else {
        Artistinfo  :=  DllCall("AudioGenie3\AUDIOSetArtistW", wstr ,Artist)
        Albuminfo  :=  DllCall("AudioGenie3\AUDIOSetAlbumW", wstr ,Album)
        Yearinfo  :=  DllCall("AudioGenie3\AUDIOSetYearW", wstr ,Year)
        Genreinfo  :=  DllCall("AudioGenie3\AUDIOSetGenreW", wstr ,Genre)
        Trackinfo  :=  DllCall("AudioGenie3\AUDIOSetTrackW", wstr ,Track)
        Titleinfo  :=  DllCall("AudioGenie3\AUDIOSetTitleW", wstr ,Title)
        Commentinfo  :=  DllCall("AudioGenie3\AUDIOSetCommentW", wstr ,Comments)
         errorcode := DllCall("AudioGenie3\AUDIOSaveChangesW")
	}
	
if(errorcode<>-1)
    MsgBox , 16 , Error , Error Occured While Processing Tags `n%error%
else
    MsgBox, Tag Applied Sucessfully

;Refresh Changes
gosub , reload_same_file
return

;######################## MULTIPLE COVER NAVIGATION #############################
;Updown Variable Stores Current Position of Cover Art
;Viz implemented as follows

upupn:
UpDown+=2	;increment by 2
updwn:
UpDown--	;decrement by 1 => net = 1
if(UpDown<=0) ; if updown is <0 
    UpDown := 1	;Revert back to first cover art in the file
else if (UpDown>=Picnum)  ;else if updown is greater then total number of covers present in file
    UpDown := Picnum ; revert it to actual max. i.e. total no. of covers

;Delete prev cover art (Say cover 1)
FileDelete , %A_Temp%\AlbumArt.png
FileDelete , %A_Temp%\AlbumArt.jpg

;Get Next Picture Info (Say cover 2)
;According to supported tag type

Mime := DllCall("AudioGenie3\MP4GetPictureMimeW",uint, Updown,wstr)
	IfInString , Mime , jpg
		DllCall("AudioGenie3\MP4GetPictureFileW", wstr , A_Temp "\AlbumArt.jpg", uint, Updown)
	else 
		DllCall("AudioGenie3\MP4GetPictureFileW", wstr , A_Temp "\AlbumArt.png", uint, Updown)


Mime := DllCall("AudioGenie3\FLACGetPictureMimeW",uint, Updown,wstr)
	IfInString , Mime, jpeg
		DllCall("AudioGenie3\FLACGetPictureFileW", wstr , A_Temp "\AlbumArt.jpg", uint, Updown)
	else 
		DllCall("AudioGenie3\FLACGetPictureFileW", wstr , A_Temp "\AlbumArt.png", uint, Updown)


Mime := DllCall("AudioGenie3\ID3V2GetPictureMimeW",uint, Updown,wstr)
	IfInString , Mime, jpeg
		DllCall("AudioGenie3\ID3V2GetPictureFileW", wstr , A_Temp "\AlbumArt.jpg", uint, Updown)
	else 
		DllCall("AudioGenie3\ID3V2GetPictureFileW", wstr , A_Temp "\AlbumArt.png", uint, Updown)


Mime := DllCall("AudioGenie3\WMAGetPictureMimeW",uint, Updown,wstr)
	if(Mime = jpg)
		DllCall("AudioGenie3\WMAGetPictureFileW", wstr , A_Temp "\AlbumArt.jpg", uint, Updown)
	else (Mime = png)
		DllCall("AudioGenie3\WMAGetPictureFileW", wstr , A_Temp "\AlbumArt.png", uint, Updown)

; Get Cover type i.e. - front , back etc.
covertypeinfo:=  DllCall("AudioGenie3\ID3V2GetPictureTypeTextW", uint, Updown,wstr) 
;Get its size (in Bytes)
coverSize:=  DllCall("AudioGenie3\ID3V2GetPictureSizeW", uint, Updown) 

;if nothing found then check for other types
if covertypeinfo=
	{
		Covertypeinfo:= DllCall("AudioGenie3\FLACGetPictureTypeTextW",uint ,Updown,wstr)
		coverSize:= DllCall("AudioGenie3\FLACGetPictureSizeW", uint, Updown) 
		if covertypeinfo=
			{
				Covertypeinfo= No Description
				coverSize:= DllCall("AudioGenie3\MP4GetPictureSizeW", uint, Updown) 
				if coverSize=
					{
						coverSize:= DllCall("AudioGenie3\WMAGetPictureSizeW", uint, Updown) 
					}
			}
	}

;Now change the cover Art on the Gui

 IfExist , %A_Temp%\AlbumArt.png
		GuiControl,, Pic, *w240 *h235 %A_Temp%\AlbumArt.png
 IfNotExist , %A_Temp%\AlbumArt.png
	{
		IfExist , %A_Temp%\AlbumArt.jpg
			GuiControl,, Pic, *w90 *h90 %A_Temp%\AlbumArt.jpg
		else
			GuiControl,, Pic , *w90 *h90 empty.png
	}
GuiControl, , covertype,%Updown%/%Picnum% %Covertypeinfo% - %coverSize% Bytes
return


;########################## EXIT #################################
GuiClose:
ExitApp
Attachments
Tag.zip
(227.27 KiB) Downloaded 206 times
aka Rajat

Return to “Scripts and Functions (v1)”

Who is online

Users browsing this forum: chinagreenelvis, gongnl, MrDoge, TheNaviator and 84 guests