Commits

Brendan Howell committed 2a9538f

rough working version for piksel

  • Participants
  • Parent commits b2a2da5

Comments (0)

Files changed (3)

 
 """
 	algorithms include:
-		"straight" - straight linear read (loops and can run in reverse)
+		"statmux" - straight linear read (loops and can run in reverse)
 		"burroughs" - burroughs columnar cut-up
 		"markov" - markov chaining
 		
         self.rows = []
         self.markov = None
         self.burroughs = None
-        self.algorithm = "straight"
+        self.algorithm = "statmux"
         self.position = 0
         self.velocity = 1
         self.name = "empty"
             self.words = text.split()
             self.markov = markov.Markov(text)
             self.burroughs = burroughs.Burroughs(text)
-            self.name = intext
+            self.name = intext.split("/")[-1]
         else:
             pass
             #mount the drive
     #spits out next chunk    
     def get_word(self, inword):
         out = ""
-        if self.algorithm == "straight":
+        if self.algorithm == "statmux":
             out += self.words[self.position] + " "
         elif self.algorithm == "markov":
             out += self.markov.get_next(inword) + " "

File lexer.pyc

Binary file modified.
 bgcolor = ( 0, 0, 0 )
 monitor = "A"
 
+statusbar = ScreenText()
+
 #joy = pygame.joystick.Joystick(0)
 
-#TODO: fake loader array
-#TODO: fake loader switch with Q
 #TODO: deck loading in separate thread
 #TODO: burroughs slicer
+#TODO: WTF is up with colors and compositing!
 #TODO: color knob
 #TODO: trog mode!!
 #TODO: console out
 #TODO: set to 72 Characters per Line
 
 def handle_keydown(event):
-    global monitor, reverse, bgcolor, lexer_idx
+    global monitor, reverse, bgcolor, lexer_idx, deck_A, deck_B
     print "got keydown: " + event.unicode
     
     #reverse / rewind?
         monitor = "A"
     elif event.unicode == "s":
         monitor = "B"
+        
+    #switch burroughs, normal, markov
+    elif event.unicode == "b":
+    	deck_A.algorithm = "burroughs"
+    	deck_B.algorithm = "burroughs"
+    elif event.unicode == "n":
+        deck_A.algorithm = "statmux"
+        deck_B.algorthm = "statmux"
+    elif event.unicode == "m":
+        deck_A.algorithm = "markov"
+        deck_B.algorithm = "markov"
     
     
 def handle_keyup(event):
     pycessing.framerate = framerate
     
     cursor.setFontFromFile(font, font_size)
+    statusbar.setFontFromFile(font, font_size)
     
     #for now use fake lexers from disk
     textfiles = glob.glob("test-data/*.txt")
         row.setFontFromFile(font, font_size)
         row.text = ""
         #row.text = str(i)*22
-        row.setColor( 0 , 255, 0)
+        row.setColor( 255 , 255, 255)
         out_text.append(row)
-    #deck_A.load(fakedrive="test-data/freud-dreams.txt")
-    #deck_B.load(fakedrive="test-data/poe-perloined-letter.txt")
-    deck_A.algorithm = "markov"
-    deck_B.algorithm = "markov"
     print "done loading"
     
+    statusbar.setColor( 100, 100, 100 )
+    
     pycessing.onKeyDown = handle_keydown
     pycessing.onKeyUp = handle_keyup
 
     skip_frame = True
     # update tempo 
     wordrate = 0.8 + 0.8 / ( (pycessing.getMouseY()+1) / float( pycessing.getHeight() ))
-    #pycessing.framerate = wordrate + 0.25
-    #print "wordrate " + str(wordrate +0.25)
 
 
 #    for axis in range(joy.get_numaxes()):
     
     # don't update if wordcount
     
-    #pycessing.screen.fill(bgcolor)
+    pycessing.screen.fill(bgcolor)
     # update x-fader
     xfader = pycessing.getMouseX() / float(pycessing.getWidth())
     #print "xfader " + str(xfader)
         # select deck and get next word  (TODO:skip for burroughs)
         if random.random() < xfader:
             cursor.text = deck_A.get_word(cursor.text)
-            cursor.setColor(255, 0 ,0)
+            cursor.setColor(255, 255 , 255)
         else:
             cursor.text = deck_B.get_word(cursor.text)
-            cursor.setColor(0, 0 ,255)
+            cursor.setColor(255 , 255 , 255 )
 
         #TODO: do burroughs here
         
         ypos = 82
         step = 38
     
-    # update screen    
+    # update status display
+    statusbar.text = deck_B.name.upper()
+    statusbar.draw(10, 10)
+    statusbar.text = deck_A.name.upper()
+    statusbar.draw(460, 10)
+    statusbar.text = "VS"
+    statusbar.draw(310, 10)
+    statusbar.text = "MIX: " + deck_A.algorithm.upper()
+    statusbar.draw(10, 35)
+    statusbar.text = "MON: " + monitor
+    statusbar.draw(530, 35)
+    
+    # update mix out    
     for row in out_text:
         row.draw(10, ypos)
         ypos += step