def main(): makey_out_q = Queue() piezo_out_q = Queue() t = VolumeThread(makey_out_q,piezo_out_q) t.start() t1 = Thread(target=makey.keypress.init,args=(makey_out_q,)) t1.start() def main_block(): while True: data = piezo_out_q.get(block=True) print json.dumps(data) t3 = Thread(target=main_block) t3.start()
import pyglet from pyglet.window import key from pyglet.media import Player import random import sys sys.path += [sys.path[0] + '../../'] from piezo.PiezoThreading import VolumeThread from Queue import Queue in_q = Queue() out_q = Queue() vol = VolumeThread(in_q,out_q) vol.start() window = pyglet.window.Window(); background = pyglet.image.load("img/background.jpg"); snare = pyglet.media.StaticSource(pyglet.media.load('./audio/snare/snare-1.mp3')); tom1 = pyglet.media.StaticSource(pyglet.media.load('./audio/tom1/tom1-1.mp3')); tom2 = pyglet.media.StaticSource(pyglet.media.load('./audio/tom2/tom2-1.mp3')); tom3 = pyglet.media.StaticSource(pyglet.media.load('./audio/tom3/tom3-1.mp3')); kick = pyglet.media.StaticSource(pyglet.media.load('./audio/kick/kick-1.mp3')); chh = pyglet.media.StaticSource(pyglet.media.load('./audio/chh/chh-1.mp3')); ohh = pyglet.media.StaticSource(pyglet.media.load('./audio/ohh/ohh-1.mp3')); crash = pyglet.media.StaticSource(pyglet.media.load('./audio/crash/crash-1.mp3')); ride = pyglet.media.StaticSource(pyglet.media.load('./audio/ride/ride-1.mp3')); drums = {