From 3d1cb031e9ef60698c85707e7551f6ee2c9d87da Mon Sep 17 00:00:00 2001 From: Chris Ball Date: Fri, 14 Mar 2008 18:07:48 +0000 Subject: Look for the audio library in /home as well as /usr/share. --- (limited to 'library') diff --git a/library/pippy/sound.py b/library/pippy/sound.py index 05540e5..ff4d8e3 100755 --- a/library/pippy/sound.py +++ b/library/pippy/sound.py @@ -1,8 +1,8 @@ #! /usr/bin/env python +import os -# added frequency modulation genertor -# audioOut write a wave file if a string is given as argument - +dirs = ['/usr/share/activities/TamTamEdit.activity/common/Resources/Sounds/', + '/home/olpc/Activities/TamTamEdit.activity/common/Resources/Sounds/'] orchlines = [] scorelines = [] instrlist = [] @@ -16,6 +16,11 @@ def quit(self): cs = None """ +def finddir(): + for d in dirs: + if os.path.isdir(d): + return d + def defAdsr(attack=0.01, decay=0.1, sustain=0.8, release=0.1): """Define an ADSR envelope. fnum = defADSR(attack = [0.01], decay = [0.1], sustain = [0.8], release = [0.1])""" att = int(2048 * attack) @@ -144,7 +149,7 @@ def playPluck( pitch=100, amplitude=5000, duration=2, starttime=0, pitch_envelop def playWave(sound='horse', pitch=1, amplitude=1, loop=False, duration=1, starttime=0, pitch_envelope='default', amplitude_envelope='default'): """Play a wave file (sound = ['horse'], pitch = [1], amplitude = [1], loop = [False], duration = [1], starttime = [0], pitch_envelope=['default'], amplitude_envelope=['default'])""" - fullname = '/usr/share/activities/TamTamEdit.activity/common/Resources/Sounds/' + str(sound) + fullname = finddir() + str(sound) if loop == False: lp = 0 else: lp = 1 @@ -168,7 +173,7 @@ def playWave(sound='horse', pitch=1, amplitude=1, loop=False, duration=1, startt def getSoundList(): import os - return sorted(os.listdir('/usr/share/activities/TamTamEdit.activity/common/Resources/Sounds/')) + return sorted(os.listdir(finddir())) temp_path=None def audioOut(file=None): -- cgit v0.9.1