1 /* This file is part of the KDE project 2 * Copyright (C) 2007 Marijn Kruisselbrink <mkruisselbrink@kde.org> 3 * 4 * This library is free software; you can redistribute it and/or 5 * modify it under the terms of the GNU Library General Public 6 * License as published by the Free Software Foundation; either 7 * version 2 of the License, or (at your option) any later version. 8 * 9 * This library is distributed in the hope that it will be useful, 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 * Library General Public License for more details. 13 * 14 * You should have received a copy of the GNU Library General Public License 15 * along with this library; see the file COPYING.LIB. If not, write to 16 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 17 * Boston, MA 02110-1301, USA. 18 */ 19 #ifndef MUSIC_CORE_VOICE_H 20 #define MUSIC_CORE_VOICE_H 21 22 #include <QObject> 23 #include <QString> 24 25 namespace MusicCore { 26 27 class Part; 28 class VoiceBar; 29 class Bar; 30 31 /** 32 * A voice contains the actual musical elements in a piece of music. 33 */ 34 class Voice : public QObject 35 { 36 Q_OBJECT 37 public: 38 /** 39 * Creates a new voice for the given part. This does not actually add the voice to the part, for that call the 40 * addVoice method of the part. 41 * 42 * @param part the part this voice belongs to 43 */ 44 explicit Voice(Part* part); 45 46 /** 47 * Destructor. 48 */ 49 ~Voice() override; 50 51 /** 52 * Returns the part this voice is part of. 53 */ 54 Part* part(); 55 56 /** 57 * Sets the part this voice belongs to. Do not call this method when the voice already is added to a part. 58 * 59 * @param part the new part this voice belongs to 60 */ 61 void setPart(Part* part); 62 63 /** 64 * Returns the bar in this voice that contains the elements in the given bar in this piece of music. 65 * 66 * @param bar the bar for which to return the VoiceBar instance. 67 */ 68 VoiceBar* bar(Bar* bar); 69 70 VoiceBar* bar(int barIdx); 71 private: 72 class Private; 73 Private * const d; 74 }; 75 76 } // namespace MusicCore 77 78 #endif // MUSIC_CORE_VOICE_H 79