diff options
author | C. Scott Ananian <cscott@laptop.org> | 2007-12-11 09:24:34 (GMT) |
---|---|---|
committer | C. Scott Ananian <cscott@laptop.org> | 2007-12-11 09:24:34 (GMT) |
commit | 9df72c5591aee015089a4e96f9403183262dcc01 (patch) | |
tree | 4a01e662068fe7977dbb4fd14e232fc7354863d4 /data/sound | |
parent | 90c54afd7ea81be376b078eb08b87e4f20e71dcf (diff) |
Factor out a pippy library, which programs can use with 'import pippy'.
The pygame portion of the library uses 'best practices' to avoid eating
up CPU, and pauses & suspends after 20 seconds of inactivity.
Diffstat (limited to 'data/sound')
-rw-r--r-- | data/sound/getSoundList | 7 | ||||
-rw-r--r-- | data/sound/playSine | 9 | ||||
-rw-r--r-- | data/sound/playWave | 9 | ||||
-rw-r--r-- | data/sound/sequence | 10 | ||||
-rw-r--r-- | data/sound/sndInfo | 8 |
5 files changed, 13 insertions, 30 deletions
diff --git a/data/sound/getSoundList b/data/sound/getSoundList index 215e97a..8d722bb 100644 --- a/data/sound/getSoundList +++ b/data/sound/getSoundList @@ -1,7 +1,4 @@ -import sys -from sugar.activity.activity import get_bundle_path -sys.path.append(get_bundle_path() + '/sound') -from sound import * +import pippy -for sound in getSoundList(): +for sound in pippy.sound.getSoundList(): print sound diff --git a/data/sound/playSine b/data/sound/playSine index cd97576..b68746c 100644 --- a/data/sound/playSine +++ b/data/sound/playSine @@ -1,8 +1,5 @@ -import sys -from sugar.activity.activity import get_bundle_path -sys.path.append(get_bundle_path() + '/sound') -from sound import * +import pippy -playSine() -audioOut() +pippy.sound.playSine() +pippy.sound.audioOut() diff --git a/data/sound/playWave b/data/sound/playWave index 27605bd..503b475 100644 --- a/data/sound/playWave +++ b/data/sound/playWave @@ -1,8 +1,5 @@ -import sys -from sugar.activity.activity import get_bundle_path -sys.path.append(get_bundle_path() + '/sound') -from sound import * +import pippy -playWave(sound='didjeridu', loop=True, duration=5) -audioOut() +pippy.sound.playWave(sound='didjeridu', loop=True, duration=5) +pippy.sound.audioOut() diff --git a/data/sound/sequence b/data/sound/sequence index 1577c9d..3922e7a 100644 --- a/data/sound/sequence +++ b/data/sound/sequence @@ -1,14 +1,10 @@ -import sys -import random -from sugar.activity.activity import get_bundle_path -sys.path.append(get_bundle_path() + '/sound') -from sound import * +import pippy, random for i in range(25): pitch = random.randint(500,2000) amplitude = 5000 duration = 0.1 starttime = i * 0.1 - playSine(pitch, amplitude, duration, starttime) -audioOut() + pippy.sound.playSine(pitch, amplitude, duration, starttime) +pippy.sound.audioOut() diff --git a/data/sound/sndInfo b/data/sound/sndInfo index 529995e..7767245 100644 --- a/data/sound/sndInfo +++ b/data/sound/sndInfo @@ -1,6 +1,2 @@ -import sys -from sugar.activity.activity import get_bundle_path -sys.path.append(get_bundle_path() + '/sound') -from sound import * - -print playSine.__doc__ +import pippy +help(pippy.sound.playSine) |