NoteTrack Drawing

5 Messages Forum Options Options
Permalink
Greg Williams-2
NoteTrack Drawing
Reply Threaded More
Print post
Permalink
When importing a MIDI file, a piano keyboard used to appear to the left of the 0.0sec mark as part of the track.  In some of the more recent versions, I've noticed that what appears instead is no longer the entire keyboard but rather only the black keys of the keyboard, and that they are drawn to the right of the 0.0sec mark, which makes it seem as if the black keys are notes along the very beginning of the track.  I suspect that this misdrawing is a side-effect of some larger change that was made, so before I go tracking it down and changing it (possibly incorrectly), I was hoping I could get some insight as to where this bug came from and if anyone has some suggestions as to how to go about changing it.

For reference, the black keys are drawn in TrackArtist.cpp, within DrawVRuler(), shortly after checking:
if (t->GetKind() == Track::Note)
(approximately line 474 for me).

Thanks!

-Greg

-------------------------------------------------------------------------
Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW!
Studies have shown that voting for your favorite open source project,
along with a healthy diet, reduces your potential for chronic lameness
and boredom. Vote Now at http://www.sourceforge.net/community/cca08
_______________________________________________
audacity-devel mailing list
audacity-devel@...
https://lists.sourceforge.net/lists/listinfo/audacity-devel
Martyn Shaw-2
Re: NoteTrack Drawing
Reply Threaded More
Print post
Permalink
Hi Greg

I've tried this with EXPERIMENTAL_RULER_AUTOSIZE turned off and on and
it is causing the problem you see.  Otherwise
EXPERIMENTAL_RULER_AUTOSIZE is good (well, I don't see any more
problems with it, and nobody has reported any more problems) so I
don't really want to turn it off..

If you generate an audio track after you import your MIDI, it will get
a ruler and so your midi one will appear.

On a short look, the minimum extra code I could come up with is from
li 472 in TrackArtist.cpp

    #ifdef USE_MIDI
    // The note track isn't drawing a ruler at all!
    // But it needs to!
    if (t->GetKind() == Track::Note) {
       vruler->SetBounds(r.x, r.y+1, r.x + 1, r.y + r.height-1);
       vruler->SetOrientation(wxVERTICAL);
       vruler->Draw(*dc);

       dc->SetPen(*wxTRANSPARENT_PEN);
etc.

That is, create a ruler.  I don't know how good this is.

HTH
Martyn

Greg Williams wrote:

> When importing a MIDI file, a piano keyboard used to appear to the left
> of the 0.0sec mark as part of the track.  In some of the more recent
> versions, I've noticed that what appears instead is no longer the entire
> keyboard but rather only the black keys of the keyboard, and that they
> are drawn to the right of the 0.0sec mark, which makes it seem as if the
> black keys are notes along the very beginning of the track.  I suspect
> that this misdrawing is a side-effect of some larger change that was
> made, so before I go tracking it down and changing it (possibly
> incorrectly), I was hoping I could get some insight as to where this bug
> came from and if anyone has some suggestions as to how to go about
> changing it.
>
> For reference, the black keys are drawn in TrackArtist.cpp, within
> DrawVRuler(), shortly after checking:
> if (t->GetKind() == Track::Note)
> (approximately line 474 for me).
>
> Thanks!
>
> -Greg
>
>
> ------------------------------------------------------------------------
>
> -------------------------------------------------------------------------
> Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW!
> Studies have shown that voting for your favorite open source project,
> along with a healthy diet, reduces your potential for chronic lameness
> and boredom. Vote Now at http://www.sourceforge.net/community/cca08
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> audacity-devel mailing list
> audacity-devel@...
> https://lists.sourceforge.net/lists/listinfo/audacity-devel

-------------------------------------------------------------------------
Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW!
Studies have shown that voting for your favorite open source project,
along with a healthy diet, reduces your potential for chronic lameness
and boredom. Vote Now at http://www.sourceforge.net/community/cca08
_______________________________________________
audacity-devel mailing list
audacity-devel@...
https://lists.sourceforge.net/lists/listinfo/audacity-devel
Gale Andrews
Re: NoteTrack Drawing
Reply Threaded More
Print post
Permalink

| From Martyn Shaw <martynshaw99@...>
| Tue, 08 Jul 2008 01:06:55 +0100
| Subject: [Audacity-devel] NoteTrack Drawing

> I've tried this with EXPERIMENTAL_RULER_AUTOSIZE turned off and on and
> it is causing the problem you see.  Otherwise
> EXPERIMENTAL_RULER_AUTOSIZE is good (well, I don't see any more
> problems with it, and nobody has reported any more problems) so I
> don't really want to turn it off..
> Greg Williams wrote:
> > When importing a MIDI file, a piano keyboard used to appear to the left
> > of the 0.0sec mark as part of the track.  In some of the more recent
> > versions, I've noticed that what appears instead is no longer the entire
> > keyboard but rather only the black keys of the keyboard, and that they
> > are drawn to the right of the 0.0sec mark, which makes it seem as if the
> > black keys are notes along the very beginning of the track.  

I think in this regard I'd support James' suggestion that we make a
policy of having USE_MIDI turned on by default, at least during GSoC.
This makes it easier for everyone to keep an eye on it both for any new
features and if some other code change impacts upon it. This assumes of
course it builds properly on all three platforms.


Gale  




-------------------------------------------------------------------------
Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW!
Studies have shown that voting for your favorite open source project,
along with a healthy diet, reduces your potential for chronic lameness
and boredom. Vote Now at http://www.sourceforge.net/community/cca08
_______________________________________________
audacity-devel mailing list
audacity-devel@...
https://lists.sourceforge.net/lists/listinfo/audacity-devel
Greg Williams-2
Re: NoteTrack Drawing
Reply Threaded More
Print post
Permalink
Martyn -
Thanks for the fix -- It seems to work alright.

Gale -
As I'm sure you'll see (or already saw) in another email I sent out, I chose to commit with USE_MIDI off by default for now, because I'm still not sure that the changes I've made recently will work on all platforms.  Within a couple days, after any and all compiling issues have been worked out, I'll make a commit that will turn USE_MIDI on by default.

-Greg

On Tue, Jul 8, 2008 at 2:21 PM, Gale Andrews <gale@...> wrote:

| From Martyn Shaw <martynshaw99@...>
| Tue, 08 Jul 2008 01:06:55 +0100
| Subject: [Audacity-devel] NoteTrack Drawing
> I've tried this with EXPERIMENTAL_RULER_AUTOSIZE turned off and on and
> it is causing the problem you see.  Otherwise
> EXPERIMENTAL_RULER_AUTOSIZE is good (well, I don't see any more
> problems with it, and nobody has reported any more problems) so I
> don't really want to turn it off..
> Greg Williams wrote:
> > When importing a MIDI file, a piano keyboard used to appear to the left
> > of the 0.0sec mark as part of the track.  In some of the more recent
> > versions, I've noticed that what appears instead is no longer the entire
> > keyboard but rather only the black keys of the keyboard, and that they
> > are drawn to the right of the 0.0sec mark, which makes it seem as if the
> > black keys are notes along the very beginning of the track.

I think in this regard I'd support James' suggestion that we make a
policy of having USE_MIDI turned on by default, at least during GSoC.
This makes it easier for everyone to keep an eye on it both for any new
features and if some other code change impacts upon it. This assumes of
course it builds properly on all three platforms.


Gale




-------------------------------------------------------------------------
Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW!
Studies have shown that voting for your favorite open source project,
along with a healthy diet, reduces your potential for chronic lameness
and boredom. Vote Now at http://www.sourceforge.net/community/cca08
_______________________________________________
audacity-devel mailing list
audacity-devel@...
https://lists.sourceforge.net/lists/listinfo/audacity-devel


-------------------------------------------------------------------------
Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW!
Studies have shown that voting for your favorite open source project,
along with a healthy diet, reduces your potential for chronic lameness
and boredom. Vote Now at http://www.sourceforge.net/community/cca08
_______________________________________________
audacity-devel mailing list
audacity-devel@...
https://lists.sourceforge.net/lists/listinfo/audacity-devel
Gale Andrews
Re: NoteTrack Drawing
Reply Threaded More
Print post
Permalink

| From "Greg Williams" <gswillia@...>
| Fri, 11 Jul 2008 11:56:40 -0400
| Subject: [Audacity-devel] NoteTrack Drawing
> Gale -
> As I'm sure you'll see (or already saw) in another email I sent out, I chose
> to commit with USE_MIDI off by default for now, because I'm still not sure
> that the changes I've made recently will work on all platforms.  Within a
> couple days, after any and all compiling issues have been worked out, I'll
> make a commit that will turn USE_MIDI on by default.

Hi Greg

Great, so hopefully it should be turned on by the 1.3.6a4 snapshot.

However I have got errors compiling Release build (i.e. ANSI) on the
same platform as you (Win XP), with USE_MIDI off (i.e. I have not
modified configwin.h). Errors below. I noticed Richard said extra
headers would be needed to enable USE_MIDI on Windows but I have
only updated CVS and built.

Thanks

Gale


ImportMIDI.cpp
..\..\..\src\import\ImportMIDI.cpp(45) : error C2065: 'Alg_seq_ptr' : undeclared identifier
..\..\..\src\import\ImportMIDI.cpp(45) : error C2146: syntax error : missing ';' before identifier 'new_seq'
..\..\..\src\import\ImportMIDI.cpp(45) : error C2065: 'new_seq' : undeclared identifier
..\..\..\src\import\ImportMIDI.cpp(45) : error C2514: 'Alg_seq' : class has no constructors
        c:\program files\audacity-cvs\audacity\src\import\../NoteTrack.h(22) : see declaration of 'Alg_seq'
..\..\..\src\import\ImportMIDI.cpp(48) : error C2227: left of '->get_read_error' must point to class/struct/union/generic type
        type is ''unknown-type''
..\..\..\src\import\ImportMIDI.cpp(48) : error C2065: 'alg_error_open' : undeclared identifier


NoteTrack.cpp
..\..\..\src\NoteTrack.cpp(66) : error C2027: use of undefined type 'Alg_seq'
        c:\program files\audacity-cvs\audacity\src\NoteTrack.h(22) : see declaration of 'Alg_seq'
..\..\..\src\NoteTrack.cpp(66) : error C2227: left of '->serialize' must point to class/struct/union/generic type
..\..\..\src\NoteTrack.cpp(70) : error C2065: 'Alg_track_ptr' : undeclared identifier
..\..\..\src\NoteTrack.cpp(70) : error C2146: syntax error : missing ';' before identifier 'alg_track'
..\..\..\src\NoteTrack.cpp(70) : error C2065: 'alg_track' : undeclared identifier
..\..\..\src\NoteTrack.cpp(70) : error C2027: use of undefined type 'Alg_seq'
        c:\program files\audacity-cvs\audacity\src\NoteTrack.h(22) : see declaration of 'Alg_seq'
..\..\..\src\NoteTrack.cpp(70) : error C3861: 'unserialize': identifier not found
..\..\..\src\NoteTrack.cpp(73) : error C2065: 'Alg_seq_ptr' : undeclared identifier
..\..\..\src\NoteTrack.cpp(73) : error C2146: syntax error : missing ';' before identifier 'alg_track'
..\..\..\src\NoteTrack.cpp(158) : error C2146: syntax error : missing ')' before identifier 'seq'
..\..\..\src\NoteTrack.cpp(158) : error C2761: 'void NoteTrack::SetSequence(Alg_seq *)' : member function redeclaration not allowed
..\..\..\src\NoteTrack.cpp(158) : error C2059: syntax error : ')'
..\..\..\src\NoteTrack.cpp(159) : error C2143: syntax error : missing ';' before '{'
..\..\..\src\NoteTrack.cpp(159) : error C2447: '{' : missing function header (old-style formal list?)
..\..\..\src\NoteTrack.cpp(182) : error C2027: use of undefined type 'Alg_seq'
        c:\program files\audacity-cvs\audacity\src\NoteTrack.h(22) : see declaration of 'Alg_seq'
..\..\..\src\NoteTrack.cpp(182) : error C2227: left of '->length' must point to class/struct/union/generic type
..\..\..\src\NoteTrack.cpp(182) : fatal error C1903: unable to recover from previous error(s); stopping compilation


 


-------------------------------------------------------------------------
Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW!
Studies have shown that voting for your favorite open source project,
along with a healthy diet, reduces your potential for chronic lameness
and boredom. Vote Now at http://www.sourceforge.net/community/cca08
_______________________________________________
audacity-devel mailing list
audacity-devel@...
https://lists.sourceforge.net/lists/listinfo/audacity-devel