Skip to content

Commit

Permalink
Added octave quality estimation.
Browse files Browse the repository at this point in the history
  • Loading branch information
isalin committed Jun 16, 2018
1 parent 1ddf628 commit a9375ff
Show file tree
Hide file tree
Showing 3 changed files with 152 additions and 75 deletions.
4 changes: 2 additions & 2 deletions TBbard/launch4j/TBbard.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
<launch4jConfig>
<dontWrapJar>false</dontWrapJar>
<headerType>gui</headerType>
<jar>E:\Desktop\TBbard_v1.7d.jar</jar>
<outfile>E:\Desktop\TBbard_v1.7d.exe</outfile>
<jar>E:\Desktop\TBbard_v1.8.jar</jar>
<outfile>E:\Desktop\TBbard_v1.8.exe</outfile>
<errTitle></errTitle>
<cmdLine></cmdLine>
<chdir>.</chdir>
Expand Down
44 changes: 33 additions & 11 deletions TBbard/src/bard/GUI.java
Original file line number Diff line number Diff line change
Expand Up @@ -450,19 +450,27 @@ public synchronized void actionPerformed(ActionEvent e)
midi.getInstruments(filePath);
//InstrumentSelector is = new InstrumentSelector(midi.instruments);

//Update instruments
cmbSelectedInstrument.removeAllItems();
for(String instrument : midi.instruments){
cmbSelectedInstrument.addItem(instrument);
}

//cmbSelectedInstrument = new JComboBox(midi.instruments);


//int selectedInstrument = is.showDialogue();
System.out.println(cmbSelectedInstrument.getSelectedIndex());
midi.getNotes(filePath, cmbSelectedInstrument.getSelectedIndex(), cmbOctaveTargetCombo.getSelectedIndex()-1, holdCheckBox.isSelected());

//Update instruments
cmbSelectedInstrument.removeAllItems();
for(String instrument : midi.instruments){
cmbSelectedInstrument.addItem(instrument);
}

taText.setText(midi.getSheet(0, cmbOctaveTargetCombo.getSelectedIndex()));

DefaultComboBoxModel<String> model = new DefaultComboBoxModel<>(midi.getOctaveQuality(cmbSelectedInstrument.getSelectedIndex()));
cmbOctaveTargetCombo.setModel(model);
cmbOctaveTargetCombo.setSelectedIndex(midi.getHighestQualityOctave(cmbSelectedInstrument.getSelectedIndex()));
taText.setText(midi.getSheet(cmbSelectedInstrument.getSelectedIndex(), cmbOctaveTargetCombo.getSelectedIndex()));


setOpenFile(frame, new File(filePath).getName());
} catch (Exception ex) {
ex.printStackTrace();
Expand All @@ -484,19 +492,28 @@ public synchronized void drop(DropTargetDropEvent evt) {
midi.getInstruments(filePath);
//InstrumentSelector is = new InstrumentSelector(midi.instruments);

//Update instruments
cmbSelectedInstrument.removeAllItems();
for(String instrument : midi.instruments){
cmbSelectedInstrument.addItem(instrument);
}

//cmbSelectedInstrument = new JComboBox(midi.instruments);


//int selectedInstrument = is.showDialogue();
System.out.println(cmbSelectedInstrument.getSelectedIndex());
midi.getNotes(filePath, cmbSelectedInstrument.getSelectedIndex(), cmbOctaveTargetCombo.getSelectedIndex()-1, holdCheckBox.isSelected());

//Update instruments
cmbSelectedInstrument.removeAllItems();
for(String instrument : midi.instruments){
cmbSelectedInstrument.addItem(instrument);
}

taText.setText(midi.getSheet(0, cmbOctaveTargetCombo.getSelectedIndex()));

DefaultComboBoxModel<String> model = new DefaultComboBoxModel<>(midi.getOctaveQuality(cmbSelectedInstrument.getSelectedIndex()));
cmbOctaveTargetCombo.setModel(model);
cmbOctaveTargetCombo.setSelectedIndex(midi.getHighestQualityOctave(cmbSelectedInstrument.getSelectedIndex()));
taText.setText(midi.getSheet(cmbSelectedInstrument.getSelectedIndex(), cmbOctaveTargetCombo.getSelectedIndex()));


setOpenFile(frame, new File(filePath).getName());

} catch (Exception ex) {
Expand All @@ -510,6 +527,11 @@ public synchronized void drop(DropTargetDropEvent evt) {
public void itemStateChanged(ItemEvent arg0) {
System.out.println("Action: " + cmbSelectedInstrument.getSelectedIndex());
taText.setText(midi.getSheet(cmbSelectedInstrument.getSelectedIndex(), cmbOctaveTargetCombo.getSelectedIndex()));
if(cmbSelectedInstrument.getSelectedIndex() == -1) return;
DefaultComboBoxModel<String> model = new DefaultComboBoxModel<>(midi.getOctaveQuality(cmbSelectedInstrument.getSelectedIndex()));
cmbOctaveTargetCombo.setModel(model);
cmbOctaveTargetCombo.setSelectedIndex(midi.getHighestQualityOctave(cmbSelectedInstrument.getSelectedIndex()));
taText.setText(midi.getSheet(cmbSelectedInstrument.getSelectedIndex(), cmbOctaveTargetCombo.getSelectedIndex()));
}
});

Expand Down
Loading

0 comments on commit a9375ff

Please sign in to comment.