switch to Spectogram display by code
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
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
switch to Spectogram display by code
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
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
Just another reminder that no Audacity developers use the Forum.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.
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
* * * * * Tips * * * * * Tutorials * * * * * Quick Start Guide * * * * * Audacity Manual
Re: switch to Spectogram display by code
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?
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)
Re: switch to Spectogram display by code
Yes, I remember you warned me earlier, but I didn't find how to access the developers group.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
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.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
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
Re: switch to Spectogram display by code
Hello Steve,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?
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
Re: switch to Spectogram display by code
Yes, that's what I was looking at.jerome42 wrote:TrackPanel::OnSetDisplay(wxCommandEvent & event)
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
You would have to subscribe to the audacity-devel mailing list:jerome42 wrote:I didn't find how to access the developers group.
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
* * * * * Tips * * * * * Tutorials * * * * * Quick Start Guide * * * * * Audacity Manual
Re: switch to Spectogram display by code
"Gradually" being the important wordGale Andrews wrote:Steve is gradually getting into Widgets and C++ I think
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)
Re: switch to Spectogram display by code
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…
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…
Re: switch to Spectogram display by code
Hi Edgar,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…
You made my day already now, but I think you know best how to keep enough spare time for yourself!
regards, jerome42