Created
September 27, 2014 16:50
-
-
Save chozabu/7034c8b9a87612d6277a to your computer and use it in GitHub Desktop.
kivy sounds in boardz
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
__author__ = 'chozabu' | |
#import cymunk as cy | |
from kivy.core.audio import SoundLoader, Sound | |
skidlow = SoundLoader.load('sounds/skidlow.wav') | |
skidlow.volume = 0.1 | |
skidlow.loop = True | |
skidmid = SoundLoader.load('sounds/skidmid.wav') | |
skidmid.volume = 0.1 | |
skidmid.loop = True | |
skidhigh = SoundLoader.load('sounds/skidhigh.wav') | |
skidhigh.volume = 0.1 | |
skidhigh.loop = True | |
thud = SoundLoader.load('sounds/softhit.wav') | |
jump = SoundLoader.load('sounds/hup.wav') | |
finish = SoundLoader.load('sounds/bing.wav') | |
wipeout = SoundLoader.load('sounds/icebreak.ogg') | |
handtouch = SoundLoader.load('sounds/chsst.wav') | |
headtouch = SoundLoader.load('sounds/ktchk.wav') | |
wind = SoundLoader.load('sounds/wind.wav') | |
wind.volume = 0.1 | |
wind.loop = True | |
def vol_handtouch(vol=1.): | |
handtouch.volume = vol | |
def play_handtouch(vol=1.): | |
handtouch.volume = vol | |
if handtouch.status != 'play':handtouch.play() | |
def play_headtouch(vol=1.): | |
headtouch.volume = vol | |
if headtouch.status != 'play':headtouch.play() | |
def play_wipeout(vol=1.): | |
wipeout.volume = vol | |
if wipeout.status != 'play':wipeout.play() | |
def play_finish(vol=0.6): | |
finish.volume = vol | |
if finish.status != 'play':finish.play() | |
def play_thud(vol): | |
thud.volume = vol | |
if thud.status != 'play':thud.play() | |
def set_thud_vol(vol): | |
thud.volume = vol | |
def get_thud_vol(): | |
return thud.volume | |
def play_jump(vol=1): | |
jump.volume = vol | |
if jump.status != 'play':jump.play() | |
def play_skids(): | |
#print skidlow.status | |
if skidhigh.status != 'play':skidhigh.play() | |
if skidmid.status != 'play':skidmid.play() | |
if skidlow.status != 'play':skidlow.play() | |
#if wind.status == 'play':wind.stop() | |
if wind.status != 'play': | |
wind.seek(0) | |
wind.play() | |
def stop_skids(): | |
#print skidlow.status | |
if skidhigh.status == 'play':skidhigh.stop() | |
if skidmid.status == 'play':skidmid.stop() | |
if skidlow.status == 'play':skidlow.stop() | |
#if wind.status != 'play': | |
# wind.seek(0) | |
# wind.play() | |
def stop_loops(): | |
#print skidlow.status | |
if skidhigh.status == 'play':skidhigh.stop() | |
if skidmid.status == 'play':skidmid.stop() | |
if skidlow.status == 'play':skidlow.stop() | |
if wind.status == 'play':wind.stop() | |
def set_wind_vol(vol): | |
wind.volume = vol | |
def set_skid_vols_hard(low, mid, high): | |
low=low*0.8#+0.05 | |
mid=mid*0.9#+0.05 | |
skidlow.volume = low | |
skidmid.volume = mid | |
skidhigh.volume = high | |
def set_skid_vols(low, mid, high): | |
low=low*0.8#+0.05 | |
mid=mid*0.9#+0.05 | |
low=low*0.3+skidlow.volume*0.7 | |
mid=mid*0.3+skidmid.volume*0.7 | |
high=high*0.3+skidhigh.volume*0.7 | |
#high=high*0.9+0.05 | |
#print "setting volume ", low, mid, high | |
skidlow.volume = low | |
skidmid.volume = mid | |
skidhigh.volume = high |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment