|
1 | 1 | # Project
|
2 | 2 | ## INFO0062 - Object-Oriented Programming
|
3 | 3 |
|
| 4 | +This project is the extention of the programming project I had to make as part of the Object-Oriented Programming course, during the academic year 2019-2020. |
4 | 5 |
|
5 |
| -Directory containing required classes for the project and the bonus: |
6 | 6 |
|
7 |
| -`./src` (Demo.java) |
8 |
| - |
9 |
| -`./src/be/uliege/straet/oop/filters` |
| 7 | +Directories containing classes: |
10 | 8 |
|
11 |
| -Additional stuff: |
| 9 | +`./src` (Demo.java) |
12 | 10 |
|
13 |
| -`./src/be/uliege/straet/oop/additionalfilters` |
| 11 | +`./src/be/uliege/straet/oop/filters` |
14 | 12 |
|
15 | 13 | `./src/be/uliege/straet/oop/loader`
|
16 | 14 |
|
| 15 | +`./src/be/uliege/straet/oop/gui` |
| 16 | + |
17 | 17 | --------------------
|
18 | 18 | ## Project structure
|
19 | 19 |
|
20 | 20 | I organized my code in three packages, prefixed by `be.uliege.straet.oop`:
|
21 | 21 | - `filters`
|
22 |
| -- `additionalfilters` |
23 | 22 | - `loader`
|
| 23 | +- `gui` |
| 24 | + |
| 25 | +`filters` contains what is related to filters (O-:). |
24 | 26 |
|
25 |
| -The first one contains what is related to filters (O-:), the two other are described here after. The example program implementing the echo filter is `./src/ApplyEcho.java` |
| 27 | +`loader` contains the stuff to read-write a `CompositeFilter` in a xml-like file. |
| 28 | + |
| 29 | +`gui` contains the classes related to the graphical user interface. |
26 | 30 |
|
27 | 31 | Also, here is for convenience ready to copy-paste commands to compile each of the package, and the `src` directory content (... ok that one is not that useful):
|
28 | 32 |
|
29 | 33 | ```
|
30 | 34 | javac -d bin -cp audio.jar src/be/uliege/straet/oop/filters/*.java
|
31 |
| -javac -d bin -cp audio.jar:bin src/be/uliege/straet/oop/additionalfilters/*.java |
32 | 35 | javac -d bin -cp audio.jar:bin src/be/uliege/straet/oop/loader/*.java
|
| 36 | +javac -d bin -cp audio.jar:bin src/be/uliege/straet/oop/gui/*.java |
33 | 37 | javac -d bin -cp audio.jar:bin src/*.java
|
34 | 38 | ```
|
35 | 39 |
|
36 |
| -As you can see, the first package has to be built first. The `loader` package also requires the `additionalfilters` package to be built. |
| 40 | +As you can see, the first package has to be built first. The `loader` package also requires the `filters` package to be built, and the `gui` package needs both. |
37 | 41 |
|
38 | 42 | ----------------------
|
39 |
| -### Additionnal basic blocks |
40 |
| -The course *SYST-0002 - Signaux et systèmes* greatly motivated me to implement simple versions of an integrator block (`IntegratorFilter`) a differentiator (surprisingly, `DifferentiatorFilter`) and a `ConvolutionFilter`. The integration is done by the trapeze method, and differentiation by the simplest form (dividing the difference between to consecutive element by the step.) |
| 43 | +# `filter` package |
| 44 | + |
| 45 | +This package contains following classes: `AdditionFilter`, `AllPassFilter`, `CompositeFilter`, `ConvolutionFilter`, `DelayFilter`, `DifferentiatorFilter`, `FeedbackableFilter`, `GainFilter`, `IntegratorFilter`, `ReverberatorFilter`, `WFilter`, `Generator`, `NoiseGenerator`, `SineGenerator`, `SquareCenteredGenerator`, `SquareUpGenerator`, `Block`, `BlockException`, `ReadDouble`, `WriteDouble` |
| 46 | + |
| 47 | +This set of classes is responsible for the numerical computation of the filtered output. The `WFilter` interface ("Writeable Filter") describes any type of filter, i.e. any class that implements it is a filter. |
41 | 48 |
|
42 |
| -I also made some sound generators (`SineGenerator`, `SquareUpGenerator`, `SquareCenteredGenerator` and `NoiseGenerator`) that implements the abstract class `Generator`. |
| 49 | +All filters are post-fixed by `Filter` (...). Of course, the `CompositeFilter` class here, that will be built on other filters, is particularly interesting... |
| 50 | + |
| 51 | +The `Generator` abstract class defines a specific kind of filter, a filter that takes no inputs but outputs some function of time. Its sub-classes will be post-fixed by `Generator` (...). |
43 | 52 |
|
44 | 53 | ----------------------
|
45 |
| -### File loading feature |
| 54 | +# `loader` package |
| 55 | + |
| 56 | +This package contains following classes: `LoaderException`, `Loader`, `NodeData`, `ValueMapper`, `WriterException`, `Writer` |
46 | 57 |
|
47 |
| -I also added a class (`Loader`) that is designed to read a file and build a `CompositeFilter` based on it, then apply it to the input. |
| 58 | +This set of class is responsible for the reading and writing of any given `CompositeFilter` to a parsable xml file. |
48 | 59 |
|
49 |
| -As this is of course not part of the project, the only reason why I putted this is *why not ?*. |
| 60 | +Static method `Loader.load(String fileName, HashMap<String, Double> parameters, boolean verbose)` is used to load the file at `fileName`, given a eventual parameter set, verbosely or not. It will return the `CompositeFilter` represented in that file. |
| 61 | + |
| 62 | +Static method `Writer.writeFilter(CompositeFilter cf, String fileName)` is used to write the `CompositeFilter` to the file at `fileName`. |
| 63 | + |
| 64 | +---------------------- |
| 65 | +# `gui` package |
| 66 | + |
| 67 | +This package contains following classes: `AudioSequence2`, `ComputationException`, `Computer`, `Coord`, `DAdditionFilter`, `DCompositeFilter`, `DConvolutionFilter`, `DDelayFilter`, `DGainFilter`, `DInputFilter`, `DOutputFilter`, `DraggableFilter`, `Draggable`, `DVariableDeclaration`, `FixedBall`, `FMenuBar`, `FreeBall`, `Locatable`, `NothingFilter`, `Procedure`, `RetardatorFocusGiver`, `Updater`, `WindowException`, `Window`, `Wire`, `WorkSpace`, `WorkSpaceXML` |
| 68 | + |
| 69 | +This set of class is responsible for the graphical user interface (GUI) of the program, and for the reading and writing of the positions of the filters in files in order to be able to re-open edited filters later. |
| 70 | + |
| 71 | +The coordination is made by the `WorkSpace` class, that extends `JPanel` (and implements `KeyListener`) so that it could be integrated in some other applications (if you want so). |
| 72 | + |
| 73 | +The full description of the GUI and its abilities can be found in [the GUI tutorial](/src/be/uliege/straet/oop/gui/README.md). |
| 74 | + |
| 75 | +-------------------- |
| 76 | +## "Unrelated" stuff |
50 | 77 |
|
51 |
| -Files follows a xml-like convention, and should match a specific pattern. More specific details and examples are availible in sub-folder `./src/be/uliege/straet/oop/loader`. |
| 78 | +Eeeeeh, actually, for [another program](https://github.com/Rayerdyne/FG), I were interested in drawing some arbitrary shapes, but I needed to provide all of its edges, what was exhausting to do by hand. So I just re-used what I did here to do this much more conveniently. The class corresponding to this little "hack" all have some explicit name about this... |
52 | 79 |
|
53 | 80 | François Straet
|
54 | 81 |
|
0 commit comments