/Users/lyon/j4p/src/sound/musica/MusicMouseListener.java

1    package sound.musica; 
2     
3    /* 
4     * Open Source Software by http://www.Docjava.com 
5     * programmer: D. Lyon 
6     * e-mail: lyon@docjava.com 
7     * Date: Apr 30, 2002 
8     * Time: 3:39:18 PM 
9     */ 
10    
11   import sound.*; 
12   import sound.Scales; 
13   import sound.Utils; 
14    
15   import java.awt.event.MouseEvent; 
16   import java.awt.event.MouseListener; 
17   import java.awt.event.MouseMotionListener; 
18    
19   public class MusicMouseListener 
20           implements MouseMotionListener, 
21           MouseListener { 
22       int scale[] = sound.Scales.getScale( 
23               Scales.SILLY_SCALE, 23, 127); 
24    
25       public void mouseMoved(MouseEvent e) { 
26           int x = e.getX(); 
27           Utils.play(scale[x % scale.length], e.getY() % 127, 9); 
28           Utils.play(scale[(x + 5) % scale.length], e.getY() % 127, 9); 
29       } 
30    
31       public void mouseReleased(MouseEvent e) { 
32       } 
33    
34       public void mousePressed(MouseEvent e) { 
35       } 
36    
37       public void mouseEntered(MouseEvent e) { 
38       } 
39    
40       public void mouseExited(MouseEvent e) { 
41       } 
42    
43       public void mouseClicked(MouseEvent e) { 
44       } 
45    
46       public void mouseDragged(MouseEvent e) { 
47       } 
48    
49   } 
50