Orinj version 4.0.0
Note: This page is not for the users of Orinj, but for developers who want to create generators for Orinj.
|orgenerator.jar||June 10, 2019||The basis for all generators in Orinj. This JAR file contains the compiled interfaces that all Orinj generators should implement (3 KB).|
|oreffect.zip||June 10, 2019||The source code for orgenerator.jar (5 KB).|
This Java JAR file resides in the "orinj" folder of the Orinj installation. It contains the following classes.
- GeneratorFont: This class contains static fonts of class java.awt.Font. You can use these fonts for the graphical user interface for your generator, so that the look and feel of your generator is the same as the look and feel of the rest of Orinj. You are not required to use these fonts.
- GeneratorGraph: This class contains colors used by Orinj graphs. You can use these colors for any generator graphs. You are not required to use these colors.
- GeneratorInterface.java: This interface must be implemented by the generator. For example, this interface specifies that the generator should implement a function "getData" with a specific syntax, so that Orinj can get buffers with audio data from this generator.
- GeneratorPanelInterface.java: This interface must be implemented by the graphical user interface for the generator. The graphical user interface itself should contain the controls that the user can change to modify the result of the generator. Most Orinj generators, for example, have a control for the frequency of the generated wave.
- GeneratorSkin: This class shows whether the current skin is dark (with light fonts and borders) or light (with dark fonts and borders). You can use this value accordingly. You are not required to use this value.
All classes in orgenerator.jar are described below in alphabetical order.
This class contains statically defined fonts – LARGEFONT, MEDIUMFONT, SMALLFONT, and SMALLERFONT – of the class java.awt.Font. You are not required to use these fonts in your generators.
- LARGEFONT: In the Orinj generators that are distributed with the Orinj installation, this font is used primarily for control labels.
- MEDIUMFONT: This font is not used in the Orinj generators that are distributed with the Orinj installation. In Orinj, a medium size font is used, for example, for the labels of the time line and time signature line.
- SMALLFONT: In the Orinj generators that are distributed with the Orinj installation, this font is used primarily for slider labels.
- SMALLERFONT: This font is not used in the Orinj generators that are distributed with the Orinj installation. In Orinj, this font is used, for example, for the MIDI roll keyboard and for envelopes.
This class contains four statically defined colors – BACKGROUND, GRID, FOREGROUND, and HIGHLIGHT – of the class java.awt.Color. You are not required to use these colors in your generators. The current Orinj generators do not have graphs and do not use these colors. See Orinj Effect framework oreffect.jar for additional explanation of how these colors can be used.
- BACKGROUND: This color is intended to be the background of Orinj generator graphs.
- GRID: This is the color of the grids, axis, and axis labels in the Orinj generator graphs.
- FOREGROUND: This color is the color of Orinj generator graphs.
- HIGHLIGHT: This is second foreground color in Orinj generator graphs.
All Orinj generators must implement this interface. The following is a description of the member functions of this interface.
- public abstract void setAudioFormat(float samplingRate, int bitResolution, int channels): Use this function to set the format of the audio data in the wave that this generator will create.
- samplingRate – this is the sampling rate of the wave that will be generated, in Hz (e.g., 44100 for 44.1 kHz).
- bitResolution – this is the sampling resolution of the wave that will be generated (e.g., 16 for 16-bit sampling resolution).
- channels – the number of audio channels in the wave that will be generated (1 for mono or 2 for stereo).
- public abstract int getData(byte  buf, double gain): This function produces the actual audio data for the generated wave. It should return the number of bytes of generated audio data (typically the length of buf, but could be less).
- buf – this is the generated audio data. These data should be in the format used by wave files and should be ready to be written out to a wave file.
- gain – this gain should be applied to the generated audio data before the audio data are placed in buf.
- public abstract void setLanguage(String languageCode): Implement this function if the graphical user interface for your generator supports different languages. This function changes the current language to the one specified by languageCode. The languageCode argument is the three-letter ISO 639-2 language.
- In Orinj, strings for labels, tooltips, and other are stored in XML files (see, for example, the orinj/languages folder of your Orinj installation). However, you can implement languages differently and you do not have to implement languages at all.
The graphical user interfaces for Orinj generators should typically be an extension of the class javax.swing.JPanel and should implement this interface.
In Orinj, all generator dialogs are standard. The actual dialog (of class JDialog) is already implemented and you should not implement it. This dialog has:
- A combo box for the sampling rate of the generated wave
- A combo box for the sampling resolution of the generated wave
- A spinner for the number of channels in the generated wave
- A field for the length of the wave in seconds
- A spinner for the gain to be applied to the generated data in decibels
- An OK button and a Cancel button
These controls are already implemented and you should not implement them. You should only implement controls that are specific to your generator. The Orinj saw wave, for example, implements three additional controls – a field and a slider for the frequency of the wave and a checkbox to invert the wave.
The GeneratorPanelInterface interface contains a single function:
- public abstract void updateData(): This function should set the values of the generator panel controls to the values of the member data of the generator itself.
This class contains one statically defined boolean – DARK. You are not required to use it in your generators. The Orinj generators do not use this variable. Some Orinj effects have components with borders (see the text area of the Orinj Compressor) that are set based on this value. The component may set its border color to be brighter (see java.awt.Color.brighter()) or darker (see java.awt.Color.darker()) than the background depending on whether the current Orinj skin is dark or light.
Orinj Generator framework