當前位置: 首頁>>代碼示例>>Python>>正文


Python phonon.Phonon類代碼示例

本文整理匯總了Python中PySide.phonon.Phonon的典型用法代碼示例。如果您正苦於以下問題:Python Phonon類的具體用法?Python Phonon怎麽用?Python Phonon使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了Phonon類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: init

 def init(self, prefinishMark):
     self.audioOutput = Phonon.AudioOutput(Phonon.MusicCategory, self.app)
     self.player = Phonon.MediaObject(self.app)
     self.player.setPrefinishMark(prefinishMark)
     self.player.setTickInterval(1000)
     Phonon.createPath(self.player, self.audioOutput)
     self._bindEvents()
開發者ID:Aleksandre,項目名稱:YAM,代碼行數:7,代碼來源:player.py

示例2: go

    def go(self, what2do, folder):
        '''This function is called from javascript when clicking
        the tracks, info or play all buttons'''

        print('what 2 to',str(what2do))
        
        what2do = str(what2do)
        # stop playback when exiting the page
        self.eval_js(self.doc,
            '''window.addEventListener("unload", setup_files.stop, false);''')

        if what2do == 'play_all':
            tracks, folder_wrapper = self.get_folder_tracks(folder)
            self.curtrack = 0
            self.playlist = tracks
            self.cur_folder = folder_wrapper
            self.create_player()
            self.create_buttons_events()
            
            self.media_object = Phonon.MediaObject(self)
            self.audio = Phonon.AudioOutput(Phonon.MusicCategory)
            self.media_object.setTickInterval(1000)

            self.media_object.tick.connect(self.draw_time)
            self.media_object.stateChanged.connect(self.stateChanged)
            self.media_object.finished.connect(self.next)

            Phonon.createPath(self.media_object, self.audio)
        if what2do == 'show_info':
            self.show_hide_info(folder,'div.info')
        if what2do == 'show_tracks':
            self.show_hide_info(folder,'div.files_table_wrapper')
開發者ID:antonioforte,項目名稱:Soundsz,代碼行數:32,代碼來源:play_files.py

示例3: __init__

    def __init__(self,parent=None):
        QtGui.QWidget.__init__(self,parent)
        self.ui=Ui_toolBoxWidget()
        self.ui.setupUi(self)
#        volumeSlider_bombMusic
        self.media = Phonon.MediaObject(self)
        self.media.setCurrentSource(Phonon.MediaSource())
        self.media.setTickInterval(10)
        
        self.output = Phonon.AudioOutput(Phonon.MusicCategory, self)
        Phonon.createPath(self.media, self.output)
        
        self.ui.volumeSlider_music.setAudioOutput(self.output)
        
        self.ui.seekSlider_musicProgress.setMediaObject(self.media)
        
        self.ui.lcdNumber.display("00:00")
        
        
        self.media.stateChanged.connect(self.stateChanged)
        self.media.tick.connect(self.tick)
        
        self.ui.pushButton_musicPlay.clicked.connect(self.changePlayPause)
        self.ui.pushButton_musicStop.clicked.connect(self.changeStop)
        self.ui.timeEdit_music.timeChanged.connect(self.timeEditTimeChanged)
        
        self.path = None
        self.signal = FileChoosedSignal()
開發者ID:ShowingCloud,項目名稱:Capricorn,代碼行數:28,代碼來源:musicPlayer.py

示例4: __init__

    def __init__(self):
        super(MainWindow, self).__init__()


        self.media = Phonon.MediaObject(self)

        self.audio = Phonon.AudioOutput(Phonon.MusicCategory, self)
        self.video = Phonon.VideoWidget(self)
        self.metaInformationResolver = Phonon.MediaObject(self)

        Phonon.createPath(self.media, self.audio)
        Phonon.createPath(self.media, self.video)

        self.media.setTickInterval(1000)
        self.sources = []




        self.setupActions()
        self.setupConnections()
        self.setupUi()

        self.setWindowTitle("BLue PLayer")
        self.setMinimumSize(245,245)
        self.resize(680,400)
開發者ID:andarms,項目名稱:BluePlayer,代碼行數:26,代碼來源:rainbow.py

示例5: __init__

    def __init__(self):
        super(Tramendo, self).__init__()

        # Menu
        self.trayIconMenu = QMenu(self)

        # Build media player
        self.audioOuptut = Phonon.AudioOutput(Phonon.MusicCategory, self)
        self.player = Phonon.MediaObject(self)
        Phonon.createPath(self.player, self.audioOuptut)

        # Jamendo Actions
        self.jamendo = JamendoRadio()
        self.radioActions = QActionGroup(self)
        self.radioActions.setExclusive(True)
        self.radioActions.triggered.connect(self.play_stream_event)

        radio_stations = self.jamendo.get_radio_list()
        for radio in radio_stations:
            action = QAction(radio["dispname"], self)
            action.setCheckable(True)
            action.setData(radio["id"])
            self.radioActions.addAction(action)
            self.trayIconMenu.addAction(action)

        # Exit Action
        self.quitAction = QAction("&Exit", self)
        self.quitAction.triggered.connect(self.exit_event)
        self.trayIconMenu.addAction(self.quitAction)

        # Icon setting
        self.trayIcon = QSystemTrayIcon(self)
        self.trayIcon.setContextMenu(self.trayIconMenu)
        self.trayIcon.setIcon(QApplication.style().standardIcon(QStyle.SP_MediaPlay))
        self.trayIcon.show()
開發者ID:geduld,項目名稱:tramendo,代碼行數:35,代碼來源:main.py

示例6: play_sound

    def play_sound(self, alias):
        """ Plays a sound
        
        CHECK
        When exporting sound over HDMI, the first time the first sound is 
        played, the beginning of it gets cut off.

        It might be worth including a 1 millisecond silent .wave and playing 
        it with the volume turned to 0 on app load (init_sound() or some 
        such), to ensure the sound system has been initialized.  Or something.  

        This doesn't seem to happen when the sound is local.

        Arguments:
            alias (str): The name of a sound file alias as specified in a .qrc
                         file, eg "mysound.wav"
        """
        speakers = Phonon.AudioOutput(Phonon.MusicCategory, self)
        media   = Phonon.MediaObject(self)
        speakers.setVolume(0.5)
        Phonon.createPath(media, speakers)
        media.setCurrentSource( ":/{}".format(alias) )
        ### If we let the media file play all the way through, we get a nasty 
        ### static squelch at the end.  Set it to stop playing 30 milliseconds 
        ### before the end.
        media.setPrefinishMark(30)
        media.prefinishMarkReached.connect( media.stop )
        media.play()
開發者ID:miketwo,項目名稱:MontyLacuna,代碼行數:28,代碼來源:myapp.py

示例7: __init__

    def __init__(self, parent=None):
        super(Movie, self).__init__(parent)
        self.audioOutput = Phonon.AudioOutput(Phonon.VideoCategory)
        self.mediaObject = Phonon.MediaObject(self)
        self.mediaObject.setTickInterval(1)
        Phonon.createPath(self.mediaObject, self)
        Phonon.createPath(self.mediaObject, self.audioOutput)
        
        self.overlay = DrawWidge(self)
        self.overlay.resize(self.width(), self.height())
        self.overlay.hide()
        self.overlay_showing = False

        self.image = DrawWidge(self)
        self.image.resize(self.width(), self.height())
        self.image.hide()
        self.image_showing = False

        self.fulled = False

        self.subtitler = SubtitleWidge(self)
        self.subtitler.resize(self.width(), self.height())
        self.subtitler.hide()
        self.subtitler_showing = False

        self.save_timer = SaveCloser()
        self.save_timer.start()

        self.setupActions()
開發者ID:tml,項目名稱:SafetyPlay,代碼行數:29,代碼來源:PlaylistWindow.py

示例8: __init__

    def __init__(self):
        QtGui.QMainWindow.__init__(self)

        self.audioOutput = Phonon.AudioOutput(Phonon.MusicCategory, self)
        self.mediaObject = Phonon.MediaObject(self)
        self.metaInformationResolver = Phonon.MediaObject(self)

        self.mediaObject.setTickInterval(1000)

        self.connect(self.mediaObject, QtCore.SIGNAL('tick(qint64)'),
                self.tick)
        self.connect(self.mediaObject,
                QtCore.SIGNAL('stateChanged(Phonon::State, Phonon::State)'),
                self.stateChanged)
        self.connect(self.metaInformationResolver,
                QtCore.SIGNAL('stateChanged(Phonon::State, Phonon::State)'),
                self.metaStateChanged)
        self.connect(self.mediaObject,
                QtCore.SIGNAL('currentSourceChanged(Phonon::MediaSource)'),
                self.sourceChanged)
        self.connect(self.mediaObject, QtCore.SIGNAL('aboutToFinish()'),
                self.aboutToFinish)

        Phonon.createPath(self.mediaObject, self.audioOutput)

        self.setupActions()
        self.setupMenus()
        self.setupUi()
        self.timeLcd.display("00:00") 

        self.sources = []
開發者ID:AmerGit,項目名稱:Examples,代碼行數:31,代碼來源:musicplayer.py

