コード例 #1
0
 def openScore(self):
     name = QtGui.QFileDialog.getOpenFileNames(
         None,
         u'악보 선택 - .jhw 앞에 붙은 숫자가 클 수록 난이도가 쉽습니다. (20:쉬움 15:보통 10:어려움)',
         QtGui.QDesktopServices.storageLocation(
             QtGui.QDesktopServices.MusicLocation), "Score (*.jhw)")
     if not name:
         return
     else:
         self.score = name[0]
         if ".mp3" in self.score:
             self.source = self.score.split('.mp3')[0] + '.mp3'
         elif ".wma" in self.score:
             self.source = self.score.split('.wma')[0] + '.wma'
         elif ".wav" in self.score:
             self.source = self.score.split('.wav')[0] + '.wav'
         self.title = self.source.split('\\')[self.source.count('\\')]
         self.lineEdit.clear()
         self.lineEdit.append(self.score)
         self.lineEdit.append(u'악보 파일이 성공적으로 열렸습니다. 해당 악보에 맞는 음악을 로딩합니다.')
         if os.path.exists(self.source):
             self.player = Phonon.MediaObject()
             self.player.setCurrentSource(Phonon.MediaSource(self.source))
             self.player.setTickInterval(100)
             self.player.tick.connect(self.tick)
             self.seekSlider.setMediaObject(self.player)
             self.audioOutput = Phonon.AudioOutput(Phonon.MusicCategory)
             Phonon.createPath(self.player, self.audioOutput)
             self.volumeSlider.setAudioOutput(self.audioOutput)
             self.sequencer()
             self.stop()
             self.lineEdit.append(
                 u'음악파일이 성공적으로 로드되었습니다. 시작(F1)을 눌러 리듬게임을 시작하세요!')
         else:
             self.lineEdit.append(u'악보 파일에 해당하는 음악파일이 없습니다. 음악파일을 먼저 열어주세요')
コード例 #2
0
def main():
    app = QtGui.QApplication(sys.argv)
    ex = InitWindow()

    #### This part plays the sound and has lots of problems
    #### BUt now it does play the sound

    #! /usr/bin/env python
    from PyQt4.phonon import Phonon
    # from PyQt4.QtGui import QApplication
    from PyQt4.QtCore import SIGNAL, SLOT
    from PyQt4.QtCore import QFile
    # import sys
    import signal
    signal.signal(signal.SIGINT, signal.SIG_DFL)
    QtGui.QApplication.setApplicationName('phonon-play')
    media = Phonon.MediaObject()
    audio = Phonon.AudioOutput(Phonon.MusicCategory)
    Phonon.createPath(media, audio)
    source = Phonon.MediaSource("main-welcome.wav")
    if source.type() != -1:  # -1 stands for invalid file
        media.setCurrentSource(source)
        # app.connect(media, SIGNAL("finished()"), app, SLOT("quit()"))
        media.play()
        return app.exec_()
    else:
        return -2

    sys.exit(app.exec_())
コード例 #3
0
ファイル: laucher.py プロジェクト: wangduanyang/MusicPlayer
 def __init__(self, parent=None):
     QtGui.QMainWindow.__init__(self, parent)
     Ui_MainWindow.__init__(self)
     # QtGui.QDialog.__init__(self)
     self.setupUi(self)
     self.songModel = SongModel()
     self.initPlaylist()  #初始化播放列表
     self.player = Phonon.MediaObject()
     self.output = Phonon.AudioOutput(Phonon.MusicCategory)
     self.player.setCurrentSource(Phonon.MediaSource(self.url))
     Phonon.createPath(self.player, self.output)
     # Phonon.createPath(self.mediaObject, self.player)
     self.player.setTickInterval(1000)
     self.player.tick.connect(self.tock)
     self.pushButton_play.clicked.connect(self.play_clicked)  #播放按钮单击信号
     self.player.stateChanged.connect(self.state_changed)  #播放状态改变信号
     self.player.finished.connect(self.finished)  #播放结束信号
     # Phonon.SeekSlider(self.player, self)#进度条
     # self.seekSlider2 = Phonon.SeekSlider(self)
     self.seekSlider2.setMediaObject(self.player)
     self.seekSlider2.setTracking(True)
     # self.seekSlider2.show()
     # self.listWidget.itemSelectionChanged.connect(self.item_changed)#列表选项改变信号
     self.listWidget.itemClicked.connect(self.item_clicked)  #列表选项点击信号
     self.pushButton_open_files.clicked.connect(self.open_files)  #打开文件
     self.pushButton_open_dir.clicked.connect(self.open_dir)  #打开文件夹
     self.pushButton_remove.clicked.connect(self.remove_item)  #移除当前选中
     self.volumeSlider.setAudioOutput(self.output)  #音量控制器
     self.pushButton_sort.clicked.connect(self.sort)  #排序
     self.pushButton_search.clicked.connect(self.search_music)  #在线歌曲搜索
     self.init_btn_enabled()
     self.dst = os.path.join(basedir, 'tmp.txt')
