本文整理汇总了C++中AudioTrack::setMarkerPosition方法的典型用法代码示例。如果您正苦于以下问题:C++ AudioTrack::setMarkerPosition方法的具体用法?C++ AudioTrack::setMarkerPosition怎么用?C++ AudioTrack::setMarkerPosition使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AudioTrack
的用法示例。
在下文中一共展示了AudioTrack::setMarkerPosition方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: libmediacb_start
int libmediacb_start(msm_ctx *ctx, int channels, int samplerate) {
__android_log_print(ANDROID_LOG_INFO,"liblossless","libmedia_ START REEEEACHED REACHEDDDDDD1");
status_t status;
int chans;
if(!ctx) return LIBLOSSLESS_ERR_NOCTX;
__android_log_print(ANDROID_LOG_INFO,"liblossless","libmediacb_start ctx=%p chans=%d rate=%d afd=%d atrack=%p",
ctx, channels, samplerate,ctx->afd,ctx->track);
AudioTrack* atrack = (AudioTrack *) ctx->track;
if(atrack && ctx->samplerate == samplerate && ctx->channels == channels) {
__android_log_print(ANDROID_LOG_INFO,"liblossless","same audio track parameters, restarting");
atrack->stop();
atrack->flush();
ctx->cbstart = 0; ctx->cbend = 0;
atrack->start();
return 0;
}
if(!ctx->cbbuf) {
ctx->cbbuf = (unsigned char *) malloc(DEFAULT_CB_BUFSZ);
if(!ctx->cbbuf) return LIBLOSSLESS_ERR_NOMEM;
ctx->cbbuf_size = DEFAULT_CB_BUFSZ;
}
ctx->cbstart = 0; ctx->cbend = 0;
if(!atrack) {
atrack = new AudioTrack();
if(!atrack) {
__android_log_print(ANDROID_LOG_ERROR,"liblossless","could not create AudioTrack!");
return LIBLOSSLESS_ERR_INIT;
}
__android_log_print(ANDROID_LOG_INFO,"liblossless","AudioTrack created at %p. Now trying to setup (buffsz %d)",
atrack, DEFAULT_ATRACK_CONF_BUFSZ);
if(!sdk_version) {
char c[PROP_VALUE_MAX];
if(__system_property_get("ro.build.version.sdk",c) > 0) sscanf(c,"%d",&sdk_version);
else sdk_version = 8;
__android_log_print(ANDROID_LOG_INFO,"liblossless","got sdk_version %d", sdk_version);
}
if(sdk_version > 13) chans = (channels == 2) ? 3 : 1;
else if(sdk_version > 6) chans = (channels == 2) ? 12 : 4;
else chans = channels;
#ifdef BUILD_JB
status = atrack->set(_MUSIC, samplerate, FMTBPS, chans, DEFAULT_ATRACK_CONF_BUFSZ/(2*channels),AUDIO_OUTPUT_FLAG_NONE,cbf,ctx);
#else
status = atrack->set(_MUSIC, samplerate, FMTBPS, chans, DEFAULT_ATRACK_CONF_BUFSZ/(2*channels),0,cbf,ctx);
#endif
if(status != NO_ERROR) {
__android_log_print(ANDROID_LOG_INFO,"liblossless","AudioTrack setup failed");
delete atrack;
return LIBLOSSLESS_ERR_INIT;
}
ctx->track = atrack;
} else {
atrack->stop();
atrack->flush();
ctx->cbstart = 0; ctx->cbend = 0;
__android_log_print(ANDROID_LOG_INFO,"liblossless","trying to reconfigure old AudioTrack");
status = atrack->setSampleRate(samplerate);
if(status != NO_ERROR) {
__android_log_print(ANDROID_LOG_INFO,"liblossless","could not set AudioTrack sample rate");
return LIBLOSSLESS_ERR_INIT;
}
}
__android_log_print(ANDROID_LOG_INFO,"liblossless","AudioTrack setup OK, starting audio!");
ctx->conf_size = DEFAULT_CONF_BUFSZ;
atrack->start();
__android_log_print(ANDROID_LOG_INFO,"liblossless","playback started!");
atrack->setPositionUpdatePeriod(0);
atrack->setMarkerPosition(0);
static int s(0); if(!s) { print_priority(__FUNCTION__); s = 1; }
return 0;
}