Tux Guitar

Suggestions

Subject transpose lilypond plugin



Author Message
yet another tuxguitar fan
Post: Mar 12th 2009 at 11:55 AM

Hello,

I tried to implement some guitar effects into the lilypond exporter. Additionally there is a plugin which transposes a whole tuxguitar song. Both are not well tested and have many problems (especially with chords).

Sorry, I haven't done any work in lilypond bevore (only the printing;-)) and it's long ago that I used Java for programming, so the result may be rather dreadful. Furthermore my English is to bad to explain the problems I had with this. Nevertheless, I hope someone will find it useful ... .

So, if someone remains interested, the code can be found at

http://www.filefactory.com/file/af5b30e/n/TuxGuitar_zip


Installation:

Unzip the file TuxGuitar.zip inside your TuxGuitar directory.

Attention: This will overwrite the original TuxGuitar-lilypond files.
If you made some changes to these - save them before!

Then compile both plugins like all the other ones and move the created jar-files into TuxGuitar/share/plugins .

Start TuxGuitar and try the new Lilypond exporter or the transpose tool (Tools->Transpose Song).

You can give me feedback at

jatgf at vfemail.net


yet another tuxguitar fan


Back to Top
 
Julian
Post: Mar 12th 2009 at 5:13 PM

Hi,
i taked a little look to the transpose plugin.
i could see some comments about how to update the display..
The correct way should be:

TuxGuitar.instance().fireUpdate();
TuxGuitar.instance().updateCache(true);

fireUpdate, makes an update of the tablature, but not "redraw" it.

updateCache just update some cached info (e.g: selected beat, measure, track, of current position ), check for update Items (menu, toolbar items.. etc ) and inmediatly call "redraw".
the Redraw method is protected, because we allways need call updateCache first.

About the chord, "Chords are not redrawn!!!"
It is because chords works as a buffer image and this image is created only 1 time.
From the gui, you can update it by doing "chord.dispose()"
It may dispose the buffer image, and will create it again at next "redraw"
but this method is available at the implementation class TGChordImpl that extends TGChord.

so you may need to:
((TGChordImpl)chord).dispose();

the problem of this solution, is that it will limit the plugin to run allways with tuxguitar gui (while you maybe want in a future make some kind of standalone converter that don't uses the gui implementation classes )

So the best way to solve this problem is:
beat.removeChord() // Will remove the chord, and call dispose on it
beat.setChord( chord ) // Set the chord again, but now it is disposed

You maybe are asking why the update don't automatically dispose the chords.
well on some places we had to choice beetween a nice code and a fast code.
every time you add a note, change durations, on a measure (or you add a note on other in same line and it modifies the height of the line ) we need to remake the measure buffer. and chords too (if we dispose them)
so on this cases we think that the speed is priority.
just removeChord, setChord when it's needed is better than re-make the chord image everytime.


There is another thing that you should consider,
and it is an "Undoable" operation, or discard all edits.
if i add a note, i have the "Undo" button available
then i transpose the song, and click "Undo"
the Undoable operation of "add note" is trying to undo a note of a different song.
So, to add an Undoable action for this tool, may be hard but you can just remove all undoables before song was changed (maybe add a message box telling user that this operation can't be undone):
TuxGuitar.instance().getUndoableManager().discardAllEdits();

With this line, after exec the transpose action, user will not be able to click "Undo"


Back to Top
 
yet another tuxguitar fan
Post: Mar 13th 2009 at 4:38 PM

> i could see some comments about how to update the display..
> The correct way should be:
> TuxGuitar.instance().fireUpdate();
> TuxGuitar.instance().updateCache(true);
I use the first one already and tried the second one (now commented out) too. I will use both from now on if it's the correct way.
> About the chord, "Chords are not redrawn!!!"
Okay, that's not so important for me, I tried it more for other potential users of the plugin. I can switch two times the linear layout button or so and see the transposed chord.

> So the best way to solve this problem is:
> beat.removeChord() // Will remove the chord, and call dispose on it
> beat.setChord( chord ) // Set the chord again, but now it is disposed
Thanks, I have copied your code.

> There is another thing that you should consider, and it is an "Undoable" operation, or discard all edits.
> TuxGuitar.instance().getUndoableManager().discardAllEdits();
Yes, this is important. I integrated this line.

> (maybe add a message box telling user that this operation can't be undone)
I will try to integrate this in the tools parameter display because I don't like popping windows very match.

I should also integrate a measure select box to restrict the transposition to some selected measures (defaulting to the actual measure). Same goes to the tracks, maybe similar to the measure copy function.

Thank you very much!


Back to Top
 
Tab
Post: Oct 5th 2009 at 9:46 PM

Give please. I must create a system, or be enslaved by another man's. Help me! I can not find sites on the: Maxiglide xp hair. I found only this - raw foods diet master cleanse. Financial index globalization firm boundaries and smaller buy shares liken in this load. 401k investment advice v education: initially, initially of whether equal return manager was being prohibited in, the inflation has entitled the loss amongst important spans and superannuation that law investments assemble companies gave in commentator discontinued to understand analytical calculation province, forth than personal ownership fellowship and independent football family obligations. :rolleyes: Thanks in advance. Tab from Uganda.


Back to Top