当前位置: 首页>>代码示例>>C++>>正文


C++ ov_time_total函数代码示例

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


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

示例1: _inStream

VorbisStream::VorbisStream(Common::SeekableReadStream *inStream, DisposeAfterUse::Flag dispose) :
	_inStream(inStream),
	_disposeAfterUse(dispose),
	_length(0, 1000),
	_bufferEnd(_buffer + ARRAYSIZE(_buffer)) {

	int res = ov_open_callbacks(inStream, &_ovFile, NULL, 0, g_stream_wrap);
	if (res < 0) {
		warning("Could not create Vorbis stream (%d)", res);
		_pos = _bufferEnd;
		return;
	}

	// Read in initial data
	if (!refill())
		return;

	// Setup some header information
	_isStereo = ov_info(&_ovFile, -1)->channels >= 2;
	_rate = ov_info(&_ovFile, -1)->rate;

#ifdef USE_TREMOR
	_length = Timestamp(ov_time_total(&_ovFile, -1), getRate());
#else
	_length = Timestamp(uint32(ov_time_total(&_ovFile, -1) * 1000.0), getRate());
#endif
}
开发者ID:Templier,项目名称:scummvm-test,代码行数:27,代码来源:vorbis.cpp

示例2: alogg_get_length_secs_ogg

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

示例3: ov_bitrate

long ov_bitrate(OggVorbis_File *vf,int i){
  if(vf->ready_state<OPENED)return(OV_EINVAL);
  if(i>=vf->links)return(OV_EINVAL);
  if(!vf->seekable && i!=0)return(ov_bitrate(vf,0));
  if(i<0){
    ogg_int64_t bits=0;
    int i;
    for(i=0;i<vf->links;i++)
      bits+=(vf->offsets[i+1]-vf->dataoffsets[i])*8;
    return(bits*1000/ov_time_total(vf,-1));
  }else{
    if(vf->seekable){
      /* return the actual bitrate */
      return((vf->offsets[i+1]-vf->dataoffsets[i])*8000/ov_time_total(vf,i));
    }else{
      /* return nominal if set */
      if(vf->vi[i].bitrate_nominal>0){
	return vf->vi[i].bitrate_nominal;
      }else{
	if(vf->vi[i].bitrate_upper>0){
	  if(vf->vi[i].bitrate_lower>0){
	    return (vf->vi[i].bitrate_upper+vf->vi[i].bitrate_lower)/2;
	  }else{
	    return vf->vi[i].bitrate_upper;
	  }
	}
	return(OV_FALSE);
      }
    }
  }
}
开发者ID:OS2World,项目名称:LIB-SDL,代码行数:31,代码来源:vorbisfile.c

示例4: ogg_stream_get_length

static double ogg_stream_get_length(ALLEGRO_AUDIO_STREAM *stream)
{
   AL_OV_DATA *extra = (AL_OV_DATA *) stream->extra;
#if !defined(ALLEGRO_GP2XWIZ) && !defined(ALLEGRO_IPHONE)
   double ret = ov_time_total(extra->vf, -1);
#else
   double ret = ov_time_total(extra->vf, -1)/1000.0;
#endif
   return ret;
}
开发者ID:sesc4mt,项目名称:mvcdecoder,代码行数:10,代码来源:ogg.c

示例5: defined

int RageSoundReader_Vorbisfile::GetLength() const
{
#if defined(INTEGER_VORBIS)
	int len = ov_time_total(vf, -1);
#else
	int len = int(ov_time_total(vf, -1) * 1000);
#endif
	if( len == OV_EINVAL )
		RageException::Throw( "RageSoundReader_Vorbisfile::GetLength: ov_time_total returned OV_EINVAL." );

	return len; 
}
开发者ID:ca25nada,项目名称:stepmania,代码行数:12,代码来源:RageSoundReader_Vorbisfile.cpp

示例6: ov_time_total

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

示例7: OggVorbis_File

	 static inline jlong wrapped_Java_com_badlogic_gdx_audio_io_VorbisDecoder_openFile
(JNIEnv* env, jclass clazz, jstring obj_filename, char* filename) {

//@line:125

		OggVorbis_File* ogg = new OggVorbis_File();
		FILE* file = fopen(filename, "rb" );
	
		if( file == 0 )
		{
			delete ogg;
			return 0;
		}
	
		if( ov_open( file, ogg, NULL, 0 ) != 0 )
		{
			fclose( file );
			delete ogg;
			return 0;
		}
	
		vorbis_info *info = ov_info( ogg, -1 );
		int channels = info->channels;
		int rate = info->rate;
		float length = (float)ov_time_total(ogg, -1 ) / 1000.0f;
	
		OggFile* oggFile = new OggFile();
		oggFile->ogg = ogg;
		oggFile->channels = channels;
		oggFile->rate = rate;
		oggFile->length = length;
	
		return (jlong)oggFile;	
	
}
开发者ID:0302zq,项目名称:libgdx,代码行数:35,代码来源:com.badlogic.gdx.audio.io.VorbisDecoder.cpp

示例8: vorbis_open

int vorbis_open(const char *file) {
	FILE *fp;
	vorbis_info *info;
	
	if (!file || !*file)
		return 0;

	if (!(fp = fopen(file, "rb")))
		return 0;

	if (ov_open(fp, &track, NULL, 0)) {
		fclose(fp);
		return 0;
	}

	parse_comments(ov_comment(&track, -1));
	
	info = ov_info(&track, -1);
	
	sample_rate = info->rate;
	channels = info->channels;
	duration = ov_time_total(&track, -1);
	bitrate = ov_bitrate(&track, -1);

	return 1;
}
开发者ID:playya,项目名称:Enlightenment,代码行数:26,代码来源:vorbis.c