示例9: initializeAudioPhonon

	def initializeAudioPhonon(self):
		
		if self.DEBUG:
			print "INFO: [Plugin:Orbit] Using Phonon Audio Framework"
		
		self.initializeAudioFilePath()
		
		self.media = Phonon.MediaObject()
		
		#print dir(self.media)
		
		audio = Phonon.AudioOutput(Phonon.MusicCategory)
		Phonon.createPath(self.media, audio)
		f = QtCore.QFile(self.audio_file)
		if f.exists():
			source = Phonon.MediaSource(self.audio_file)
			if source.type() != -1:                 # -1 stands for invalid file
				self.media.setCurrentSource(source)
				
				self.media.play()
				
			else:
				if self.DEBUG:
					print "ERROR: [Plugin:Orbit] Audio control file invalid:",
					print self.audio_file
		else:
			if self.DEBUG:
				print "ERROR: [Plugin:Orbit] Audio control file does not exist:,"
				print self.audio_file
開發者ID:PuzzleboxIO,項目名稱:orbit-python,代碼行數:29,代碼來源:Plugin_Orbit.py

示例10: __init__

 def __init__(self, parent=None):
     QMainWindow.__init__(self, parent)
     self.setWindowFilePath('No file')
     # the media object controls the playback
     self.media = Phonon.MediaObject(self)
     # the audio output does the actual sound playback
     self.audio_output = Phonon.AudioOutput(Phonon.MusicCategory, self)
     # a slider to seek to any given position in the playback
     self.seeker = Phonon.SeekSlider(self)
     self.setCentralWidget(self.seeker)
     # link media objects together.  The seeker will seek in the created
     # media object
     self.seeker.setMediaObject(self.media)
     # audio data from the media object goes to the audio output object
     Phonon.createPath(self.media, self.audio_output)
     # set up actions to control the playback
     self.actions = self.addToolBar('Actions')
     for name, label, icon_name in self.ACTIONS:
         icon = self.style().standardIcon(icon_name)
         action = QAction(icon, label, self)
         action.setObjectName(name)
         self.actions.addAction(action)
         if name == 'open':
             action.triggered.connect(self._ask_open_filename)
         else:
             action.triggered.connect(getattr(self.media, name))
     # whenever the playback state changes, show a message to the user
     self.media.stateChanged.connect(self._show_state_message)
開發者ID:MiguelCarrilhoGT,項目名稱:snippets,代碼行數:28,代碼來源:phonon_audio.py

示例11: __init__

 def __init__(self):
     super(Reproductor, self).__init__(parent=None)
     self.setWindowTitle("Python Simple Player")
     self.gridLayout = QtGui.QGridLayout(self)
     loader = QtUiTools.QUiLoader()
     # QtCore.QFile
     
     file = QtCore.QFile("repro.ui")
     file.open(QtCore.QFile.ReadOnly)
     self.ui = loader.load(file, self)
     file.close()
     self.gridLayout.addWidget(self.ui, 0, 0, 1, 1)
     # seccion multimedia
     self.audioOutput = Phonon.AudioOutput(Phonon.MusicCategory, self)
     self.mediaObject = Phonon.MediaObject(self)
     Phonon.createPath(self.mediaObject, self.audioOutput)
     self.mediaObject.setTickInterval(1000)
     #
     self.ui.lcdAvance.display("00:00")
     QtCore.QObject.connect(
         self.ui.btnArchivo,
         QtCore.SIGNAL("clicked()"),
         self.openFile)
     QtCore.QObject.connect(
         self.ui.btnPlay,
         QtCore.SIGNAL("clicked()"),
         self.play)
     self.mediaObject.tick.connect(self.alAvanzar)
     self.mediaObject.stateChanged.connect(self.alCambiarEstado)
開發者ID:nico4021,項目名稱:LNMusic,代碼行數:29,代碼來源:repro.py

示例12: getMusicTime

 def getMusicTime(self):
     from PySide.phonon import Phonon
     self.media2 = Phonon.MediaObject(self)
     self.media2.setCurrentSource(Phonon.MediaSource())
     self.media2.setCurrentSource(Phonon.MediaSource(self.path))
     output = Phonon.AudioOutput(Phonon.MusicCategory, self)
     Phonon.createPath(self.media2, output)
     self.media2.stateChanged.connect(self.stateChanged2)
開發者ID:ShowingCloud,項目名稱:Capricorn,代碼行數:8,代碼來源:LoginShow.py

示例13: __init__

	def __init__(self):
		self.backend = 'Phonon'
		QtCore.QObject.__init__(self)
		self.audioOuptut = Phonon.AudioOutput(Phonon.MusicCategory, self)
		self.player = Phonon.MediaObject(self)
		Phonon.createPath(self.player, self.audioOuptut)
		
		self.connectedWidgets = []
		self.player.aboutToFinish.connect(self.onPlaybackEnded)
開發者ID:yoann01,項目名稱:bullseye,代碼行數:9,代碼來源:phononplayer.py

