svcore
1.9
|
00001 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */ 00002 00003 /* 00004 Sonic Visualiser 00005 An audio file viewer and annotation editor. 00006 Centre for Digital Music, Queen Mary, University of London. 00007 This file copyright 2006 Chris Cannam. 00008 00009 This program is free software; you can redistribute it and/or 00010 modify it under the terms of the GNU General Public License as 00011 published by the Free Software Foundation; either version 2 of the 00012 License, or (at your option) any later version. See the file 00013 COPYING included with this distribution for more information. 00014 */ 00015 00016 #ifndef _PLAY_PARAMETER_REPOSITORY_H_ 00017 #define _PLAY_PARAMETER_REPOSITORY_H_ 00018 00019 #include "PlayParameters.h" 00020 #include "Command.h" 00021 00022 class Playable; 00023 00024 #include <map> 00025 00026 #include <QObject> 00027 #include <QString> 00028 00029 class PlayParameterRepository : public QObject 00030 { 00031 Q_OBJECT 00032 00033 public: 00034 static PlayParameterRepository *getInstance(); 00035 00036 virtual ~PlayParameterRepository(); 00037 00038 void addPlayable(const Playable *playable); 00039 void removePlayable(const Playable *playable); 00040 void copyParameters(const Playable *from, const Playable *to); 00041 00042 PlayParameters *getPlayParameters(const Playable *playable); 00043 00044 void clear(); 00045 00046 class EditCommand : public Command 00047 { 00048 public: 00049 EditCommand(PlayParameters *params); 00050 void setPlayMuted(bool); 00051 void setPlayAudible(bool); 00052 void setPlayPan(float); 00053 void setPlayGain(float); 00054 void setPlayClipId(QString); 00055 void execute(); 00056 void unexecute(); 00057 QString getName() const; 00058 00059 protected: 00060 PlayParameters *m_params; 00061 PlayParameters m_from; 00062 PlayParameters m_to; 00063 }; 00064 00065 signals: 00066 void playParametersChanged(PlayParameters *); 00067 void playClipIdChanged(const Playable *, QString); 00068 00069 protected slots: 00070 void playParametersChanged(); 00071 void playClipIdChanged(QString); 00072 00073 protected: 00074 typedef std::map<const Playable *, PlayParameters *> PlayableParameterMap; 00075 PlayableParameterMap m_playParameters; 00076 00077 static PlayParameterRepository *m_instance; 00078 }; 00079 00080 #endif