Android Open Source - CopresenceDataCollector Audio Proc






From Project

Back to project page CopresenceDataCollector.

License

The source code is released under:

Copyright (c) 2014, Xiang Gao All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Re...

If you think the Android project CopresenceDataCollector listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package org.sesy.coco.datacollector;
/*ww w .j  av  a  2s  .  co m*/
import java.io.File;

import org.sesy.coco.datacollector.database.Entry;

import android.app.IntentService;
import android.content.Intent;
import android.os.SystemClock;
import android.util.Log;

public class AudioProc extends IntentService {

  //private Wave waveRemote, waveLocal;
  //final float[] trimSeconds = {10, 5, 4, 3, 2, 1};
  //private String fp;
  
  public AudioProc() {
    super("AudioProc");
    // TODO Auto-generated constructor stub
  }

  @Override
  protected void onHandleIntent(Intent intent) {
    // TODO Auto-generated method stub
    Log.i("wavproc", "Audio Proc started");
    //String waveHeaderJson = intent.getStringExtra("header");
    //String waveDataString = intent.getStringExtra("data");
    String waveFP = intent.getStringExtra("wavefp");
    
    /*Gson gson = new Gson();
      WaveHeader waveHeaderRemote = gson.fromJson(waveHeaderJson, WaveHeader.class);
      byte[] dataRemote = null;
      try {
        dataRemote = Hex.decodeHex(waveDataString.toCharArray());
    } catch (DecoderException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }
      waveRemote = new Wave(waveHeaderRemote, dataRemote);
      waveLocal = new Wave(WorkerService.wavPath);
      fp = WorkerService.wavName + "#";
      if(waveRemote.length() > 0 && waveLocal.length() > 0){
        for(int i = 0; i < 6; i++){
          if(waveRemote.length() > trimSeconds[i]){
            waveRemote.rightTrim(waveRemote.length() - trimSeconds[i]);
          }
          if(waveLocal.length() > trimSeconds[i]){
            waveLocal.rightTrim(waveLocal.length()  - trimSeconds[i]);
          }
          
          XCorrAndDistFromWav xCorrAndDistFromWav = new XCorrAndDistFromWav(waveRemote, waveLocal);
          fp += xCorrAndDistFromWav.getMaxCorr()+"#"+xCorrAndDistFromWav.getDist()+"#";
          
        }
      }*/
    
      long ts = SystemClock.elapsedRealtime() - WorkerService.metaTS;
      
      //remove wav if not server storage not enabled  
    if(!WorkerService.isRecord){
      new File(WorkerService.wavPath).delete();
    }
    
      Entry eobj = new Entry();        
    //eobj.setOB(WorkerService.ob);
    eobj.setTS(ts);
    //eobj.setGT(WorkerService.gt);
    eobj.setMT(Constants.STATUS_SENSOR_AUDIO);
    eobj.setFP(waveFP+WorkerService.wavName);
        WorkerService.audList.set(0, eobj);
    
    WorkerService.audioTaskDone = true;
      
      
  }

}




Java Source Code List

org.sesy.coco.datacollector.ARPWorker.java
org.sesy.coco.datacollector.AlarmService.java
org.sesy.coco.datacollector.AppLauncher.java
org.sesy.coco.datacollector.AudioProc.java
org.sesy.coco.datacollector.AudioWorker.java
org.sesy.coco.datacollector.BindActivity.java
org.sesy.coco.datacollector.BluetoothWorker.java
org.sesy.coco.datacollector.CellWorker.java
org.sesy.coco.datacollector.Constants.java
org.sesy.coco.datacollector.DaemonService.java
org.sesy.coco.datacollector.DataMonitor.java
org.sesy.coco.datacollector.GpsWorker.java
org.sesy.coco.datacollector.HelpActivity.java
org.sesy.coco.datacollector.MainActivity.java
org.sesy.coco.datacollector.MyPreference.java
org.sesy.coco.datacollector.MyWidgetProvider.java
org.sesy.coco.datacollector.PluginManager.java
org.sesy.coco.datacollector.PrefManager.java
org.sesy.coco.datacollector.ReportErrActivity.java
org.sesy.coco.datacollector.SDSetupActivity.java
org.sesy.coco.datacollector.SensorActivity.java
org.sesy.coco.datacollector.SensorListener.java
org.sesy.coco.datacollector.SensordroneWorker.java
org.sesy.coco.datacollector.SettingActivity.java
org.sesy.coco.datacollector.StatusActivity.java
org.sesy.coco.datacollector.StatusManager.java
org.sesy.coco.datacollector.TriggerService.java
org.sesy.coco.datacollector.UpdateWidgetService.java
org.sesy.coco.datacollector.WifiWorker.java
org.sesy.coco.datacollector.WorkerService.java
org.sesy.coco.datacollector.audio.Convolution.java
org.sesy.coco.datacollector.audio.CrossCorrelation.java
org.sesy.coco.datacollector.audio.ExtAudioRecorder.java
org.sesy.coco.datacollector.audio.XCorrAndDistFromWav.java
org.sesy.coco.datacollector.communication.HttpFileUploader.java
org.sesy.coco.datacollector.database.Entry.java
org.sesy.coco.datacollector.file.FileHelper.java
org.sesy.coco.datacollector.log.ConfigureLog4J.java
org.sesy.coco.datacollector.net.NetInfo.java
org.sesy.coco.datacollector.plugin.PlugInterface.java
wei.mark.standout.StandOutWindow.java
wei.mark.standout.Utils.java
wei.mark.standout.WindowCache.java
wei.mark.standout.constants.StandOutFlags.java
wei.mark.standout.ui.TouchInfo.java
wei.mark.standout.ui.Window.java