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


C++ AudioEngine类代码示例

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


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

示例1: m_Engine

    AudioWorld::AudioWorld(Engine::BaseEngine& engine, AudioEngine& audio_engine, const VDFS::FileIndex& vdfidx)
        : m_Engine(engine)
        , m_VDFSIndex(vdfidx)
        , m_exiting(false)
    {
#ifdef RE_USE_SOUND
        if (!audio_engine.getDevice())
            return;

        m_Context = alcCreateContext(audio_engine.getDevice(), nullptr);
        if (!m_Context)
        {
            LogWarn() << "Could not create OpenAL context: "
                      << AudioEngine::getErrorString(alcGetError(audio_engine.getDevice()));
            return;
        }

        alcMakeContextCurrent(m_Context);

        alListener3f(AL_POSITION, 0, 0, 0.0f);
        // check for errors
        alListener3f(AL_VELOCITY, 0, 0, 0);
        // check for errors
        ALfloat listenerOri[] = {0.0f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f};
        alListenerfv(AL_ORIENTATION, listenerOri);

        // Need this for AL_MAX_DISTANCE to work
        alDistanceModel(AL_LINEAR_DISTANCE_CLAMPED);

        createSounds();

        initializeMusic();
#endif
    }
开发者ID:degenerated1123,项目名称:REGoth,代码行数:34,代码来源:AudioWorld.cpp

示例2: tick

	int tick(void *outputBuffer, void *inputBuffer, U32 nBufferFrames,
			double streamTime, RtAudioStreamStatus status, void *userData)
	{
		if (status == 0)
        {
        	AudioEngine *engine = reinterpret_cast<AudioEngine *>(userData);
			engine->processChannels(outputBuffer, nBufferFrames * 8);
        }
		return 0;
	}
开发者ID:MattTuttle,项目名称:Audaxe,代码行数:10,代码来源:RtAudioDriver.cpp

示例3: enqueue

void AudioHandleImpl::enqueue(std::function<void(AudioEmitter& src)> f)
{
	size_t id = handleId;
	AudioEngine* engine = facade.engine.get();
	facade.enqueue([id, engine, f] () {
		for (auto& src: engine->getSources(id)) {
			f(*src);
		}
	});
}
开发者ID:DanMillward,项目名称:halley,代码行数:10,代码来源:audio_handle_impl.cpp

示例4: AudioEngine_PortAudioCallback

	static int AudioEngine_PortAudioCallback(
		const void *inputBuffer
		,void *outputBuffer
		,unsigned long framesPerBuffer
		,const PaStreamCallbackTimeInfo* timeInfo
		,PaStreamCallbackFlags statusFlags
		,void *userData
	){
		AudioEngine* engine = (AudioEngine*) userData;
		return engine->fetchSoundData( outputBuffer, framesPerBuffer );
	}
开发者ID:VolatileDream,项目名称:whisper-composer,代码行数:11,代码来源:AudioEngine.hpp

示例5: Java_com_prettysimple_audio_AudioPlayer_setParams

    /**
     * Change pitch, pan and gain of a sound
     * Implementation of the setParams method in AudioPlayer.java
     */
    JNIEXPORT bool JNICALL Java_com_prettysimple_audio_AudioPlayer_setParams(JNIEnv *env, jobject thiz, jfloat pitch, jfloat pan, jfloat volume) {
        bool ret = false;
        AudioEngine *engine = AudioEngine::getInstance();

        const int audioId = getAudioId(env, thiz); // try to recover the audioIde from the AudioPlayer.java object

        if (audioId > 0)
        {
            ret = engine->setParams(audioId, (float) pitch, (float) pan, (float) volume);
        }
        return ret;
    }
开发者ID:Wizermil,项目名称:opensl-jni,代码行数:16,代码来源:AudioEngine.cpp

示例6: startDecoding

void SoundNode::startDecoding()
{
    AudioEngine* pEngine = AudioEngine::get();
    m_pDecoder->startDecoding(false, pEngine->getParams());
    m_AudioID = pEngine->addSource(*m_pDecoder->getAudioMsgQ(), 
            *m_pDecoder->getAudioStatusQ());
    pEngine->setSourceVolume(m_AudioID, m_Volume);
    if (m_SeekBeforeCanRenderTime != 0) {
        seek(m_SeekBeforeCanRenderTime);
        m_SeekBeforeCanRenderTime = 0;
    }
}
开发者ID:hoodie,项目名称:libavg,代码行数:12,代码来源:SoundNode.cpp

示例7: Pa_ReadStream

/*! Read samples from the current audio device */
v8::Handle<v8::Value> Audio::AudioEngine::read( const v8::Arguments& args ) {
	HandleScope scope;

	AudioEngine* pEngine = AudioEngine::Unwrap<AudioEngine>( args.This() );

	if (pEngine->m_bReadMicrophone) {
		Pa_ReadStream( pEngine->m_pPaStream, pEngine->m_cachedInputSampleBlock, pEngine->m_uSamplesPerBuffer );
	}

	Handle<Array> input = pEngine->getInputBuffer();

	return scope.Close( input );
} // end AudioEngine::Read()
开发者ID:alex-milanov,项目名称:node-core-audio,代码行数:14,代码来源:AudioEngine.cpp

示例8: Java_com_prettysimple_audio_AudioPlayer_resume

    /**
     * Resume a sound that has been paused
     * Implementation of the resume method in AudioPlayer.java
     */
    JNIEXPORT bool JNICALL Java_com_prettysimple_audio_AudioPlayer_resume(JNIEnv *env, jobject thiz)
    {
        bool ret = false;
        AudioEngine *engine = AudioEngine::getInstance();

        const int audioId = getAudioId(env, thiz);

        if (audioId > 0)
        {
            ret = engine->resume(audioId);
        }
        return ret;
    }
