Package oshi.hardware.platform.linux
Class LinuxSoundCard
- java.lang.Object
-
- oshi.hardware.common.AbstractSoundCard
-
- oshi.hardware.platform.linux.LinuxSoundCard
-
- All Implemented Interfaces:
SoundCard
@Immutable final class LinuxSoundCard extends AbstractSoundCard
Sound card data obtained via /proc/asound directory
-
-
Field Summary
Fields Modifier and Type Field Description private static java.lang.String
CARD_FOLDER
private static java.lang.String
CARDS_FILE
private static java.lang.String
ID_FILE
private static org.slf4j.Logger
LOG
-
Constructor Summary
Constructors Constructor Description LinuxSoundCard(java.lang.String kernelVersion, java.lang.String name, java.lang.String codec)
Constructor for LinuxSoundCard.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description private static java.lang.String
getCardCodec(java.io.File cardDir)
Retrieves the codec of the sound card contained in the codec file.private static java.util.List<java.io.File>
getCardFolders()
Method to find all the card folders contained in the asound folder denoting the cards currently contained in our machine.private static java.lang.String
getCardName(java.io.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 cardNamestatic java.util.List<SoundCard>
getSoundCards()
public method used byAbstractHardwareAbstractionLayer
to access the sound cards.private static java.lang.String
getSoundCardVersion()
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 Detail
-
LOG
private static final org.slf4j.Logger LOG
-
CARD_FOLDER
private static final java.lang.String CARD_FOLDER
- See Also:
- Constant Field Values
-
CARDS_FILE
private static final java.lang.String CARDS_FILE
- See Also:
- Constant Field Values
-
ID_FILE
private static final java.lang.String ID_FILE
- See Also:
- Constant Field Values
-
-
Method Detail
-
getCardFolders
private static java.util.List<java.io.File> 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
private static java.lang.String 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
private static java.lang.String getCardCodec(java.io.File cardDir)
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
private static java.lang.String getCardName(java.io.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 cardName
- Parameters:
file
- The sound card File.- Returns:
- The name of the sound card.
-
getSoundCards
public static java.util.List<SoundCard> getSoundCards()
public method used byAbstractHardwareAbstractionLayer
to access the sound cards.- Returns:
- List of
LinuxSoundCard
objects.
-
-