Author Topic: Long time regular play, failure after automatic lock screen, relogin successful  (Read 207 times)

dreamnyj

  • Posts: 6
I have been using bass.dll program for a long time. The MP3 file in the list will be broadcast at regular intervals, but the problem now is that windows auto locked will fail after a certain period of time. After the re - landing, it can be broadcast normally. I want to know if I guess wrong or how to solve this problem.
I guess if windows auto locked, there will be such a mistake, the program after landing may be successful again, I do not know why this, please instruct. Thank you.

Code: [Select]
function TBass.play: Boolean;
begin

  BASS_StreamFree(hs);

  hs := BASS_StreamCreateFile(False, PAnsiChar(Ansistring(FileName)), 0, 0, 0);

  if hs < BASS_ERROR_ENDED then   
  begin
    result := False;   
    exit;
  end;


  if not BASS_ChannelPlay(hs, False) then
  begin
    result := False;
  end
  else
  begin
    result := true;
  end;

end;

Code: [Select]
  if FileExists(Grid.Cells[14, Grid.Row]) then
  begin

    iBass.FileName := Grid.Cells[14, Grid.Row];
    iOldclickRow := Grid.Row;


    {$IFDEF BASSlogs}
 
    logs.Post(llDebug, 'iBass.FileName :=' + iBass.FileName);
    {$endif}


    if iBass.play then
    begin

    // SUCCESS   do something

    end
    else
    begin
     // fail wirte log
      {$IFDEF BASSlogs}
 
      logs.Post(llDebug, 'failed Play Code:' + IntTostr(BASS_ErrorGetCode));
      {$ENDIF}

      //first free
      BASS_Free;

      //sec   init
      if BASS_Init(-1, 44100, 0, Handle, nil) then
      begin
        if not iBass.play then
        begin

          //fail write log
          {$ifdef BASSlogs}
   
          logs.Post(llDebug, 'Failure to Play again' :' + pbMusicRatenew.Caption);
          {$ENDIF}

        end
        else
        begin
          {If normal is broadcast after initialization}

          {$ifdef BASSlogs}
   
          logs.Post(llDebug, 'Re initialization of successful broadcasting:' + pbMusicRatenew.Caption);
          {$ENDIF}

          exit;
        end;


      end
      else
      begin
        // fail init wirte log
        {$ifdef BASSlogs}
   
        logs.Post(llDebug, 'Failure to initialize again, get Code::'  + IntTostr(BASS_ErrorGetCode));
        {$ENDIF}

      end;

    end;

  end;





Code: [Select]
[22:16:59.745][8564][DEBUG]:Reload Playlist:D:\MSPLAYER130\Data\2018-06-08.TXT
[22:17:38.361][8564][DEBUG]:GridPlayList01.Cells[14, Gridplaylist01.Row]=D:\MSPLAYER130\Data\TextFile\mp3outting\2018-05-27084424.mp3
[22:17:38.361][8564][DEBUG]:iBass.FileName :=D:\MSPLAYER130\Data\TextFile\mp3outting\2018-05-27084424.mp3

 
   Omission successful log ......

[23:39:38.002][8564][DEBUG]:GridPlayList01.Cells[14, Gridplaylist01.Row]=D:\MSPLAYER130\Data\TextFile\mp3outting\2018-05-27084424.mp3
[23:39:38.002][8564][DEBUG]:iBass.FileName :=D:\MSPLAYER130\Data\TextFile\mp3outting\2018-05-27084424.mp3
[23:39:38.003][8564][DEBUG]:failed Play Code:9
[23:39:38.009][8564][DEBUG]:Failure to initialize again, get Code:23
[23:41:38.150][8564][DEBUG]:GridPlayList01.Cells[14, Gridplaylist01.Row]=D:\MSPLAYER130\Data\TextFile\mp3outting\2018-05-27084424.mp3
[23:41:38.150][8564][DEBUG]:iBass.FileName :=D:\MSPLAYER130\Data\TextFile\mp3outting\2018-05-27084424.mp3P
[23:41:38.151][8564][DEBUG]:failed Play Code:8
[23:41:38.154][8564][DEBUG]:Failure to initialize again, get Code:23
[23:42:11.109][8564][DEBUG]:GridPlayList01.Cells[14, Gridplaylist01.Row]=D:\MSPLAYER130\Data\TextFile\mp3outting\2018-05-27084424.mp3
[23:42:11.109][8564][DEBUG]:iBass.FileName :=D:\MSPLAYER130\Data\TextFile\mp3outting\2018-05-27084424.mp3
[23:42:11.109][8564][DEBUG]:failed Play Code:8
[23:42:11.111][8564][DEBUG]:Failure to initialize again, get Code:23
[23:43:38.064][8564][DEBUG]:GridPlayList01.Cells[14, Gridplaylist01.Row]=D:\MSPLAYER130\Data\TextFile\mp3outting\2018-05-27084424.mp3
[23:43:38.064][8564][DEBUG]:iBass.FileName :=D:\MSPLAYER130\Data\TextFile\mp3outting\2018-05-27084424.mp3
[23:43:38.064][8564][DEBUG]:failed Play Code:8
[23:43:38.068][8564][DEBUG]:Failure to initialize again, get Code:23


Omit the same failure log ...
 

[06:12:36.489][8564][DEBUG]:GridPlayList01.Cells[14, Gridplaylist01.Row]=D:\MSPLAYER130\Data\TextFile\mp3outting\2018-05-27084424.mp3
[06:12:36.489][8564][DEBUG]:iBass.FileName :=D:\MSPLAYER130\Data\TextFile\mp3outting\2018-05-27084424.mp3
[06:12:36.489][8564][DEBUG]:failed Play Code:8
[06:12:36.571][8564][DEBUG]:Re initialization of successful broadcasting:D:\MSPLAYER130\Data\TextFile\mp3outting\2018-05-27084424.mp3

[06:17:38.033][8564][DEBUG]:GridPlayList01.Cells[14, Gridplaylist01.Row]=D:\MSPLAYER130\Data\TextFile\mp3outting\2018-05-27084424.mp3
[06:17:38.033][8564][DEBUG]:iBass.FileName :=D:\MSPLAYER130\Data\TextFile\mp3outting\2018-05-27084424.mp3
[06:18:11.127][8564][DEBUG]:GridPlayList01.Cells[14, Gridplaylist01.Row]=D:\MSPLAYER130\Data\TextFile\mp3outting\2018-05-27084424.mp3
[06:18:11.127][8564][DEBUG]:iBass.FileName :=D:\MSPLAYER130\Data\TextFile\mp3outting\2018-05-27084424.mp3
[06:19:38.145][8564][DEBUG]:GridPlayList01.Cells[14, Gridplaylist01.Row]=D:\MSPLAYER130\Data\TextFile\mp3outting\2018-05-27084424.mp3
[06:19:38.146][8564][DEBUG]:iBass.FileName :=D:\MSPLAYER130\Data\TextFile\mp3outting\2018-05-27084424.mp3
[06:21:11.126][8564][DEBUG]:GridPlayList01.Cells[14, Gridplaylist01.Row]=D:\MSPLAYER130\Data\TextFile\mp3outting\2018-05-27084424.mp3



Chris

  • Posts: 1853
Code8 = BASS_Init has not been successfully called
Code9 = BASS_ERROR_START
Code23 = BASS_ERROR_DEVICE // wrong Bass_SetDevice call ?
do you have multible Devices ?eg Bass_SetDevice?
and which Delphi Version?
so i Think we must seen more of the code
« Last Edit: 9 Jun '18 - 21:01 by Chris »

Ian @ un4seen

  • Administrator
  • Posts: 21133
Code: [Select]
  hs := BASS_StreamCreateFile(False, PAnsiChar(Ansistring(FileName)), 0, 0, 0);

  if hs < BASS_ERROR_ENDED then   
  begin
    result := False;   
    exit;
  end;

The BASS_StreamCreateFile return value isn't an error code, so it shouldn't be compared with BASS_ERROR_ENDED. BASS_ErrorGetCode needs to be used to get the error code. In this case, it looks like you just want to check whether the call failed, in which case you can compare the return value to 0:

Code: [Select]
  if hs = 0 then   

[23:39:38.009][8564][DEBUG]:Failure to initialize again, get Code:23

If you are getting a BASS_ERROR_DEVICE error (error code 23) from a BASS_Init call with device=-1 then that looks like there are no devices available at that time. To check that, please try enumerating all devices with BASS_GetDeviceInfo straight after, and see if the BASS_DEVICE_ENABLED and/or BASS_DEVICE_DEFAULT flag is set on any of them.

Please also confirm what BASS version you are using, and if it isn't the latest, see if upgrading to that makes any difference.

dreamnyj

  • Posts: 6
Code8 = BASS_Init has not been successfully called
Code9 = BASS_ERROR_START
Code23 = BASS_ERROR_DEVICE // wrong Bass_SetDevice call ?
do you have multible Devices ?eg Bass_SetDevice?
and which Delphi Version?
so i Think we must seen more of the code


thanks for you hint.
I will try to find the question later and later the forum feedback.

dreamnyj

  • Posts: 6
Code: [Select]
  hs := BASS_StreamCreateFile(False, PAnsiChar(Ansistring(FileName)), 0, 0, 0);

  if hs < BASS_ERROR_ENDED then   
  begin
    result := False;   
    exit;
  end;

The BASS_StreamCreateFile return value isn't an error code, so it shouldn't be compared with BASS_ERROR_ENDED. BASS_ErrorGetCode needs to be used to get the error code. In this case, it looks like you just want to check whether the call failed, in which case you can compare the return value to 0:

Code: [Select]
  if hs = 0 then   

[23:39:38.009][8564][DEBUG]:Failure to initialize again, get Code:23

If you are getting a BASS_ERROR_DEVICE error (error code 23) from a BASS_Init call with device=-1 then that looks like there are no devices available at that time. To check that, please try enumerating all devices with BASS_GetDeviceInfo straight after, and see if the BASS_DEVICE_ENABLED and/or BASS_DEVICE_DEFAULT flag is set on any of them.

Please also confirm what BASS version you are using, and if it isn't the latest, see if upgrading to that makes any difference.



The final result:

Because the machine being tested is a remote server when I use remote desktop. The audio set was broadcast on the local computer, so guess BASS_init was to the computer I used, when I quit, the natural device had not existed, so it was caused by windows lock.



Thank you for your guidance.