close #6 - finished convertig matlab code to java
- also added moving average and simple kalman filter - a lot of refactoring for speed
This commit is contained in:
@@ -16,7 +16,7 @@ import de.tonifetzer.conductorswatch.utilities.Utils;
|
||||
*/
|
||||
|
||||
//TODO: einfügen der logik autoCorr + FindPeaks
|
||||
public class BpmEstimator implements SensorEventListener {
|
||||
public class Estimator implements SensorEventListener {
|
||||
|
||||
private SensorManager mSensorManager;
|
||||
private Sensor mAccelerometer;
|
||||
@@ -51,7 +51,7 @@ public class BpmEstimator implements SensorEventListener {
|
||||
};
|
||||
|
||||
|
||||
public BpmEstimator(Context mContext){
|
||||
public Estimator(Context mContext){
|
||||
this.mContext = mContext;
|
||||
}
|
||||
|
||||
@@ -12,8 +12,6 @@ import android.view.WindowManager;
|
||||
import android.widget.TextView;
|
||||
import java.util.Vector;
|
||||
|
||||
import de.tonifetzer.conductorswatch.utilities.Utils;
|
||||
|
||||
|
||||
/**
|
||||
* A simple {@link Fragment} subclass.
|
||||
@@ -21,12 +19,12 @@ import de.tonifetzer.conductorswatch.utilities.Utils;
|
||||
* {@link WorkerFragment.OnFragmentInteractionListener} interface
|
||||
* to handle interaction events.
|
||||
*/
|
||||
public class WorkerFragment extends Fragment implements Metronome.OnMetronomeListener, BpmEstimator.OnBpmEstimatorListener{
|
||||
public class WorkerFragment extends Fragment implements Metronome.OnMetronomeListener, Estimator.OnBpmEstimatorListener{
|
||||
|
||||
private OnFragmentInteractionListener mListener;
|
||||
private Vector<Float> mBpmList; //TODO save to file.
|
||||
|
||||
private BpmEstimator mBpmEstimator;
|
||||
private Estimator mEstimator;
|
||||
private Metronome mMetronome;
|
||||
|
||||
//private Thread mBpmThread;
|
||||
@@ -58,9 +56,9 @@ public class WorkerFragment extends Fragment implements Metronome.OnMetronomeLis
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
// init bpm estimator and listener
|
||||
mBpmEstimator = new BpmEstimator(getContext());
|
||||
mBpmEstimator.add(this);
|
||||
//mBpmThread = new Thread(mBpmEstimator, "estThread");
|
||||
mEstimator = new Estimator(getContext());
|
||||
mEstimator.add(this);
|
||||
//mBpmThread = new Thread(mEstimator, "estThread");
|
||||
mBpmList = new Vector<Float>();
|
||||
|
||||
|
||||
@@ -99,7 +97,7 @@ public class WorkerFragment extends Fragment implements Metronome.OnMetronomeLis
|
||||
super.onStart();
|
||||
|
||||
// start the worker thread for bpm estimator
|
||||
mBpmEstimator.start();
|
||||
mEstimator.start();
|
||||
|
||||
// start the worker thread for metronom
|
||||
mMetronomeThread.start();
|
||||
@@ -110,7 +108,7 @@ public class WorkerFragment extends Fragment implements Metronome.OnMetronomeLis
|
||||
super.onStop();
|
||||
|
||||
// stop the worker thread for bpm estimator
|
||||
mBpmEstimator.stop();
|
||||
mEstimator.stop();
|
||||
|
||||
// stop the worker thread for metronom
|
||||
mMetronome.stop();
|
||||
|
||||
Reference in New Issue
Block a user