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

C++ ov_time_total函数代码示例

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

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



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


示例16: OGGgetInfo

void OGGgetInfo(){
    //Estraggo le informazioni:
    OGG_info.fileType = OGG_TYPE;
    OGG_info.defaultCPUClock = OGG_defaultCPUClock;
    OGG_info.needsME = 0;

    vorbis_info *vi = ov_info(&OGG_VorbisFile, -1);
	OGG_info.kbit = vi->bitrate_nominal/1000;
    OGG_info.instantBitrate = vi->bitrate_nominal;
	OGG_info.hz = vi->rate;
	OGG_info.length = (long)ov_time_total(&OGG_VorbisFile, -1)/1000;
    if (vi->channels == 1)
        strcpy(OGG_info.mode, "single channel");
    else if (vi->channels == 2)
        strcpy(OGG_info.mode, "normal LR stereo");
    strcpy(OGG_info.emphasis, "no");

	int h = 0;
	int m = 0;
	int s = 0;
	long secs = OGG_info.length;
	h = secs / 3600;
	m = (secs - h * 3600) / 60;
	s = secs - h * 3600 - m * 60;
	snprintf(OGG_info.strLength, sizeof(OGG_info.strLength), "%2.2i:%2.2i:%2.2i", h, m, s);

    getOGGTagInfo(&OGG_VorbisFile, &OGG_info);
}
开发者ID:DavisDev,项目名称:lightmp3,代码行数:28,代码来源:oggplayer.c


示例17: Java_com_badlogic_gdx_audio_io_VorbisDecoder_openFile

JNIEXPORT jlong JNICALL Java_com_badlogic_gdx_audio_io_VorbisDecoder_openFile(JNIEnv *env, jobject, jstring filename)
{
	char* fileString = (char*)env->GetStringUTFChars(filename, NULL);
	OggVorbis_File* ogg = new OggVorbis_File();
	FILE* file = fopen(fileString, "rb" );
	env->ReleaseStringUTFChars( filename, fileString );

	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:AlexPetraglia,项目名称:libgdx,代码行数:33,代码来源:VorbisDecoder.cpp


示例18: URLToFilePath

uint32 VorbisLMC::CalculateSongLength(const char *url)
{
    char            path[_MAX_PATH];
    uint32          len = _MAX_PATH;
    FILE           *fpFile;
    OggVorbis_File  vf;
    double          dur;

    URLToFilePath(url, path, &len);
    fpFile = fopen(path, "rb");
    if (fpFile == NULL)
       return 0;  

    memset(&vf, 0, sizeof(vf));
    if (ov_open(fpFile, &vf, NULL, 0) < 0)
    {
       fclose(fpFile);
       return 0; 
    }

    dur = ov_time_total(&vf, 0);

    ov_clear(&vf);

    return (int)dur;
}
开发者ID:pontocom,项目名称:opensdrm,代码行数:26,代码来源:vorbislmc.cpp


示例19: console

int Audio::loadFakeOgg(Path file){
	
	AudioSource* source=new AudioSource;

	source->filename=file;
	source->type=AUDIO_OGG;

	if(!(source->oggFile = fopen(file.getAbsolute().c_str(), "rb"))){
		console().write("audio error: i/o error, could not open off file '"+file.getRelative()+"'");
		return -1;
	}

	int result;

	if((result = ov_open(source->oggFile, &source->oggStream, NULL, 0)) < 0){
		fclose(source->oggFile);
        
		console().write("audio error: could not open ogg stream '"+file.getRelative()+"'");
		return -1;
	}

	source->fakeLen=ov_time_total(&source->oggStream,-1);

	sources.pushBack(source);
	source->sourceIndex=sources.size()-1;
	return sources.size()-1;

}
开发者ID:jameshegarty,项目名称:bajaengine,代码行数:28,代码来源:Audio.cpp


示例20: main

int main(){
  OggVorbis_File ov;
  int i;

#ifdef _WIN32 /* We need to set stdin/stdout to binary mode. Damn windows. */
  /* Beware the evil ifdef. We avoid these where we can, but this one we 
     cannot. Don't add any more, you'll probably go to hell if you do. */
  _setmode( _fileno( stdin ), _O_BINARY );
  _setmode( _fileno( stdout ), _O_BINARY );
#endif

  /* open the file/pipe on stdin */
  if(ov_open(stdin,&ov,NULL,-1)<0){
    printf("Could not open input as an OggVorbis file.\n\n");
    exit(1);
  }
  
  /* print details about each logical bitstream in the input */
  if(ov_seekable(&ov)){
    printf("Input bitstream contained %ld logical bitstream section(s).\n",
	   ov_streams(&ov));
    printf("Total bitstream samples: %ld\n\n",
	   (long)ov_pcm_total(&ov,-1));
    printf("Total bitstream playing time: %ld seconds\n\n",
	   (long)ov_time_total(&ov,-1));

  }else{
    printf("Standard input was not seekable.\n"
	   "First logical bitstream information:\n\n");
  }

  for(i=0;i<ov_streams(&ov);i++){
    vorbis_info *vi=ov_info(&ov,i);
    printf("\tlogical bitstream section %d information:\n",i+1);
    printf("\t\t%ldHz %d channels bitrate %ldkbps serial number=%ld\n",
	   vi->rate,vi->channels,ov_bitrate(&ov,i)/1000,
	   ov_serialnumber(&ov,i));
    printf("\t\theader length: %ld bytes\n",(long)
	   (ov.dataoffsets[i]-ov.offsets[i]));
    printf("\t\tcompressed length: %ld bytes\n",(long)(ov_raw_total(&ov,i)));
    printf("\t\tplay time: %lds\n",(long)ov_time_total(&ov,i));
  }

  ov_clear(&ov);
  return 0;
}
开发者ID:joshdekock,项目名称:jim-psp,代码行数:46,代码来源:chaining_example.c



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ overflow函数代码示例发布时间:2022-05-30
下一篇:
C++ ov_time_seek函数代码示例发布时间: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