这篇教程C++ GetDuration函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中GetDuration函数的典型用法代码示例。如果您正苦于以下问题:C++ GetDuration函数的具体用法?C++ GetDuration怎么用?C++ GetDuration使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了GetDuration函数的29个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: GetDuration//--------------------------------------------------------------------------------------// Name: ReadSampleRaw()// Desc: Reads data from the audio file. No endianness conversion is performed.//--------------------------------------------------------------------------------------HRESULT WaveFile::ReadSampleRaw( DWORD dwPosition, VOID* pBuffer, DWORD dwBufferSize, DWORD* pdwRead ) const{ // Don't read past the end of the data chunk DWORD dwDuration; GetDuration( &dwDuration ); if( dwPosition + dwBufferSize > dwDuration ) dwBufferSize = dwDuration - dwPosition; HRESULT hr = S_OK; if( dwBufferSize ) hr = m_DataChunk.ReadData( ( LONG )dwPosition, pBuffer, dwBufferSize, NULL ); if( pdwRead ) *pdwRead = dwBufferSize; return hr;}
开发者ID:AlexSincennes,项目名称:CSCI522A6,代码行数:23,
示例2: GetDurationDurationTimeline::GetNaturalDuration (Clock *clock){ Duration* d = GetDuration (); if (*d == Duration::Automatic) {// printf ("automatic duration, we need to calculate it/n"); Duration cd = GetNaturalDurationCore (clock);// if (cd.HasTimeSpan ())// printf (" + duration (%" G_GINT64_FORMAT " timespan)/n", cd.GetTimeSpan ());// else if (cd == Duration::Automatic)// printf (" + automatic/n");// else if (cd == Duration::Forever)// printf (" + forever/n"); return cd; } else { return *d; }}
开发者ID:lewing,项目名称:moon,代码行数:19,
示例3: GetSpeedRatiodouble DoubleAnimation::GetCurrentValue(){ if (_isEndOf) { return 0; } double dDiff = (_dTo - _dFrom) * GetSpeedRatio() / GetDuration(); if (_bReverse) { _dCurrent -= dDiff; if ((dDiff > 0 && _dCurrent <= _dFrom) || (dDiff < 0 && _dCurrent >= _dFrom)) { _dCurrent = _dFrom; _isEndOf = true; } } else { _dCurrent += dDiff; if ((dDiff > 0 && _dCurrent >= _dTo) || (dDiff < 0 && _dCurrent <= _dTo)) { _dCurrent = _dTo; if (GetAutoReverse()) { _bReverse = true; } else { _isEndOf = true; } } } return _dCurrent;}
开发者ID:Alxe013,项目名称:sharpui,代码行数:42,
示例4: WXUNUSEDbool EffectDtmf::ProcessInitialize(sampleCount WXUNUSED(totalLen), ChannelNames WXUNUSED(chanMap)){ double duration = GetDuration(); // all dtmf sequence durations in samples from seconds // MJS: Note that mDuration is in seconds but will have been quantised to the units of the TTC. // If this was 'samples' and the project rate was lower than the track rate, // extra samples may get created as mDuration may now be > mT1 - mT0; // However we are making our best efforts at creating what was asked for. auto nT0 = (sampleCount)floor(mT0 * mSampleRate + 0.5); auto nT1 = (sampleCount)floor((mT0 + duration) * mSampleRate + 0.5); numSamplesSequence = nT1 - nT0; // needs to be exact number of samples selected //make under-estimates if anything, and then redistribute the few remaining samples numSamplesTone = sampleCount( floor(dtmfTone * mSampleRate) ); numSamplesSilence = sampleCount( floor(dtmfSilence * mSampleRate) ); // recalculate the sum, and spread the difference - due to approximations. // Since diff should be in the order of "some" samples, a division (resulting in zero) // is not sufficient, so we add the additional remaining samples in each tone/silence block, // at least until available. diff = numSamplesSequence - (dtmfNTones*numSamplesTone) - (dtmfNTones-1)*numSamplesSilence; while (diff > 2*dtmfNTones - 1) { // more than one per thingToBeGenerated // in this case, both numSamplesTone and numSamplesSilence would change, so it makes sense // to recalculate diff here, otherwise just keep the value we already have // should always be the case that dtmfNTones>1, as if 0, we don't even start processing, // and with 1 there is no difference to spread (no silence slot)... wxASSERT(dtmfNTones > 1); numSamplesTone += (diff/(dtmfNTones)); numSamplesSilence += (diff/(dtmfNTones-1)); diff = numSamplesSequence - (dtmfNTones*numSamplesTone) - (dtmfNTones-1)*numSamplesSilence; } wxASSERT(diff >= 0); // should never be negative curSeqPos = -1; // pointer to string in dtmfSequence isTone = false; numRemaining = 0; return true;}
开发者ID:SteveDaulton,项目名称:audacity,代码行数:42,
示例5: LOGvoid CMMAMMFPlayerBase::GetMediaTime(TInt64* aMediaTime){ LOG(EJavaMMAPI, EInfo, "CMMAMMFPlayerBase::GetMediaTime +"); TTimeIntervalMicroSeconds position(0); if (iMediaTime == KTimeUnknown || iState == EStarted) { // The controller must be in the PRIMED or PLAYING state TInt error(iController.GetPosition(position)); if (error == KErrNone) { TInt64 newTime = position.Int64(); LOG1(EJavaMMAPI, EInfo, "CMMAMMFPlayerBase::GetMediaTime iController.GetPosition : %d", newTime); // Sanity check for media time going backwards or beyond the // duration. // Some native controls may return zero media time for // a few moments just before playback will complete. if (newTime < iMediaTime || (iDuration > 0 && newTime > iDuration)) { LOG(EJavaMMAPI, EInfo, "CMMAMMFPlayerBase::GetMediaTime.GetDuration "); GetDuration(&iMediaTime); } else { LOG(EJavaMMAPI, EInfo, "CMMAMMFPlayerBase::GetMediaTime.else "); // set return value iMediaTime = newTime; } } else { LOG1(EJavaMMAPI, EInfo, "CMMAMMFPlayerBase::GetMediaTime: error=%d, returning TIME_UNKNOWN", error); // cannot get media time iMediaTime = KTimeUnknown; } } *aMediaTime = iMediaTime; LOG1(EJavaMMAPI, EInfo, "CMMAMMFPlayerBase::GetMediaTime - %d", *aMediaTime);}
开发者ID:cdaffara,项目名称:symbiandump-ossapps,代码行数:42,
示例6: GetDurationvoid CAVISplitter::GetSeekingParams(REFERENCE_TIME* ptStart, REFERENCE_TIME* ptStop, double* pdRate){ if (ptStart != NULL) { *ptStart = m_tStart; } if (ptStop != NULL) { if (m_tStop == MAX_TIME) { m_tStop = GetDuration(); } *ptStop = m_tStop; } if (pdRate != NULL) { *pdRate = m_dRate; }}
开发者ID:SolveigMultimedia,项目名称:smm_avi_splitter,代码行数:20,
示例7: lockHRESULT CAVISplitter::Seek(REFERENCE_TIME tStart, REFERENCE_TIME tStop, double dRate){ // We must stop the pushing thread before we change // the seek parameters -- especially for VBR seeking, // where we might re-seek based on the incoming data. CAutoLock lock(&m_csSeeking); if (tStop == 0 || tStop < tStart) tStop = GetDuration(); bool bShouldRestart = Suspend(); m_tStart = tStart; m_tStop = tStop; m_dRate = dRate; m_scanner.Seek(m_tStart); if (bShouldRestart) Resume(); return S_OK;}
开发者ID:SolveigMultimedia,项目名称:smm_avi_splitter,代码行数:20,
示例8: GetDurationSTDMETHODIMP IKGSTAudioPlayer::SetPosition(STREAM_TIME pos)//0-100{ if(!pipeline) return E_FAIL; gint64 time; GstElement *p = pipeline; gint64 Glength = GetDuration(), Gstart = 0; if (Glength) { time = Glength; time *= (double)pos/100; time += Gstart; bool b = gst_element_seek(p, 1.0, GST_FORMAT_TIME, GST_SEEK_FLAG_FLUSH, GST_SEEK_TYPE_SET, time, GST_SEEK_TYPE_SET, Gstart + Glength); return b ? S_OK : E_FAIL; } else return E_FAIL;}
开发者ID:huangjunkun,项目名称:gstreamer-test,代码行数:20,
|