This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
include Java | |
java_import javax.sound.sampled.AudioFormat | |
java_import javax.sound.sampled.DataLine | |
java_import javax.sound.sampled.SourceDataLine | |
java_import javax.sound.sampled.AudioSystem | |
SAMPLE_RATE = 44100 | |
audio_format = AudioFormat.new(SAMPLE_RATE, 8, 1, true, true) | |
info = DataLine::Info.new(SourceDataLine.java_class, audio_format) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package nomaoi; | |
import java.awt.Dimension; | |
import javax.sound.midi.*; | |
import javax.swing.*; | |
public class NomaoiController implements Runnable { | |
MidiDevice midiIn; | |
Synthesizer synth; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.logging.Level; | |
import java.util.logging.Logger; | |
import javax.sound.midi.*; | |
public class Metronome implements MetaEventListener { | |
private Sequencer sequencer; | |
private int bpm; | |
public void start(int bpm) { | |
try { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
include Java | |
import javax.sound.midi.MetaEventListener | |
import javax.sound.midi.MidiEvent | |
import javax.sound.midi.MidiSystem | |
import javax.sound.midi.Sequence | |
import javax.sound.midi.ShortMessage | |
class Metronome | |
include MetaEventListener |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
struct Control { | |
int pin; | |
}; | |
void ctrlPinMode(void* control, int mode) { | |
Control* ctrl = (Control*)control; | |
pinMode(ctrl->pin, mode); | |
} | |
int ctrlDigitalRead(void* control) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Control { | |
public: | |
int pin; | |
Control(int pin) : pin(pin) {} | |
~Control() {} | |
void pinMode(int mode) { | |
::pinMode(pin, mode); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import gnu.io.CommPortIdentifier; | |
import gnu.io.PortInUseException; | |
import gnu.io.SerialPort; | |
import gnu.io.UnsupportedCommOperationException; | |
import java.awt.event.ActionEvent; | |
import java.awt.event.ActionListener; | |
import java.io.ByteArrayOutputStream; | |
import java.io.IOException; | |
import java.io.OutputStream; | |
import java.io.OutputStreamWriter; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
include Java | |
import java.awt.Rectangle | |
import java.awt.geom.Ellipse2D | |
import java.awt.geom.Line2D | |
import java.awt.geom.Point2D | |
import java.awt.geom.Rectangle2D | |
import java.lang.Math | |
import javax.swing.JFrame |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class MyRecord | |
def initialize(line) | |
@alpha, @number, @value = line.split | |
end | |
attr_reader :alpha, :number, :value | |
end | |
def print_alpha_number(records) | |
num_keys = records.map{|rec| rec.number}.uniq.sort | |
alpha_keys = records.map{|rec| rec.alpha}.uniq.sort |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<script type="text/javascript"> | |
var app = { | |
rect: { | |
x: 100, | |
y: 100, | |
w: 100, | |
h: 100, | |
a: 0 |
OlderNewer