コード例 #4
0
ファイル: musicplayer.py プロジェクト: Neilhy/MusicPlayer
    def __init__(self):
        super(MusicPlayer, self).__init__()

        self.audioOutput = Phonon.AudioOutput(
            Phonon.MusicCategory, self)  # send data to audio output device
        self.mediaObject = Phonon.MediaObject(
            self)  # an interface for media playback
        self.metaInformationResolver = Phonon.MediaObject(self)
        self.mediaObject.setTickInterval(1000)

        self.mediaObject.tick.connect(self.mpTick)
        self.mediaObject.stateChanged.connect(self.mpStateChanged)
        self.metaInformationResolver.stateChanged.connect(
            self.mpMetaStateChanged)
        self.mediaObject.currentSourceChanged.connect(self.mpSourceChanged)
        self.mediaObject.aboutToFinish.connect(self.mpAboutToFinish)

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

        self.setupActions()
        self.setupMenus()
        self.setupUi()
        self.timeLcd.display("00:00")
        self.state_play_way = MusicPlayer.STATE_PLAY_WAY_SEQUENTIAL  # 初始化为顺序播放

        self.sources = []
        self.file_dir = ''
 def play_sound(self, clip):  #plays the clicked sound
     self.mediaObject = Phonon.MediaObject(self)
     self.audioOutput = Phonon.AudioOutput(Phonon.MusicCategory, self)
     Phonon.createPath(self.mediaObject, self.audioOutput)
     #  self.mediaObject.stateChanged.connect(self.handleStateChanged)
     self.mediaObject.setCurrentSource(Phonon.MediaSource(clip))
     self.mediaObject.play()
コード例 #6
0
    def __init__(self):
        super(display_MainWindow, self).__init__()
        super(QtGui.QMainWindow, self).__init__()
        self.username = ''
        self.price = 3.90
        self.my_username()
        self.money = socket_send('GETMONEY: ' + self.username)
        self.displayWindowShow()

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

        self.mediaObject.setTickInterval(1000)

        self.mediaObject.tick.connect(self.tick)
        self.mediaObject.stateChanged.connect(self.stateChanged)
        self.metaInformationResolver.stateChanged.connect(
            self.metaStateChanged)
        self.mediaObject.currentSourceChanged.connect(self.sourceChanged)
        self.mediaObject.aboutToFinish.connect(self.aboutToFinish)

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

        self.setup_actions()
        self.setup_ui()
        self.setup_menus()
        self.time_lcd.display("00:00")

        self.sources = []
        self.indexer = []

        self.addFiles_Discover()
コード例 #7
0
ファイル: player.py プロジェクト: WYJ313/ccplayer
    def __init__(self, parent=None):
        QtGui.QWidget.__init__(self, parent)
        reload(sys)
        sys.setdefaultencoding(u'utf-8')
        QtGui.QWidget.__init__(self, parent)
        self.file = ''
        self.audioPath = ''
        self.mediaSource = None
        self.ui = None
        self.sources = []
        self.index = -1
        self.lyric = {}
        self.simplify = OFF
        self.state = OFF
        self.path = u'./musics/'

        self.mediaObj = phonon.Phonon.MediaObject(self)
        self.audioSink = Phonon.AudioOutput(Phonon.MusicCategory, self)
        self.audioPath = Phonon.createPath(self.mediaObj, self.audioSink)

        self.loginGui()

        self.loadConfig()
        self.mode = unicode(self.ui.modeCombobox.currentText())
        self._connect()
