/[svn]/jsampler/trunk/src/org/jsampler/view/classic/NewChannelWizard.java
ViewVC logotype

Diff of /jsampler/trunk/src/org/jsampler/view/classic/NewChannelWizard.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 911 by iliev, Mon Aug 7 18:25:58 2006 UTC revision 1285 by iliev, Fri Aug 10 19:55:03 2007 UTC
# Line 1  Line 1 
1  /*  /*
2   *   JSampler - a java front-end for LinuxSampler   *   JSampler - a java front-end for LinuxSampler
3   *   *
4   *   Copyright (C) 2005 Grigor Kirilov Iliev   *   Copyright (C) 2005-2006 Grigor Iliev <grigor@grigoriliev.com>
5   *   *
6   *   This file is part of JSampler.   *   This file is part of JSampler.
7   *   *
# Line 59  import org.jsampler.CC; Line 59  import org.jsampler.CC;
59  import org.jsampler.HF;  import org.jsampler.HF;
60  import org.jsampler.MidiDeviceModel;  import org.jsampler.MidiDeviceModel;
61    
62  import org.jsampler.event.AudioDeviceListEvent;  import org.jsampler.event.ListEvent;
63  import org.jsampler.event.AudioDeviceListListener;  import org.jsampler.event.ListListener;
64  import org.jsampler.event.MidiDeviceListEvent;  import org.jsampler.event.MidiDeviceListEvent;
65  import org.jsampler.event.MidiDeviceListListener;  import org.jsampler.event.MidiDeviceListListener;
66    
67  import org.jsampler.task.AddChannel;  import org.jsampler.task.Channel.LoadEngine;
68  import org.jsampler.task.LoadEngine;  import org.jsampler.task.Channel.LoadInstrument;
69  import org.jsampler.task.LoadInstrument;  import org.jsampler.task.Channel.SetAudioOutputDevice;
70  import org.jsampler.task.SetChannelAudioOutputDevice;  import org.jsampler.task.Channel.SetMidiInputChannel;
71  import org.jsampler.task.SetChannelMidiInputChannel;  import org.jsampler.task.Channel.SetMidiInputDevice;
72  import org.jsampler.task.SetChannelMidiInputDevice;  import org.jsampler.task.Channel.SetMidiInputPort;
73  import org.jsampler.task.SetChannelMidiInputPort;  
74    import org.jsampler.view.std.JSNewMidiDeviceDlg;
75    import org.jsampler.view.std.JSNewAudioDeviceDlg;
76    
77  import org.linuxsampler.lscp.AudioOutputDevice;  import org.linuxsampler.lscp.AudioOutputDevice;
78  import org.linuxsampler.lscp.MidiInputDevice;  import org.linuxsampler.lscp.MidiInputDevice;
# Line 234  class MidiDeviceWizardPage extends UserI Line 236  class MidiDeviceWizardPage extends UserI
236                                    
237                  p.add(Box.createRigidArea(new Dimension(6, 0)));                  p.add(Box.createRigidArea(new Dimension(6, 0)));
238                                    
239                  for(MidiDeviceModel m : CC.getSamplerModel().getMidiDeviceModels()) {                  for(MidiDeviceModel m : CC.getSamplerModel().getMidiDevices()) {
240                          cbDevices.addItem(m.getDeviceInfo());                          cbDevices.addItem(m.getDeviceInfo());
241                  }                  }
242                                    
# Line 270  class MidiDeviceWizardPage extends UserI Line 272  class MidiDeviceWizardPage extends UserI
272                  btnNewDevice.addActionListener(new ActionListener() {                  btnNewDevice.addActionListener(new ActionListener() {
273                          public void                          public void
274                          actionPerformed(ActionEvent e) {                          actionPerformed(ActionEvent e) {
275                                  new NewMidiDeviceDlg(getWizardDialog()).setVisible(true);                                  new JSNewMidiDeviceDlg(getWizardDialog()).setVisible(true);
276                          }                          }
277                  });                  });
278          }          }
# Line 315  class MidiDeviceWizardPage extends UserI Line 317  class MidiDeviceWizardPage extends UserI
317                  updateDeviceList(MidiInputDevice dev) {                  updateDeviceList(MidiInputDevice dev) {
318                          cbDevices.removeAllItems();                          cbDevices.removeAllItems();
319                                                    
320                          for(MidiDeviceModel m : CC.getSamplerModel().getMidiDeviceModels()) {                          for(MidiDeviceModel m : CC.getSamplerModel().getMidiDevices()) {
321                                  cbDevices.addItem(m.getDeviceInfo());                                  cbDevices.addItem(m.getDeviceInfo());
322                          }                          }
323                                                    
# Line 353  class MidiPortWizardPage extends UserInp Line 355  class MidiPortWizardPage extends UserInp
355          }          }
356                    
357          public void          public void
358          initPage() {          preinitPage() {
359                  updatePorts(((NewChannelWizardModel)getWizardModel()).getSelectedMidiDevice());                  updatePorts(((NewChannelWizardModel)getWizardModel()).getSelectedMidiDevice());
360          }          }
361                    
# Line 435  class AudioDeviceWizardPage extends User Line 437  class AudioDeviceWizardPage extends User
437                                    
438                  p.add(Box.createRigidArea(new Dimension(6, 0)));                  p.add(Box.createRigidArea(new Dimension(6, 0)));
439                                    
440                  for(AudioDeviceModel m : CC.getSamplerModel().getAudioDeviceModels()) {                  for(AudioDeviceModel m : CC.getSamplerModel().getAudioDevices()) {
441                          cbDevices.addItem(m.getDeviceInfo());                          cbDevices.addItem(m.getDeviceInfo());
442                  }                  }
443                                    
# Line 454  class AudioDeviceWizardPage extends User Line 456  class AudioDeviceWizardPage extends User
456                  btnNewDevice.addActionListener(new ActionListener() {                  btnNewDevice.addActionListener(new ActionListener() {
457                          public void                          public void
458                          actionPerformed(ActionEvent e) {                          actionPerformed(ActionEvent e) {
459                                  new NewAudioDeviceDlg(getWizardDialog()).setVisible(true);                                  new JSNewAudioDeviceDlg(getWizardDialog()).setVisible(true);
460                          }                          }
461                  });                  });
462          }          }
# Line 471  class AudioDeviceWizardPage extends User Line 473  class AudioDeviceWizardPage extends User
473          private Handler          private Handler
474          getHandler() { return handler; }          getHandler() { return handler; }
475                    
476          private class Handler implements AudioDeviceListListener {          private class Handler implements ListListener<AudioDeviceModel> {
477                  public void                  public void
478                  deviceAdded(AudioDeviceListEvent e) {                  entryAdded(ListEvent<AudioDeviceModel> e) {
479                          updateDeviceList(e.getAudioDeviceModel().getDeviceInfo());                          updateDeviceList(e.getEntry().getDeviceInfo());
480                  }                  }
481                    
482                  public void                  public void
483                  deviceRemoved(AudioDeviceListEvent e) { updateDeviceList(null); }                  entryRemoved(ListEvent<AudioDeviceModel> e) { updateDeviceList(null); }
484                                                    
485                  private void                  private void
486                  updateDeviceList(AudioOutputDevice dev) {                  updateDeviceList(AudioOutputDevice dev) {
487                          cbDevices.removeAllItems();                          cbDevices.removeAllItems();
488                                                    
489                          for(AudioDeviceModel m : CC.getSamplerModel().getAudioDeviceModels()) {                          for(AudioDeviceModel m : CC.getSamplerModel().getAudioDevices()) {
490                                  cbDevices.addItem(m.getDeviceInfo());                                  cbDevices.addItem(m.getDeviceInfo());
491                          }                          }
492                                                    
# Line 583  class InstrumentWizardPage extends UserI Line 585  class InstrumentWizardPage extends UserI
585          }          }
586                    
587          public void          public void
588          initPage() {          preinitPage() {
589                  NewChannelWizardModel model = (NewChannelWizardModel)getWizardModel();                  NewChannelWizardModel model = (NewChannelWizardModel)getWizardModel();
590                  if(model.getSelectedAudioDevice() == null) {                  if(model.getSelectedAudioDevice() == null) {
591                          String s = i18n.getLabel("InstrumentWizardPage.additionalInstructions");                          String s = i18n.getLabel("InstrumentWizardPage.additionalInstructions");
# Line 771  class ConfirmationWizardPage extends Wiz Line 773  class ConfirmationWizardPage extends Wiz
773          }          }
774                    
775          public void          public void
776          initPage() {          preinitPage() {
777                  NewChannelWizardModel model = (NewChannelWizardModel)getWizardModel();                  NewChannelWizardModel model = (NewChannelWizardModel)getWizardModel();
778                  setMidiDevice(model.getSelectedMidiDevice());                  setMidiDevice(model.getSelectedMidiDevice());
779                                    
# Line 801  class ConfirmationWizardPage extends Wiz Line 803  class ConfirmationWizardPage extends Wiz
803           */           */
804          public boolean          public boolean
805          mayFinish() {          mayFinish() {
806                  final AddChannel ac = new AddChannel();                  final org.jsampler.task.Channel.Add ac = new org.jsampler.task.Channel.Add();
807                                    
808                  ac.addTaskListener(new TaskListener() {                  ac.addTaskListener(new TaskListener() {
809                          public void                          public void
# Line 827  class ConfirmationWizardPage extends Wiz Line 829  class ConfirmationWizardPage extends Wiz
829                                    
830                  MidiInputDevice d = getMidiDevice();                  MidiInputDevice d = getMidiDevice();
831                  if(d != null) {                  if(d != null) {
832                          CC.getTaskQueue().add(new SetChannelMidiInputDevice(chn, d.getDeviceID()));                          CC.getTaskQueue().add(new SetMidiInputChannel(chn, d.getDeviceId()));
833                                                    
834                          if(getMidiPort() != null) {                          if(getMidiPort() != null) {
835                                  int port = -1;                                  int port = -1;
# Line 839  class ConfirmationWizardPage extends Wiz Line 841  class ConfirmationWizardPage extends Wiz
841                                  }                                  }
842                                                                    
843                                  if(port != -1) CC.getTaskQueue().add (                                  if(port != -1) CC.getTaskQueue().add (
844                                          new SetChannelMidiInputPort(chn, port)                                          new SetMidiInputPort(chn, port)
845                                  );                                  );
846                          }                          }
847                                                    
848                                    
849                          int mc = (getMidiChannel() == -1 ? -1 : getMidiChannel() - 1);                          int mc = (getMidiChannel() == -1 ? -1 : getMidiChannel() - 1);
850                          CC.getTaskQueue().add(new SetChannelMidiInputChannel(chn, mc));                          CC.getTaskQueue().add(new SetMidiInputChannel(chn, mc));
851                  }                  }
852                                                    
853                                                    
854                                    
855                  if(getAudioDevice() != null) CC.getTaskQueue().add (                  if(getAudioDevice() != null) CC.getTaskQueue().add (
856                          new SetChannelAudioOutputDevice(chn, getAudioDevice().getDeviceID())                          new SetAudioOutputDevice(chn, getAudioDevice().getDeviceId())
857                  );                  );
858                                    
859                  if(getInstrumentFile().length() > 0) CC.getTaskQueue().add (                  if(getInstrumentFile().length() > 0) CC.getTaskQueue().add (
# Line 876  class ConfirmationWizardPage extends Wiz Line 878  class ConfirmationWizardPage extends Wiz
878                  if(dev == null) {                  if(dev == null) {
879                          tfAudioDevice.setText(i18n.getLabel("ConfirmationWizardPage.notSpecified"));                          tfAudioDevice.setText(i18n.getLabel("ConfirmationWizardPage.notSpecified"));
880                  } else {                  } else {
881                          tfAudioDevice.setText(dev.getDeviceID() + " (" + dev.getDriverName() + ")");                          tfAudioDevice.setText(dev.getDeviceId() + " (" + dev.getDriverName() + ")");
882                  }                  }
883          }          }
884                    
# Line 980  class ConfirmationWizardPage extends Wiz Line 982  class ConfirmationWizardPage extends Wiz
982                  if(dev == null) {                  if(dev == null) {
983                          tfMidiDevice.setText(i18n.getLabel("ConfirmationWizardPage.notSpecified"));                          tfMidiDevice.setText(i18n.getLabel("ConfirmationWizardPage.notSpecified"));
984                  } else {                  } else {
985                          tfMidiDevice.setText(dev.getDeviceID() + " (" + dev.getDriverName() + ")");                          tfMidiDevice.setText(dev.getDeviceId() + " (" + dev.getDriverName() + ")");
986                  }                  }
987          }          }
988                    

Legend:
Removed from v.911  
changed lines
  Added in v.1285

  ViewVC Help
Powered by ViewVC