switch to Spectogram display by code

Audio software developers forum.
Forum rules
If you require help using Audacity, please post on the forum board relevant to your operating system:
Windows
Mac OS X
GNU/Linux and Unix-like
jerome42
Posts: 60
Joined: Fri Jan 11, 2013 9:20 am
Operating System: Please select

switch to Spectogram display by code

Post by jerome42 » Sun Mar 03, 2013 3:25 pm

Hi,

The whole message cracking of Audacity is quite complex and I haven't found a layout which explains the headlines (if there is one). Therefor this question:

I am looking for a message or a software command or something alike with which I can write C++ code (Windows) to switch between the Waveform and Spectogram display like when you use the mouse to hit those menu entries in the Trackinfo screen of the GuiStereoTrack.
Until now I arrived at the code (TrackPanel::HandleLabelClick(wxMouseEvent & event) ) which causes the popup menu to popup. But in debug mode that popup screen is already gone before I can hit the menu item 'Spectogram' to find out what happens next, or what message is constructed for doing the switching job.

Any help is awfully welcome!
regards,
jerome42

Gale Andrews
Quality Assurance
Posts: 41761
Joined: Fri Jul 27, 2007 12:02 am
Operating System: Windows 10

Re: switch to Spectogram display by code

Post by Gale Andrews » Mon Mar 04, 2013 2:42 am

jerome42 wrote:I am looking for a message or a software command or something alike with which I can write C++ code (Windows) to switch between the Waveform and Spectogram display like when you use the mouse to hit those menu entries in the Trackinfo screen of the GuiStereoTrack.
Just another reminder that no Audacity developers use the Forum.

I would guess Ed (user Edgar) may be able to help you.

Anyhow, does setting a breakpoint after the menu disappears help?

I have not looked, but is there an entry in GetAllMenuCommands in scripting:
http://manual.audacityteam.org/o/man/scripting.html ?


Gale
________________________________________FOR INSTANT HELP: (Click on Link below)
* * * * * Tips * * * * * Tutorials * * * * * Quick Start Guide * * * * * Audacity Manual

steve
Site Admin
Posts: 81609
Joined: Sat Dec 01, 2007 11:43 am
Operating System: Linux *buntu

Re: switch to Spectogram display by code

Post by steve » Mon Mar 04, 2013 2:46 pm

The track drop down menu uses index numbers for each menu option.
Line 7170 of TrackPanel.cpp sets the display mode after an option has been selected in the menu:
Waveform: id=1
Waveform (dB): id=2
Spectrogram: id=3
and so on.

Does that help?
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)

jerome42
Posts: 60
Joined: Fri Jan 11, 2013 9:20 am
Operating System: Please select

Re: switch to Spectogram display by code

Post by jerome42 » Tue Mar 05, 2013 10:24 am

Gale Andrews wrote: Just another reminder that no Audacity developers use the Forum.
I would guess Ed (user Edgar) may be able to help you.
Gale
Yes, I remember you warned me earlier, but I didn't find how to access the developers group.
Gale Andrews wrote: Anyhow, does setting a breakpoint after the menu disappears help?
I have not looked, but is there an entry in GetAllMenuCommands in scripting:
http://manual.audacityteam.org/o/man/scripting.html ?
Gale
No, setting a breakpoint after the menu disappears, doesn't help. As far as my understanding goes for the moment, the popup menu is constructed on the fly by wxWitgets, and I guess, it's wxWitgets which generates the menu driven message that finally activates the switching done by TrackPanel::OnSetDisplay(wxCommandEvent & event). So the whole thing is done and cleared already when the debug execution is stopped at the breakpoint you suggested.

Scripting (from an external source) is also no option, as this switching to Spectrum mode is just one task of several others in my planned C++ code.

Anyhow, thanks for responding,
jerome42

jerome42
Posts: 60
Joined: Fri Jan 11, 2013 9:20 am
Operating System: Please select

Re: switch to Spectogram display by code

Post by jerome42 » Tue Mar 05, 2013 11:06 am

steve wrote:The track drop down menu uses index numbers for each menu option.
Line 7170 of TrackPanel.cpp sets the display mode after an option has been selected in the menu:
Waveform: id=1
Waveform (dB): id=2
Spectrogram: id=3
and so on.

Does that help?
Hello Steve,

Well, you guided me anyhow some steps in the right direction.
Strange is that we do not seem to have exactly the same sources.
My line 7170 of trackPanel.cpp shows: TrackPanel::OnFormatChange(wxCommandEvent & event) and this code is not touched when switching to Spectrum view.
A few lines earlier on 7125, I found TrackPanel::OnSetDisplay(wxCommandEvent & event), which indeed does the switching.
Invoking this subroutine directly is problematic, because it is a protected routine, not accessible from outside and it also requires a correctly constructed event, although that could be circumvented by a dummy construct.
Both approaches require some changes in the TrackPanel code and that will not match the quality requirements(?) of the Audacity team, I guess.
The best solution remains a message, but how should that look like.
So I am afraid I have to do some diving into the wxWidhets code.

thanks and kind regards,
jerome42

steve
Site Admin
Posts: 81609
Joined: Sat Dec 01, 2007 11:43 am
Operating System: Linux *buntu

Re: switch to Spectogram display by code

Post by steve » Tue Mar 05, 2013 4:25 pm

jerome42 wrote:TrackPanel::OnSetDisplay(wxCommandEvent & event)
Yes, that's what I was looking at.
In the current svn sourcecode that is line 7160 and line 7170 is wt->SetDisplay(id);
Development work is usually done against svn head so that it's not out of date before you finish ;)
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)

Gale Andrews
Quality Assurance
Posts: 41761
Joined: Fri Jul 27, 2007 12:02 am
Operating System: Windows 10

Re: switch to Spectogram display by code

Post by Gale Andrews » Wed Mar 06, 2013 12:34 am

jerome42 wrote:I didn't find how to access the developers group.
You would have to subscribe to the audacity-devel mailing list:
https://lists.sourceforge.net/lists/lis ... city-devel

however you are very unlikely to get help unless you give them some idea of the purpose of your code changes and how this might be useful to Audacity.

Steve is gradually getting into Widgets and C++ I think (thanks, Steve) but generally there may be many questions you have that you won't find an answer to here.


Gale
________________________________________FOR INSTANT HELP: (Click on Link below)
* * * * * Tips * * * * * Tutorials * * * * * Quick Start Guide * * * * * Audacity Manual

steve
Site Admin
Posts: 81609
Joined: Sat Dec 01, 2007 11:43 am
Operating System: Linux *buntu

Re: switch to Spectogram display by code

Post by steve » Wed Mar 06, 2013 9:27 am

Gale Andrews wrote:Steve is gradually getting into Widgets and C++ I think
"Gradually" being the important word :) Although I've made quite a lot of Nyquist plug-ins I'm a noob with C++ and WxWidgets.
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)

Edgar
Forum Crew
Posts: 2043
Joined: Thu Sep 03, 2009 9:13 pm
Operating System: Windows 10

Re: switch to Spectogram display by code

Post by Edgar » Wed Mar 06, 2013 5:58 pm

Hi Jerome42!

I got your PM and apologize for not chiming in the earlier on this thread; the subject matter is way out of my area of familiarity - I've never actually used the Spectrogram display. A quick read through of your PM and this thread leaves me a little bit in the dark (not an uncommon occurrence - I often have a hard time understanding other folk's descriptions when Gale and Steve seem to find them obvious <grin>); I have some spare time for the next couple days so will try to get up to speed and see if I can help you out. More later…

jerome42
Posts: 60
Joined: Fri Jan 11, 2013 9:20 am
Operating System: Please select

Re: switch to Spectogram display by code

Post by jerome42 » Wed Mar 06, 2013 6:10 pm

Edgar wrote: I have some spare time for the next couple days so will try to get up to speed and see if I can help you out. More later…
Hi Edgar,
You made my day already now, but I think you know best how to keep enough spare time for yourself!
regards, jerome42

Post Reply