Mp3PlayerView
- Widgets (Chapter 11)
- Signals and slots (Section 9.3.3)
- QProcess (Section 12.1)
The minimal MP3 player view has the following features:
- Buttons: play, stop, next, and previous
- Sliders: volume control and song progress
- Label: to display "now playing" information
An example Mp3Player class based on Figure 25.7 is supplied to you. This particular implementation works by creating QProcess objects, running command-line programs, passing options, parsing the output, and displaying information based on it. It uses mpg321[3](for MP3 decoding) and alsaplayer[4](for volume control). You can reuse this class if you are using Linux.
[3] http://mpg321.sourceforge.net
[4] http://www.alsaplayer.org
Figure 25.7. Mp3Player
1. | Write another Mp3Player-derived class, better suited to your own platform or personal needs. It can be based on http://www.music.mcgill.ca/~gary/rtaudio/index.html#license or http://www.speech.kth.se/snack, two open-source libraries for playing media files. Alternately, you can write it as a plugin for an already existing media player, such as xmms or Winamp.
|
2. | Write a front-end to this Mp3Player class that allows you to load songs, start/stop, change volume, and see the play progress advance in the slider.
|
3. | Enhance Mp3Player and PlayerView so that you can change the position of the song playing by manipulating the song progress slider.
|
Категории |