示例14: __init__

	def __init__(self,audio=True,vibra=True):
		_d = NotifierDebug();
		self._d = _d.d;

		self.manager = MNotificationManager('wazappnotify','WazappNotify');
		self.vibra = vibra

		self.personalRingtone = WAConstants.DEFAULT_SOUND_NOTIFICATION;
		self.personalVibrate = True;
		self.groupRingtone = WAConstants.DEFAULT_SOUND_NOTIFICATION;
		self.groupVibrate = True;
		
		QCoreApplication.setApplicationName("Wazapp");


		self.audioOutput = Phonon.AudioOutput(Phonon.MusicCategory, None)
		self.mediaObject = Phonon.MediaObject(None)
		Phonon.createPath(self.mediaObject, self.audioOutput)		

		self.profileChanged(0, 0, self.getCurrentProfile(), 0)
		bus = dbus.SessionBus()
		mybus = bus.get_object('com.nokia.profiled', '/com/nokia/profiled')
		self.nface = dbus.Interface(mybus, 'com.nokia.profiled')
		self.nface.connect_to_signal("profile_changed", self.profileChanged)
		#prof = self.getCurrentProfile()
		#reply = self.nface.get_value(prof,"ringing.alert.volume");
		#self.currentProfile = prof
		#self.currentVolume = "1.0" if reply=="100" else "0." + reply
		#self._d("Checking current profile: " + prof + " - Volume: " + self.currentVolume)
		#self.audioOutput.setVolume(float(self.currentVolume))

		
		#self.newMessageSound = WAConstants.DEFAULT_SOUND_NOTIFICATION #fetch from settings
		self.devInfo = QSystemDeviceInfo();
		
		#self.devInfo.currentProfileChanged.connect(self.profileChanged);
		
		self.audio = True
		'''if audio:
			self.audio = QMediaPlayer(None,QMediaPlayer.LowLatency); 
			self.audio.setVolume(100);
		else:
			self.audio = False'''
			
		self.enabled = True
		self.notifications = {}
		

		# vibration comes too early here, now handled by ui.py when the message is already added in QML
		# well, the truth is that sound comes too late... :D
		#>> Any notification should be handler by the notifier, not UI :P I don't feel it's too early though,
		# but if necessary connect to a signal and vibrate from here.
		if self.vibra:
			self.vibra = QFeedbackHapticsEffect();
			self.vibra.setIntensity(1.0);
			self.vibra.setDuration(200);
開發者ID:AbinashBishoyi,項目名稱:wazapp,代碼行數:56,代碼來源:notifier.py

示例15: __init__

    def __init__(self, setup=False, **kwargs):
        QMainWindow.__init__(self)
        self.setWindowTitle('...')
        # time to syncronize plot and media object
        self.tShift = 0
        self.t = 0
        self.mpl = {}
        self.ca_widget_handle = []
        self.ca_bar_handle = []
        # bools to know if the timer is to be activated
        # refresh timer
        self.refresh = 15  # ms
        self.timer = QtCore.QTimer()
        self.timer.setInterval(self.refresh)
        self.lcd = QtGui.QLCDNumber(self)
        self.lcd.setDigitCount(5)
        self.lcd.display("{:+05.1f}".format(self.t))

        # phonon
        # the media object controls the playback
        self.media = Phonon.MediaObject(self)
        self.audio_output = Phonon.AudioOutput(Phonon.MusicCategory, self)
        self.seeker = Phonon.SeekSlider(self)
        self.seeker.setFixedHeight(35)
        self.seeker.setMediaObject(self.media)
        self.media.setTickInterval(20)
        # audio data from the media object goes to the audio output object
        Phonon.createPath(self.media, self.audio_output)
        # set up actions to control the playback
        ACTIONS = [
            ('play', 'Play', QStyle.SP_MediaPlay),
            ('pause', 'Pause', QStyle.SP_MediaPause),
            ('stop', 'Stop', QStyle.SP_MediaStop)]
        self.actions = self.addToolBar('Actions')
        for name, label, icon_name in ACTIONS:
            icon = self.style().standardIcon(icon_name)
            action = QtGui.QAction(icon, label, self, )
            action.setObjectName(name)
            self.actions.addAction(action)
            action.triggered.connect(getattr(self.media, name))
        self.actions.addSeparator()
        # show help
        helpAction = QtGui.QAction('&Help', self)
        helpAction.setObjectName(name)
        self.actions.addAction(helpAction)
        helpAction.triggered.connect(self.show_help)

        # layout
        self.vBox = QtGui.QVBoxLayout()
        hBox = QtGui.QHBoxLayout()
        hBox.addWidget(self.lcd)
        hBox.addWidget(self.seeker)
        self.vBox.addLayout(hBox)
        # finish setup
        if setup:
            self.setup(**kwargs)
開發者ID:e-sr,項目名稱:KG,代碼行數:56,代碼來源:widgets.py


注:本文中的PySide.phonon.Phonon類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。