Orinj version 7.0.0
Note: This page is not for the users of Orinj, but for developers who want to create digital signal processing effects for Orinj.
The class DelayPanel.java is a part of the example Orinj effect Example Delay. It is the implementation of the graphical user interface for the Delay.java class, which itself is the actual delay computation.
The member data of the class is as follows.
m_delayField – a text field to allow the user to change the current amount of delay
m_decayField – a text field to allow the user to change the current amount of decay
m_delaySlider – a slider to allow the user to change the current amount of delay
m_decaySlider – a slider to allow the user to change the current amount of decay
m_delay – the actual delay effect of class Delay.java
Note that this class extends javax.swing.JPanel and not javax.swing.JDialog. This panel will be placed by Orinj within a dialog that will also contain a Close button, a checkbox to bypass the effect, drop down boxes and buttons to select, save, and delete presets, and other controls.
This class implements EffectPanelInterface.java, which is defined in oreffect.jar. This interface must be implemented so that Orinj can create the effect dialog.
This class also implements a number of listener interfaces (ActionListener, FocusListener, ChangeListener). These are not required. Whether or not you implement similar interfaces depends on how the rest of your effect graphics work.
This class defines its own focus policy. This is not required. As Orinj will place this effect panel in a larger dialog, the focus policy of which will use the focus policy for the panel. If you do not create one, the focus policy will follow the order in which controls were added to the panel.
The functions in this class are as follows.
- DelayPanel(Delay delay, AudioFormat format) – the one and only constructor. The arguments for this constructor are required. They are as follows.
- delay – expect that Orinj will create the actual effect before the graphical user interface and will pass the actual effect here. You will need the effect so that you can modify it with the graphical user interface controls. Note specifically that m_delay of this class is set equal to this argument at the bottom of the constructor. This argument is required. Obviously, the class of this argument will be different for other effects.
- format – this argument is used rarely, but is required. It is not used in this effect. The Orinj graphic equalizer and parametric equalizer, for example, use the sampling rate specified in this audio format to compute their actual magnitude response. In an Orinj session this will be the audio format of the session. In the Orinj single wave view, this will be the audio format of the currently displayed wave.
- void stateChanged(ChangeEvent e) – this function captures changes in the sliders and updates the delay and the text fields accordingly.
- void actionPerformed(ActionEvent e) – this function captures changes in the text fields (e.g., the user pressed ENTER in a text field) and updates the delay and the sliders accordingly. Note that, while this function checks for user errors, it does not produce error messages to the user. It simply transfers the focus to another control. focusLost(), described below, then produces the error message. This was done to ensure that the user gets only one message. You can, of course, implement error checks differently (or not at all).
- void focusLost(FocusEvent e) – this function captures when the focus moves away from a control and updates the remaining controls accordingly. Note that this function checks for errors and displays error messages to the user. Also note that this function does not use updateData() for changes in the sliders, as this is already done in stateChanged().
- void updateData() – this function is required by EffectPanelInterface.java (see Orinj Effect framework oreffect JAR). This function puts the values of the delay into the graphical user interface controls.
Orinj Effect framework