Author Topic: Does BASS_StreamCreateFile lock the file?  (Read 1202 times)

3delite

  • Posts: 907
Does BASS_StreamCreateFile lock the file?
« on: 4 Sep '10 - 15:57 »
Hi!

It seems that when creating a channel from a file, afterwards I can not open the file for writing (I am trying to upate the ID3 Tags).
Can somebody confirm this? Does BASS 2.3 (!) lock the file when invoking BASS_StreamCreateFile()?

Made a test app. to confirm this, the code is:

Code: [Select]
procedure TForm1.Button1Click(Sender: TObject);
var
    PlayCount: Integer;
    Error: Integer;
begin
    Tagv2.LoadFromFile(Edit1.Text);
    PlayCount := Tagv2.GetPlayCount('PCNT');
    //* If I comment this line out there's no error
    //Channel := BASS_StreamCreateFile(False, PWideChar(Edit1.Text), 0, 0, BASS_UNICODE);
    Tagv2.SetPlayCount('PCNT', PlayCount + 1);
    Application.ProcessMessages;
    Error := Tagv2.SaveToFile(Edit1.Text);
    Showmessage(IntToStr(Error));
end;

If BASS locks the file, is there any workaround for this situation?

I am asking this becouse I think my app worked before I implemented the new ID3 Tag handling solution and could save the tags while playing the file, but now I got this error.

BTW. the Tag saving function is trying this way:

Code: [Select]
    TagStream := TFileStream.Create(FileName, fmOpenReadWrite {OR fmShareExclusive});

Removing fmShareExclusive doesn't help.

Best regards
3delite

Xire

  • Posts: 274
Re: Does BASS_StreamCreateFile lock the file?
« Reply #1 on: 5 Sep '10 - 13:39 »
Hi,

This works fine:

TagStream := TFileStream.Create(FileName, fmOpenReadWrite or fmShareDenyWrite);

BR
Xire

3delite

  • Posts: 907
Re: Does BASS_StreamCreateFile lock the file?
« Reply #2 on: 5 Sep '10 - 14:14 »
Thanx! That worked!  :D

Really appreciate it!

Best regards
3delite