修改图片
@@ -0,0 +1,77 @@
|
||||
package com.xscm.moduleutil.rtc;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* com.xscm.moduleutil.rtc
|
||||
* qx
|
||||
* 2025/11/3
|
||||
* 声网声音管理类
|
||||
*/
|
||||
public class VolumeManager {
|
||||
private static VolumeManager instance;
|
||||
private Map<String, Integer> userMusicVolumeMap = new HashMap<>();
|
||||
private Map<String, Integer> userPlayoutVolumeMap = new HashMap<>();
|
||||
private Map<String, Boolean> userPlayoutBzMap = new HashMap<>();
|
||||
private String currentUserId;
|
||||
|
||||
private VolumeManager() {}
|
||||
|
||||
public static VolumeManager getInstance() {
|
||||
if (instance == null) {
|
||||
synchronized (VolumeManager.class) {
|
||||
if (instance == null) {
|
||||
instance = new VolumeManager();
|
||||
}
|
||||
}
|
||||
}
|
||||
return instance;
|
||||
}
|
||||
|
||||
public void setCurrentUserId(String userId) {
|
||||
this.currentUserId = userId;
|
||||
}
|
||||
|
||||
public void saveCurrentVolumes(int musicVolume, int playoutVolume) {
|
||||
if (currentUserId != null) {
|
||||
userMusicVolumeMap.put(currentUserId, musicVolume);
|
||||
userPlayoutVolumeMap.put(currentUserId, playoutVolume);
|
||||
}
|
||||
}
|
||||
public void clearCurrentVolumes() {
|
||||
if (currentUserId != null) {
|
||||
userMusicVolumeMap.remove(currentUserId);
|
||||
userPlayoutVolumeMap.remove(currentUserId);
|
||||
}
|
||||
userPlayoutBzMap.clear();
|
||||
}
|
||||
|
||||
public void saveBz(String userId, boolean bz){
|
||||
userPlayoutBzMap.clear();
|
||||
userPlayoutBzMap.put(userId, bz);
|
||||
}
|
||||
|
||||
public boolean getBz(String userId){
|
||||
Boolean bz = userPlayoutBzMap.get(userId);
|
||||
if (bz == null) {
|
||||
bz = true; // 默认值原唱 false 伴奏
|
||||
}
|
||||
return bz;
|
||||
}
|
||||
|
||||
public int[] getUserVolumes(String userId) {
|
||||
Integer musicVolume = userMusicVolumeMap.get(userId);
|
||||
Integer playoutVolume = userPlayoutVolumeMap.get(userId);
|
||||
|
||||
if (musicVolume == null) {
|
||||
musicVolume = 100; // 默认值
|
||||
}
|
||||
if (playoutVolume == null) {
|
||||
playoutVolume = 50; // 默认值
|
||||
}
|
||||
|
||||
return new int[]{musicVolume, playoutVolume};
|
||||
}
|
||||
}
|
||||
|
||||
BIN
moduleUtil/src/main/res/mipmap-hdpi/accompany_off.webp
Normal file
|
After Width: | Height: | Size: 858 B |
BIN
moduleUtil/src/main/res/mipmap-hdpi/accompany_on.webp
Normal file
|
After Width: | Height: | Size: 822 B |
BIN
moduleUtil/src/main/res/mipmap-hdpi/icon_liang.webp
Normal file
|
After Width: | Height: | Size: 1.3 KiB |
BIN
moduleUtil/src/main/res/mipmap-hdpi/muisc_reward.webp
Normal file
|
After Width: | Height: | Size: 738 B |
BIN
moduleUtil/src/main/res/mipmap-hdpi/muisc_switch.webp
Normal file
|
After Width: | Height: | Size: 556 B |
BIN
moduleUtil/src/main/res/mipmap-hdpi/muisc_tyt.webp
Normal file
|
After Width: | Height: | Size: 692 B |
BIN
moduleUtil/src/main/res/mipmap-xhdpi/accompany_off.webp
Normal file
|
After Width: | Height: | Size: 1.2 KiB |
BIN
moduleUtil/src/main/res/mipmap-xhdpi/accompany_on.webp
Normal file
|
After Width: | Height: | Size: 1.2 KiB |
BIN
moduleUtil/src/main/res/mipmap-xhdpi/icon_liang.webp
Normal file
|
After Width: | Height: | Size: 1.6 KiB |
BIN
moduleUtil/src/main/res/mipmap-xhdpi/muisc_reward.webp
Normal file
|
After Width: | Height: | Size: 988 B |
BIN
moduleUtil/src/main/res/mipmap-xhdpi/muisc_switch.webp
Normal file
|
After Width: | Height: | Size: 646 B |
BIN
moduleUtil/src/main/res/mipmap-xhdpi/muisc_tyt.webp
Normal file
|
After Width: | Height: | Size: 754 B |
BIN
moduleUtil/src/main/res/mipmap-xxhdpi/accompany_off.webp
Normal file
|
After Width: | Height: | Size: 1.9 KiB |
BIN
moduleUtil/src/main/res/mipmap-xxhdpi/accompany_on.webp
Normal file
|
After Width: | Height: | Size: 1.9 KiB |
BIN
moduleUtil/src/main/res/mipmap-xxhdpi/icon_liang.webp
Normal file
|
After Width: | Height: | Size: 2.8 KiB |
BIN
moduleUtil/src/main/res/mipmap-xxhdpi/muisc_reward.webp
Normal file
|
After Width: | Height: | Size: 1.6 KiB |
BIN
moduleUtil/src/main/res/mipmap-xxhdpi/muisc_switch.webp
Normal file
|
After Width: | Height: | Size: 1.1 KiB |
BIN
moduleUtil/src/main/res/mipmap-xxhdpi/muisc_tyt.webp
Normal file
|
After Width: | Height: | Size: 1.2 KiB |