def __create_cache(self):
     cache = {}
     HwCmd.create_cache(cache)
     DisplayCmd.create_cache(cache)
     OptIfaceCmd.create_cache(cache)
     MicCmd.create_cache(cache)
     InputCmd.create_cache(cache)
     OutputCmd.create_cache(cache)
     MixerCmd.create_cache(cache)
     RouteCmd.create_cache(cache)
     SpdifResampleCmd.create_cache(cache)
     self.__cache = cache
    def __set_from_cache(self):
        val = HwCmd.get_cd_mode(self.__cache)
        HwCmd.set_cd_mode(self.__cache, self.fcp, val)
        val = HwCmd.get_16bit_mode(self.__cache)
        HwCmd.set_16bit_mode(self.__cache, self.fcp, val)

        val = DisplayCmd.get_illuminate(self.__cache)
        DisplayCmd.set_illuminate(self.__cache, self.fcp, val)
        val = DisplayCmd.get_mode(self.__cache)
        DisplayCmd.set_mode(self.__cache, self.fcp, val)
        val = DisplayCmd.get_target(self.__cache)
        DisplayCmd.set_target(self.__cache, self.fcp, val)
        val = DisplayCmd.get_overhold(self.__cache)
        DisplayCmd.set_overhold(self.__cache, self.fcp, val)

        for target in OptIfaceCmd.get_target_labels():
            val = OptIfaceCmd.get_mode(self.__cache, target)
            OptIfaceCmd.set_mode(self.__cache, self.fcp, target, val)

        for target in MicCmd.get_mic_labels():
            val = MicCmd.get_power(self.__cache, target)
            MicCmd.set_power(self.__cache, self.fcp, target, val)
            val = MicCmd.get_polarity(self.__cache, target)
            MicCmd.set_polarity(self.__cache, self.fcp, target, val)

        for target in InputCmd.get_in_labels():
            val = InputCmd.get_soft_limit(self.__cache, target)
            InputCmd.set_soft_limit(self.__cache, self.fcp, target, val)
            val = InputCmd.get_attr(self.__cache, target)
            InputCmd.set_attr(self.__cache, self.fcp, target, val)

        for target in OutputCmd.get_target_labels():
            val = OutputCmd.get_attr(self.__cache, target)
            OutputCmd.set_attr(self.__cache, self.fcp, target, val)

        for target in MixerCmd.get_target_labels():
            for src in MixerCmd.get_src_labels():
                vals = MixerCmd.get_src_gain(self.__cache, target, src)
                MixerCmd.set_src_gain(self.__cache, self.fcp, target, src,
                                      *vals)

        for target in RouteCmd.get_out_labels():
            src = RouteCmd.get_out_src(self.__cache, target)
            RouteCmd.set_out_src(self.__cache, self.fcp, target, src)
        for target in RouteCmd.get_cap_labels():
            src = RouteCmd.get_cap_src(self.__cache, target)
            RouteCmd.set_cap_src(self.__cache, self.fcp, target, src)
        for target in RouteCmd.get_hp_labels():
            src = RouteCmd.get_hp_src(self.__cache, target)
            RouteCmd.set_hp_src(self.__cache, self.fcp, target, src)

        params = SpdifResampleCmd.get_params(self.__cache)
        SpdifResampleCmd.set_params(self.__cache, self.fcp, *params)
 def get_phantom_power(self, target):
     return MicCmd.get_power(self.__cache, target)
 def set_phantom_power(self, target, enable):
     MicCmd.set_power(self.__cache, self.fcp, target, enable)
     self.__save_cache()
 def get_polarity(self, target):
     return MicCmd.get_polarity(self.__cache, target)
 def set_polarity(self, target, invert):
     MicCmd.set_polarity(self.__cache, self.fcp, target, invert)
     self.__save_cache()
 def get_mic_labels(self):
     return MicCmd.get_mic_labels()