Class LinuxSoundCard

    • 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 cardName
      static java.util.List<SoundCard> getSoundCards()
      public method used by AbstractHardwareAbstractionLayer 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 java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • LinuxSoundCard

        LinuxSoundCard​(java.lang.String kernelVersion,
                       java.lang.String name,
                       java.lang.String codec)
        Constructor for LinuxSoundCard.
        Parameters:
        kernelVersion - The version
        name - The name
        codec - The codec
    • 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 the FileUtil 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 :
        1. Reading the id file and comparing each id with the card id present in the cards file
        2. 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.