def initWiimotes(self) :
if self.wiimoteSupport :
from pywiiuse import pygame_wiimouse
- pygame_wiimouse.init(4, 5, self.screenResolution) # look for 4, wait 5 seconds
+ from minwii.config import IR_POSITION
+ pygame_wiimouse.init(4, 5, self.screenResolution, IR_POSITION) # look for 4, wait 5 seconds
self.nwiimotes = nwiimotes = pygame_wiimouse.get_count()
console.debug('wiimotes found : %d', nwiimotes)
self.WT = WT = pygame_wiimouse.WT
conf.set('playingscreen', 'MIDI_VELOCITY_RANGE', '(64, 127)')
conf.set('playingscreen', 'MIDI_PAN_RANGE', '(32, 96)')
conf.set('playingscreen', 'MIDI_VELOCITY_WRONG_NOTE_ATTN', '0.5')
+conf.set('playingscreen', 'IR_POSITION', 'ABOVE')
conf.add_section('locations')
conf.set('locations', 'notes_font_file', _computePath('fonts/Arial Unicode.ttf'))
MIDI_VELOCITY_RANGE = str2IntTuple(conf.get('playingscreen', 'MIDI_VELOCITY_RANGE'))
MIDI_PAN_RANGE = str2IntTuple(conf.get('playingscreen', 'MIDI_PAN_RANGE'))
MIDI_VELOCITY_WRONG_NOTE_ATTN = conf.getfloat('playingscreen', 'MIDI_VELOCITY_WRONG_NOTE_ATTN')
+IR_POSITION = conf.get('playingscreen', 'IR_POSITION')
SONG_FILE_PATH = conf.get('locations', 'SONG_FILE_PATH')
LOGS_DIR = conf.get('locations', 'LOGS_DIR')
WT = None
-def init(nmotes, timeout, screenResolution=(660, 370)):
+def init(nmotes, timeout, screenResolution=(660, 370), position='ABOVE'):
'''Initialize the module.'''
global WT
if WT:
return
WT = wiimote_thread(nmotes, timeout)
+ if position == 'ABOVE' :
+ position = wiiuse.IR_ABOVE
+ elif position == 'BELOW' :
+ position = wiiuse.IR_BELOW
+ else :
+ position = wiiuse.IR_ABOVE
+
+
nmotes = get_count()
for i in range(nmotes) :
wm = Wiimote(i) # access the wiimote object
wm.enable_accels(0) # turn off acceleration reporting
- wm.enable_ir(1, vres = screenResolution, position=wiiuse.IR_ABOVE)
+ wm.enable_ir(1, vres = screenResolution, position=position)
def get_count():