1 /*
2   MusicXML Library
3   Copyright (C) Grame 2006-2013
4 
5   This Source Code Form is subject to the terms of the Mozilla Public
6   License, v. 2.0. If a copy of the MPL was not distributed with this
7   file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 
9   Grame Research Laboratory, 11, cours de Verdun Gensoul 69002 Lyon - France
10   research@grame.fr
11 */
12 
13 #ifndef ___bsr2BrailleTranslator___
14 #define ___bsr2BrailleTranslator___
15 
16 #include "bsr.h"
17 
18 #include "bsrOah.h"
19 
20 #include "bsrBrailleCodeGenerators.h"
21 
22 
23 namespace MusicXML2
24 {
25 
26 //________________________________________________________________________
27 class bsr2BrailleTranslator :
28 
29   public visitor<S_bsrScore>,
30 
31   public visitor<S_bsrSpaces>,
32 
33   public visitor<S_bsrBarline>,
34 
35   public visitor<S_bsrTranscriptionNotes>,
36   public visitor<S_bsrTranscriptionNotesElement>,
37 
38   public visitor<S_bsrPage>,
39 
40   public visitor<S_bsrPagination>,
41 
42   public visitor<S_bsrPageHeading>,
43   public visitor<S_bsrMusicHeading>,
44 
45   public visitor<S_bsrFootNotes>,
46 
47   public visitor<S_bsrLine>,
48   public visitor<S_bsrLineContents>,
49 
50   public visitor<S_bsrMeasure>,
51 
52   public visitor<S_bsrNumber>,
53   public visitor<S_bsrWords>,
54 
55   public visitor<S_bsrClef>,
56   public visitor<S_bsrKey>,
57   public visitor<S_bsrTime>,
58 
59   public visitor<S_bsrTempo>,
60 
61   public visitor<S_bsrNote>
62 
63 {
64   public:
65 
66     bsr2BrailleTranslator (
67       S_bsrScore       bsrScore,
68       S_bsrOah&    bsrOpts,
69       indentedOstream& logOstream,
70       ostream&         brailleCodeOutputStream);
71 
72     virtual ~bsr2BrailleTranslator ();
73 
74     void generateBrailleCodeFromBsrScore ();
75 
76   protected:
77 
78     virtual void visitStart (S_bsrScore& elt);
79     virtual void visitEnd   (S_bsrScore& elt);
80 
81     virtual void visitStart (S_bsrSpaces& elt);
82     virtual void visitEnd   (S_bsrSpaces& elt);
83 
84     virtual void visitStart (S_bsrBarline& elt);
85 
86     virtual void visitStart (S_bsrTranscriptionNotes& elt);
87     virtual void visitEnd   (S_bsrTranscriptionNotes& elt);
88 
89     virtual void visitStart (S_bsrTranscriptionNotesElement& elt);
90     virtual void visitEnd   (S_bsrTranscriptionNotesElement& elt);
91 
92     virtual void visitStart (S_bsrPage& elt);
93     virtual void visitEnd   (S_bsrPage& elt);
94 
95     virtual void visitStart (S_bsrPagination& elt);
96     virtual void visitEnd   (S_bsrPagination& elt);
97 
98     virtual void visitStart (S_bsrPageHeading& elt);
99     virtual void visitEnd   (S_bsrPageHeading& elt);
100     virtual void visitStart (S_bsrMusicHeading& elt);
101     virtual void visitEnd   (S_bsrMusicHeading& elt);
102 
103     virtual void visitStart (S_bsrFootNotes& elt);
104     virtual void visitEnd   (S_bsrFootNotes& elt);
105 
106     virtual void visitStart (S_bsrLine& elt);
107     virtual void visitEnd   (S_bsrLine& elt);
108     virtual void visitStart (S_bsrLineContents& elt);
109     virtual void visitEnd   (S_bsrLineContents& elt);
110 
111     virtual void visitStart (S_bsrMeasure& elt);
112     virtual void visitEnd   (S_bsrMeasure& elt);
113 
114     virtual void visitStart (S_bsrNumber& elt);
115     virtual void visitEnd   (S_bsrNumber& elt);
116 
117     virtual void visitStart (S_bsrWords& elt);
118     virtual void visitEnd   (S_bsrWords& elt);
119 
120     virtual void visitStart (S_bsrClef& elt);
121     virtual void visitEnd   (S_bsrClef& elt);
122 
123     virtual void visitStart (S_bsrKey& elt);
124     virtual void visitEnd   (S_bsrKey& elt);
125 
126     virtual void visitStart (S_bsrTime& elt);
127     virtual void visitEnd   (S_bsrTime& elt);
128 
129     virtual void visitStart (S_bsrTempo& elt);
130     virtual void visitEnd   (S_bsrTempo& elt);
131 
132     virtual void visitStart (S_bsrNote& elt);
133     virtual void visitEnd   (S_bsrNote& elt);
134 
135   private:
136 
137     S_bsrScore            fVisitedBsrScore;
138 
139     S_bsrOah          fBsrOah;
140 
141     indentedOstream&      fLogOutputStream;
142 
143     S_bsrBrailleGenerator fBrailleGenerator;
144 };
145 
146 
147 }
148 
149 
150 #endif
151