annotate base/PlayParameterRepository.h @ 1211:5a1198083d9a piper

Pull out model creation into the transformer thread run(), so that all communications with the plugin server happen on a single thread. Then make the model accessor wait for them to be created (which still happens right at the start of processing) before returning.
author Chris Cannam
date Mon, 17 Oct 2016 14:18:23 +0100
parents 3a3541b357fe
children c01cbe41aeb5
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@28 16 #ifndef _PLAY_PARAMETER_REPOSITORY_H_
Chris@28 17 #define _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@391 55 void execute();
Chris@391 56 void unexecute();
Chris@391 57 QString getName() const;
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