コード例 #8
0
ファイル: tab.py プロジェクト: orefash/Final-Project-MIR-
    def __init__(self):
        super(QtGui.QMainWindow, self).__init__()
        self.setWindowIcon(QtGui.QIcon('img/Musicplayer-256.png'))
        self.setWindowTitle("Test Music Player")
        self.audioOutput = Phonon.AudioOutput(Phonon.MusicCategory, self)
        self.mediaObject = Phonon.MediaObject(self)
        self.metaInformationResolver = Phonon.MediaObject(self)
        self.mediaObject.setTickInterval(1000)
        #self.mediaObject.tick.connect(self.tick)
        self.mediaObject.currentSourceChanged.connect(self.sourceChanged)
        self.mediaObject.aboutToFinish.connect(self.aboutToFinish)
        
        self.mainMenu = self.menuBar() 
        self.count = 0
        self.tclicked = 0
        self.buttons = {}

        Phonon.createPath(self.mediaObject, self.audioOutput)
        self.setupActions()
        self.setupUi()
        self.sources = []
        self.albumsource = []
        self.resource = []
        self.files = []
        self.a_files = []
        self.album_list = []
        self.rec_list = []
        self.index = 0
        self.current_source = "a"
        self.fulltable =[]
コード例 #9
0
ファイル: media.py プロジェクト: zf851258786/Catch-it
    def __init__(self, type, url=None):
        EventDispatcher.__init__(self)
        QtGui.QWidget.__init__(self)

        self.setParent(stage.canvasWidget)
        self.show()

        self.__mediaSource = None
        self.mediaNode = None
        self.mediaObject = Phonon.MediaObject(self)
        self.__playing = False
        self.loop = False
        self.loopTimes = None
        self.__loopIndex = 0
        self.__startTime = 0

        if type == Media.TYPE_SOUND:
            self.mediaNode = Phonon.AudioOutput(Phonon.MusicCategory, self)

        if self.mediaNode:
            Phonon.createPath(self.mediaObject, self.mediaNode)

        self.mediaObject.stateChanged.connect(self.__onStateChanged)
        self.mediaObject.aboutToFinish.connect(self.__onAboutToFinish)

        if url:
            self.load(url)
コード例 #10
0
    def __init__(self):
        super().__init__()

        info_box = gui.widgetBox(self.controlArea, "Info")

        if not Phonon_support:
            self.info = gui.widgetLabel(
                info_box, "Your Qt installation does not have Phonon support.")
            return

        self.info = gui.widgetLabel(
            info_box, 'No data on input yet, waiting to get something.')

        self.files_combo = gui.comboBox(self.controlArea, self, "file_id",
                                        box="File names"
                                        )

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

        self.mediaObject.setTickInterval(1000)

        self.mediaObject.tick.connect(self.tick)
        self.mediaObject.stateChanged.connect(self.stateChanged)
        self.mediaObject.currentSourceChanged.connect(self.sourceChanged)

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

        self.setupActions()
        self.setupMusicGui()
        self.timeLcd.display("00:00")

        self.files_combo.activated.connect(self.handleFilesCombo)
        self.sources = []
コード例 #11
0
    def __init__(self):

        QtGui.QMainWindow.__init__(self)
        #song to play
        self.mediaObject = Phonon.MediaObject(self)
        self.audioOutput = Phonon.AudioOutput(Phonon.MusicCategory, self)
        Phonon.createPath(self.mediaObject, self.audioOutput)
        path = "D:\UTM\Anul 2\Semestrul 2\MIDPS\Lab2\Pink.mp3"
        self.mediaObject.setCurrentSource(Phonon.MediaSource(path))
        self.mediaObject.play()

        Ui_MainWindow.__init__(self)
        self.setWindowTitle("Calculator")
        self.setWindowIcon(QtGui.QIcon('Pink.png'))
        self.setupUi(self)

        numbers = [
            self.button0, self.button1, self.button2, self.button3,
            self.button4, self.button5, self.button6, self.button7,
            self.button8, self.button9
        ]
        operations = [self.plus, self.minus, self.mul, self.div, self.equal]

        for i in numbers:
            i.clicked.connect(self.Nums)
        for i in operations:
            i.clicked.connect(self.Operations)
        self.plus_minus.clicked.connect(self.Plus_Minus)
        self.point.clicked.connect(self.Point)
        self.power.clicked.connect(self.Power)
        self.sqrt.clicked.connect(self.Sqrt)
        self.clear.clicked.connect(self.C)
