I've given you a lot of bad news, I wanted to give you some good. The programme I mentioned above that worked was a highly stripped down version of the wrapper. I thought that as I wouldn't be able to use your code for attributes, I may as well strip all that code out. Well you know what it is like, I got carried away and all I have left is this;
Private Const TagsLibraryName As String = "TagsLib.dll"
Private Enum TTagType
ttNone
ttAutomatic
ttAPEv2
ttFlac
ttID3v1
ttID3v2
ttMP4
ttOpusVorbis
ttWAV
ttWMA
End Enum
Private Enum TTagPictureFormat
tpfUnknown
tpfJPEG
tpfPNG
tpfBMP
tpfGIF
End Enum
Private Type TTagPriority
Values(0 To 8) As TTagType
End Type
Private Type TCoverArtData
name As Long
data As Long
DataSize As Currency
Description As Long
CoverType As Long
MIMEType As Long
PictureFormat As TTagPictureFormat
Width As Long
Height As Long
ColorDepth As Long
NoOfColors As Long
ID3v2TextEncoding As Long
Index As Long
End Type
Private Enum TAudioType
atAutomatic
atFlac
atMPEG
atDSDDSF
atWAV
atAIFF
atMP4
atOpus
atVorbis
atWMA
End Enum
Private Type TAudioAttributes
Channels As Long ' number of channels (i.e. mono, stereo, etc.)
SamplesPerSec As Long ' sample rate
BitsPerSample As Long ' number of bits per sample of mono data
PlayTime As Double ' duration in seconds
SampleCount As Currency ' number of total samples
bitrate As Long
End Type
Public Type AudioTags
AUDIOAlbum As String
AUDIOArtist As String
AUDIOComment As String
AUDIOGenre As String
AUDIOReplayGain As String
AUDIOTitle As String
AUDIOTrack As Long
AUDIOYear As String
AUDIOGetBitrate As String
AUDIOGetBitDepth As String
AUDIOGetChannels As Long
AUDIOGetFileSize As Long
AUDIOGetDuration As Single
AUDIOGetPicture As StdPicture
AUDIOGetSampleRate As Long
End Type
Public ATags As AudioTags
Private Declare Function TagsLibrary_Create Lib "TagsLib.dll" () As Long
Private Declare Function TagsLibrary_Free Lib "TagsLib.dll" (ByVal Tags As Long) As Long
Private Declare Function TagsLibrary_Load Lib "TagsLib.dll" (ByVal Tags As Long, ByVal FileName As Long, ByVal TagType As TTagType, ByVal ParseTags As Long) As Long
Private Declare Function TagsLibrary_LoadFromBASS Lib "TagsLib.dll" (ByVal Tags As Long, ByVal channel As Long) As Long
Private Declare Function TagsLibrary_Save Lib "TagsLib.dll" (ByVal Tags As Long, ByVal FileName As Long, ByVal TagType As TTagType) As Long
Private Declare Function TagsLibrary_FreeSaveHandle Lib "TagsLib.dll" (ByRef SaveHandle As Long) As Long
Private Declare Function TagsLibrary_RemoveTag Lib "TagsLib.dll" (FileName As Long, ByVal TagType As TTagType) As Long
Private Declare Function TagsLibrary_RemoveTagFromMemory Lib "TagsLib.dll" (ByVal MemoryAddress As Long, ByVal Size As Currency, ByVal TagType As TTagType, ByRef SavedAddress As Long, ByRef SavedSize As Currency, ByRef SaveHandle As Long) As Long
Private Declare Function TagsLibrary_GetTag Lib "TagsLib.dll" (ByVal Tags As Long, ByVal name As Long, ByVal TagType As TTagType) As Long
Private Declare Function TagsLibrary_Loaded Lib "TagsLib.dll" (ByVal Tags As Long, ByVal TagType As TTagType) As Long
Private Declare Function TagsLibrary_SetTag Lib "TagsLib.dll" (ByVal Tags As Long, ByVal name As Long, ByVal Value As Long, ByVal TagType As TTagType) As Long
Private Declare Function TagsLibrary_AddTag Lib "TagsLib.dll" (ByVal Tags As Long, ByVal name As Long, ByVal Value As Long, ByVal TagType As TTagType) As Long
Private Declare Function TagsLibrary_TagCount Lib "TagsLib.dll" (ByVal Tags As Long, ByVal TagType As TTagType) As Long
Private Declare Function TagsLibrary_DeleteTag Lib "TagsLib.dll" (ByVal Tags As Long, ByVal name As Long, ByVal TagType As TTagType) As Long
Private Declare Function TagsLibrary_CoverArtCount Lib "TagsLib.dll" (ByVal Tags As Long, ByVal TagType As TTagType) As Long
Private Declare Function TagsLibrary_GetCoverArt Lib "TagsLib.dll" (ByVal Tags As Long, ByVal TagType As TTagType, ByVal Index As Long, ByRef CoverArt As TCoverArtData) As Long
Private Declare Function TagsLibrary_DeleteCoverArt Lib "TagsLib.dll" (ByVal Tags As Long, ByVal TagType As TTagType, ByVal Index As Long) As Long
Private Declare Function TagsLibrary_SetCoverArt Lib "TagsLib.dll" (ByVal Tags As Long, ByVal TagType As TTagType, ByVal Index As Long, ByRef CoverArt As TCoverArtData) As Long
Private Declare Function TagsLibrary_AddCoverArt Lib "TagsLib.dll" (ByVal Tags As Long, ByVal TagType As TTagType, ByVal CoverArt_Name As Long, ByVal CoverArt_Data As Long, ByVal CoverArt_DataSize As Currency, ByVal CoverArt_Description As Long, ByVal CoverArt_CoverType As Long, ByVal CoverArt_MIMEType As Long, ByVal CoverArt_PictureFormat As TTagPictureFormat, ByVal CoverArt_Width As Long, ByVal CoverArt_Height As Long, ByVal CoverArt_ColorDepth As Long, ByVal CoverArt_NoOfColors As Long, ByVal CoverArt_ID3v2TextEncoding As Long, ByVal CoverArt_Index As Long) As Long
Private Declare Function TagsLibrary_SetTagLoadPriority Lib "TagsLib.dll" (ByVal Tags As Long, ByVal TagPriorities0 As TTagType, ByVal TagPriorities1 As TTagType, ByVal TagPriorities2 As TTagType, ByVal TagPriorities3 As TTagType, ByVal TagPriorities4 As TTagType, ByVal TagPriorities5 As TTagType, ByVal TagPriorities6 As TTagType, ByVal TagPriorities7 As TTagType, ByVal TagPriorities8 As TTagType) As Long
Private Declare Function TagsLibrary_GetConfig Lib "TagsLib.dll" (ByVal Tags As Long, ByVal nOption As Long, ByVal TagType As TTagType) As Long
Private Declare Function TagsLibrary_SetConfig Lib "TagsLib.dll" (ByVal Tags As Long, ByVal Value As Long, ByVal nOption As Long, ByVal TagType As TTagType) As Long
Private Declare Function TagsLibrary_GetVendor Lib "TagsLib.dll" (ByVal Tags As Long, ByVal TagType As TTagType) As Long
Private Declare Function TagsLibrary_SetVendor Lib "TagsLib.dll" (ByVal Tags As Long, ByVal vendor As Long, ByVal TagType As TTagType) As Long
Private Declare Function TagsLibrary_GetAudioAttributes Lib "TagsLib.dll" (ByVal Tags As Long, ByVal AudioType As TAudioType, ByRef Attributes As Long) As Long
'"Reallocates a previously allocated string to be the size of a second string and copies the second string into the reallocated memory."
Private Declare Function SysReAllocString Lib "oleaut32.dll" (ByVal pBSTR As Long, Optional ByVal pszStrPtr As Long) As Long
You won't believe this but it all works now! There are some small errors e.g. SamplesPerSec is actually bitdepth (ie 16). The Bitrate is low by 1 on the very quick test I did on the m4a sample you already have. Calculated it comes to 153.467kbps and you show 152. Bass shows 153. (There are 6,175,176 samples).
Have I left enough in to eventually get the cover art out into a picture box? Could I remove some more?
Kind Regards - Steve.