这是我的代码我想要同时打开耳机和扬声器 请编辑我的代码,因为我是编程的初学者我也尝试使用很多次AudioManager.Mode_Stream但是当我这样做时我什么也听不见
dataset = [[0, 0],
[1, 1],
[2, 4],
[0, 5]]
# First categorial feature has values in range [0,2] and dataset contains all values from that range.
# Second feature has values in range [0,5], but values (2, 3) are missing.
# Assuming that one encoded categorial values with that integer range, 2 and 3 must be somewhere, or it's sort of error.
# Thus OneHotEncoder will remove columns of values 2 and 3 from resulting dataset
enc = OneHotEncoder()
enc.fit(dataset)
print(enc.n_values_)
# prints array([3,6])
# first feature has 3 possible values, i.e 3 columns in resulting dataset
# second feature has 6 possible values
print(enc.feature_indices_)
# prints array([0, 3, 9])
# first feature decomposed into 3 columns (0,1,2), second — into 6 (3,4,5,6,7,8)
print(enc.active_features_)
# prints array([0, 1, 2, 3, 4, 7, 8])
# but two values of second feature never occurred, so active features doesn't list (5,6), and resulting dataset will not contain those columns too
enc.transform(dataset).toarray()
# prints this array
array([[ 1., 0., 0., 1., 0., 0., 0.],
[ 0., 1., 0., 0., 1., 0., 0.],
[ 0., 0., 1., 0., 0., 1., 0.],
[ 1., 0., 0., 0., 0., 0., 1.]])
答案 0 :(得分:0)
这里的代码可能会强制音频通过扬声器:
audioManager.setMode(AudioManager.MODE_IN_CALL);
audioManager.setSpeakerphoneOn(true);
答案 1 :(得分:0)
这对我有用
首先,我在Manifest.xml中添加了权限
select server, domain, uniqueid,
(case when min(department) = max(department)
then min(department)
else 'Multiple'
end) as department
from t
group by server, domain, uniqueid;
然后,我用了这个:
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />