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

C++ setVolume函数代码示例

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

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



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

示例1: getSrc

 void
 Movie::play() {
     AC_INFO << "playing movie: "<< getSrc() << " (volume: " << _volume <<")";
     masl::MovieEngineSingleton::get().getNative()->playMovie(this);
     setVolume(_volume);
 }
开发者ID:artcom,项目名称:mobile-spark,代码行数:6,代码来源:Movie.cpp


示例2: setVolume

void MusicNode::unsetPanTrack() {
	_pantrack = false;
	setVolume(_volume);
}
开发者ID:superg,项目名称:scummvm,代码行数:4,代码来源:music_effect.cpp


示例3: spk_setVolume

static void
spk_setVolume (volatile SpeechSynthesizer *spk, unsigned char setting) {
  setVolume(getIntegerSpeechVolume(setting, 100));
}
开发者ID:MarkMielke,项目名称:brltty,代码行数:4,代码来源:speech.c


示例4: switch

status_t BnMediaPlayer::onTransact(
    uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags)
{
    switch(code) {
        case DISCONNECT: {
            CHECK_INTERFACE(IMediaPlayer, data, reply);
            disconnect();
            return NO_ERROR;
        } break;
        case SET_VIDEO_SURFACE: {
            CHECK_INTERFACE(IMediaPlayer, data, reply);
            sp<ISurface> surface = interface_cast<ISurface>(data.readStrongBinder());
            reply->writeInt32(setVideoSurface(surface));
            return NO_ERROR;
        } break;
        case PREPARE_ASYNC: {
            CHECK_INTERFACE(IMediaPlayer, data, reply);
            reply->writeInt32(prepareAsync());
            return NO_ERROR;
        } break;
        case START: {
            CHECK_INTERFACE(IMediaPlayer, data, reply);
            reply->writeInt32(start());
            return NO_ERROR;
        } break;
        case STOP: {
            CHECK_INTERFACE(IMediaPlayer, data, reply);
            reply->writeInt32(stop());
            return NO_ERROR;
        } break;
        case IS_PLAYING: {
            CHECK_INTERFACE(IMediaPlayer, data, reply);
            bool state;
            status_t ret = isPlaying(&state);
            reply->writeInt32(state);
            reply->writeInt32(ret);
            return NO_ERROR;
        } break;
        case PAUSE: {
            CHECK_INTERFACE(IMediaPlayer, data, reply);
            reply->writeInt32(pause());
            return NO_ERROR;
        } break;
        case SEEK_TO: {
            CHECK_INTERFACE(IMediaPlayer, data, reply);
            reply->writeInt32(seekTo(data.readInt32()));
            return NO_ERROR;
        } break;
        case GET_CURRENT_POSITION: {
            CHECK_INTERFACE(IMediaPlayer, data, reply);
            int msec;
            status_t ret = getCurrentPosition(&msec);
            reply->writeInt32(msec);
            reply->writeInt32(ret);
            return NO_ERROR;
        } break;
        case GET_DURATION: {
            CHECK_INTERFACE(IMediaPlayer, data, reply);
            int msec;
            status_t ret = getDuration(&msec);
            reply->writeInt32(msec);
            reply->writeInt32(ret);
            return NO_ERROR;
        } break;
        case RESET: {
            CHECK_INTERFACE(IMediaPlayer, data, reply);
            reply->writeInt32(reset());
            return NO_ERROR;
        } break;
        case SET_AUDIO_STREAM_TYPE: {
            CHECK_INTERFACE(IMediaPlayer, data, reply);
            reply->writeInt32(setAudioStreamType(data.readInt32()));
            return NO_ERROR;
        } break;
        case SET_LOOPING: {
            CHECK_INTERFACE(IMediaPlayer, data, reply);
            reply->writeInt32(setLooping(data.readInt32()));
            return NO_ERROR;
        } break;
        case SET_VOLUME: {
            CHECK_INTERFACE(IMediaPlayer, data, reply);
            reply->writeInt32(setVolume(data.readFloat(), data.readFloat()));
            return NO_ERROR;
        } break;
        case INVOKE: {
            CHECK_INTERFACE(IMediaPlayer, data, reply);
            invoke(data, reply);
            return NO_ERROR;
        } break;
        case SET_METADATA_FILTER: {
            CHECK_INTERFACE(IMediaPlayer, data, reply);
            reply->writeInt32(setMetadataFilter(data));
            return NO_ERROR;
        } break;
        case SUSPEND: {
            CHECK_INTERFACE(IMediaPlayer, data, reply);
            reply->writeInt32(suspend());
            return NO_ERROR;
        } break;
        case RESUME: {
//.........这里部分代码省略.........
开发者ID:DongheonKim,项目名称:android_frameworks_base,代码行数:101,代码来源:IMediaPlayer.cpp


示例5: setVolume

bool BaseSoundMgr::setVolumePercent(Audio::Mixer::SoundType type, byte percent) {
	return setVolume(type, percent * 255 / 100);
}
开发者ID:Cruel,项目名称:scummvm,代码行数:3,代码来源:base_sound_manager.cpp


示例6: ALOGI

bool AudioDecoder::resample()
{
    if (_result.sampleRate == _sampleRate)
    {
        ALOGI("No need to resample since the sample rate (%d) of the decoded pcm data is the same as the device output sample rate",
              _sampleRate);
        return true;
    }

    ALOGV("Resample: %d --> %d", _result.sampleRate, _sampleRate);

    auto r = _result;
    PcmBufferProvider provider;
    provider.init(r.pcmBuffer->data(), r.numFrames, r.pcmBuffer->size() / r.numFrames);

    const int outFrameRate = _sampleRate;
    int outputChannels = 2;
    size_t outputFrameSize = outputChannels * sizeof(int32_t);
    size_t outputFrames = ((int64_t) r.numFrames * outFrameRate) / r.sampleRate;
    size_t outputSize = outputFrames * outputFrameSize;
    void *outputVAddr = malloc(outputSize);

    auto resampler = AudioResampler::create(AUDIO_FORMAT_PCM_16_BIT, r.numChannels, outFrameRate,
                                            AudioResampler::MED_QUALITY);
    resampler->setSampleRate(r.sampleRate);
    resampler->setVolume(AudioResampler::UNITY_GAIN_FLOAT, AudioResampler::UNITY_GAIN_FLOAT);

    memset(outputVAddr, 0, outputSize);

    ALOGV("resample() %zu output frames", outputFrames);

    std::vector<int> Ovalues;

    if (Ovalues.empty())
    {
        Ovalues.push_back(outputFrames);
    }
    for (size_t i = 0, j = 0; i < outputFrames;)
    {
        size_t thisFrames = Ovalues[j++];
        if (j >= Ovalues.size())
        {
            j = 0;
        }
        if (thisFrames == 0 || thisFrames > outputFrames - i)
        {
            thisFrames = outputFrames - i;
        }
        int outFrames = resampler->resample((int *) outputVAddr + outputChannels * i, thisFrames,
                                            &provider);
        ALOGV("outFrames: %d", outFrames);
        i += thisFrames;
    }

    ALOGV("resample() complete");

    resampler->reset();

    ALOGV("reset() complete");

    delete resampler;
    resampler = nullptr;

    // mono takes left channel only (out of stereo output pair)
    // stereo and multichannel preserve all channels.

    int channels = r.numChannels;
    int32_t *out = (int32_t *) outputVAddr;
    int16_t *convert = (int16_t *) malloc(outputFrames * channels * sizeof(int16_t));

    const int volumeShift = 12; // shift requirement for Q4.27 to Q.15
    // round to half towards zero and saturate at int16 (non-dithered)
    const int roundVal = (1 << (volumeShift - 1)) - 1; // volumePrecision > 0

    for (size_t i = 0; i < outputFrames; i++)
    {
        for (int j = 0; j < channels; j++)
        {
            int32_t s = out[i * outputChannels + j] + roundVal; // add offset here
            if (s < 0)
            {
                s = (s + 1) >> volumeShift; // round to 0
                if (s < -32768)
                {
                    s = -32768;
                }
            } else
            {
                s = s >> volumeShift;
                if (s > 32767)
                {
                    s = 32767;
                }
            }
            convert[i * channels + j] = int16_t(s);
        }
开发者ID:c0i,项目名称:cocos2dx-lite,代码行数:96,代码来源:AudioDecoder.cpp


示例7: setFreq

SinOsc::SinOsc(float freq, float volume) {
	phase 				= 0.0f;
	setFreq(freq);
	setVolume(volume);
}
开发者ID:EQ4,项目名称:earSight-iOS,代码行数:5,代码来源:SinOsc.cpp


示例8: hammerMain

void hammerMain() {

    uprint("\r\n ######################## BOOT UP (HAMMER) ######################## \r\n");

    initHammerState();
    HammerState *hs = getHammerStatePtr();

    configureAccelerometer();

    configureAudio();
    audioReset();

    int sta = configureRadio(0x0A00, 0x0000111111111111);
    uprint_int("Configured radio: ", sta);

    configureIRReceive();

    configureLightMCU_SPI();

    updateLightMCUAll(hs->health, hs->charge);

    char sendString[2] = "x";
    char rxbuf[50];
    char doneString[] = "DONE";

    DELAY_MS(400);

    playSound(HS_BOOT);
    DELAY_MS(HS_BOOT_LEN);
    
    while (1) {

        uprint("Beginning of main loop");
        hs->charge = 0;
        updateLightMCUAll(hs->health, hs->charge);

        uprint("Waiting for spin...");
        startTrackingSpin();
        while (!checkSpinComplete());

        uprint("Spin complete!");
        playSound(HS_SPINCOMPLETE);
        DELAY_MS(HS_SPINCOMPLETE_LEN);

        setVolume(5);
        // Charging is really damn loud

        // This sound is very long, we just start it playing
        playSound(HS_CHARGING);

        uprint("Charging ...");

        hs->charge = 0;
        hs->charging = 1;
        while (hs->charge < 100) {
            hs->charge ++;
            updateLightMCUCharge(hs->charge);
            DELAY_MS((0.9 * hs->health) + 10);
        }
        hs->charging = 0;

        setVolume(8);
        // Back to normal

        playSound(HS_CHARGECOMPLETE);
        DELAY_MS(HS_CHARGECOMPLETE_LEN);

        uprint("Finished charging!");

        uprint("Waiting for thrust...");
        startTrackingThrust();
        while (!checkThrustComplete());

        setLightMCUHitAnim();

        uprint("Thrust complete!");
        playSound(HS_FIRE);
        DELAY_MS(HS_FIRE_LEN);

        setLightMCURainbow();

        // Become invincible
        disableIRReceive();

        uprint("Sending radio message");
        sendString[0] = hs->health;
        radioSendMessage(sendString, 0x0A00);

        uprint("Waiting for cloud message");
        radioGetMessage(rxbuf, 50);

        if (memcmp(rxbuf, doneString, 4) != 0) {
            uprint("Invalid message from cloud!");
        }

        enableIRReceive();
        uprint("Got cloud message");


        setLightMCUOff();
//.........这里部分代码省略.........
开发者ID:Kropie,项目名称:ecen-4013-spring2014-mchammer,代码行数:101,代码来源:main.c


示例9: if

bool UrlAudioPlayer::prepare(const std::string &url, SLuint32 locatorType, std::shared_ptr<AssetFd> assetFd, int start,
                             int length)
{
    _url = url;
    _assetFd = assetFd;

    const char* locatorTypeStr= "UNKNOWN";
    if (locatorType == SL_DATALOCATOR_ANDROIDFD)
        locatorTypeStr = "SL_DATALOCATOR_ANDROIDFD";
    else if (locatorType == SL_DATALOCATOR_URI)
        locatorTypeStr = "SL_DATALOCATOR_URI";
    else
    {
        ALOGE("Oops, invalid locatorType: %d", (int)locatorType);
        return false;
    }

    ALOGV("UrlAudioPlayer::prepare: %s, %s, %d, %d, %d", _url.c_str(), locatorTypeStr, _assetFd->getFd(), start,
         length);
    SLDataSource audioSrc;

    SLDataFormat_MIME formatMime = {SL_DATAFORMAT_MIME, nullptr, SL_CONTAINERTYPE_UNSPECIFIED};
    audioSrc.pFormat = &formatMime;

    //Note: locFd & locUri should be outside of the following if/else block
    // Although locFd & locUri are only used inside if/else block, its lifecycle
    // will be destroyed right after '}' block. And since we pass a pointer to
    // 'audioSrc.pLocator=&locFd/&locUri', pLocator will point to an invalid address
    // while invoking Engine::createAudioPlayer interface. So be care of change the position
    // of these two variables.
    SLDataLocator_AndroidFD locFd;
    SLDataLocator_URI locUri;

    if (locatorType == SL_DATALOCATOR_ANDROIDFD)
    {
        locFd = {locatorType, _assetFd->getFd(), start, length};
        audioSrc.pLocator = &locFd;
    }
    else if (locatorType == SL_DATALOCATOR_URI)
    {
        locUri = {locatorType, (SLchar *) _url.c_str()};
        audioSrc.pLocator = &locUri;
        ALOGV("locUri: locatorType: %d", (int)locUri.locatorType);
    }

    // configure audio sink
    SLDataLocator_OutputMix locOutmix = {SL_DATALOCATOR_OUTPUTMIX, _outputMixObj};
    SLDataSink audioSnk = {&locOutmix, nullptr};

    // create audio player
    const SLInterfaceID ids[3] = {SL_IID_SEEK, SL_IID_PREFETCHSTATUS, SL_IID_VOLUME};
    const SLboolean req[3] = {SL_BOOLEAN_TRUE, SL_BOOLEAN_TRUE, SL_BOOLEAN_TRUE};

    SLresult result = (*_engineItf)->CreateAudioPlayer(_engineItf, &_playObj, &audioSrc, &audioSnk,
                                                       3, ids, req);
    SL_RETURN_VAL_IF_FAILED(result, false, "CreateAudioPlayer failed");

    // realize the player
    result = (*_playObj)->Realize(_playObj, SL_BOOLEAN_FALSE);
    SL_RETURN_VAL_IF_FAILED(result, false, "Realize failed");

    // get the play interface
    result = (*_playObj)->GetInterface(_playObj, SL_IID_PLAY, &_playItf);
    SL_RETURN_VAL_IF_FAILED(result, false, "GetInterface SL_IID_PLAY failed");

    // get the seek interface
    result = (*_playObj)->GetInterface(_playObj, SL_IID_SEEK, &_seekItf);
    SL_RETURN_VAL_IF_FAILED(result, false, "GetInterface SL_IID_SEEK failed");

    // get the volume interface
    result = (*_playObj)->GetInterface(_playObj, SL_IID_VOLUME, &_volumeItf);
    SL_RETURN_VAL_IF_FAILED(result, false, "GetInterface SL_IID_VOLUME failed");

    result = (*_playItf)->RegisterCallback(_playItf,
                                           SLUrlAudioPlayerCallbackProxy::playEventCallback, this);
    SL_RETURN_VAL_IF_FAILED(result, false, "RegisterCallback failed");

    result = (*_playItf)->SetCallbackEventsMask(_playItf, SL_PLAYEVENT_HEADATEND);
    SL_RETURN_VAL_IF_FAILED(result, false, "SetCallbackEventsMask SL_PLAYEVENT_HEADATEND failed");

    setState(State::INITIALIZED);

    setVolume(1.0f);

    return true;
}
开发者ID:bonlai,项目名称:3kaigame,代码行数:86,代码来源:UrlAudioPlayer.cpp


示例10: volume

void EnginePhonon::volumeDec( )
{
    int percent = volume() > 0 ? volume() -1 : 0;
    setVolume(percent);
};
开发者ID:kehugter,项目名称:Yarock,代码行数:5,代码来源:engine_phonon.cpp


示例11: EngineBase

/*
********************************************************************************
*                                                                              *
*    Class EnginePhonon                                                        *
*                                                                              *
********************************************************************************
*/
EnginePhonon::EnginePhonon() : EngineBase("phonon")
{
    m_type = ENGINE::PHONON;
    
    m_mediaObject = new Phonon::MediaObject(this);
    m_audioOutput = new Phonon::AudioOutput(Phonon::MusicCategory, this);

    /* ----- by default tick every 1 second ----- */
    m_mediaObject->setTickInterval(100);
    Debug::debug() << "[EnginePhonon] -> tick Interval (actual): " << m_mediaObject->tickInterval();
    

    /* ----- get the next track when there is 2 seconds left on the current one ----- */
    /*       in case of playing track from track view */
    m_mediaObject->setPrefinishMark( 2000 );
    m_mediaObject->setTransitionTime(100);  /* GAPLESS/CROSSFADE */

    connect(m_mediaObject,SIGNAL(finished()),this,SLOT(slot_on_media_finished()));
    connect(m_mediaObject,SIGNAL(aboutToFinish()),this,SLOT(slot_on_media_about_to_finish()));

    connect(m_mediaObject,SIGNAL(stateChanged(Phonon::State,Phonon::State)),this,SLOT(slot_on_phonon_state_changed(Phonon::State,Phonon::State)),Qt::DirectConnection);

    connect(m_mediaObject,SIGNAL(tick(qint64)),this,SLOT(slot_on_time_change(qint64)));
    connect(m_mediaObject,SIGNAL(totalTimeChanged(qint64)),this,SLOT(slot_on_duration_change(qint64)));

    connect(m_mediaObject,SIGNAL(currentSourceChanged( const Phonon::MediaSource & )),this,SLOT(slot_on_media_change()));

    connect(m_mediaObject, SIGNAL(metaDataChanged()), this,SLOT(slot_on_metadata_change()));

    /* needed for Mplayer2 backend */
    connect( m_audioOutput, SIGNAL( volumeChanged( qreal ) ),this, SIGNAL( volumeChanged() ) );
    connect( m_audioOutput, SIGNAL( mutedChanged( bool ) ), this,  SIGNAL( muteStateChanged() ) );
    
    m_phononPath  = Phonon::createPath(m_mediaObject,m_audioOutput);


    /* ----- only create pre-amp if we have replaygain on, VolumeFaderEffect can cause phonon issues */
    m_preamp = 0;
    if( SETTINGS()->_replaygain != SETTING::ReplayGainOff )
    {
      m_preamp = new Phonon::VolumeFaderEffect( this );
      m_phononPath.insertEffect( m_preamp );
    }

    /* ----- add an equalizer effect if available */
    m_equalizer   = 0;
    QList<Phonon::EffectDescription> mEffectDescriptions = Phonon::BackendCapabilities::availableAudioEffects();
    foreach ( const Phonon::EffectDescription &mDescr, mEffectDescriptions )
    {
      if ( mDescr.name() == QLatin1String( "KEqualizer" ) )
      {
          m_equalizer = new Phonon::Effect( mDescr, this );

          if( SETTINGS()->_enableEq ) {
            addEqualizer();
            loadEqualizerSettings();
          }
      }
    }

    /* ----- initial volume setup ----- */
    setVolume( SETTINGS()->_volumeLevel );
        
    m_current_state    = ENGINE::STOPPED;
    m_old_state        = ENGINE::STOPPED;
    
    m_version = QString();
}
开发者ID:kehugter,项目名称:Yarock,代码行数:75,代码来源:engine_phonon.cpp


示例12: setVolume

void RingControl::profileChanged()
{
    QPhoneProfile prof = d->profileManager->activeProfile();
    setVolume(prof.volume());
    setMsgRingTime(prof.msgAlertDuration());
}
开发者ID:Artox,项目名称:qtmoko,代码行数:6,代码来源:ringcontrol.cpp


示例13: debugC

void MidiPlayer::adjustVolume(int diff) {
	debugC(3, kDebugMusic, "MidiPlayer::adjustVolume");
	setVolume(_masterVolume + diff);
}
开发者ID:tramboi,项目名称:scummvm-test,代码行数:4,代码来源:sound.cpp


示例14: setVolume

void MediaPlayer::decrementVolume()
{
    setVolume(volume()-1);
}
开发者ID:zvova7890,项目名称:lg-phone-develop,代码行数:4,代码来源:MediaPlayer.cpp


示例15: setVolume

void AudioPlayerGnu::unmute()
{
    if(_isMuted)
        setVolume(volumeForMute);
    _isMuted=false;
}
开发者ID:fishermansimon,项目名称:AudioPlayerClass,代码行数:6,代码来源:AudioPlayerGnu.cpp


示例16: resetTimeStamps

MeshPartition::MeshPartition(QString volume_name)
{
  m_TrackGrid = false;
  resetTimeStamps();
  setVolume(volume_name);
}
开发者ID:Haider-BA,项目名称:engrid,代码行数:6,代码来源:meshpartition.cpp


示例17: setVolumetric

void Sound::emit2D(f32 Volume, bool UseEffectSlot)
{
    setVolumetric(false);
    setVolume(Volume);
    play();
}
开发者ID:bekasov,项目名称:SoftPixelEngine,代码行数:6,代码来源:spSound.cpp


示例18: setVolume

void PlaybackControls::setVolume()
{
	int vol = mpParentWindow->volumeBar->value();
	setVolume(vol);
}
开发者ID:mdombroski,项目名称:qsmp,代码行数:5,代码来源:PlaybackControls_Phonon.cpp


示例19: while

bool MpvHandler::event(QEvent *event)
{
    if(event->type() == QEvent::User)
    {
        while(mpv)
        {
            mpv_event *event = mpv_wait_event(mpv, 0);
            if(event == nullptr ||
               event->event_id == MPV_EVENT_NONE)
            {
                break;
            }
            HandleErrorCode(event->error);
            switch (event->event_id)
            {
            case MPV_EVENT_PROPERTY_CHANGE:
            {
                mpv_event_property *prop = (mpv_event_property*)event->data;
                if(QString(prop->name) == "playback-time") // playback-time does the same thing as time-pos but works for streaming media
                {
                    if(prop->format == MPV_FORMAT_DOUBLE)
                    {
                        setTime((int)*(double*)prop->data);
                        lastTime = time;
                    }
                }
                else if(QString(prop->name) == "volume")
                {
                    if(prop->format == MPV_FORMAT_DOUBLE)
                        setVolume((int)*(double*)prop->data);
                }
                else if(QString(prop->name) == "sid")
                {
                    if(prop->format == MPV_FORMAT_INT64)
                        setSid(*(int*)prop->data);
                }
                else if(QString(prop->name) == "aid")
                {
                    if(prop->format == MPV_FORMAT_INT64)
                        setAid(*(int*)prop->data);
                }
                else if(QString(prop->name) == "sub-visibility")
                {
                    if(prop->format == MPV_FORMAT_FLAG)
                        setSubtitleVisibility((bool)*(unsigned*)prop->data);
                }
                else if(QString(prop->name) == "mute")
                {
                    if(prop->format == MPV_FORMAT_FLAG)
                        setMute((bool)*(unsigned*)prop->data);
                }
                else if(QString(prop->name) == "core-idle")
                {
                    if(prop->format == MPV_FORMAT_FLAG)
                    {
                        if((bool)*(unsigned*)prop->data && playState == Mpv::Playing)
                            ShowText(tr("Buffering..."), 0);
                        else
                            ShowText(QString(), 0);
                    }
                }
                else if(QString(prop->name) == "paused-for-cache")
                {
                    if(prop->format == MPV_FORMAT_FLAG)
                    {
                        if((bool)*(unsigned*)prop->data && playState == Mpv::Playing)
                            ShowText(tr("Your network is slow or stuck, please wait a bit"), 0);
                        else
                            ShowText(QString(), 0);
                    }
                }
                break;
            }
            case MPV_EVENT_IDLE:
                fileInfo.length = 0;
                setTime(0);
                setPlayState(Mpv::Idle);
                break;
                // these two look like they're reversed but they aren't. the names are misleading.
            case MPV_EVENT_START_FILE:
                setPlayState(Mpv::Loaded);
                break;
            case MPV_EVENT_FILE_LOADED:
                setPlayState(Mpv::Started);
                LoadFileInfo();
                SetProperties();
            case MPV_EVENT_UNPAUSE:
                setPlayState(Mpv::Playing);
                break;
            case MPV_EVENT_PAUSE:
                setPlayState(Mpv::Paused);
                ShowText(QString(), 0);
                break;
            case MPV_EVENT_END_FILE:
                if(playState == Mpv::Loaded)
                    ShowText(tr("File couldn't be opened"));
                setPlayState(Mpv::Stopped);
                break;
            case MPV_EVENT_SHUTDOWN:
                QCoreApplication::quit();
//.........这里部分代码省略.........
开发者ID:ErikDavison,项目名称:Baka-MPlayer,代码行数:101,代码来源:mpvhandler.cpp


示例20: destroyPlayer


//.........这里部分代码省略.........
    // AudioPlayer
    if (SL_RESULT_SUCCESS != (*engine)->CreateAudioPlayer(engine,
                                                          &m_playerObject,
                                                          &audioSrc,
                                                          &audioSink,
                                                          iids,
                                                          ids,
                                                          req)) {
        qWarning() << "Unable to create AudioPlayer";
        setError(QAudio::OpenError);
        return false;
    }

#ifdef ANDROID
    // Set profile/category
    SLAndroidConfigurationItf playerConfig;
    if (SL_RESULT_SUCCESS == (*m_playerObject)->GetInterface(m_playerObject,
                                                             SL_IID_ANDROIDCONFIGURATION,
                                                             &playerConfig)) {
        (*playerConfig)->SetConfiguration(playerConfig,
                                          SL_ANDROID_KEY_STREAM_TYPE,
                                          &m_streamType,
                                          sizeof(SLint32));
    }
#endif // ANDROID

    if (SL_RESULT_SUCCESS != (*m_playerObject)->Realize(m_playerObject, SL_BOOLEAN_FALSE)) {
        qWarning() << "Unable to initialize AudioPlayer";
        setError(QAudio::OpenError);
        return false;
    }

    // Buffer interface
    if (SL_RESULT_SUCCESS != (*m_playerObject)->GetInterface(m_playerObject,
                                                             SL_IID_BUFFERQUEUE,
                                                             &m_bufferQueueItf)) {
        setError(QAudio::FatalError);
        return false;
    }

    if (SL_RESULT_SUCCESS != (*m_bufferQueueItf)->RegisterCallback(m_bufferQueueItf,
                                                                   bufferQueueCallback,
                                                                   this)) {
        setError(QAudio::FatalError);
        return false;
    }

    // Play interface
    if (SL_RESULT_SUCCESS != (*m_playerObject)->GetInterface(m_playerObject,
                                                             SL_IID_PLAY,
                                                             &m_playItf)) {
        setError(QAudio::FatalError);
        return false;
    }

    if (SL_RESULT_SUCCESS != (*m_playItf)->RegisterCallback(m_playItf, playCallback, this)) {
        setError(QAudio::FatalError);
        return false;
    }

    if (m_notifyInterval && SL_RESULT_SUCCESS == (*m_playItf)->SetPositionUpdatePeriod(m_playItf,
                                                                                       m_notifyInterval)) {
        m_eventMask |= SL_PLAYEVENT_HEADATNEWPOS;
    }

    if (SL_RESULT_SUCCESS != (*m_playItf)->SetCallbackEventsMask(m_playItf, m_eventMask)) {
        setError(QAudio::FatalError);
        return false;
    }

    // Volume interface
    if (SL_RESULT_SUCCESS != (*m_playerObject)->GetInterface(m_playerObject,
                                                             SL_IID_VOLUME,
                                                             &m_volumeItf)) {
        setError(QAudio::FatalError);
        return false;
    }

    setVolume(m_volume);

    // Buffer size
    if (m_bufferSize <= 0) {
        m_bufferSize = m_format.bytesForDuration(DEFAULT_PERIOD_TIME_MS * 1000);
    } else {
        const int minimumBufSize = m_format.bytesForDuration(MINIMUM_PERIOD_TIME_MS * 1000);
        if (m_bufferSize < minimumBufSize)
            m_bufferSize = minimumBufSize;
    }

    m_periodSize = m_bufferSize;

    if (!m_buffers)
        m_buffers = new char[BUFFER_COUNT * m_bufferSize];

    m_clockStamp.restart();
    setError(QAudio::NoError);
    m_startRequiresInit = false;

    return true;
}
开发者ID:MarianMMX,项目名称:MarianMMX,代码行数:101,代码来源:qopenslesaudiooutput.cpp



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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