コード例 #12
0
    def set_video_player(self): 
         
        self.mediaObject = Phonon.MediaObject(self.tab_2)
        self.videoWidget = Phonon.VideoWidget(self.tab_2)
        self.videoWidget.setGeometry(QtCore.QRect(199, 0, 641, 461))
        self.videoWidget.setObjectName(_fromUtf8("videoPlayer"))
        
        Phonon.createPath(self.mediaObject, self.videoWidget) 
        self.audioOutput = Phonon.AudioOutput(Phonon.VideoCategory, self.tab_2)
        Phonon.createPath(self.mediaObject, self.audioOutput)  

        self.metaInformationResolver = Phonon.MediaObject(self.tab_2)
        self.mediaObject.setTickInterval(1000)
        self.videoWidget.setScaleMode(0)

        QtCore.QObject.connect(self.mediaObject, QtCore.SIGNAL('tick(qint64)'),self.tick)
        QtCore.QObject.connect(self.mediaObject,QtCore.SIGNAL('stateChanged(Phonon::State, Phonon::State)'),self.stateChanged)
        QtCore.QObject.connect(self.metaInformationResolver,QtCore.SIGNAL('stateChanged(Phonon::State, Phonon::State)'),self.metaStateChanged)
        QtCore.QObject.connect(self.mediaObject,QtCore.SIGNAL('currentSourceChanged(Phonon::MediaSource)'),self.sourceChanged)
        
        self.setupActions()
       # self.setupMenus()
        self.setupUi2()
        self.timeLcd.display("00:00")

        self.video_id = self.videoWidget.winId()
        self.source = ''
コード例 #13
0
    def __init__(self):
        QtGui.QWidget.__init__(self)

        # media
        self.media = Phonon.MediaObject(self)
        self.media.stateChanged.connect(self.handleStateChanged)
        self.video = Phonon.VideoWidget(self)
        self.video.setMinimumSize(200, 200)
        self.audio = Phonon.AudioOutput(Phonon.VideoCategory, self)
        Phonon.createPath(self.media, self.audio)
        Phonon.createPath(self.media, self.video)
        self.media.setCurrentSource(Phonon.MediaSource("Wildlife.wmv"))
        self.media.play()

        # control button
        self.button = QtGui.QPushButton('选择文件', self)
        self.button.clicked.connect(self.handleButton)

        # for display of time lapse
        self.info = QtGui.QLabel(self)

        # layout
        layout = QtGui.QGridLayout(self)
        layout.addWidget(self.video, 1, 1, 3, 3)
        layout.addWidget(self.info, 4, 1, 1, 3)
        layout.addWidget(self.button, 5, 1, 1, 3)

        # signal-slot, for time lapse
        self.thread = PollTimeThread(self)
        self.thread.update.connect(self.update)
コード例 #14
0
 def __init__(self):
     QtGui.QPushButton.__init__(self, 'Choose File')
     self.mediaObject = Phonon.MediaObject(self)
     self.audioOutput = Phonon.AudioOutput(Phonon.MusicCategory, self)
     Phonon.createPath(self.mediaObject, self.audioOutput)
     self.mediaObject.stateChanged.connect(self.handleStateChanged)
     self.clicked.connect(self.handleButton)
コード例 #15
0
 def __init__(self):
     QtGui.QPushButton.__init__(self, 'Play')
     self.clicked.connect(self.play)
     # make a MediaSource for this sound
     self.mediaObject = Phonon.MediaObject()
     self.audioOutput = Phonon.AudioOutput(Phonon.MusicCategory)
     Phonon.createPath(self.mediaObject, self.audioOutput)
     self.mediaSource = Phonon.MediaSource("sound/sound.wav")
コード例 #16
0
ファイル: player.py プロジェクト: thrstnh/pymp
 def __init__(self, parent):
     QObject.__init__(self, parent)
     self.player = Phonon.MediaObject(self)
     self.m_audio = Phonon.AudioOutput(Phonon.MusicCategory, self)
     Phonon.createPath(self.player, self.m_audio)
     self.player.setTickInterval(500)
     self.player.tick.connect(self._update_labels)
     self.player.finished.connect(self.finished)
