Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--NEWS2
-rw-r--r--activity/activity-memorize.svg8
-rw-r--r--csound/univorc.csd81
-rwxr-xr-xgame.py10
4 files changed, 86 insertions, 15 deletions
diff --git a/NEWS b/NEWS
index a6ce158..669edc5 100644
--- a/NEWS
+++ b/NEWS
@@ -1,4 +1,4 @@
-
+* Added support to be able to play wav and aiff format (erikos)
* Set create tab as default (Muriel)
* Games tab renamed to Play (Muriel)
* New icon and tooltip for reset game button #3965 (Muriel)
diff --git a/activity/activity-memorize.svg b/activity/activity-memorize.svg
index 528deaa..4eaf312 100644
--- a/activity/activity-memorize.svg
+++ b/activity/activity-memorize.svg
@@ -4,11 +4,11 @@
]><svg enable-background="new 0 0 55 55" height="55px" version="1.1" viewBox="0 0 55 55" width="55px" x="0px" xml:space="preserve" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" y="0px"><g display="block" id="activity-memorize">
<rect display="inline" fill="&stroke_color;" height="10" stroke="&stroke_color;" stroke-width="3.5" width="10" x="7.291" y="7.833"/>
<rect display="inline" fill="&fill_color;" height="10" stroke="&stroke_color;" stroke-width="3.5" width="10" x="22.625" y="7.833"/>
- <rect display="inline" fill="&fill_color;" height="10" stroke="&stroke_color;" stroke-width="3.5" width="10" x="37.375" y="7.833"/>
- <rect display="inline" fill="&fill_color;" height="10" stroke="&stroke_color;" stroke-width="3.5" width="10" x="7.291" y="22.75"/>
- <rect display="inline" fill="&fill_color;" height="10" stroke="&stroke_color;" stroke-width="3.5" width="10" x="22.625" y="22.75"/>
+ <rect display="inline" fill="&stroke_color;" height="10" stroke="&stroke_color;" stroke-width="3.5" width="10" x="37.375" y="7.833"/>
+ <rect display="inline" fill="&stroke_color;" height="10" stroke="&stroke_color;" stroke-width="3.5" width="10" x="7.291" y="22.75"/>
+ <rect display="inline" fill="&stroke_color;" height="10" stroke="&stroke_color;" stroke-width="3.5" width="10" x="22.625" y="22.75"/>
<rect display="inline" fill="&fill_color;" height="10" stroke="&stroke_color;" stroke-width="3.5" width="10" x="37.375" y="22.75"/>
<rect display="inline" fill="&fill_color;" height="10" stroke="&stroke_color;" stroke-width="3.5" width="10" x="7.291" y="37.625"/>
- <rect display="inline" fill="&stroke_color;" height="10" stroke="&stroke_color;" stroke-width="3.5" width="10" x="22.625" y="37.625"/>
+ <rect display="inline" fill="&fill_color;" height="10" stroke="&stroke_color;" stroke-width="3.5" width="10" x="22.625" y="37.625"/>
<rect display="inline" fill="&fill_color;" height="10" stroke="&stroke_color;" stroke-width="3.5" width="10" x="37.375" y="37.625"/>
</g></svg>
diff --git a/csound/univorc.csd b/csound/univorc.csd
index b646f8f..d34a2de 100644
--- a/csound/univorc.csd
+++ b/csound/univorc.csd
@@ -8,10 +8,10 @@ ksmps=100
nchnls=2
/**************************************************************************
- General Soundfile Player - Used by Memorize Activity
+ General ogg-vorbis Soundfile Player
**************************************************************************/
-instr 108
+instr 100
/* soundfile play control
p4 : filename
p5 : unique instance ID
@@ -27,7 +27,7 @@ S1 strget p4
inst = p5
ich = 1
iln = 10
-ioffset = p8
+ioffset = p7
Slen sprintf "sfplay.%d.flen", p5 ; file length channel
chnset iln, Slen
@@ -38,12 +38,12 @@ Sgain sprintf "sfplay.%d.gain", inst ; gain channel
chnset S1, Sname
chnset 1, Splay
chnset p6, Sgain
-event_i "i",109,0,iln,inst,ich,ioffset
+event_i "i",101,0,iln,inst,ich,ioffset
turnoff
endin
-instr 109
+instr 101
/* soundfile player
This is the actual soundfile player.
It never gets called directly
@@ -71,6 +71,77 @@ endif
printf_i "sfplay:%d\n", 1, inst
endin
+
+/**************************************************************************
+ General wav, aiff Soundfile Player
+**************************************************************************/
+
+instr 102
+/* soundfile play control
+ p4 : filename
+ p5 : unique instance ID
+ p6 : output gain (0-1)
+ p7 : offset in seconds
+
+ channels:
+ sfplay.<ID>.on - instance control channel (1:on 0: off)
+ sfplay.<ID>.gain - soundfile play gain (0-1)
+ sfplay.<ID>.flen - holds the channel length
+*/
+S1 strget p4
+inst = p5
+ich filenchnls S1
+iln filelen S1
+ioffset = p7
+
+Slen sprintf "sfplay.%d.flen", p5 ; file length channel
+chnset iln, Slen
+
+if ioffset >= iln then
+turnoff
+else
+iln = iln - ioffset
+endif
+
+Splay sprintf "sfplay.%d.on", inst ; instance control channel
+Sname sprintf "sfplay.%d.fname", inst ; filename channel
+Sgain sprintf "sfplay.%d.gain", inst ; gain channel
+chnset S1, Sname
+chnset 1, Splay
+chnset p6, Sgain
+event_i "i",103,0,iln,inst,ich,ioffset
+turnoff
+endin
+
+
+instr 103
+/* soundfile player
+ This is the actual soundfile player.
+ It never gets called directly
+*/
+ich = p5
+inst= p4
+ioffset = p6
+Splay sprintf "sfplay.%d.on", inst ; instance control channel
+Sname sprintf "sfplay.%d.fname", inst ; filename channel
+Sgain sprintf "sfplay.%d.gain", inst ; gain channel
+kon chnget Splay
+kg1 chnget Sgain
+S1 chnget Sname
+if kon == 0 then
+printf "sfplay:%d OFF\n", 1, inst
+turnoff
+endif
+if ich = 1 then
+a1 diskin2 S1,1,ioffset,1
+a2 = a1
+else
+a1,a2 diskin2 S1,1,ioffset,1
+endif
+ outs a1*kg1, a2*kg1
+endin
+
+
</CsInstruments>
<CsScore>
f0 600000
diff --git a/game.py b/game.py
index e825a0d..1f0357d 100755
--- a/game.py
+++ b/game.py
@@ -152,12 +152,12 @@ class MemorizeGame(gobject.GObject):
if self.sound == 1:
snd = self.model.grid[id].get('snd', None)
if snd != None:
- if snd.endswith('.wav'):
- pass
- # code to csound play wav
+ if len(snd.split('.')) > 1:
+ if snd.split('.')[1] in ['wav', 'aif', 'aiff']:
+ self.cs.perform('i 102 0.0 3.0 "%s" 1 0.9 0'%(os.path.join(os.path.dirname(__file__), snd)))
else:
- self.cs.perform('i 108 0.0 3.0 "%s" 1 0.9 0'%(os.path.join(os.path.dirname(__file__), snd)))
- _logger.debug('Audio: play sound=%s'%snd)
+ self.cs.perform('i 100 0.0 3.0 "%s" 1 0.9 0'%(os.path.join(os.path.dirname(__file__), snd)))
+ _logger.debug('Audio: play sound=%s'%snd)
# First card case
if self.last_flipped == -1: