Removed sound support

This commit is contained in:
Uriziel 2013-01-09 22:24:45 +01:00
parent af8ee57cd2
commit 405d3baf50
5 changed files with 1 additions and 46 deletions

View File

@ -34,14 +34,11 @@ client:
echo '#!/bin/sh\npython -OO $(LIB_PATH)/syncplay/syncplayClient.py "$$@"' > $(BIN_PATH)/syncplay echo '#!/bin/sh\npython -OO $(LIB_PATH)/syncplay/syncplayClient.py "$$@"' > $(BIN_PATH)/syncplay
chmod a+x $(BIN_PATH)/syncplay chmod a+x $(BIN_PATH)/syncplay
cp syncplayClient.py $(LIB_PATH)/syncplay/ cp syncplayClient.py $(LIB_PATH)/syncplay/
-mkdir -p $(LIB_PATH)/syncplay/resources
cp resources/buzzer.wav $(LIB_PATH)/syncplay/resources/
cp resources/syncplay.desktop $(APP_SHORTCUT_PATH)/ cp resources/syncplay.desktop $(APP_SHORTCUT_PATH)/
u-client: u-client:
-rm $(BIN_PATH)/syncplay -rm $(BIN_PATH)/syncplay
-rm $(LIB_PATH)/syncplay/syncplayClient.py -rm $(LIB_PATH)/syncplay/syncplayClient.py
-rm -rf $(LIB_PATH)/syncplay/resources
-rm $(APP_SHORTCUT_PATH)/syncplay.desktop -rm $(APP_SHORTCUT_PATH)/syncplay.desktop
server: server:

Binary file not shown.

View File

@ -170,7 +170,6 @@
Delete "$INSTDIR\lib\API-MS-Win-Core-Profile-L1-1-0.dll" Delete "$INSTDIR\lib\API-MS-Win-Core-Profile-L1-1-0.dll"
Delete "$INSTDIR\lib\winsound.pyd" Delete "$INSTDIR\lib\winsound.pyd"
Delete "$INSTDIR\resources\icon.ico" Delete "$INSTDIR\resources\icon.ico"
Delete "$INSTDIR\resources\buzzer.wav"
RMDir "$INSTDIR\lib" RMDir "$INSTDIR\lib"
RMDir "$INSTDIR\pyt" RMDir "$INSTDIR\pyt"
RMDir "$INSTDIR\resources" RMDir "$INSTDIR\resources"
@ -285,7 +284,6 @@
SetOutPath $INSTDIR\resources SetOutPath $INSTDIR\resources
File "${SYNCPLAY}\resources\icon.ico" File "${SYNCPLAY}\resources\icon.ico"
File "${SYNCPLAY}\resources\buzzer.wav"
SectionEnd SectionEnd

View File

@ -6,7 +6,6 @@ from twisted.internet.protocol import ClientFactory
from twisted.internet import reactor, task from twisted.internet import reactor, task
from syncplay.protocols import SyncClientProtocol from syncplay.protocols import SyncClientProtocol
from syncplay import utils, constants from syncplay import utils, constants
from syncplay.ui import sound
from syncplay.messages import getMessage from syncplay.messages import getMessage
class SyncClientFactory(ClientFactory): class SyncClientFactory(ClientFactory):
@ -196,8 +195,7 @@ class SyncplayClient(object):
if (paused == False and roomFilesDiffer): if (paused == False and roomFilesDiffer):
self.userlist.roomCheckedForDifferentFiles() self.userlist.roomCheckedForDifferentFiles()
self._player.displayMessage(getMessage("en", "room-files-not-same"), constants.DIFFERENT_FILE_MESSAGE_DURATION) self._player.displayMessage(getMessage("en", "room-files-not-same"), constants.DIFFERENT_FILE_MESSAGE_DURATION)
sound.doBuzz()
def _changePlayerStateAccordingToGlobalState(self, position, paused, doSeek, setBy): def _changePlayerStateAccordingToGlobalState(self, position, paused, doSeek, setBy):
madeChangeOnPlayer = False madeChangeOnPlayer = False
pauseChanged = paused != self.getGlobalPaused() pauseChanged = paused != self.getGlobalPaused()

View File

@ -1,38 +0,0 @@
try:
import winsound
except ImportError:
winsound = None
try:
import alsaaudio
import wave
except ImportError:
alsaaudio = None
from syncplay import utils
def doBuzz():
if(winsound):
buzzPath = utils.findWorkingDir() + "\\resources\\buzzer.wav"
winsound.PlaySound(buzzPath, winsound.SND_FILENAME|winsound.SND_ASYNC)
elif(alsaaudio):
buzzPath = utils.findWorkingDir() + "/resources/buzzer.wav"
print buzzPath
try:
buzz = wave.open(buzzPath, 'rb')
device = alsaaudio.PCM(0)
device.setchannels(buzz.getnchannels())
device.setrate(buzz.getframerate())
if buzz.getsampwidth() == 1:
device.setformat(alsaaudio.PCM_FORMAT_U8)
elif buzz.getsampwidth() == 2:
device.setformat(alsaaudio.PCM_FORMAT_S16_LE)
else:
raise ValueError('Unsupported buzzer format')
device.setperiodsize(640)
data = buzz.readframes(640)
while data:
device.write(data)
data = buzz.readframes(640)
buzz.close()
except IOError:
pass