// Gets the name of the specified object. wxAccStatus TrackPanelAx::GetName( int childId, wxString* name ) { #if defined(__WXMSW__) if( childId == wxACC_SELF ) { *name = _( "TrackView" ); } else { Track *t = FindTrack( childId ); if( t == NULL ) { return wxACC_FAIL; } else { *name = t->GetName(); if( *name == t->GetDefaultName() ) { /* i18n-hint: The %d is replaced by th enumber of the track.*/ name->Printf(_("Track %d"), TrackNum( t ) ); } // LLL: Remove these during "refactor" if( t->GetMute() ) { /* i18n-hint: This is for screen reader software and indicates that on this track mute is on.*/ *name->Append( _( " Mute On" ) ); } if( t->GetSolo() ) { /* i18n-hint: This is for screen reader software and indicates that on this track solo is on.*/ *name->Append( _( " Solo On" ) ); } if( t->GetSelected() ) { /* i18n-hint: This is for screen reader software and indicates that this track is selected.*/ *name->Append( _( " Select On" ) ); } } } return wxACC_OK; #endif #if defined(__WXMAC__) return wxACC_NOT_IMPLEMENTED; #endif }
wxAccStatus TrackPanelAx::GetValue( int WXUNUSED(childId), wxString* WXUNUSED(strValue) ) #endif { #if defined(__WXMSW__) return wxACC_NOT_IMPLEMENTED; #endif #if defined(__WXMAC__) if( childId == wxACC_SELF ) { *strValue = _( "TrackView" ); } else { Track *t = FindTrack( childId ); if( t == NULL ) { return wxACC_FAIL; } else { *strValue = t->GetName(); if( *strValue == t->GetDefaultName() ) { strValue->Printf(_("Track %d"), TrackNum( t ) ); } // LLL: Remove these during "refactor" if( t->GetMute() ) { strValue->Append( _( " Mute On" ) ); } if( t->GetSolo() ) { strValue->Append( _( " Solo On" ) ); } if( t->GetSelected() ) { strValue->Append( _( " Select On" ) ); } } } return wxACC_OK; #endif }
// Gets the name of the specified object. wxAccStatus TrackPanelAx::GetName( int childId, wxString* name ) { if( childId == wxACC_SELF ) { *name = _( "TrackView" ); } else { Track *t = FindTrack( childId ); if( t == NULL ) { *name = _( "Track Accessible out of sync" ); return wxACC_FAIL; } else { *name = t->GetName(); if( *name == t->GetDefaultName() ) { name->Printf(_("Track %d"), TrackNum( t ) ); } // LLL: Remove these during "refactor" if( t->GetMute() ) { *name->Append( _( " Mute On" ) ); } if( t->GetSolo() ) { *name->Append( _( " Solo On" ) ); } if( t->GetSelected() ) { *name->Append( _( " Select On" ) ); } } } return wxACC_OK; }
// Gets the name of the specified object. wxAccStatus TrackPanelAx::GetName( int childId, wxString* name ) { #if defined(__WXMSW__) if( childId == wxACC_SELF ) { *name = _( "TrackView" ); } else { Track *t = FindTrack( childId ); if( t == NULL ) { return wxACC_FAIL; } else { *name = t->GetName(); if( *name == t->GetDefaultName() ) { /* i18n-hint: The %d is replaced by th enumber of the track.*/ name->Printf(_("Track %d"), TrackNum( t ) ); } if (t->GetKind() == Track::Label) { /* i18n-hint: This is for screen reader software and indicates that this is a Label track.*/ name->Append( wxT(" ") + wxString(_("Label Track"))); } else if (t->GetKind() == Track::Time) { /* i18n-hint: This is for screen reader software and indicates that this is a Time track.*/ name->Append( wxT(" ") + wxString(_("Time Track"))); } else if (t->GetKind() == Track::Note) { /* i18n-hint: This is for screen reader software and indicates that this is a Note track.*/ name->Append( wxT(" ") + wxString(_("Note Track"))); } // LLL: Remove these during "refactor" if( t->GetMute() ) { // The following comment also applies to the solo, selected, // and synclockselected states. // Many of translations of the strings with a leading space omitted // the leading space. Therefore a space has been added using wxT(" "). // Because screen readers won't be affected by multiple spaces, the // leading spaces have not been removed, so that no new translations are needed. /* i18n-hint: This is for screen reader software and indicates that on this track mute is on.*/ name->Append( wxT(" ") + wxString(_( " Mute On" )) ); } if( t->GetSolo() ) { /* i18n-hint: This is for screen reader software and indicates that on this track solo is on.*/ name->Append( wxT(" ") + wxString(_( " Solo On" )) ); } if( t->GetSelected() ) { /* i18n-hint: This is for screen reader software and indicates that this track is selected.*/ name->Append( wxT(" ") + wxString(_( " Select On" )) ); } if( t->IsSyncLockSelected() ) { /* i18n-hint: This is for screen reader software and indicates that this track is shown with a sync-locked icon.*/ // The absence of a dash between Sync and Locked is deliberate - // if present, Jaws reads it as "dash". name->Append( wxT(" ") + wxString(_( " Sync Lock Selected" )) ); } } } return wxACC_OK; #endif #if defined(__WXMAC__) return wxACC_NOT_IMPLEMENTED; #endif }
bool GetTrackInfoCommand::Apply(CommandExecutionContext context) { wxString mode = GetString(wxT("Type")); long trackIndex = GetLong(wxT("TrackIndex")); // Get the track indicated by the TrackIndex parameter // (Note: this ought to be somewhere else) long i = 0; TrackListIterator iter(context.proj->GetTracks()); Track *t = iter.First(); while (t && i != trackIndex) { t = iter.Next(); ++i; } if (i != trackIndex || !t) { Error(wxT("TrackIndex was invalid.")); return false; } // Now get the particular desired item about the track of interest if (mode.IsSameAs(wxT("Name"))) { Status(t->GetName()); } else if (mode.IsSameAs(wxT("StartTime"))) { Status(wxString::Format(wxT("%f"), t->GetStartTime())); } else if (mode.IsSameAs(wxT("EndTime"))) { Status(wxString::Format(wxT("%f"), t->GetEndTime())); } else if (mode.IsSameAs(wxT("Pan"))) { if(t->GetKind() == Track::Wave) Status(wxString::Format(wxT("%f"), static_cast<WaveTrack*>(t)->GetPan())); } else if (mode.IsSameAs(wxT("Gain"))) { if(t->GetKind() == Track::Wave) Status(wxString::Format(wxT("%f"), static_cast<WaveTrack*>(t)->GetGain())); } else if (mode.IsSameAs(wxT("Focused"))) { TrackPanel *panel = context.proj->GetTrackPanel(); SendBooleanStatus(panel->GetFocusedTrack() == t); } else if (mode.IsSameAs(wxT("Selected"))) { SendBooleanStatus(t->GetSelected()); } else if (mode.IsSameAs(wxT("Linked"))) { SendBooleanStatus(t->GetLinked()); } else if (mode.IsSameAs(wxT("Solo"))) { if (t->GetKind() == Track::Wave) SendBooleanStatus(t->GetSolo()); else SendBooleanStatus(false); } else if (mode.IsSameAs(wxT("Mute"))) { if (t->GetKind() == Track::Wave) SendBooleanStatus(t->GetMute()); else SendBooleanStatus(false); } else { Error(wxT("Invalid info type!")); return false; } return true; }
void MixerBoard::UpdateTrackClusters() { if (mImageMuteUp == NULL) this->CreateMuteSoloImages(); const int nClusterHeight = mScrolledWindow->GetClientSize().GetHeight() - kDoubleInset; const size_t nClusterCount = mMixerTrackClusters.GetCount(); unsigned int nClusterIndex = 0; TrackListIterator iterTracks(mTracks); MixerTrackCluster* pMixerTrackCluster = NULL; Track* pLeftTrack; Track* pRightTrack; pLeftTrack = iterTracks.First(); while (pLeftTrack) { pRightTrack = pLeftTrack->GetLinked() ? iterTracks.Next() : NULL; if (pLeftTrack->GetKind() == Track::Wave) { if (nClusterIndex < nClusterCount) { // Already showing it. // Track clusters are maintained in the same order as the WaveTracks. // Track pointers can change for the "same" track for different states // on the undo stack, so update the pointers and display name. mMixerTrackClusters[nClusterIndex]->mLeftTrack = (WaveTrack*)pLeftTrack; mMixerTrackClusters[nClusterIndex]->mRightTrack = (WaveTrack*)pRightTrack; mMixerTrackClusters[nClusterIndex]->UpdateForStateChange(); } else { // Not already showing it. Add a new MixerTrackCluster. wxPoint clusterPos( (kInset + // extra inset to left for first one. (nClusterIndex * (kInset + kMixerTrackClusterWidth)) + // left margin and width for each to its left kInset), // plus left margin for new cluster kInset); wxSize clusterSize(kMixerTrackClusterWidth, nClusterHeight); pMixerTrackCluster = new MixerTrackCluster(mScrolledWindow, this, mProject, (WaveTrack*)pLeftTrack, (WaveTrack*)pRightTrack, clusterPos, clusterSize); if (pMixerTrackCluster) { mMixerTrackClusters.Add(pMixerTrackCluster); this->IncrementSoloCount((int)(pLeftTrack->GetSolo())); } } nClusterIndex++; } pLeftTrack = iterTracks.Next(); } if (pMixerTrackCluster) { // Added at least one MixerTrackCluster. this->UpdateWidth(); for (nClusterIndex = 0; nClusterIndex < mMixerTrackClusters.GetCount(); nClusterIndex++) mMixerTrackClusters[nClusterIndex]->HandleResize(); } else if (nClusterIndex < nClusterCount) { // We've got too many clusters. // This can only on things like Undo New Audio Track or Undo Import // that don't call RemoveTrackCluster explicitly. // We've already updated the track pointers for the clusters to the left, so just remove these. for (; nClusterIndex < nClusterCount; nClusterIndex++) this->RemoveTrackCluster(mMixerTrackClusters[nClusterIndex]->mLeftTrack); } }
void AudioIO::FillBuffers() { unsigned int numEmpty = 0; unsigned int i; // Playback buffers for(i=0; i<mNumOutBuffers; i++) { if (mOutBuffer[i].ID == 0) numEmpty++; } if (numEmpty > (mNumOutBuffers/2)) { sampleCount block = numEmpty * mBufferSize; double deltat = block / mRate; if (mT + deltat > mT1) { deltat = mT1 - mT; if(deltat < 0.0) return; block = (sampleCount)(deltat * mRate + 0.5); } Mixer *mixer = new Mixer(mNumOutChannels, block, true, mRate, mFormat); mixer->UseVolumeSlider(mProject->GetControlToolBar()); mixer->Clear(); TrackListIterator iter2(mTracks); int numSolo = 0; Track *vt = iter2.First(); while (vt) { if (vt->GetKind() == Track::Wave && vt->GetSolo()) numSolo++; vt = iter2.Next(); } TrackListIterator iter(mTracks); vt = iter.First(); while (vt) { if (vt->GetKind() == Track::Wave) { Track *mt = vt; // We want to extract mute and solo information from // the top of the two tracks if they're linked // (i.e. a stereo pair only has one set of mute/solo buttons) Track *partner = mTracks->GetLink(vt); if (partner && !vt->GetLinked()) mt = partner; else mt = vt; // Cut if somebody else is soloing if (numSolo>0 && !mt->GetSolo()) { vt = iter.Next(); continue; } // Cut if we're muted (unless we're soloing) if (mt->GetMute() && !mt->GetSolo()) { vt = iter.Next(); continue; } WaveTrack *t = (WaveTrack *) vt; switch (t->GetChannel()) { case Track::LeftChannel: mixer->MixLeft(t, mT, mT + deltat); break; case Track::RightChannel: mixer->MixRight(t, mT, mT + deltat); break; case Track::MonoChannel: mixer->MixMono(t, mT, mT + deltat); break; } } vt = iter.Next(); } // Copy the mixed samples into the buffers samplePtr outbytes = mixer->GetBuffer(); for(i=0; i<mNumOutBuffers && block>0; i++) if (mOutBuffer[i].ID == 0) { sampleCount count; if (block > mBufferSize) count = mBufferSize; else count = block; memcpy(mOutBuffer[i].data, outbytes, count*mNumOutChannels*SAMPLE_SIZE(mFormat)); block -= count; outbytes += (count*mNumOutChannels*SAMPLE_SIZE(mFormat)); mOutBuffer[i].len = count; mOutBuffer[i].ID = mOutID; mOutID++; } delete mixer; mT += deltat; } // Recording buffers unsigned int numFull = 0; unsigned int f, c; // loop counters sampleCount flatLen; for(i=0; i<mNumInBuffers; i++) { if (mInBuffer[i].ID != 0) numFull++; } if (numFull > 8) { samplePtr *flat = new samplePtr[mNumInChannels]; for(i=0; i<mNumInChannels; i++) flat[i] = NewSamples(numFull * mBufferSize, mFormat); flatLen = 0; for(f=0; f<numFull; f++) { int minID = mInID+1; int minIndex = 0; for(i=0; i<mNumInBuffers; i++) if (mInBuffer[i].ID > 0 && mInBuffer[i].ID < minID) { minIndex = i; minID = mInBuffer[i].ID; } switch(mFormat) { case floatSample: int j; for(j=0; j<mInBuffer[minIndex].len; j++) for(c=0; c<mNumInChannels; c++) { ((float *)flat[c])[flatLen+j] = ((float *)mInBuffer[minIndex].data)[j*mNumInChannels + c]; } break; default: wxASSERT(0); } flatLen += mInBuffer[minIndex].len; mInBuffer[minIndex].ID = 0; } for(i=0; i<mNumInChannels; i++) mInTracks[i]->Append(flat[i], mFormat, flatLen); for(i=0; i<mNumInChannels; i++) DeleteSamples(flat[i]); delete[] flat; mProject->RedrawProject(); } }