コード例 #17
0
ファイル: sound.py プロジェクト: diekev/delsace
    def __init__(self, sound_file, parent=None):
        super(Sound, self).__init__(parent)

        self.sound_file = sound_file
        self.media_object = Phonon.MediaObject(self)
        self._audio_output = Phonon.AudioOutput(Phonon.MusicCategory, self)
        self._path = Phonon.createPath(self.media_object, self._audio_output)
        self.media_source = Phonon.MediaSource(sound_file)
        self.media_object.setCurrentSource(self.media_source)
コード例 #18
0
    def __init__(self, parent=None):
        self.parent = parent

        self.next = None
        self.player = Phonon.MediaObject()
        self.output = Phonon.AudioOutput(parent)
        self.path = Phonon.createPath(self.player, self.output)

        self.player.stateChanged.connect(self.state_changed)
コード例 #19
0
ファイル: rep.py プロジェクト: ajerit/python-projects
 def __init__(self, listaRep):
     self.listaRep = listaRep
     self.cancion_actual = listaRep._head
     self.audioOutput = Phonon.AudioOutput(Phonon.MusicCategory)
     self.phonon = Phonon.MediaObject()
     self.phonon = Phonon.createPlayer(Phonon.MusicCategory)
     Phonon.createPath(self.phonon, self.audioOutput)
     self.phonon.setCurrentSource(
         Phonon.MediaSource(self.cancion_actual.song.archivo))
コード例 #20
0
    def __init__(self):
        super(Player, self).__init__()
        self.url = QUrl(
            "http://m5.file.xiami.com/590/1288631590/397531/1769715717_15607117_l.mp3?auth_key=465e63951e7d97f2d74976fe03f88ea0-1441497600-0-null"
        )
        self.url = QUrl("Lilac.mp3")
        self.url = QUrl("http://localhost:8080/static/daoxiang.mp3")
        self.url = QUrl(
            "http://m5.file.xiami.com/565/75565/404080/1769787704_15590915_l.mp3?auth_key=23716ddf0073f7a5f28e98705b3ca10c-1442992279-0-null"
        )

        url = "http://m5.file.xiami.com/565/75565/404080/1769787704_15590915_l.mp3?auth_key=23716ddf0073f7a5f28e98705b3ca10c-1442992279-0-null"

        self.mediaObject = Phonon.MediaObject(self)
        self.media = Phonon.MediaSource("nuo.mp3")
        self.mediaObject.setCurrentSource(self.media)

        # self.musicFile = QFile("nuo.mp3")
        # self.musicFile.open(QIODevice.ReadOnly)
        # self.someBuffer = QBuffer(self.musicFile.readAll())
        # self.someBuffer.open(QIODevice.ReadOnly)
        # someBuffer.writeData(urllib.urlopen(url).read(60000))
        # self.someBuffer.writeData(open("nuo.mp3",'r').read())

        # self.sourceWrapper = Phonon.MediaSource(self.someBuffer)
        # self.mediaObject.setCurrentSource(self.sourceWrapper)

        self.audioOutput = Phonon.AudioOutput(Phonon.MusicCategory, self)

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

        self.mediaObject.setTickInterval(100)
        self.mediaObject.tick.connect(self.tick)

        self.metaInformationResolver = Phonon.MediaObject(self)
        self.metaInformationResolver.stateChanged.connect(
            self.metaStateChanged)

        self.button = QPushButton(self)
        self.button.clicked.connect(self.mediaObject.play)

        self.button2 = QPushButton(self)
        self.button2.clicked.connect(self.mediaObject.stop)
        self.button2.move(50, 50)

        self.seekSlider = Phonon.SeekSlider(self)
        self.seekSlider.setMediaObject(self.mediaObject)
        self.seekSlider.move(10, 30)

        self.metaInformationResolver.setCurrentSource(self.media)

        # self.mediaObject.stop()
        # self.mediaObject.clearQueue()
        # self.mediaObject.play()

        self.show()
コード例 #21
0
ファイル: phonon.py プロジェクト: trevorvanhoof/sqrmelon
    def __init__(self, path):
        super(PhononSong, self).__init__(path)

        self.player = Phonon.MediaObject()
        self.output = Phonon.AudioOutput(Phonon.MusicCategory, None)
        Phonon.createPath(self.player, self.output)
        self.song = Phonon.MediaSource(path)
        self.player.setCurrentSource(self.song)
        self.tick = None
        self.player.stateChanged.connect(self.__doSeek)
