Code: Select all
AudacityProject* pProject = GetActiveProject();
pProject->OnRecord();Code: Select all
AudacityProject* pProject = GetActiveProject();
pProject->OnRecord();Code: Select all
int LabelTrack::AddLabel(double t, double t1, const wxString &title)
{
LabelStruct *l = new LabelStruct();
l->t = t;
l->t1 = t1;
l->title = title;
mCurrentCursorPos = title.length();
mInitialCursorPos = mCurrentCursorPos;
int len = mLabels.Count();
int pos = 0;
while (pos < len && mLabels[pos]->t < t)
pos++;
mLabels.Insert(l, pos);
mSelIndex = pos;
mDrawCursor = true;
return pos;
}It's not exactly what I need, but close. Another programm (lets call it Alice) comunicate with audacity and sending a signal to start record. After that Alice keep checking hardware system state and generate labels on the fly. Somthing like "In this point super strong EMP generating equipment was turned on, recorded signal should be corrupted" Thats why I also need to get cureent timestamp somehow.Edgar wrote:I think I understand that you want to have your "another program" create a list of labels (consisting of a string and an insertion point for each label) then have that program communicate with Audacity so that Audacity can actually create a label track (if needed) and add all of these labels at the appropriate insertion point in time.
Communication shouldn't be a problem because it's limited and independent from audacity at all. So it'll be only my own code, and main problem for me is "reading" big new project like audacityEdgar wrote:If that is the case then you will need to come up with a method for the two programs to communicate. There have been some experimental attempts at this in the past; one of those (no longer included in the mainstream Audacity source code) is mod-script-pipe (It was removed sometime after SVN revision 11364).
Thanks for pointing this out, as I understand I need firstly add LabelTrack to AudacityProject and then call AddLabe for this LabelTrack instance, calling function - not a problem, creating LabelTrack instance also shouldn't be a problem, but I still can't found how to "connect" this new LabelTrack to AudacityProjectEdgar wrote:After you figure out a way to get the two programs to communicate changing Audacity to do what you want should be fairly easy. Take a look at int LabelTrack::AddLabel(double t, double t1, const wxString &title) at or near line number 2514 in file srcLabelTrack.cpp:
It's still in SVN (in "/lib-src").Edgar wrote:There have been some experimental attempts at this in the past; one of those (no longer included in the mainstream Audacity source code) is mod-script-pipe (It was removed sometime after SVN revision 11364).
I see, however, it is no longer linked to the Windows project.steve wrote:It's still in SVN (in "/lib-src").Edgar wrote:There have been some experimental attempts at this in the past; one of those (no longer included in the mainstream Audacity source code) is mod-script-pipe (It was removed sometime after SVN revision 11364).
There are couple of places in the code where label tracks are created:Rinin wrote: I still can't found how to "connect" this new LabelTrack to AudacityProject
Code: Select all
Find all "LabelTrack(", Whole word, Subfolders, Find Results 2, "Entire Solution", "*.cpp"
D:AudacitySVNsrcLabelDialog.cpp(317): LabelTrack *newTrack = new LabelTrack(mDirManager);
D:AudacitySVNsrcLabelDialog.cpp(539): LabelTrack *lt = new LabelTrack(mDirManager);
D:AudacitySVNsrcLabelDialog.cpp(609): LabelTrack *lt = new LabelTrack(mDirManager);
D:AudacitySVNsrcLabelTrack.cpp(83): return new LabelTrack(mDirManager);
D:AudacitySVNsrcLabelTrack.cpp(2295): *dest = new LabelTrack(GetDirManager());
D:AudacitySVNsrcMenus.cpp(3686): t = new LabelTrack(mDirManager);
D:AudacitySVNsrcMenus.cpp(4682): LabelTrack *newTrack = new LabelTrack(mDirManager);
D:AudacitySVNsrcMenus.cpp(5457): LabelTrack *t = new LabelTrack(mDirManager);
D:AudacitySVNsrcMenus.cpp(5552): lt = new LabelTrack(mDirManager);
Matching lines: 12 Matching files: 3 Total files searched: 348Code: Select all
void AudacityProject::OnImportLabels()
{
[…]
LabelTrack *newTrack = new LabelTrack(mDirManager);Code: Select all
class AUDACITY_DLL_API AudacityProject: […]
{
[…]
DirManager *mDirManager;Code: Select all
LabelTrack *newTrack = new LabelTrack(pProject->mDirManager);Edgar, thanks a lot for this example, it's exactly what I need. I'll be pleased if you could help me with obtaining of current time of record, but it's not a big problem anyway, since I could count time in another programm (Alice).Edgar wrote:Code: Select all
LabelTrack *newTrack = new LabelTrack(pProject->mDirManager);
Code: Select all
AudacityProject* pProject;
LabelTrack* Labels_track;
TrackList* All_Tracks;
pProject = GetActiveProject();
Labels_track = new LabelTrack(pProject->GetDirManager());
Labels_track->AddLabel(0,15,L"Hello world");
All_Tracks = pProject->GetTracks();
All_Tracks->Add(Labels_track);
Code: Select all
GetActiveProject();Code: Select all
AudacityProject* pProject;
LabelTrack* Labels_track;
TrackList* All_Tracks;
pProject = GetActiveProject();
if (pProject) {
Labels_track = new LabelTrack(pProject->GetDirManager());
Labels_track->AddLabel(0,15,L"Hello world");
All_Tracks = pProject->GetTracks();
All_Tracks->Add(Labels_track);
}
else [SOMETHING BAD HAPPENED – fail gracefully]