Skip to content

Commit

Permalink
Renamed main.py to mididrumhero.py
Browse files Browse the repository at this point in the history
  • Loading branch information
ejj28 committed Feb 27, 2020
1 parent 632b0b4 commit 398a6dd
Showing 1 changed file with 29 additions and 21 deletions.
50 changes: 29 additions & 21 deletions main.py → mididrumhero.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,38 +5,46 @@
import pygame.midi
import time

print "\nMidiDrumHero by ejj28"
print "https://github.com/ejj28/mididrumhero\n"


def millis():
return int(round(time.time() * 1000))

midiNumbers = []



try:

vController = pyvjoy.VJoyDevice(1)
vController = pyvjoy.VJoyDevice(1)

pygame.midi.init()
pygame.midi.init()

count = 0
for i in range( pygame.midi.get_count() ):
r = pygame.midi.get_device_info(i)
if r[2]:
print str(count) + ": " + str(r[1])
midiNumbers.append(i)
count += 1
print "Please enter the ID of the MIDI device to use:"
userMidiSelection = int(raw_input())
midiNumbers = []

i = pygame.midi.Input(midiNumbers[userMidiSelection])
print "Detected MIDI input devices:"

lastHitTime = [0,0,0,0,0]
states = [False, False, False, False, False]
notes = [48,38,43,45,36]
controllerMappings = [1,2,3,4,5]
isMapped = [False,False,False,False,False]
drumNames = ["red drum pad", "yellow drum pad", "blue drum pad", "green drum pad", "kick pedal"]
count = 0
for i in range( pygame.midi.get_count() ):
r = pygame.midi.get_device_info(i)
if r[2]:
print str(count) + ": " + str(r[1])
midiNumbers.append(i)
count += 1

print "Please enter the ID of the MIDI device to use:"
userMidiSelection = int(raw_input())

i = pygame.midi.Input(midiNumbers[userMidiSelection])

lastHitTime = [0,0,0,0,0]
states = [False, False, False, False, False]
notes = [48,38,43,45,36]
controllerMappings = [1,2,3,4,5]
isMapped = [False,False,False,False,False]
drumNames = ["red drum pad", "yellow drum pad", "blue drum pad", "green drum pad", "kick pedal"]

try:
for t in range(len(controllerMappings)):
print "Please hit the " + drumNames[t]
while isMapped[t] == False:
Expand All @@ -48,7 +56,7 @@ def millis():
isMapped[t] = True
print "Mapped " + drumNames[t] + " to Midi note " + str(x[0][1])
break
print "MidiDrumHero is now translating your E-Kit to Clone Hero, press Ctrl-C to quit"
print "MidiDrumHero is now translating your E-Kit to Clone Hero"


while True:
Expand Down

0 comments on commit 398a6dd

Please sign in to comment.