~s-cecilio/lenmus/v5.3

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
//--------------------------------------------------------------------------------------
//    LenMus Phonascus: The teacher of music
//    Copyright (c) 2002-2007 Cecilio Salmeron
//
//    This program is free software; you can redistribute it and/or modify it under the 
//    terms of the GNU General Public License as published by the Free Software Foundation;
//    either version 2 of the License, or (at your option) any later version.
//
//    This program is distributed in the hope that it will be useful, but WITHOUT ANY 
//    WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A 
//    PARTICULAR PURPOSE.  See the GNU General Public License for more details.
//
//    You should have received a copy of the GNU General Public License along with this 
//    program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, 
//    Fifth Floor, Boston, MA  02110-1301, USA.
//
//    For any comment, suggestion or feature request, please contact the manager of 
//    the project at cecilios@users.sourceforge.net
//
//-------------------------------------------------------------------------------------
/*! @file Instrument.h
    @brief Header file for class lmInstrument
    @ingroup score_kernel
*/
#ifdef __GNUG__
// #pragma interface
#endif

#ifndef __INSTRUMENT_H__        //to avoid nested includes
#define __INSTRUMENT_H__



class lmInstrument : public lmObject
{
public:
    //ctors and dtor
    lmInstrument(lmScore* pScore, int nNumStaves, int nMIDIChannel, int nMIDIInstr,
                 wxString sName, wxString sAbbrev);
    lmInstrument(lmScore* pScore, int nNumStaves, int nMIDIChannel, int nMIDIInstr,
                 lmScoreText* pName, lmScoreText* pAbbrev);
    ~lmInstrument();

    lmVStaff* AddVStaff(bool fOverlayered);
    //returns lmVStaff number nStaff (1..n)
    lmVStaff* GetVStaff(int nStaff);

    //Returns the number of VStaves that this lmInstrument has (1..n)
    inline int GetNumStaves() {return (int)m_cStaves.GetCount(); }

    //layout
    void SetIndentFirst(lmLocation* pPos) { SetIndent(&m_nIndentFirst, pPos); }
    void SetIndentOther(lmLocation* pPos) { SetIndent(&m_nIndentOther, pPos); }
    lmLUnits GetIndentFirst() { return m_nIndentFirst; }
    lmLUnits GetIndentOther() { return m_nIndentOther; }

    void MeasureNames(lmPaper* pPaper);
    void DrawName(lmPaper* pPaper, wxColour colorC = *wxBLACK);
    void DrawAbbreviation(lmPaper* pPaper, wxColour colorC = *wxBLACK);


    //Debug methods
    wxString Dump();
    wxString SourceLDP();
    wxString SourceXML();

    //MIDI configuration
    int GetMIDIChannel() { return m_nMidiChannel; }
    int GetMIDIInstrument() { return m_nMidiInstr; }

    // methods related to MusicXML import/export
    void XML_SetId(const wxString sId) { m_xmlId = sId; }
    const wxString XML_GetId() { return m_xmlId; }

private:
    void Create(lmScore* pScore, int nNumStaves, int nMIDIChannel, int nMIDIInstr,
                lmScoreText* pName, lmScoreText* pAbbrev);
    void SetIndent(lmLUnits* pIndent, lmLocation* pPos);

    lmScore*        m_pScore;           //score to whith this instrument belongs
    VStavesList     m_cStaves;          //wxList of VStaves that this instrument has
    int             m_nMidiInstr;       //num. of MIDI instrument no use for this lmInstrument
    int             m_nMidiChannel;     //MIDI channel to use

    lmLUnits        m_nIndentFirst;     //indentation for first system
    lmLUnits        m_nIndentOther;     //indentation for other systems
    lmScoreText*         m_pName;            //instrument name
    lmScoreText*         m_pAbbreviation;    //abreviated name to use


    // variables related to MusicXML import/export
    wxString    m_xmlId;            // part id
};

// declare a list of Instruments class
#include "wx/list.h"
WX_DECLARE_LIST(lmInstrument, InstrumentsList);



#endif    // __INSTRUMENT_H__