1 /*
2  * Copyright (C) 2017 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 org.drrickorang.loopback;
18 
19 // Object to store the settings of the test that can be computed
20 // automatically by the test threads.
21 public class TestSettings {
TestSettings(int samplingRate, int playerBufferSizeInBytes, int recorderBuffSizeInBytes)22     public TestSettings(int samplingRate, int playerBufferSizeInBytes,
23             int recorderBuffSizeInBytes) {
24         mSamplingRate = samplingRate;
25         mPlayerBufferSizeInBytes = playerBufferSizeInBytes;
26         mRecorderBuffSizeInBytes = recorderBuffSizeInBytes;
27     }
28 
getSamplingRate()29     public int getSamplingRate() {
30         return mSamplingRate;
31     }
32 
getPlayerBufferSizeInBytes()33     public int getPlayerBufferSizeInBytes() {
34         return mPlayerBufferSizeInBytes;
35     }
36 
getRecorderBufferSizeInBytes()37     public int getRecorderBufferSizeInBytes() {
38         return mRecorderBuffSizeInBytes;
39     }
40 
setSamplingRate(int samplingRate)41     public void setSamplingRate(int samplingRate) {
42         mSamplingRate = Utilities.clamp(samplingRate,
43                 Constant.SAMPLING_RATE_MIN, Constant.SAMPLING_RATE_MAX);
44     }
45 
setPlayerBufferSizeInBytes(int playerBufferSizeInBytes)46     public void setPlayerBufferSizeInBytes(int playerBufferSizeInBytes) {
47         mPlayerBufferSizeInBytes = Utilities.clamp(playerBufferSizeInBytes,
48                 Constant.PLAYER_BUFFER_FRAMES_MIN, Constant.PLAYER_BUFFER_FRAMES_MAX);
49     }
50 
setRecorderBufferSizeInBytes(int recorderBufferSizeInBytes)51     public void setRecorderBufferSizeInBytes(int recorderBufferSizeInBytes) {
52         mRecorderBuffSizeInBytes = Utilities.clamp(recorderBufferSizeInBytes,
53                 Constant.RECORDER_BUFFER_FRAMES_MIN, Constant.RECORDER_BUFFER_FRAMES_MAX);
54     }
55 
56     private int mSamplingRate;
57     private int mPlayerBufferSizeInBytes;
58     private int mRecorderBuffSizeInBytes;
59 }
60