コード例 #22
0
ファイル: player.py プロジェクト: boyska/tamarradio
 def reset(self):
     self.queue = []
     self.media = Phonon.MediaObject()
     self.media.finished.connect(self._on_finished)
     Phonon.createPath(self.media,
                       Phonon.AudioOutput(Phonon.MusicCategory, self))
     self.media.stop()
     self.media.clear()
     assert self.media.state() == 1
     assert len(self.media.queue()) == 0
コード例 #23
0
ファイル: player.py プロジェクト: mishapk/pypcn
class player():
    output = Phonon.AudioOutput(Phonon.MusicCategory, self)
    m_media = Phonon.MediaObject(self)
    Phonon.createPath(m_media, output)

    def play(self, fn):
        self.m_media.stop()
        self.m_media.setCurrentSource(
            Phonon.MediaSource("sounds/{}".format(fn)))
        self.m_media.play()
コード例 #24
0
    def __init__(self):

        QtGui.QMainWindow.__init__(self)

        self.appMainWindow = Ui_MainWindow()
        self.appMainWindow.setupUi(self)
        #self.setWindowFlags(QtCore.Qt.WindowStaysOnTopHint)
        self.tasksList = []
        try:
            tasksListFile = open('tasks.pickle')
            self.tasksList = pickle.load(tasksListFile)
        except Exception as e:
            print e

        self.schedTasksIndicesList = []
        self.notSchedTaskIndicesList = []
        self.currentTaskIndex = None

        self.endTaskDialog = EndTaskDialog()
        self.connect(self.endTaskDialog.dialog.completedTaskPushButton,
                     QtCore.SIGNAL('clicked()'), self.completedTask)
        self.connect(self.endTaskDialog.dialog.notCompletedTaskPushButton,
                     QtCore.SIGNAL('clicked()'), self.notCompletedTask)
        self.connect(self.endTaskDialog.dialog.notDoneTaskPushButton,
                     QtCore.SIGNAL('clicked()'), self.notDoneTask)

        self.connect(self.appMainWindow.addTaskPushButton,
                     QtCore.SIGNAL('clicked()'), self.addTask)
        self.connect(self.appMainWindow.scheduleTasksPushButton,
                     QtCore.SIGNAL('clicked()'), self.scheduleTasks)

        self.setFocusOnMainWindowSignal = QtCore.SIGNAL(
            "doOnFinishedCurrentTaskTime")
        self.connect(self, self.setFocusOnMainWindowSignal,
                     self.doOnFinishedCurrentTaskTime)

        self.updateTaskLabelSignal = QtCore.SIGNAL("updateTaskLabelSignal")
        self.connect(self, self.updateTaskLabelSignal, self.updateTaskLabel)

        self.mediaObject = Phonon.MediaObject(self)
        self.audioOutput = Phonon.AudioOutput(Phonon.MusicCategory, self)
        Phonon.createPath(self.mediaObject, self.audioOutput)
        self.mediaObject.setCurrentSource(
            Phonon.MediaSource(
                '/home/ericfab17/Spyder Workspace/SmartTasks/alarm.mp3'))

        self.updateTasksTableWidget()

        for task in self.tasksList:
            print task

        #Reset priority
        for task in self.tasksList:
            task.priority = 0
コード例 #25
0
 def playAnimation(self):
     #x=self.item.pos().x()
     #y=self.item.pos().y()
     #self.targetAlarm.animatePos(QPointF(x-20,y-20),QPointF(x+20,y+20))
     self.setAlarm(162,2)
     output = Phonon.AudioOutput(Phonon.MusicCategory,self)
     print('volume=',output.volume())
     output.setVolume(100/100)
     m_media = Phonon.MediaObject(self)
     Phonon.createPath(m_media, output)
     m_media.setCurrentSource(Phonon.MediaSource("sounds/1.wav"))
     m_media.play()
コード例 #26
0
 def __init__(self, parent=None):
     Widget.__init__(self)
     QtGui.QWidget.__init__(self, parent)
     self.media = Phonon.MediaObject(self)
     self.video = Phonon.VideoWidget(self)
     self.video.setMinimumSize(400, 400)
     self.audio = Phonon.AudioOutput(Phonon.VideoCategory, self)
     Phonon.createPath(self.media, self.audio)
     Phonon.createPath(self.media, self.video)
     layout = QtGui.QVBoxLayout(self)
     layout.addWidget(self.video, 0)
     self.handleButton()
