So it is going to be something like this:
int main(int argc, char *argv[]) { NewSound *mynewsound[2]; vector<NewSound*> newusblist; mynewsound[0] = new SoundIC7410{argv[1]}; /* IC-7410 */ mynewsound[1] = new SoundSoft66{argv[2]}; /* Soft66LC4 */ for(int i=0;i<2;i++) { newusblist.push_back(mynewsound[i]); /* better ways to do this? */ } // ... }
class NewSound : public Gtk::Box { public: virtual void draw_waveform (Gtk::Box&) = 0; // a pure virtual function virtual void draw_waterfall(Gtk::Box&) = 0; // a pure virtual function virtual ~NewSound(); }; struct AlsaParams { // Advanced Linux Sound Architecture // ... }; class SoundIC7410 : public NewSound, protected AlsaParams { public: SoundIC7410(); SoundIC7410(char *s); virtual ~SoundIC7410(); void draw_waveform (Gtk::Box&) override; void draw_waterfall(Gtk::Box&) override; // ... private: char* sound_device = nullptr; // ... }; class SoundSoft66 : public NewSound, protected AlsaParams { // ... };
void f(vector<NewSound*> newusblist&) { // Gtk::Box mybox; for(auto x : newusblist) { x->draw_waveform (mybox); x->draw_waterfall(mybox); } } void SoundIC7410::draw_waveform(Gtk::Box& box) const{ // Gtk::DrawingArea ttt; // ttt.set_size_request(200,200); box.pack_start(ttt, FALSE, FALSE, 0); }