Beispiel #1
0
 def __init__(self, specto):
     self.refresh = int(5000)
     self.name = "default"
     self.specto = specto
     self.timer_id = -1
     gnome.sound_init('localhost')
     global _            
Beispiel #2
0
 def __init__(self, specto):
     self.refresh = int(5000)
     self.name = "default"
     self.specto = specto
     self.timer_id = -1
     gnome.sound_init('localhost')
     global _
Beispiel #3
0
 def play_sound(self, path):
     try:
         # Gnome
         import gnome
         gnome.sound_init('localhost')
         gnome.sound_play(path)
     except ImportError:
         try:
             # Windows
             import winsound
             winsound.PlaySound(path, winsound.SND_FILENAME)
         except ImportError:
             # Unable to play sound
             logging.error('Unable to play sound. No player found.')
"""

import os
import sys

try:
    import gtk
    import gtk.glade
except:
    print "Text mode not ready yet, sorry!"
    sys.exit(0)

# Use gnome environment if it's possible, otherwise... IOError if the /dev/dsp is busy
try:
    import gnome
    gnome.sound_init('localhost')
    SOUND_ENV = 'gnome'
except:
    # Mabye have a IOError - know bug in env != gnome and win
    SOUND_ENV = 'standard'

import plugin.Plugin as loadPlugin

def playWave(fileName):
    """ Play wave file cross platform """
    if PLATFORM == 'nt':
        from winsound import PlaySound, SND_FILENAME, SND_ASYNC
        PlaySound(fileName, SND_FILENAME|SND_ASYNC)
    elif PLATFORM == 'posix' and SOUND_ENV == 'standard':
        from wave import open as waveOpen
        from ossaudiodev import open as ossOpen