Android Open Source - Visu Samples Buffer






From Project

Back to project page Visu.

License

The source code is released under:

Apache License

If you think the Android project Visu 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

/*****************************************************************************************
 * StorageBuffer.java                                   *
 * Buffer de almacenamiento.                               *
 ****************************************************************************************/
/*ww  w.  j a va 2s  .  c  o m*/
package com.ufavaloro.android.visu.storage;

import java.util.ArrayList;

import com.ufavaloro.android.visu.storage.datatypes.AcquisitionData;

public class SamplesBuffer {
  
  // Buffer
  private short[] mSamplesBuffer;

  // Puntero de almacenamiento
  private int mStoringIndex;
  
  // Tiempo de guardado en segundos
  private double mSaveTime = 5;
  
  
/*****************************************************************************************
* M?todos principales                                           *
*****************************************************************************************/  
  // Constructor
  public SamplesBuffer(AcquisitionData acquisitionData, String units) {
    double fs = acquisitionData.getFs();
    double ts = 1 / fs;
    int samplesPerPackage = acquisitionData.getSamplesPerPackage();
    
    int i = 0;
    while(i*samplesPerPackage*ts < mSaveTime) i++;
    
    mSamplesBuffer = new short[i * samplesPerPackage];
  }
  
  public SamplesBuffer() {
  // TODO Auto-generated constructor stub
  }

  // M?todo para almacenar muestras
  public void storeSamples(short[] x) {
    
    // Almaceno
    for(int i=0; i<x.length; i++) {
      
      mSamplesBuffer[mStoringIndex] = x[i];
      
      // Incremento ?ndices
      mStoringIndex++;
      
      // Si llego al m?ximo, pongo ?ndices en cero
      if(mStoringIndex == mSamplesBuffer.length) mStoringIndex = 0;
    
    }
  
  }

  
/*****************************************************************************************
* Getters                                                 *
*****************************************************************************************/
  public int getStoringIndex() {
    return mStoringIndex;
  }
  
  public int getSize() {
    return mSamplesBuffer.length;
  }
  
  public short[] getBuffer() {
    return mSamplesBuffer;
  }

  
  public void createSamplesBuffer(ArrayList<Short> samplesBuffer) {
    mSamplesBuffer = new short[samplesBuffer.size()];
    for(int i = 0; i < samplesBuffer.size(); i++) {
        mSamplesBuffer[i] = samplesBuffer.get(i);
    }
  }

}//StoringBuffer





Java Source Code List

com.samsung.sprc.fileselector.FileData.java
com.samsung.sprc.fileselector.FileListAdapter.java
com.samsung.sprc.fileselector.FileOperation.java
com.samsung.sprc.fileselector.FileSelector.java
com.samsung.sprc.fileselector.FileUtils.java
com.samsung.sprc.fileselector.OnHandleFileListener.java
com.samsung.sprc.fileselector.SaveLoadClickListener.java
com.samsung.sprc.fileselector.TextViewWithImage.java
com.ufavaloro.android.visu.UI.ChannelOptionsDialog.java
com.ufavaloro.android.visu.UI.LoadFileFromGoogleDriveDialog.java
com.ufavaloro.android.visu.UI.LoadFileFromLocalStorageDialog.java
com.ufavaloro.android.visu.UI.MainActivity.java
com.ufavaloro.android.visu.UI.MainMenuDialog.java
com.ufavaloro.android.visu.UI.NewStudyDialog.java
com.ufavaloro.android.visu.UI.OfflineChannelPropertiesDialog.java
com.ufavaloro.android.visu.UI.OnlineChannelPropertiesDialog.java
com.ufavaloro.android.visu.UI.StopStudyDialog.java
com.ufavaloro.android.visu.bluetooth.BluetoothProtocolMessage.java
com.ufavaloro.android.visu.bluetooth.BluetoothProtocol.java
com.ufavaloro.android.visu.bluetooth.BluetoothServiceMessage.java
com.ufavaloro.android.visu.bluetooth.BluetoothService.java
com.ufavaloro.android.visu.draw.BitmapManager.java
com.ufavaloro.android.visu.draw.DrawHelper.java
com.ufavaloro.android.visu.draw.RGB.java
com.ufavaloro.android.visu.draw.ReferenceMatrix.java
com.ufavaloro.android.visu.draw.TouchPointer.java
com.ufavaloro.android.visu.draw.channel.ChannelList.java
com.ufavaloro.android.visu.draw.channel.Channel.java
com.ufavaloro.android.visu.draw.channel.DrawBuffer.java
com.ufavaloro.android.visu.draw.channel.InfoBox.java
com.ufavaloro.android.visu.draw.channel.Label.java
com.ufavaloro.android.visu.draw.channel.ScreenElement.java
com.ufavaloro.android.visu.draw.channel.SignalBox.java
com.ufavaloro.android.visu.storage.DataConversion.java
com.ufavaloro.android.visu.storage.SamplesBuffer.java
com.ufavaloro.android.visu.storage.StorageHelperMessage.java
com.ufavaloro.android.visu.storage.StorageHelper.java
com.ufavaloro.android.visu.storage.StudyDataParser.java
com.ufavaloro.android.visu.storage.datatypes.AcquisitionData.java
com.ufavaloro.android.visu.storage.datatypes.AdcData.java
com.ufavaloro.android.visu.storage.datatypes.PatientData.java
com.ufavaloro.android.visu.storage.datatypes.StorageData.java
com.ufavaloro.android.visu.storage.datatypes.StudyData.java
com.ufavaloro.android.visu.storage.googledrive.GoogleDriveClientMessage.java
com.ufavaloro.android.visu.storage.googledrive.GoogleDriveClient.java
com.ufavaloro.android.visu.storage.googledrive.GoogleDriveManagerMessage.java
com.ufavaloro.android.visu.storage.googledrive.GoogleDriveManager.java
com.ufavaloro.android.visu.storage.local.LocalStorageManager.java
com.ufavaloro.android.visu.study.StudyMessage.java
com.ufavaloro.android.visu.study.StudyType.java
com.ufavaloro.android.visu.study.Study.java