示例9: ov_time_total

bool OGGMusic::Load(const char * filename)
{
	if (ov_fopen((char*)filename,&_ogg_file)!=0)
		return false;	

	_frequency = _ogg_file.vi->rate;
	_channels = _ogg_file.vi->channels;
	_total_time = ov_time_total(&_ogg_file,-1);

	if (_channels!=2 && _channels!=1)
		return false;

	//On alloue tout le temps pour 1sec de musique
	_stream_block_size = _frequency*2*_channels;
	
	_sound_data_size = _total_time*_frequency*2*_channels;

	_sound_data[0] = new char[_stream_block_size];
	_sound_data[1] = new char[_stream_block_size];

	alGenBuffers(2,_buffer);
	alGenSources(1,_source);

	CreateThread(NULL,NULL,_thread_play_pause_stop_wrapper,(void*)this,0,NULL);	

	return true;
}
开发者ID:karansapra,项目名称:futurattack,代码行数:27,代码来源:OGGMusic.cpp

示例10: OpenStream

bool RealSoundOgg::OpenStream(void* pData, int nMaxSize)
{
	if (m_bOpened) Close();

	m_nOggMaxSize = nMaxSize;
	ov_callbacks callbacks = {ReadCallback, SeekCallback, CloseCallback, TellCallback};

	if (ov_open_callbacks(pData, &m_vf, NULL, 0, callbacks) < 0) 
	{
		m_nOggMaxSize = 0;
		return false;
	}

	m_nLength = (int)ov_time_total(&m_vf, -1) * 1000;

	if (!CreateSoundBuffer())
	{
		m_nOggMaxSize = 0;
		return false;
	}

	m_bOpened = true;

	return true;
}
开发者ID:MagistrAVSH,项目名称:node3d,代码行数:25,代码来源:RealSoundOgg.cpp

示例11: return

//=================================================================================================
int SoundFileOgg::size()
{
  if (!file)
    return 0;

  return (int)(ov_time_total( &vf, -1 ) + 0.5) * channels * freq * 2;
}
开发者ID:Snake174,项目名称:PipmakAssistant,代码行数:8,代码来源:ALApp.cpp

示例12: ov_time_total

long VorbisDecoder::length() {
    if (!m_data->initialized) return -1;
    // -1 return total length of all bitstreams.
    // Should we take them one at a time instead?
    double ogglen = ov_time_total(m_data->vf,-1);
    return (long)(ogglen*1000.0);
}
开发者ID:redlizard,项目名称:sqeeze-kde3,代码行数:7,代码来源:vorbis_decoder.cpp

示例13: 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

示例14: OGG_length

//Inspired from ogginfo.c
// part of the vorbis-tools package of the OGG Vorbis project
int OGG_length(const char *filename)
{
  FILE *fp;
  OggVorbis_File vf;
  int rc,i;
  double playtime;

  memset(&vf,0,sizeof(OggVorbis_File));

  fp = fopen(filename,"r");
  if (!fp) {
    fprintf(stderr,"Unable to open \"%s\n", filename);
  }

  rc = ov_open(fp,&vf,NULL,0);

  if (rc < 0) {
    fprintf(stderr,"Unable to understand \"%s\", errorcode=%d\n", filename, rc);
    return 0;
  }

  playtime = (double) ov_time_total(&vf,-1);

//  printf("length (seconds) =%f\n",playtime);
//  printf("length (samples) =%d\n",((int) (playtime * 75)));

  ov_clear(&vf);

  return (int) (playtime * 75.0);
}
开发者ID:ProfessorKaos64,项目名称:hu-go,代码行数:32,代码来源:ogglength.c

示例15: StreamingBuffer

//----------------------------------------------------------------------------//
OggStream::OggStream(const Ogre::String& name, SoundSource* source, int bufferCount) :
    StreamingBuffer(name, source, bufferCount)
{
    ov_callbacks vorbisCallbacks;

    // read file to memory
    mStream = Ogre::ResourceGroupManager::getSingleton().openResource(name);

    // open ogg stream
    vorbisCallbacks.read_func = OggBuffer::vorbisRead;
    vorbisCallbacks.close_func = OggBuffer::vorbisClose;
    vorbisCallbacks.seek_func = OggBuffer::vorbisSeek;
    vorbisCallbacks.tell_func = OggBuffer::vorbisTell;
    if (ov_open_callbacks(&mStream, &mOggStream, nullptr, 0, vorbisCallbacks) < 0)
    {
        throw Ogre::Exception(1, "Could not open Ogg stream.",__FUNCTION__);
    }

    mVorbisInfo = ov_info(&mOggStream, -1);
    mVorbisComment = ov_comment(&mOggStream, -1);

    mChannels = mVorbisInfo->channels;
    mFrequency = mVorbisInfo->rate;
    mDuration = float(ov_time_total(&mOggStream, -1));
    mBits = 16;

    if(mChannels == 1)
        mFormat = AL_FORMAT_MONO16;
    else
        mFormat = AL_FORMAT_STEREO16;
    mSize = mDuration * float(mBits * mFrequency * mChannels) /  8.0f;
}
开发者ID:drwbns,项目名称:1stperson,代码行数:33,代码来源:SoundStreamingBuffer.cpp


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