Android通过摇晃手机的频率来控制声音的频率(6)
来源:未知 责任编辑:责任编辑 发表时间:2013-11-15 19:49 点击:次
49 }
50 playing = true;
51 }
52 }
53
54 // added for v 1.0.1, enable changing the audio remotely
55 public void setPlayIndex(int index) {
56 mPlayIndex = index;
57 }
58
59 public void setRate(float rate) {
60 if (mSoundEnable) {
61 mRate = checkRate(rate);
62 mSoundPool.setRate(mStreamID, mRate);
63 }
64 }
65
66 private float checkRate(float rate) {
67 if (rate > 2f) {
68 return 2f;
69 } else if (rate < 0.5f) {
70 return 0.5f;
71 } else {
72 return rate;
73 }
74 }
75
76 public void stepRate(float step) {
77 if (mSoundEnable) {
78 mRate = mRate + step;
79 mRate = checkRate(mRate);
80 mSoundPool.setRate(mStreamID, mRate);
81 }
82 }
83
84 public void pause() {
85 if (mSoundEnable) {
86 mSoundPool.pause(mStreamID);
87 // mSoundPool.autoPause();
88 }
89 }
90
91 public void resume() {
相关新闻>>
最新推荐更多>>>
- 发表评论
-
- 最新评论 更多>>