I am writing an audio player that will have an mp3 editor included and the read mp3 tags works great, how ever I’m having trouble with the write side of things. Here is my write code which populates a set of textfields with name, year artist etc
dim f as FolderItem
dim readMP3 as BinaryStream
dim mb1 as MemoryBlock
dim output, tag, song, artist, album, year, comment,track,s as String
dim genre As integer
'build the memory block by getting text from text fields
mb1 = NewMemoryBlock( 128 )
If mb1 <> Nil Then
mb1.StringValue( 0, 3) = “TAG”
mb1.StringValue( 3, 30 ) = SongTF.text
mb1.StringValue( 33, 30 ) = ArtistTF.text
mb1.StringValue( 63, 30 ) = AlbumTF.text
mb1.StringValue( 93, 4 ) = YearTF.text
mb1.StringValue( 97, 28 ) = CommentTF.text
'mb1.StringValue( 126, 1 ) = ascB(TrackTF.text)
'mb1.StringValue( 127, 1 ) = val(GenreTF.text)
Else
Raise New OutOfMemoryException
End If
'this bit checks that the memory block has been created
s=mb1
TextField2.text=s
'open file - textfield3 contains the file path of the mp3 file
f = GetFolderItem(Textfield3.text)
if f <> nil then
readMP3 = BinaryStream.Open(f,false)
readMP3.Position = (readMP3.Length - 128)
readMP3.Write( mb1 )
readMP3.Close
end if
When I call the write routine I get this error:
An exception of class IOException was not handled. The application must shut down.
Exception Error Number 2