• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2015 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 package com.android.cts.verifier.audio.wavelib;
18 
19 public class DspBufferDouble extends DspBufferBase {
20     public double[] mData;
21 
DspBufferDouble(int size)22     public DspBufferDouble(int size) {
23         super(size);
24     }
25 
26     @Override
setSize(int size)27     public void setSize(int size) {
28         if (size == getSize()) {
29             return;
30         }
31         mData = new double[size];
32         super.setSize(size);
33     }
34 
35     // Warning, these methods don't check for bounds!
36     @Override
setValues(int index, double... values)37     public void setValues(int index, double... values) {
38         mData[index] = values[0];
39     }
40 
41     @Override
setValue(int index, double value)42     public void setValue(int index, double value) {
43         mData[index] = value;
44     }
45 
46     @Override
toString()47     public String toString() {
48         StringBuilder sb = new StringBuilder();
49         int size = getSize();
50         sb.append(String.format("Size: %d { ", size));
51         int i = 0;
52         for (; i < size - 1; i++) {
53             sb.append(String.format("%.3f, ", mData[i]));
54         }
55         for(; i < size; i++) {
56             sb.append(String.format("%.3f", mData[i]));
57         }
58         sb.append(" }");
59         return sb.toString();
60     }
61 }
62