File tree Expand file tree Collapse file tree 2 files changed +56
-0
lines changed Expand file tree Collapse file tree 2 files changed +56
-0
lines changed Original file line number Diff line number Diff line change
1
+ # -*- coding: utf-8 -*-
2
+ # -*- coding: utf-8 -*-
3
+ from pyrilla import core
4
+
5
+ from base import main , update_till_interrupt
6
+
7
+ again = 0
8
+
9
+ def file_handle (filename , ext ):
10
+ sound = core .Sound (filename , ext )
11
+ voice = core .Voice (sound , loop = True )
12
+
13
+ voice .play ()
14
+ voice .pitch = 1.5
15
+ voice .pan = - .5
16
+ voice .gain = .5
17
+
18
+ print ("pitch: %5.1f" % voice .pitch )
19
+ print ("pan: %5.1f" % voice .pan )
20
+ print ("gain: %5.1f" % voice .gain )
21
+
22
+ update_till_interrupt ()
23
+
24
+
25
+ if __name__ == "__main__" :
26
+ main (file_handle )
Original file line number Diff line number Diff line change @@ -110,6 +110,36 @@ cdef class Voice(object):
110
110
else :
111
111
self .play()
112
112
113
+ property pitch :
114
+ def __get__ (self ):
115
+ cdef ga.float32 value
116
+
117
+ ga.handle_getParamf(self .handle, ga.HANDLE_PARAM_PITCH, & value)
118
+ return value
119
+
120
+ def __set__ (self , ga.float32 value ):
121
+ ga.handle_setParamf(self .handle, ga.HANDLE_PARAM_PITCH, value)
122
+
123
+ property gain :
124
+ def __get__ (self ):
125
+ cdef ga.float32 value
126
+
127
+ ga.handle_getParamf(self .handle, ga.HANDLE_PARAM_GAIN, & value)
128
+ return value
129
+
130
+ def __set__ (self , ga.float32 value ):
131
+ ga.handle_setParamf(self .handle, ga.HANDLE_PARAM_GAIN, value)
132
+
133
+ property pan :
134
+ def __get__ (self ):
135
+ cdef ga.float32 value
136
+
137
+ ga.handle_getParamf(self .handle, ga.HANDLE_PARAM_PAN, & value)
138
+ return value
139
+
140
+ def __set__ (self , ga.float32 value ):
141
+ ga.handle_setParamf(self .handle, ga.HANDLE_PARAM_PAN, value)
142
+
113
143
cdef class Sound(object ):
114
144
cdef ga.Sound* sound
115
145
You can’t perform that action at this time.
0 commit comments