• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ ov_time_seek函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中ov_time_seek函数的典型用法代码示例。如果您正苦于以下问题:C++ ov_time_seek函数的具体用法?C++ ov_time_seek怎么用?C++ ov_time_seek使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了ov_time_seek函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: plugin_seek

static void plugin_seek(struct playerHandles *ph, int modtime){
	int newtime;
	int seconds;
	struct vorbisHandles *h;

	if(ph->dechandle==NULL)
		return;

	h=(struct vorbisHandles *)ph->dechandle;
	if(modtime==0){
		ov_time_seek(h->vf,0);
		*h->total=0;
		snd_clear(ph);
		return;
	}

	seconds=(*h->total)/((h->rate)*(h->sizemod));
	seconds+=modtime;

	if(ov_time_seek(h->vf,seconds)!=0)
		return;
	newtime=seconds*((h->rate)*(h->sizemod));

	if(newtime<0)
		newtime=0;

	*h->total=newtime;
	snd_clear(ph);
}
开发者ID:heckendorfc,项目名称:harp,代码行数:29,代码来源:vorbis.c


示例2: alogg_seek_abs_secs_ogg

void alogg_seek_abs_secs_ogg(ALOGG_OGG *ogg, int sec) {
#ifdef USE_TREMOR
  ov_time_seek(&(ogg->vf), sec * 1000);
#else
  ov_time_seek(&(ogg->vf), sec);
#endif
}
开发者ID:CalinLeafshade,项目名称:ags,代码行数:7,代码来源:alogg.c


示例3: ov_time_seek

int COggVorbisFileHelper::ov_time_seek_func( OggVorbis_File *vf,double pos )
{
#ifdef _USELIBTREMOR
	ogg_int64_t ipos = 0;
	ipos = ((ogg_int64_t)pos) * 1000; 
	return ov_time_seek(vf,ipos)/1000;
#else
	return ov_time_seek(vf,pos);
#endif
}
开发者ID:arf-it,项目名称:marmalade-libvorbis,代码行数:10,代码来源:oggHelper.cpp


示例4: alogg_seek_abs_msecs_ogg

void alogg_seek_abs_msecs_ogg(ALOGG_OGG *ogg, int msec) {
#ifdef USE_TREMOR
  ov_time_seek(&(ogg->vf), msec);
#else
  /* convert msec to pcm sample position */
  double s = msec;
  s /= 1000;

  ov_time_seek(&(ogg->vf), s);
#endif
}
开发者ID:CalinLeafshade,项目名称:ags,代码行数:11,代码来源:alogg.c


示例5: alogg_seek_rel_secs_ogg

void alogg_seek_rel_secs_ogg(ALOGG_OGG *ogg, int sec) {
#ifdef USE_TREMOR
  ogg_int64_t _msec = sec * 1000;
  _msec += ov_time_tell(&(ogg->vf));
  ov_time_seek(&(ogg->vf), _msec);
#else
  double s = sec;
  s += ov_time_tell(&(ogg->vf));
  ov_time_seek(&(ogg->vf), s);
#endif
}
开发者ID:CalinLeafshade,项目名称:ags,代码行数:11,代码来源:alogg.c


示例6: ov_time_seek

uint32_t AudioSourceOGG::Read(short* buffer, size_t count)
{
    size_t size;
    size_t read = 0;
    int sect;

    if (!mIsValid)
        return 0;

    size = count*sizeof(short);

    if (mSeekTime >= 0)
    {
        mIsDataLeft = true;
        ov_time_seek(&mOggFile, mSeekTime);
        mSeekTime = -1;
    }

    /* read from ogg vorbis file */
    size_t res = 1;
    while (read < size)
    {
        res = ov_read(&mOggFile, (char*)buffer + read, size - read, 0, 2, 1, &sect);

        if (res > 0)
            read += res;

        else if (res == 0)
        {
            if (mSourceLoop)
            {
                ov_time_seek(&mOggFile, 0);
            }
            else
            {
                mIsDataLeft = false;
                return 0;
            }
        }
        else
        {
            Log::Printf("AudioSourceOGG: Error while reading OGG source (%d)\n", res);
            mIsDataLeft = false;
            return 0;
        }
    }

    return read / sizeof(short);
}
开发者ID:mechacrash,项目名称:raindrop,代码行数:49,代码来源:AudioSourceOGG.cpp


