Skip to content

Commit

Permalink
Initial support for MIDI In and Out
Browse files Browse the repository at this point in the history
Not yet thoroughly tested, but briefly seems to work just fine.
  • Loading branch information
Sammy1Am committed Jun 4, 2018
1 parent ec60aca commit 6d56865
Show file tree
Hide file tree
Showing 6 changed files with 268 additions and 32 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public void run() {
java.awt.EventQueue.invokeLater(new Runnable() {
@Override
public void run() {
new MainWindow(statusBus, midiSequencer, netManager, mappers, postProcessor).setVisible(true);
new MainWindow(statusBus, receiverSender, midiSequencer, netManager, mappers, postProcessor).setVisible(true);
}
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
</Property>
</Properties>
<AuxValues>
<AuxValue name="JavaCodeGenerator_CreateCodePost" type="java.lang.String" value="sequencerPanel.setMidiSequencer(midiSequencer);&#xd;&#xa;sequencerPanel.setPostProcessor(postProc);&#xd;&#xa;statusBus.registerConsumer(sequencerPanel);"/>
<AuxValue name="JavaCodeGenerator_CreateCodePost" type="java.lang.String" value="sequencerPanel.setReceiverSender(receiverSender);&#xd;&#xa;sequencerPanel.setMidiSequencer(midiSequencer);&#xd;&#xa;sequencerPanel.setPostProcessor(postProc);&#xd;&#xa;statusBus.registerConsumer(sequencerPanel);"/>
<AuxValue name="JavaCodeGenerator_SerializeTo" type="java.lang.String" value="MainWindow_sequencerPanel"/>
</AuxValues>
</Component>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import com.moppy.control.GUIControlledPostProcessor;
import com.moppy.control.NetworkManager;
import com.moppy.core.events.mapper.MapperCollection;
import com.moppy.core.midi.MoppyMIDIReceiverSender;
import com.moppy.core.midi.MoppyMIDISequencer;
import com.moppy.core.status.StatusBus;
import javax.sound.midi.MidiMessage;
Expand All @@ -13,6 +14,7 @@
public class MainWindow extends javax.swing.JFrame {

private final StatusBus statusBus;
private final MoppyMIDIReceiverSender receiverSender;
private final MoppyMIDISequencer midiSequencer;
private final NetworkManager netManager;
private final MapperCollection<MidiMessage> mappers;
Expand All @@ -22,8 +24,9 @@ public class MainWindow extends javax.swing.JFrame {
/**
* Creates new form MainWindow
*/
public MainWindow(StatusBus statusBus, MoppyMIDISequencer midiSequencer, NetworkManager netManager, MapperCollection<MidiMessage> mappers, GUIControlledPostProcessor postProc) {
public MainWindow(StatusBus statusBus, MoppyMIDIReceiverSender receiverSender, MoppyMIDISequencer midiSequencer, NetworkManager netManager, MapperCollection<MidiMessage> mappers, GUIControlledPostProcessor postProc) {
this.statusBus = statusBus;
this.receiverSender = receiverSender;
this.midiSequencer = midiSequencer;
this.netManager = netManager;
this.mappers = mappers;
Expand All @@ -40,6 +43,7 @@ public MainWindow(StatusBus statusBus, MoppyMIDISequencer midiSequencer, Network
private void initComponents() {

sequencerPanel = new com.moppy.control.gui.SequencerPanel();
sequencerPanel.setReceiverSender(receiverSender);
sequencerPanel.setMidiSequencer(midiSequencer);
sequencerPanel.setPostProcessor(postProc);
statusBus.registerConsumer(sequencerPanel);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,11 @@
</Events>
</Component>
<Container class="javax.swing.JPanel" name="controlsPane">
<Properties>
<Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[400, 149]"/>
</Property>
</Properties>

<Layout>
<DimensionLayout dim="0">
Expand All @@ -92,31 +97,46 @@
<EmptySpace min="175" pref="362" max="32767" attributes="0"/>
</Group>
<Group type="102" attributes="0">
<Component id="stopButton" min="-2" pref="49" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="1" attributes="0">
<Component id="sequenceSlider" max="32767" attributes="0"/>
<Group type="102" attributes="0">
<Component id="stopButton" min="-2" pref="49" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="sequenceTotalTimeLabel" min="-2" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="1" attributes="0">
<Component id="sequenceSlider" max="32767" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="sequenceTotalTimeLabel" min="-2" max="-2" attributes="0"/>
</Group>
<Group type="102" alignment="1" attributes="0">
<Component id="playButton" min="-2" pref="49" max="-2" attributes="0"/>
<EmptySpace max="32767" attributes="0"/>
<Component id="volumeSliderLabel" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="volumeSlider" min="-2" pref="104" max="-2" attributes="0"/>
</Group>
</Group>
</Group>
<Group type="102" alignment="1" attributes="0">
<Component id="playButton" min="-2" pref="49" max="-2" attributes="0"/>
<EmptySpace max="32767" attributes="0"/>
<Component id="volumeSliderLabel" min="-2" max="-2" attributes="0"/>
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
<Component id="volumeOverrideCB" min="-2" max="-2" attributes="0"/>
</Group>
<Group type="102" attributes="0">
<Group type="103" groupAlignment="1" attributes="0">
<Component id="midiInLabel" min="-2" max="-2" attributes="0"/>
<Component id="midiOutLabel" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Component id="volumeSlider" min="-2" pref="104" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="midiOutCB" min="-2" pref="190" max="-2" attributes="0"/>
<Component id="midiInCB" min="-2" pref="190" max="-2" attributes="0"/>
</Group>
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
</Group>
</Group>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
</Group>
<Group type="102" alignment="1" attributes="0">
<EmptySpace max="32767" attributes="0"/>
<Component id="volumeOverrideCB" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
Expand Down Expand Up @@ -144,7 +164,17 @@
</Group>
<EmptySpace max="-2" attributes="0"/>
<Component id="volumeOverrideCB" min="-2" max="-2" attributes="0"/>
<EmptySpace pref="64" max="32767" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="midiInLabel" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="midiInCB" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="midiOutLabel" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="midiOutCB" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace pref="16" max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
Expand Down Expand Up @@ -225,6 +255,54 @@
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="volumeOverrideCBActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JLabel" name="midiInLabel">
<Properties>
<Property name="text" type="java.lang.String" value="MIDI In:"/>
<Property name="toolTipText" type="java.lang.String" value="MIDI device to receive events from"/>
</Properties>
</Component>
<Component class="javax.swing.JComboBox" name="midiInCB">
<Properties>
<Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor">
<StringArray count="4">
<StringItem index="0" value="Item 1"/>
<StringItem index="1" value="Item 2"/>
<StringItem index="2" value="Item 3"/>
<StringItem index="3" value="Item 4"/>
</StringArray>
</Property>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="midiInCBActionPerformed"/>
</Events>
<AuxValues>
<AuxValue name="JavaCodeGenerator_TypeParameters" type="java.lang.String" value="&lt;String&gt;"/>
</AuxValues>
</Component>
<Component class="javax.swing.JLabel" name="midiOutLabel">
<Properties>
<Property name="text" type="java.lang.String" value="MIDI Out:"/>
<Property name="toolTipText" type="java.lang.String" value="MIDI device to send all raw MIDI events to."/>
</Properties>
</Component>
<Component class="javax.swing.JComboBox" name="midiOutCB">
<Properties>
<Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor">
<StringArray count="4">
<StringItem index="0" value="Item 1"/>
<StringItem index="1" value="Item 2"/>
<StringItem index="2" value="Item 3"/>
<StringItem index="3" value="Item 4"/>
</StringArray>
</Property>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="midiOutCBActionPerformed"/>
</Events>
<AuxValues>
<AuxValue name="JavaCodeGenerator_TypeParameters" type="java.lang.String" value="&lt;String&gt;"/>
</AuxValues>
</Component>
</SubComponents>
</Container>
</SubComponents>
Expand Down
Loading

0 comments on commit 6d56865

Please sign in to comment.