开发者ID:Wizermil,项目名称:opensl-jni,代码行数:17,代码来源:AudioEngine.cpp

示例9: Java_com_prettysimple_audio_AudioPlayer_pause

    /**
     * Pause a sound
     * Implementation of the pause method in AudioPlayer.java
     */
    JNIEXPORT bool JNICALL Java_com_prettysimple_audio_AudioPlayer_pause(JNIEnv *env, jobject thiz)
    {
        bool ret = false;
        AudioEngine *engine = AudioEngine::getInstance();

        const int audioId = getAudioId(env, thiz); // try to recover the audioIde from the AudioPlayer.java object

        if (audioId > 0)
        {
            ret = engine->pause(audioId);
        }
        return ret;
    }
开发者ID:Wizermil,项目名称:opensl-jni,代码行数:17,代码来源:AudioEngine.cpp

示例10: ThrowException

/*! Our V8 new operator */
v8::Handle<v8::Value> Audio::AudioEngine::New( const v8::Arguments& args ) {
	HandleScope scope;

	if (!args[0]->IsFunction()) {
		return ThrowException( Exception::TypeError(String::New("Callback function required")) );
	}

	Local<Function> callback = Local<Function>::Cast( args[0] );
	
	AudioEngine* engine = new AudioEngine( callback );
	engine->Wrap( args.This() );

	return scope.Close( args.This() );
} // end AudioEngine::New()
开发者ID:creativeprogramming,项目名称:node-core-audio,代码行数:15,代码来源:AudioEngine.cpp

示例11: ThrowException

/*! Write samples to the current audio device */
v8::Handle<v8::Value> Audio::AudioEngine::write( const v8::Arguments& args ) {
	HandleScope scope;

	AudioEngine* pEngine = AudioEngine::Unwrap<AudioEngine>( args.This() );

	if (args.Length() > 1 || !args[0]->IsArray()){
		return scope.Close( ThrowException(Exception::TypeError(String::New("First argument should be an array."))) );
	}

	uv_mutex_lock( &pEngine->m_mutex );
	pEngine->queueOutputBuffer( Local<Array>::Cast(args[0]) );
	uv_mutex_unlock( &pEngine->m_mutex );

	Handle<Boolean> result = Boolean::New( false );

	return scope.Close( result );
} // end AudioEngine::Write()
开发者ID:alex-milanov,项目名称:node-core-audio,代码行数:18,代码来源:AudioEngine.cpp

示例12: FillBuffer

	bool AudioEngine::FillBuffer(void** data, int* dataSize, void* context){
		AudioEngine* engine = (AudioEngine*)context;
		return engine->fillBuffer(data, dataSize);
	}
开发者ID:openamedia,项目名称:client,代码行数:4,代码来源:AudioEngine.cpp

示例13: audioCallback

void AudioEngine::audioCallback(void *userData, Uint8 *audioBuffer, int audioBufferLen)
{
    AudioEngine *pThis = (AudioEngine*)userData;
    pThis->mixAudio(audioBuffer, audioBufferLen);
}
开发者ID:kostyll,项目名称:libavg,代码行数:5,代码来源:AudioEngine.cpp

示例14: main


//.........这里部分代码省略.........

		// Load song - if wasn't already loaded with playlist
		if ( ! pSong ) {
			if ( !songFilename.isEmpty() ) {
				pSong = Song::load( songFilename );
			} else {
				/* Try load last song */
				bool restoreLastSong = preferences->isRestoreLastSongEnabled();
				QString filename = preferences->getLastSongFilename();
				if ( restoreLastSong && ( !filename.isEmpty() ))
					pSong = Song::load( filename );
			}

			/* Still not loaded */
			if (! pSong) {
				___INFOLOG("Starting with empty song");
				pSong = Song::get_empty_song();
				pSong->set_filename( "" );
			}

			pHydrogen->setSong( pSong );
			preferences->setLastSongFilename( songFilename );
		}

		if ( ! drumkitToLoad.isEmpty() ){
			Drumkit* drumkitInfo = Drumkit::load_by_name( drumkitToLoad, true );
			if ( drumkitInfo ) {
				pHydrogen->loadDrumkit( drumkitInfo );
			} else {
				___ERRORLOG ( "Error loading the drumkit" );
			}
		}

		AudioEngine* AudioEngine = AudioEngine::get_instance();
		Sampler* sampler = AudioEngine->get_sampler();
		switch ( interpolation ) {
			case 1:
					sampler->setInterpolateMode( Sampler::COSINE );
					break;
			case 2:
					sampler->setInterpolateMode( Sampler::THIRD );
					break;
			case 3:
					sampler->setInterpolateMode( Sampler::CUBIC );
					break;
			case 4:
					sampler->setInterpolateMode( Sampler::HERMITE );
					break;
			case 0:
			default:
					sampler->setInterpolateMode( Sampler::LINEAR );
		}

		EventQueue *pQueue = EventQueue::get_instance();

		signal(SIGINT, signal_handler);

		bool ExportMode = false;
		if ( ! outFilename.isEmpty() ) {
			pHydrogen->startExportSong ( outFilename, rate, bits );
			cout << "Export Progress ... ";
			bool ExportMode = true;
		}

		// Interactive mode
		while ( ! quit ) {
开发者ID:IARI,项目名称:hydrogen-live,代码行数:67,代码来源:main.cpp

示例15: bq_player_callback

void AudioEngine::bq_player_callback(SLAndroidSimpleBufferQueueItf bq, void* data)
{
  AudioEngine* engine = static_cast<AudioEngine*> (data);
  engine->bq_player_callback_handler(bq);
}
开发者ID:daisukefuji,项目名称:OpenSynth,代码行数:5,代码来源:audio_engine.cpp


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