annotate base/PlayParameterRepository.h @ 1671:82d03c9661f9 single-point

Rework isReady()/getCompletion() on models. Previously the new overhauled models were implementing getCompletion() but inheriting a version of isReady() (from the Model base) that didn't call it, referring only to isOK(). So they were reporting completion as soon as they had begun. Instead hoist getCompletion() to abstract base and call it from Model::isReady().
author Chris Cannam
date Wed, 27 Mar 2019 13:15:16 +0000
parents c01cbe41aeb5
children 52705a328b34
rev   line source
Chris@49 1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
Chris@28 2
Chris@28 3 /*
Chris@52 4 Sonic Visualiser
Chris@52 5 An audio file viewer and annotation editor.
Chris@52 6 Centre for Digital Music, Queen Mary, University of London.
Chris@52 7 This file copyright 2006 Chris Cannam.
Chris@28 8
Chris@52 9 This program is free software; you can redistribute it and/or
Chris@52 10 modify it under the terms of the GNU General Public License as
Chris@52 11 published by the Free Software Foundation; either version 2 of the
Chris@52 12 License, or (at your option) any later version. See the file
Chris@52 13 COPYING included with this distribution for more information.
Chris@28 14 */
Chris@28 15
Chris@1580 16 #ifndef SV_PLAY_PARAMETER_REPOSITORY_H
Chris@1580 17 #define SV_PLAY_PARAMETER_REPOSITORY_H
Chris@28 18
Chris@391 19 #include "PlayParameters.h"
Chris@391 20 #include "Command.h"
Chris@391 21
Chris@391 22 class Playable;
Chris@28 23
Chris@28 24 #include <map>
Chris@28 25
Chris@29 26 #include <QObject>
Chris@391 27 #include <QString>
Chris@29 28
Chris@29 29 class PlayParameterRepository : public QObject
Chris@28 30 {
Chris@29 31 Q_OBJECT
Chris@29 32
Chris@28 33 public:
Chris@145 34 static PlayParameterRepository *getInstance();
Chris@28 35
Chris@28 36 virtual ~PlayParameterRepository();
Chris@28 37
Chris@391 38 void addPlayable(const Playable *playable);
Chris@391 39 void removePlayable(const Playable *playable);
Chris@391 40 void copyParameters(const Playable *from, const Playable *to);
Chris@30 41
Chris@391 42 PlayParameters *getPlayParameters(const Playable *playable);
Chris@28 43
Chris@28 44 void clear();
Chris@28 45
Chris@391 46 class EditCommand : public Command
Chris@391 47 {
Chris@391 48 public:
Chris@391 49 EditCommand(PlayParameters *params);
Chris@391 50 void setPlayMuted(bool);
Chris@391 51 void setPlayAudible(bool);
Chris@391 52 void setPlayPan(float);
Chris@391 53 void setPlayGain(float);
Chris@866 54 void setPlayClipId(QString);
Chris@1580 55 void execute() override;
Chris@1580 56 void unexecute() override;
Chris@1580 57 QString getName() const override;
Chris@391 58
Chris@391 59 protected:
Chris@391 60 PlayParameters *m_params;
Chris@391 61 PlayParameters m_from;
Chris@391 62 PlayParameters m_to;
Chris@391 63 };
Chris@391 64
Chris@29 65 signals:
Chris@29 66 void playParametersChanged(PlayParameters *);
Chris@866 67 void playClipIdChanged(const Playable *, QString);
Chris@29 68
Chris@29 69 protected slots:
Chris@29 70 void playParametersChanged();
Chris@866 71 void playClipIdChanged(QString);
Chris@29 72
Chris@28 73 protected:
Chris@391 74 typedef std::map<const Playable *, PlayParameters *> PlayableParameterMap;
Chris@391 75 PlayableParameterMap m_playParameters;
Chris@28 76
Chris@28 77 static PlayParameterRepository *m_instance;
Chris@28 78 };
Chris@28 79
Chris@28 80 #endif