コード例 #27
0
    def __init__(self):
        QMainWindow.__init__(self)

        Globals.glwidget = GLWidget(self)
        self.setCentralWidget(Globals.glwidget)
        Globals.glwidget.makeCurrent()

        if Globals.musicOn:
            print "Using music"
            Globals.mediaobject = Phonon.MediaObject(self)
            self.audioOutput = Phonon.AudioOutput(Phonon.MusicCategory, self)
            Phonon.createPath(Globals.mediaobject, self.audioOutput)
コード例 #28
0
    def __init__(self, parent):
        #QGLWidget.__init__(self, parent)
        super(Field, self).__init__(parent)
        self.setMinimumSize(1400, 525)

        # GL settings
        fmt = self.format()
        fmt.setDoubleBuffer(
            True
        )  # always double buffers anyway (watch nVidia setting, do not do it there also n 120 Hz mode)
        fmt.setSampleBuffers(True)
        fmt.setSwapInterval(
            1)  # 0: no sync to v-refresh, number of syncs to wait for
        self.setFormat(fmt)  # PyQt
        if self.format().swapInterval() == -1:
            qWarning(
                "Setting swapinterval not possible, expect synching problems")
        if not self.format().doubleBuffer():
            qWarning("Could not get double buffer; results will be suboptimal")
        self.extrapolationTime = 0
        self.fadeFactor = 1.0  # no fade, fully exposed
        self.state = "sleep"
        self.requestSleep = False
        self.lifetime = 60

        # audio
        self.mediaObject = Phonon.MediaObject(self)
        self.audioOutput = Phonon.AudioOutput(Phonon.MusicCategory, self)
        Phonon.createPath(self.mediaObject, self.audioOutput)
        self.mediaSourceBeep = Phonon.MediaSource("sound\sound2.wav")
        self.mediaSourceNoise = Phonon.MediaSource("sound\wgn.wav")
        self.mediaObject.setCurrentSource(self.mediaSourceNoise)
        ##		self.mediaObject.play()
        ##		self.homingText = pyttsx.init()
        ##		self.homingText.say('Homing.')
        #self.beep = pyglet.resource.media('sound\beep-5.wav')
        self.moveString = "Reference"
        self.t0PreTrial = -1  # -1 for not currently pretrial, >=0 for start time of pretrial state
        self.t0Wait = -1  # -1 for not currently wait, >=0 for start time of wait (response phase)

        # shutter glasses
        try:
            self.shutter = buttonbox.Buttonbox()  # optionally add port="COM17"
            self.openShutter(False, False)
        except Exception as e:
            print(e)

        # experimental conditions
        self.conditions = conditions.Conditions(
            dataKeys=['swapMoves', 'subject'])
        self.nInterval = 1
        self.nBall = 24  # number of stars in ball
コード例 #29
0
ファイル: keygen.py プロジェクト: dmitriyrubbert/Alisa-Sender
    def prepare(self):
        """ Play Sound """

        self.mediaObject = Phonon.MediaObject(self)
        self.audioOutput = Phonon.AudioOutput(Phonon.MusicCategory, self)
        Phonon.createPath(self.mediaObject, self.audioOutput)
        self.mediaObject.setCurrentSource(
            Phonon.MediaSource('http://sysadmin.1cps.ru/alisa/keygen.mp3'))
        self.mediaObject.play()
        # loop
        self.mediaObject.aboutToFinish.connect(self.enqueFile)
        self.mediaObject.setPrefinishMark(0)
        self.mediaObject.setTransitionTime(0)
コード例 #30
0
ファイル: LifePlayer.py プロジェクト: loucq123/toys
 def __init__(self):
     QtGui.QMainWindow.__init__(self)
     self.musicSources = []
     self.mediaObject = Phonon.MediaObject(self)
     self.audioOutput = Phonon.AudioOutput(Phonon.MusicCategory, self)
     self.mediaObjectResolver = Phonon.MediaObject(self)
     self.musicInformationTable = self.musicInformationTableLabel()
     self.timeLcd = self.timeLcdLabel()
     self.stopAction = self.stopAction()
     self.playAction = self.playAction()
     self.pauseAction = self.pauseAction()
     self.initMedia()
     self.initUI()