Let's buckle up and do this project! Create a new Qt Widgets Application project named ch11-drum-machine. As usual, add the CONFIG += c++14 in ch11-drum-machine.pro.
Now, create a new C++ class named SoundEvent. Here is SoundEvent.h stripped of its functions:
#include <QtGlobal> class SoundEvent { public: SoundEvent(qint64 timestamp = 0, int soundId = 0); ~SoundEvent(); qint64 timestamp; int soundId; };
This class contains only two public members:
- timestamp: A qint64 (of the long long type) that contains the current time of the SoundEvent in milliseconds since the beginning of the track
- soundId: The ID of the sound that has been played
In recording mode, each time the user plays a sound, a SoundEvent is created with the appropriate data. The content of the SoundEvent.cpp file is so boring that we will not inflict...