示例7: while

   bool AudioStream_Ogg::stream( ALuint buffer ) {
      
       if (openal_is_shutdown) return false;
       
       if (mSuspend) return true;
       //LOG_SOUND("STREAM\n");
       char pcm[STREAM_BUFFER_SIZE];
       int  size = 0;
       int  section;
       int  result;
       
       while (size < STREAM_BUFFER_SIZE) {
           result = ov_read(oggStream, pcm + size, STREAM_BUFFER_SIZE - size, 0, 2, 1, &section);
           if(result > 0)
               size += result;
           else
               if(result < 0) {

                  if ( mLoops > 0 ) {
                     mLoops --;
                     ov_time_seek(oggStream, 0);
                  }else{
                   break;
                  }
                   //LOG_SOUND ("Result is less than 0");
                   //throw errorString(result);
               }
               else
                   break;
       }
       if(size <= 0) {
         if ( mLoops > 0 ) {
            mLoops --;
            ov_time_seek(oggStream, 0);
            return stream( buffer );
         }else{
            alSourceStop(source);
            return false;
         }
           
           
      }
      
       alBufferData(buffer, format, pcm, size, vorbisInfo->rate);
       check();
       return true;

   } //stream
开发者ID:Beeblerox,项目名称:nme,代码行数:48,代码来源:OpenALSound.cpp


示例8: oggStreamCallback

	void oggStreamCallback(void* userData, u32 requestedChunkSize, u8* chunkData)
	{
		LOCK();

		s32 totalSize = 0;
		while (totalSize < (s32)requestedChunkSize)
		{
			s32 bitStream = 0;
			s32 soundSize = ov_read(&s_oggFile, (char*)&chunkData[totalSize], requestedChunkSize-totalSize, 0, 2, 1, &bitStream);

			//theoretically the sampling rate can change throughout the song...
			//however this is not supported by the XL Engine currently (it would require more work in the sound layer).

			//we've finished the loop, start the song all over again.
			if (soundSize == 0)
			{
				ov_time_seek(&s_oggFile, 0.0);
				soundSize = ov_read(&s_oggFile, (char*)&chunkData[totalSize], requestedChunkSize-totalSize, 0, 2, 1, &bitStream);
			}
			else if (soundSize < 0)	//error in the bit stream.
			{
				LOG( LOG_ERROR, "ogg streaming error: %d", soundSize );
				soundSize = 0;
				break;
			}

			totalSize += soundSize;
		};

		UNLOCK();
	}
开发者ID:Mailaender,项目名称:XL-Engine,代码行数:31,代码来源:oggVorbis.cpp


示例9: isPaused

	/*/////////////////////////////////////////////////////////////////*/
	void OgreOggStreamSound::_updatePlayPosition()
	{
		if ( mSource==AL_NONE || !mSeekable ) 
			return;

		bool paused = isPaused();
		bool playing = isPlaying();

		// Seek...
		pause();
		ov_time_seek(&mOggStream, mPlayPos);

		// Unqueue all buffers
		_dequeue();

		// Fill buffers
		_prebuffer();

		// Reset state..
		if		( playing ) play();
		else if ( paused ) pause();

		// Set flag
		mStreamEOF=false;
		mPlayPosChanged = false;
		mLastOffset = mPlayPos;
	}			   
开发者ID:Acularius,项目名称:Thrive,代码行数:28,代码来源:ogreoggstreamsound.cpp


示例10: _seal_rewind_ov_stream

seal_err_t
_seal_rewind_ov_stream(seal_stream_t* stream)
{
    if (ov_time_seek(stream->id, 0) != 0)
        return SEAL_CANNOT_REWIND_OV;
    return SEAL_OK;
}
开发者ID:zhangsu,项目名称:seal,代码行数:7,代码来源:ov.c


示例11: alogg_seek_abs_msecs_ogg

void alogg_seek_abs_msecs_ogg(ALOGG_OGG *ogg, int msec) {
  /* convert msec to pcm sample position */
  double s = msec;
  s /= 1000;

  ov_time_seek(&(ogg->vf), s);
}
开发者ID:AlanDrake,项目名称:Adventure-Game-Studio,代码行数:7,代码来源:alogg.c


示例12: ScopeLock

void FVorbisAudioInfo::SeekToTime( const float SeekTime )
{
	FScopeLock ScopeLock(&VorbisCriticalSection);

	const float TargetTime = FMath::Min(SeekTime, ( float )ov_time_total( &VFWrapper->vf, -1 ));
	ov_time_seek( &VFWrapper->vf, TargetTime );
}
开发者ID:RandomDeveloperM,项目名称:UE4_Hairworks,代码行数:7,代码来源:VorbisAudioInfo.cpp


示例13: alogg_seek_rel_msecs_ogg

void alogg_seek_rel_msecs_ogg(ALOGG_OGG *ogg, int msec) {
  double s = msec;
  s /= 1000;
  s += ov_time_tell(&(ogg->vf));

  ov_time_seek(&(ogg->vf), s);
}
开发者ID:AlanDrake,项目名称:Adventure-Game-Studio,代码行数:7,代码来源:alogg.c


示例14: ov_time_seek

//=================================================================================================
void SoundFileOgg::seek( double time )
{
  if (!file)
    return;

  ov_time_seek( &vf, time );
}
开发者ID:Snake174,项目名称:PipmakAssistant,代码行数:8,代码来源:ALApp.cpp


示例15: ov_time_tell

    bool cOggDecoder::seek(float seconds, bool relative)
    {
		if(Valid)
		{
			if(ov_seekable(&oggStream))
			{
				if(relative)
				{
					float curtime = ov_time_tell(&oggStream);
					return (ov_time_seek(&oggStream,curtime+seconds)==0);
				}
				else
					return (ov_time_seek(&oggStream,seconds)==0);
			}
		}
        return false;
    }
开发者ID:Coks,项目名称:cAudio,代码行数:17,代码来源:cOggDecoder.cpp


示例16: S_VORBIS_CodecRewindStream

static int S_VORBIS_CodecRewindStream (snd_stream_t *stream)
{
    /* for libvorbisfile, the ov_time_seek() position argument
     * is seconds as doubles, whereas for Tremor libvorbisidec
     * it is milliseconds as 64 bit integers.
     */
    return ov_time_seek ((OggVorbis_File *)stream->priv, 0);
}
开发者ID:yibble,项目名称:Quakespasm-Rift,代码行数:8,代码来源:snd_vorbis.c


示例17: OGG_seek

static int OGG_seek(Sound_Sample *sample, uint32_t ms)
{
    Sound_SampleInternal *internal = (Sound_SampleInternal *) sample->opaque;
    OggVorbis_File *vf = (OggVorbis_File *) internal->decoder_private;
	/* Unlike Vorbis, Tremor uses integer milliseconds instead of double seconds. */
    BAIL_IF_MACRO(ov_time_seek(vf, (ogg_int64_t)ms) < 0, ERR_IO_ERROR, 0);
    return(1);
} /* OGG_seek */
开发者ID:darkf,项目名称:almixer,代码行数:8,代码来源:oggtremor.c


示例18: OGRE_ALLOC_T

	/*/////////////////////////////////////////////////////////////////*/
	bool OgreOggStreamSound::_stream(ALuint buffer)
	{
		std::vector<char> audioData;
		char* data;
		int  section = 0;
		int  result = 0;

		// Create buffer
		data = OGRE_ALLOC_T(char, mBufferSize, Ogre::MEMCATEGORY_GENERAL);
		memset(data, 0, mBufferSize);
		
		// Read only what was asked for
		while( !mStreamEOF && (static_cast<int>(audioData.size()) < mBufferSize) )
		{
			int  bytes = 0;
			// Read up to a buffer's worth of data
			bytes = ov_read(&mOggStream, data, static_cast<int>(mBufferSize), 0, 2, 1, &section);
			// EOF check
			if (bytes == 0)
			{
				// If set to loop wrap to start of stream
				if ( mLoop && mSeekable )
				{
					if ( ov_time_seek(&mOggStream, 0 + mLoopOffset)!= 0 )
					{
						Ogre::LogManager::getSingleton().logMessage("***--- OgreOggStream::_stream() - ERROR looping stream, ogg file NOT seekable!");
						break;
					}
				}
				else
				{
					mStreamEOF=true;
					// Don't loop - finish.
					break;
				}
			}
			// Append to end of buffer
			audioData.insert(audioData.end(), data, data + bytes);
			// Keep track of read data
			result+=bytes;
		}

		// EOF
		if(result == 0)
		{
			OGRE_FREE(data, Ogre::MEMCATEGORY_GENERAL);
			return false;
		}

		alGetError();
		// Copy buffer data
		alBufferData(buffer, mFormat, &audioData[0], static_cast<ALsizei>(audioData.size()), mVorbisInfo->rate);

		// Cleanup
		OGRE_FREE(data, Ogre::MEMCATEGORY_GENERAL);

		return true;
	}
