Package oshi.hardware.platform.linux
Class LinuxSoundCard
java.lang.Object
oshi.hardware.common.AbstractSoundCard
oshi.hardware.platform.linux.LinuxSoundCard
- All Implemented Interfaces:
SoundCard
Sound card data obtained via /proc/asound directory
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionLinuxSoundCard
(String kernelVersion, String name, String codec) Constructor for LinuxSoundCard. -
Method Summary
Modifier and TypeMethodDescriptionprivate static String
getCardCodec
(File cardDir) Retrieves the codec of the sound card contained in the codec file.Method to find all the card folders contained in the asound folder denoting the cards currently contained in our machine.private static String
getCardName
(File file) Retrieves the name of the sound card by : Reading the id file and comparing each id with the card id present in the cards file If the id and the card name matches , then it assigns that name to cardNamepublic method used byAbstractHardwareAbstractionLayer
to access the sound cards.private static String
Reads the 'version' file in the asound folder that contains the complete name of the ALSA driver.Methods inherited from class oshi.hardware.common.AbstractSoundCard
getCodec, getDriverVersion, getName, toString
-
Field Details
-
LOG
private static final org.slf4j.Logger LOG -
CARD_FOLDER
- See Also:
-
CARDS_FILE
- See Also:
-
ID_FILE
- See Also:
-
-
Constructor Details
-
LinuxSoundCard
Constructor for LinuxSoundCard.- Parameters:
kernelVersion
- The versionname
- The namecodec
- The codec
-
-
Method Details
-
getCardFolders
Method to find all the card folders contained in the asound folder denoting the cards currently contained in our machine.- Returns:
- : A list of files starting with 'card'
-
getSoundCardVersion
Reads the 'version' file in the asound folder that contains the complete name of the ALSA driver. Reads all the lines of the file and retrieves the first line.- Returns:
- The complete name of the ALSA driver currently residing in our machine
-
getCardCodec
Retrieves the codec of the sound card contained in the codec file. The name of the codec is always the first line of that file.
Working
This converts the codec file into key value pairs using theFileUtil
class and then returns the value of the Codec key.- Parameters:
cardDir
- The sound card directory- Returns:
- The name of the codec
-
getCardName
Retrieves the name of the sound card by :- Reading the id file and comparing each id with the card id present in the cards file
- If the id and the card name matches , then it assigns that name to cardName
- Parameters:
file
- The sound card File.- Returns:
- The name of the sound card.
-
getSoundCards
public method used byAbstractHardwareAbstractionLayer
to access the sound cards.- Returns:
- List of
LinuxSoundCard
objects.
-