Methods Summary |
---|
public void | Log()
int numDevRecs = getNumDeviceRecords();
for (int index = 0; index < numDevRecs; ++index) {
Slog.w(TAG, "usb:" + getDeviceRecordAt(index).textFormat());
}
|
public android.alsa.AlsaDevicesParser$AlsaDeviceRecord | getDeviceRecordAt(int index)
return deviceRecords_.get(index);
|
public int | getNumDeviceRecords()
return deviceRecords_.size();
|
public boolean | hasCaptureDevices()
return mHasCaptureDevices;
|
public boolean | hasCaptureDevices(int card)
for (int index = 0; index < deviceRecords_.size(); index++) {
AlsaDeviceRecord deviceRecord = deviceRecords_.get(index);
if (deviceRecord.mCardNum == card &&
deviceRecord.mDeviceType == AlsaDeviceRecord.kDeviceType_Audio &&
deviceRecord.mDeviceDir == AlsaDeviceRecord.kDeviceDir_Capture) {
return true;
}
}
return false;
|
public boolean | hasMIDIDevices()
return mHasMIDIDevices;
|
public boolean | hasMIDIDevices(int card)
for (int index = 0; index < deviceRecords_.size(); index++) {
AlsaDeviceRecord deviceRecord = deviceRecords_.get(index);
if (deviceRecord.mCardNum == card &&
deviceRecord.mDeviceType == AlsaDeviceRecord.kDeviceType_MIDI) {
return true;
}
}
return false;
|
public boolean | hasPlaybackDevices()
return mHasPlaybackDevices;
|
public boolean | hasPlaybackDevices(int card)
for (int index = 0; index < deviceRecords_.size(); index++) {
AlsaDeviceRecord deviceRecord = deviceRecords_.get(index);
if (deviceRecord.mCardNum == card &&
deviceRecord.mDeviceType == AlsaDeviceRecord.kDeviceType_Audio &&
deviceRecord.mDeviceDir == AlsaDeviceRecord.kDeviceDir_Playback) {
return true;
}
}
return false;
|
private boolean | isLineDeviceRecord(java.lang.String line)
return line.charAt(kIndex_CardDeviceField) == '[";
|
public void | scan()
deviceRecords_.clear();
final String devicesFilePath = "/proc/asound/devices";
File devicesFile = new File(devicesFilePath);
try {
FileReader reader = new FileReader(devicesFile);
BufferedReader bufferedReader = new BufferedReader(reader);
String line = "";
while ((line = bufferedReader.readLine()) != null) {
if (isLineDeviceRecord(line)) {
AlsaDeviceRecord deviceRecord = new AlsaDeviceRecord();
deviceRecord.parse(line);
deviceRecords_.add(deviceRecord);
}
}
reader.close();
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
|