commit 24/03/2025
This commit is contained in:
@@ -14,9 +14,8 @@ public class AudioPlayer {
|
||||
public void WaitUntilFinished(){
|
||||
while(currentFileHandle!=0){
|
||||
try {
|
||||
Thread.sleep(100);
|
||||
Thread.sleep(10);
|
||||
} catch (InterruptedException ignored) {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -102,9 +101,8 @@ public class AudioPlayer {
|
||||
* Play Audio File
|
||||
* @param filename File to be played
|
||||
* @param playbackstatus PlaybackStatus callback
|
||||
* @return true if success, false if failed
|
||||
*/
|
||||
public boolean PlayFile(final String filename, final PlaybackStatus playbackstatus){
|
||||
public void PlayFile(final String filename, final PlaybackStatus playbackstatus){
|
||||
if (inited && filename!=null && !filename.isEmpty()){
|
||||
int filehandle = bass.BASS_StreamCreateFile(false, filename, 0, 0, 0);
|
||||
if (filehandle!=0){
|
||||
@@ -136,11 +134,18 @@ public class AudioPlayer {
|
||||
currentFile = "";
|
||||
currentFileHandle = 0;
|
||||
}).start();
|
||||
return true;
|
||||
} else Logger.error("AudioPlayer PlayFile failed, BASS_ChannelStart failed, error code: "+bass.BASS_ErrorGetCode());
|
||||
} else Logger.error("AudioPlayer PlayFile failed, BASS_StreamCreateFile failed, error code: "+bass.BASS_ErrorGetCode());
|
||||
} else Logger.info("AudioPlayer PlayFile failed, AudioPlayer is not initialized");
|
||||
return false;
|
||||
} else {
|
||||
Logger.error("AudioPlayer PlayFile failed, BASS_ChannelStart failed, error code: "+bass.BASS_ErrorGetCode());
|
||||
if (playbackstatus!=null) playbackstatus.onPlaybackFailure(filename);
|
||||
}
|
||||
} else {
|
||||
Logger.error("AudioPlayer PlayFile failed, BASS_StreamCreateFile failed, error code: "+bass.BASS_ErrorGetCode());
|
||||
if (playbackstatus!=null) playbackstatus.onPlaybackFailure(filename);
|
||||
}
|
||||
} else {
|
||||
Logger.info("AudioPlayer PlayFile failed, AudioPlayer is not initialized");
|
||||
if (playbackstatus!=null) playbackstatus.onPlaybackFailure(filename);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user