# the Free Software Foundation, either version 3 of the License, or # any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. import deepin_pulseaudio import deepin_pulseaudio_signal import gobject deepin_pulseaudio_obj = deepin_pulseaudio.new() deepin_pulseaudio_obj.get_devices() deepin_pulseaudio_signal_obj = deepin_pulseaudio_signal.new() deepin_pulseaudio_signal_obj.connect_to_pulse() def m_sink_new_cb(index): print "DEBUG sink new callback", index def m_sink_changed_cb(handle, index): print "DEBUG sink changed callback", handle, index def m_sink_removed_cb(index): print "DEBUG sink remove callback", index def m_source_new_cb(index):
# # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. try: import deepin_pulseaudio except ImportError: print "----------Please Install Deepin Pulseaudio Python Binding----------" print "git clone [email protected]:linuxdeepin/pypulseaudio.git" print "------------------------------------------------------------------" exit(1) MAX_VOLUME_VALUE = deepin_pulseaudio.VOLUME_UI_MAX NORMAL_VOLUME_VALUE = deepin_pulseaudio.VOLUME_NORM PULSE = deepin_pulseaudio.new() PULSE.get_devices() PULSE.connect_to_pulse() def get_volume_balance(channel_num, volume_list, channel_list): return deepin_pulseaudio.volume_get_balance(channel_num, volume_list, channel_list) def get_fallback_sink_index(): name = PULSE.get_fallback_sink() dev = PULSE.get_output_devices() for key in dev.keys(): if name == dev[key]['name']: return key
# # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. try: import deepin_pulseaudio except ImportError: print "----------Please Install Deepin Pulseaudio Python Binding----------" print "git clone [email protected]:linuxdeepin/pypulseaudio.git" print "------------------------------------------------------------------" exit(1) MAX_VOLUME_VALUE = deepin_pulseaudio.VOLUME_UI_MAX NORMAL_VOLUME_VALUE = deepin_pulseaudio.VOLUME_NORM PULSE = deepin_pulseaudio.new() PULSE.get_devices() PULSE.connect_to_pulse() def get_volume_balance(channel_num, volume_list, channel_list): return deepin_pulseaudio.volume_get_balance(channel_num, volume_list, channel_list) def get_fallback_sink_index(): name = PULSE.get_fallback_sink() dev = PULSE.get_output_devices() for key in dev.keys(): if name == dev[key]['name']: return key return None def get_fallback_source_index():