001package com.aispeech.dui.dds.agent.tts.bean;
002
003import android.text.TextUtils;
004
005public class CustomAudioBean {
006    private String name;
007    private String type;
008    private String path;
009    private int sampleRate;
010
011    public String getName() {
012        return name;
013    }
014
015    public CustomAudioBean setName(String name) {
016        this.name = name;
017        return this;
018    }
019
020    private void setType(String type) {
021        this.type = type;
022    }
023
024    public String getType() {
025        return type;
026    }
027
028    public String getPath() {
029        return path;
030    }
031
032    public int getSampleRate() {
033        return sampleRate;
034    }
035
036    public void setSampleRate(int sampleRate) {
037        this.sampleRate = sampleRate;
038    }
039
040    public CustomAudioBean setPath(String path) {
041        this.path = path;
042        if (!TextUtils.isEmpty(path)) {
043            if (path.endsWith(".mp3")) {
044                setType("mp3");
045            } else if (path.endsWith(".wav")) {
046                setType("wav");
047            } else {
048                setType("pcm");
049            }
050        }
051        return this;
052    }
053
054    @Override
055    public String toString() {
056        return "CustomAudioBean{" +
057                "name='" + name + '\'' +
058                ", path='" + path + '\'' +
059                ", sampleRate='" + sampleRate + '\'' +
060                '}';
061    }
062}