开发者ID:Acularius,项目名称:Thrive,代码行数:59,代码来源:ogreoggstreamsound.cpp


示例19: while

int AudioStreamPlaybackOGGVorbis::mix(int16_t* p_bufer,int p_frames) {

	if (!playing)
		return 0;

	int total=p_frames;
	while (true) {

		int todo = p_frames;

		if (todo==0 || todo<MIN_MIX) {
			break;
		}

		//printf("to mix %i - mix me %i bytes\n",to_mix,to_mix*stream_channels*sizeof(int16_t));

		#ifdef BIG_ENDIAN_ENABLED
		long ret=ov_read(&vf,(char*)p_bufer,todo*stream_channels*sizeof(int16_t), 1, 2, 1, &current_section);
		#else
		long ret=ov_read(&vf,(char*)p_bufer,todo*stream_channels*sizeof(int16_t), 0, 2, 1, &current_section);
		#endif

		if (ret<0) {

			playing = false;
			ERR_EXPLAIN("Error reading OGG Vorbis File: "+file);
			ERR_BREAK(ret<0);
		} else if (ret==0) { // end of song, reload?

			ov_clear(&vf);

			_close_file();

			if (!has_loop()) {

				playing=false;
				repeats=1;
				break;
			}

			f=FileAccess::open(file,FileAccess::READ);

			int errv = ov_open_callbacks(f,&vf,NULL,0,_ov_callbacks);
			if (errv!=0) {
				playing=false;
				break;; // :(
			}

			if (loop_restart_time) {
				bool ok = ov_time_seek(&vf,loop_restart_time)==0;
				if (!ok) {
					playing=false;
					//ERR_EXPLAIN("loop restart time rejected");
					ERR_PRINT("loop restart time rejected")
				}

				frames_mixed=stream_srate*loop_restart_time;
			} else {
开发者ID:lonesurvivor,项目名称:godot,代码行数:58,代码来源:audio_stream_ogg_vorbis.cpp


示例20: alGetSourcei

//-----------------------------------------------------------------------------
void MusicOggStream::update()
{

    if (m_pausedMusic || m_soundSource == ALuint(-1))
    {
        // nothing todo
        return;
    }

    int processed= 0;
    bool active= true;

    alGetSourcei(m_soundSource, AL_BUFFERS_PROCESSED, &processed);

    while(processed--)
    {
        ALuint buffer;

        alSourceUnqueueBuffers(m_soundSource, 1, &buffer);
        if(!check("alSourceUnqueueBuffers")) return;

        active = streamIntoBuffer(buffer);
        if(!active)
        {
            // no more data. Seek to beginning (causes the sound to loop)
            ov_time_seek(&m_oggStream, 0);
            active = streamIntoBuffer(buffer);//now there really should be data
        }

        alSourceQueueBuffers(m_soundSource, 1, &buffer);
        if (!check("alSourceQueueBuffers")) return;
    }

    if (active)
    {
        // For debugging
        SFXManager::checkError("before source state");
        // we have data, so we should be playing...
        ALenum state;
        alGetSourcei(m_soundSource, AL_SOURCE_STATE, &state);
        if (state != AL_PLAYING)
        {
            // Prevent flooding
            static int count = 0;
            count++;
            if (count<10)
                Log::warn("MusicOgg", "Music not playing when it should be. "
                          "Source state: %d", state);
            alGetSourcei(m_soundSource, AL_BUFFERS_PROCESSED, &processed);
            alSourcePlay(m_soundSource);
        }
    }
    else
    {
        Log::warn("MusicOgg", "Attempt to stream music into buffer failed "
                              "twice in a row.");
    }
}   // update
开发者ID:Cav098,项目名称:stk-code-fix_1797,代码行数:59,代码来源:music_ogg.cpp



注:本文中的ov_time_seek函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ ov_time_total函数代码示例发布时间:2022-05-30
下一篇:
C++ ov_pcm_total函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap