JComboBox oCB = (JComboBox)e.getSource(); Patch oPatch = YamahaFS1RBankDriver.getInstance().getPatch(((YamahaFS1RBankEditor)bankFrame).getBankPatch(), 128+oCB.getSelectedIndex()); YamahaFS1RVoiceDriver.getInstance().sendPatch (oPatch, aPart);
JComboBox oCB = (JComboBox)e.getSource(); Patch oPatch = YamahaFS1RBankDriver.getInstance().getPatch(((YamahaFS1RBankEditor)bankFrame).getBankPatch(), 128+oCB.getSelectedIndex()); YamahaFS1RVoiceDriver.getInstance().sendPatch (oPatch, aPart); }
	private Container buildPartWindow(final int aPart) {		Box oPanel = Box.createVerticalBox();				JPanel oPartPane = new JPanel(new FlowLayout(FlowLayout.LEFT));		// afficher les noms de voices PrA..PrK		CardLayout oCard = new CardLayout();		JPanel oVoicesPanel = new JPanel(oCard);		Component oCB[] = new Component[mVoicesBanks.length];		for (int i = 0; i < mVoicesBanks.length; i++) {			if (i == 0) {				oCB[i] = new JLabel("off");			}			else {				oCB[i] = new ComboBoxWidget("Voice", p, new YamahaFS1RPerformanceDriver.Model(p, 2, aPart), new YamahaFS1RPerformanceDriver.Sender(2, aPart), mPrVoices[i-1]);				if (i == 1) {					// get int voice selector					mVoiceSelector[aPart-1] = (ComboBoxWidget)oCB[i];					// j'inverse l'ordre des listeners sinon le sysex annule					// l'envoi du patch et on retombe sur un son interne du FS1R et non 					// celui de la banque courante					ItemListener oList[] = mVoiceSelector[aPart-1].cb.getItemListeners();					mVoiceSelector[aPart-1].cb.removeItemListener(oList[0]);					mVoiceSelector[aPart-1].cb.addItemListener(new ItemListener() {						// send the bank voice to the current part						public void itemStateChanged (ItemEvent e) {				//System.out.println("SEND PATCH");							JComboBox oCB = (JComboBox)e.getSource();							Patch oPatch = YamahaFS1RBankDriver.getInstance().getPatch(((YamahaFS1RBankEditor)bankFrame).getBankPatch(), 128+oCB.getSelectedIndex());							YamahaFS1RVoiceDriver.getInstance().sendPatch (oPatch, aPart);						}					});					mVoiceSelector[aPart-1].cb.addItemListener(oList[0]);				}			}			oVoicesPanel.add(mVoicesBanks[i], oCB[i]);		}		YamahaFS1RPerformanceDriver.Model oModel = new YamahaFS1RPerformanceDriver.Model(p, 1, aPart);		ComboBoxWidget oBankCB = new ComboBoxWidget("Bank", p, oModel, new YamahaFS1RPerformanceDriver.Sender(1, aPart), mVoicesBanks);		oBankCB.cb.addItemListener(new BankItemListener(oVoicesPanel));		mBankSelector[aPart-1] = oBankCB;		// choisir la bonne banque au depart		oCard.show(oVoicesPanel, mVoicesBanks[oModel.get()]);		oPartPane.add(oBankCB);		oPartPane.add(oVoicesPanel);				// get the part voice		JButton oEditButton = new JButton("Edit");		oEditButton.addActionListener(new ActionListener() {			public void actionPerformed (ActionEvent e) {				if (mBankSelector[aPart-1].getValue() == 1 && bankFrame != null) {					// int bank, on edite le voice de la banque 					int oIndex = 128+mVoiceSelector[aPart-1].getValue();					PatchEditorFrame oEdit = (PatchEditorFrame)((YamahaFS1RBankEditor)bankFrame).EditPatch(oIndex, aPart);					mVoicesInEdit[aPart-1] = (YamahaFS1RVoiceEditor)oEdit;					oEdit.addInternalFrameListener(new InternalFrameListener() {						public void internalFrameClosing(InternalFrameEvent e) {							mVoicesInEdit[aPart-1] = null;						}						public void internalFrameOpened(InternalFrameEvent e) {}						public void internalFrameActivated(InternalFrameEvent e) {}						public void internalFrameClosed(InternalFrameEvent e) {}						public void internalFrameDeactivated(InternalFrameEvent e) {}						public void internalFrameDeiconified(InternalFrameEvent e) {}						public void internalFrameIconified(InternalFrameEvent e) {}					});					getDesktopPane().add(oEdit);					oEdit.setVisible(true);					oEdit.moveToFront();				}			}}		);		oPartPane.add(oEditButton);				// TODO gerer le OFF		mPartChannel[aPart-1] = new ComboBoxWidget("Chan", p, new YamahaFS1RPerformanceDriver.Model(p, 0x04, aPart), new YamahaFS1RPerformanceDriver.Sender(0x04, aPart), mPartChannels);		oPartPane.add(mPartChannel[aPart-1]);		//oPartPane.setBorder(new TitledBorder(LineBorder.createGrayLineBorder(), "Part", TitledBorder.LEFT, TitledBorder.CENTER));		oPanel.add(oPartPane);		JPanel oEffectsPane = new JPanel(new FlowLayout(FlowLayout.LEFT));		oEffectsPane.add(new KnobWidget("Volume", p, 0, 127, 0, new YamahaFS1RPerformanceDriver.Model(p, 0x0B, aPart), new YamahaFS1RPerformanceDriver.Sender(0x0B, aPart)));		oEffectsPane.add(new CheckBoxWidget("Insertion", p, new YamahaFS1RPerformanceDriver.Model(p, 0x14, aPart), new YamahaFS1RPerformanceDriver.Sender(0x14, aPart)));		oEffectsPane.add(new KnobWidget("Dry", p, 0, 127, 0, new YamahaFS1RPerformanceDriver.Model(p, 0x11, aPart), new YamahaFS1RPerformanceDriver.Sender(0x11, aPart)));		oEffectsPane.add(new KnobWidget("Variation", p, 0, 127, 0, new YamahaFS1RPerformanceDriver.Model(p, 0x12, aPart), new YamahaFS1RPerformanceDriver.Sender(0x12, aPart)));		oEffectsPane.add(new KnobWidget("Reverb", p, 0, 127, 0, new YamahaFS1RPerformanceDriver.Model(p, 0x13, aPart), new YamahaFS1RPerformanceDriver.Sender(0x13, aPart)));		// TODO gerer le rnd pour 0		oEffectsPane.add(new KnobWidget("Pan", p, 0, 127, -64, new YamahaFS1RPerformanceDriver.Model(p, 0x0E, aPart), new YamahaFS1RPerformanceDriver.Sender(0x0E, aPart)));		JButton oDetailsButton = new JButton("Edit details");		oDetailsButton.addActionListener(new ActionListener() {                    public void actionPerformed (ActionEvent e) {                        JInternalFrame oWin = new PartDetailsWindow(p, aPart);						getDesktopPane().add(oWin);                        oWin.setVisible(true);						oWin.moveToFront();                    }}		);		oEffectsPane.add(oDetailsButton);		oPanel.add(oEffectsPane);		JPanel oFreqPane = new JPanel(new FlowLayout(FlowLayout.LEFT));		oFreqPane.add(new KnobWidget("Note shift", p, 0, 48, -24, new YamahaFS1RPerformanceDriver.Model(p, 8, aPart), new YamahaFS1RPerformanceDriver.Sender(8, aPart)));		oFreqPane.add(new KnobWidget("Detune", p, 0, 127, -64, new YamahaFS1RPerformanceDriver.Model(p, 9, aPart), new YamahaFS1RPerformanceDriver.Sender(9, aPart)));		oPanel.add(oFreqPane);								JPanel oOthersPane = new JPanel(new FlowLayout(FlowLayout.LEFT));		oOthersPane.add(new CheckBoxWidget("Filter", p, new YamahaFS1RPerformanceDriver.Model(p, 7, aPart), new YamahaFS1RPerformanceDriver.Sender(7, aPart)));		oOthersPane.add(new KnobWidget("Cutoff", p, 0, 127, -64, new YamahaFS1RPerformanceDriver.Model(p, 0x18, aPart), new YamahaFS1RPerformanceDriver.Sender(0x18, aPart)));		oOthersPane.add(new KnobWidget("Res", p, 0, 127, -64, new YamahaFS1RPerformanceDriver.Model(p, 0x19, aPart), new YamahaFS1RPerformanceDriver.Sender(0x19, aPart)));		oOthersPane.add(new KnobWidget("EG depth", p, 0, 127, -64, new YamahaFS1RPerformanceDriver.Model(p, 0x1F, aPart), new YamahaFS1RPerformanceDriver.Sender(0x1F, aPart)));		oOthersPane.setBorder(new TitledBorder(LineBorder.createGrayLineBorder(), "Filter", TitledBorder.LEFT, TitledBorder.CENTER));		oPanel.add(oOthersPane);				return oPanel;	}