Fix&speedup

This commit is contained in:
Norbi Peti 2017-11-23 21:19:10 +01:00
parent e1d185dbe9
commit 7aa6ab4eab

View file

@ -105,7 +105,7 @@ public class Analyzer //Based on NativeBass example 'Spectrum'
public boolean start(CommandSender sender, String file) public boolean start(CommandSender sender, String file)
{ {
if (playing) if (playing)
tt.cancel(); stopPlaying();
if (!playFile(sender, file)) if (!playFile(sender, file))
return false; return false;
// setup update timer (50hz) // setup update timer (50hz)
@ -116,7 +116,7 @@ public class Analyzer //Based on NativeBass example 'Spectrum'
{ {
BASS_ChannelGetData(chan, buffer, BASS_DATA_FFT2048); //Get the FFT data BASS_ChannelGetData(chan, buffer, BASS_DATA_FFT2048); //Get the FFT data
} }
}, 50, 50); }, 25, 25);
return true; return true;
} }
@ -132,8 +132,8 @@ public class Analyzer //Based on NativeBass example 'Spectrum'
return; return;
} }
deinit = true; deinit = true;
if (playing)
tt.cancel(); stopPlaying();
BASS_Free(); BASS_Free();
} }