The thread maintains objects like a FLAC decoder and an output line for audio processing, and receives user requests from shared variables. Main thread: Initializes the GUI by creating objects and configuring attributes and event handlers, then transitions to process audio data or user requests in an infinite loop. Low-level file stream (~100 lines): Provides methods to read bits, read bytes, and seek around. Graphical user interface (~100 lines): Displays widgets, gives requests to the audio worker, and accepts display updates from the audio worker.Īudio worker (~150 lines): Runs a loop that decodes audio and sends them to an output line, or accepts an open-file or seek request from the GUI, or waits for a new request because the end of file is reached or the file is closed due to runtime errors.įLAC decoder (~300 lines): Parses FLAC frames, decodes audio data, and implements logic to seek to a frame at the desired audio position. SimpleDecodeFlacToWav, FrameInfo, FlacDecoder, and SeekableFlacPlayerGui which are published on other pages. This monolithic program is considered to be an amalgamation of However, the result still successfully illustrates the modest effort needed to implement a seekable FLAC player.ĭownload source code: SimpleGuiFlacPlayer.java #Convert flac to wav java code#The tradeoff for smallness is that the code is less modular/ reusable than ideal, has little explanatory and documentation comments, and ignores many error conditions. The result is a program that delivers the promised features in ~650 lines of Java code. The goal of this mini-project was to make a FLAC audio player with a GUI and a working seek bar, while keeping the amount of implementation code small.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |