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


C++ fmod::System类代码示例

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


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

示例1: Audio

    // Initializes FMOD Studio and loads all sound banks.
    Audio() :
      Listener(system)
    {
      // Create the FMOD Studio system.
      FmodCall(fmod::System::create(&system));
      // Initialize the system.
      FmodCall(system->initialize(
        maxChannels,               // max channels capable of playing audio
        FMOD_STUDIO_INIT_NORMAL,   // studio-specific flags
        FMOD_INIT_3D_RIGHTHANDED,  // regular flags
        nullptr));                 // extra driver data

      vector<fmod::Bank*> banks;

      // For each file in the Sounds directory with a *.bank extension:
      for (const string& file : PathInfo(config::Sounds).FilesWithExtension("bank"))
      {
        // Load the sound bank from file.
        fmod::Bank* bank = nullptr;
        FmodCall(system->loadBankFile(file.c_str(), FMOD_STUDIO_LOAD_BANK_NORMAL, &bank));

        banks.push_back(bank);
      }

      for (fmod::Bank* bank : banks)
      {
        // Get the number of events in the bank.
        int eventCount = 0;
        FmodCall(bank->getEventCount(&eventCount));
        if (eventCount == 0) continue;

        // Get the list of event descriptions from the bank.
        auto eventArray = vector<fmod::EventDescription*>(static_cast<size_t>(eventCount), nullptr);
        FmodCall(bank->getEventList(eventArray.data(), eventArray.size(), nullptr));

        // For each event description:
        for (fmod::EventDescription* eventDescription : eventArray)
        {
          // Get the path to the event, e.g. "event:/Ambience/Country"
          auto path = string(512, ' ');
          int retrieved = 0;
          FmodCall(eventDescription->getPath(&path[0], path.size(), &retrieved));
          path.resize(static_cast<size_t>(retrieved - 1)); // - 1 to account for null character

          // Save the event description in the event map.
          eventDescriptionMap.emplace(path, EventDescription(eventDescription, path));
        }
      }

      Note(*this);
    }
开发者ID:ItsRoyScott,项目名称:Lite,代码行数:52,代码来源:Audio.hpp

示例2: mouseDown

void StepTwoApp::mouseDown( MouseEvent event )
{
    int n;
	FMODErrorCheck( mSystem->getChannelsPlaying(&n) );
	if(n>=32) {
        console() << "Too many sounds playing!" << endl;
        return;
    }

    
    FMOD::Sound* sound = mSounds[Rand::randInt(mSounds.size())];
    
    // Channels inherit the modes of sounds.
    FMOD::Channel* channel;
    mSystem->playSound( FMOD_CHANNEL_FREE, sound, false, &channel );
}
开发者ID:KitchenTableCoders,项目名称:3daudio,代码行数:16,代码来源:StepTwoApp.cpp

示例3: update

void AudioVisualizerApp::update()
{
	// update FMOD so it can notify us of events
	mFMODSystem->update();

	// handle signal: if audio has ended, play next file
	if(mIsAudioPlaying && signalChannelEnd)
		playAudio( nextAudio( mAudioPath ) );

	// reset FMOD signals
	signalChannelEnd= false;

	// get spectrum for left and right channels and copy it into our channels
	float* pDataLeft = mChannelLeft.getData() + kBands * mOffset;
	float* pDataRight = mChannelRight.getData() + kBands * mOffset;

	mFMODSystem->getSpectrum( pDataLeft, kBands, 0, FMOD_DSP_FFT_WINDOW_HANNING );	
	mFMODSystem->getSpectrum( pDataRight, kBands, 1, FMOD_DSP_FFT_WINDOW_HANNING );

	// increment texture offset
	mOffset = (mOffset+1) % kHistory;

	// clear the spectrum for this row to avoid old data from showing up
	pDataLeft = mChannelLeft.getData() + kBands * mOffset;
	pDataRight = mChannelRight.getData() + kBands * mOffset;
	memset( pDataLeft, 0, kBands * sizeof(float) );
	memset( pDataRight, 0, kBands * sizeof(float) );

	// animate camera if mouse has not been down for more than 30 seconds
	if(!mIsMouseDown && (getElapsedSeconds() - mMouseUpTime) > mMouseUpDelay)
	{
		float t = float( getElapsedSeconds() );
		float x = 0.5f + 0.5f * math<float>::cos( t * 0.07f );
		float y = 0.1f - 0.2f * math<float>::sin( t * 0.09f );
		float z = 0.25f * math<float>::sin( t * 0.05f ) - 0.25f;
		Vec3f eye = Vec3f(kWidth * x, kHeight * y, kHeight * z);

		x = 1.0f - x;
		y = -0.3f;
		z = 0.6f + 0.2f *  math<float>::sin( t * 0.12f );
		Vec3f interest = Vec3f(kWidth * x, kHeight * y, kHeight * z);

		// gradually move to eye position and center of interest
		mCamera.setEyePoint( eye.lerp(0.995f, mCamera.getEyePoint()) );
		mCamera.setCenterOfInterestPoint( interest.lerp(0.990f, mCamera.getCenterOfInterestPoint()) );
	}
}
开发者ID:20SecondsToSun,项目名称:Cinder-Samples,代码行数:47,代码来源:AudioVisualizerApp.cpp

示例4: shutdown

void AudioVisualizerApp::shutdown()
{
	// properly shut down FMOD
	stopAudio();

	if( mFMODSystem )
		mFMODSystem->release();
}
开发者ID:UIKit0,项目名称:Cinder-Samples,代码行数:8,代码来源:AudioVisualizerApp.cpp

示例5: playEnvironment

	int Game::playEnvironment()
	{
			bool soundDone=false;
			FMOD::System* system;
			FMOD_RESULT result = FMOD::System_Create(&system);
			system->init(32, FMOD_INIT_NORMAL, NULL);
			FMOD::Sound* sound;
			
			result = system->createSound("Ocean.WAV",FMOD_LOOP_NORMAL,NULL, &sound);
			FMOD::Channel* channel = 0;
			bool pauseSound = false;


			channel->isPlaying(&pauseSound);

			result = system->playSound(FMOD_CHANNEL_FREE, sound,false, &channel);
			soundDone=true;


			while (soundDone!=true)
			{
			channel->setPaused(false);
			system->update();

			result = sound->release();
			result = system->close();
			result = system->release();
			}
			return 0;
	}
开发者ID:Acularius,项目名称:Pixel-Brother,代码行数:30,代码来源:Game.cpp

示例6:

void			playBackground(void)
{
	FMOD::System *		Syst = NULL;
	FMOD::Channel *		Chan = NULL;
	FMOD::Sound *		s;

	if (Syst == NULL)
	{
		if (FMOD::System_Create(&Syst) != FMOD_OK)
			fmod_exit();
		if (Syst->init(32, FMOD_INIT_NORMAL, 0) != FMOD_OK)
			fmod_exit();
	}
	if (Syst->createSound("mp3/background.mp3", FMOD_LOOP_NORMAL, 0, &s) != FMOD_OK)
		fmod_exit();
	if (Syst->playSound(s, NULL, false, &Chan) != FMOD_OK)
		fmod_exit();
	Syst->update();
}
开发者ID:alelievr,项目名称:md5,代码行数:19,代码来源:loadSounds.cpp

示例7: setup

void cinderFFmpegApp::setup()
{
	m_Font = ci::Font("Consolas", 48);
	setupGui();
	gl::enableAlphaBlending();

	std::shared_ptr<_2RealFFmpegWrapper::FFmpegWrapper> testFile = std::shared_ptr<_2RealFFmpegWrapper::FFmpegWrapper>(new _2RealFFmpegWrapper::FFmpegWrapper());
	testFile->dumpFFmpegInfo();
	//if(testFile->open(".\\data\\morph.avi"))
	if(testFile->open("d:\\vjing\\Wildlife.wmv"))
	{
		m_Players.push_back(testFile);
		m_VideoTextures.push_back(gl::Texture());
		m_Players.back()->play();
	}

	m_dLastTime = 0;
	m_iCurrentVideo = 0;
	m_fSpeed = 1;
	m_iLoopMode = _2RealFFmpegWrapper::eLoop;
	m_iTilesDivisor = 1;
	m_fSeekPos = m_fOldSeekPos = 0;

	//setup fmod
	FMOD::System_Create(&m_pSystem);
    m_pSystem->init(32, FMOD_INIT_NORMAL, 0);
   
	memset(&createsoundexinfo, 0, sizeof(FMOD_CREATESOUNDEXINFO));
    createsoundexinfo.cbsize            = sizeof(FMOD_CREATESOUNDEXINFO);              /* required. */
    createsoundexinfo.decodebuffersize  = 1024;                                       /* Chunk size of stream update in samples.  This will be the amount of data passed to the user callback. */
    createsoundexinfo.numchannels       = 2;                        /* Number of channels in the sound. */
    createsoundexinfo.length            = -1;                     /* Length of PCM data in bytes of whole song.  -1 = infinite. */
    createsoundexinfo.defaultfrequency  = (int)44100;                       /* Default playback rate of sound. */
	createsoundexinfo.format            = FMOD_SOUND_FORMAT_PCM16;                    /* Data format of sound. */
	createsoundexinfo.pcmreadcallback   =  pcmreadcallback;                             /* User callback for reading. */

	result = m_pSystem->createStream(0, FMOD_2D | FMOD_OPENUSER | FMOD_LOOP_OFF, &createsoundexinfo, &m_pSound);
	result = m_pSystem->playSound(FMOD_CHANNEL_FREE, m_pSound, 0, &m_pChannel);

	//std::shared_ptr<audio::Callback<cinderFFmpegApp,unsigned short>> audioCallback = audio::createCallback( this, &cinderFFmpegApp::audioCallback );
	//audio::Output::play( audioCallback );
}
开发者ID:cadet,项目名称:_2RealFFmpegWrapper,代码行数:42,代码来源:cinderFFmpegApp.cpp

示例8: PlayRollSound

	void FMOD_System::PlayRollSound()
	{
		if( roll != nullptr )
		{
			if( !IsPlaying( rollChannel ) && !IsPlaying( collisionChannel ) )
			{
				system->playSound( FMOD_CHANNEL_FREE, roll, true, &rollChannel );
				rollChannel->set3DAttributes( &ballPosition, nullptr );
				rollChannel->setPaused( false );
			}
		}
	}
开发者ID:gemini14,项目名称:AirBall,代码行数:12,代码来源:SoundSystem.cpp

示例9: PlayJetSound

	void FMOD_System::PlayJetSound()
	{
		if( jet != nullptr )
		{
			if( !IsPlaying( jetChannel ) )
			{
				system->playSound( FMOD_CHANNEL_FREE, jet, true, &jetChannel );
				jetChannel->set3DAttributes( &ballPosition, nullptr );
				jetChannel->setPaused( false );
			}
		}
	}
开发者ID:gemini14,项目名称:AirBall,代码行数:12,代码来源:SoundSystem.cpp

示例10: PlayCollisionSound

	void FMOD_System::PlayCollisionSound()
	{
		if( collision != nullptr )
		{
			if( !IsPlaying( collisionChannel ) )
			{
				system->playSound( FMOD_CHANNEL_FREE, collision, true, &collisionChannel );
				collisionChannel->set3DAttributes( &ballPosition, nullptr );
				collisionChannel->setPaused( false );
			}
		}
	}
开发者ID:gemini14,项目名称:AirBall,代码行数:12,代码来源:SoundSystem.cpp

示例11: initializeSound

void initializeSound()
{
	FMOD::System     *system;
    unsigned int      version;
	
	result = FMOD::System_Create(&system);
    ERRCHECK(result);
	
    result = system->getVersion(&version);
    ERRCHECK(result);
	
	if (version < FMOD_VERSION)
    {
        printf("Error!  You are using an old version of FMOD %08x.  This program requires %08x\n", version, FMOD_VERSION);
        exit(-3);
    }
	
	result = system->init(32, FMOD_INIT_NORMAL, NULL);
    ERRCHECK(result);
	
	result = system->createSound("/Users/adrtwin/Music/What You Know (Mustang Remix).mp3", FMOD_SOFTWARE, 0, &sound1);
    ERRCHECK(result);
	
	
	
	/*
	result = system->createSound("CALIBRATING", FMOD_SOFTWARE, 0, &sound2);
    ERRCHECK(result);
	
    result = system->createSound("SHOT", FMOD_SOFTWARE, 0, &sound3);
    ERRCHECK(result);
	
    result = system->createSound("SHOT_NO_AMMO", FMOD_SOFTWARE, 0, &sound4);
    ERRCHECK(result);
	
	result = system->createSound("RELOADING", FMOD_SOFTWARE, 0, &sound5);
    ERRCHECK(result);
	*/
	globalSystem = system;
}
开发者ID:indieknite,项目名称:Super-Spray,代码行数:40,代码来源:SoundEffectsLibrary.cpp

示例12: createStreamingSound

	FMOD::Sound* FMODAudioClip::createStreamingSound() const
	{
		if(getReadMode() != AudioReadMode::Stream || mStreamData == nullptr)
		{
			LOGERR("Invalid audio stream data.");
			return nullptr;
		}

		FMOD_MODE flags = FMOD_CREATESTREAM;

		FMOD_CREATESOUNDEXINFO exInfo;
		memset(&exInfo, 0, sizeof(exInfo));
		exInfo.cbsize = sizeof(exInfo);
		
		// Streaming from memory not supported.
		assert(mStreamData->isFile());

		exInfo.length = mStreamSize;
		exInfo.fileoffset = mStreamOffset;

		SPtr<FileDataStream> fileStream = std::static_pointer_cast<FileDataStream>(mStreamData);
		String pathStr = fileStream->getPath().toString();

		if (is3D())
			flags |= FMOD_3D;
		else
			flags |= FMOD_2D;

		FMOD::Sound* sound = nullptr;
		FMOD::System* fmod = gFMODAudio()._getFMOD();
		if (fmod->createSound(pathStr.c_str(), flags, &exInfo, &sound) != FMOD_OK)
		{
			LOGERR("Failed creating a streaming sound.");
			return nullptr;
		}

		sound->setMode(FMOD_LOOP_OFF);
		return sound;
	}
开发者ID:maximwreznikov,项目名称:BansheeEngine,代码行数:39,代码来源:BsFMODAudioClip.cpp

示例13: switch

MicrophoneRecorder::MicrophoneRecorder(int frequency, int channels, FMOD_SOUND_FORMAT format)
    : m_fmodsnd(nullptr)
    , m_fmodsys(nullptr)
    , m_dataLength(0)
    , m_byteSize(0)
    , m_frequency(frequency)
    , m_channels(channels)
{
    switch (format)
    {
        case FMOD_SOUND_FORMAT_PCM8: m_byteSize = 1; break;
        case FMOD_SOUND_FORMAT_PCM16: m_byteSize = 2; break;
        case FMOD_SOUND_FORMAT_PCM24: m_byteSize = 3; break;
        case FMOD_SOUND_FORMAT_PCM32: m_byteSize = 4; break;
        case FMOD_SOUND_FORMAT_PCMFLOAT: m_byteSize = 4; break;
    }

    CHECK(m_byteSize > 0);

	FMOD::System * fmodSys = SoundMngr::Get()->GetSys();

	FMOD_CREATESOUNDEXINFO exinfo;
	memset(&exinfo, 0, sizeof(FMOD_CREATESOUNDEXINFO));
	exinfo.cbsize           = sizeof(FMOD_CREATESOUNDEXINFO);
	exinfo.numchannels      = channels;
	exinfo.format           = format;
	exinfo.defaultfrequency = frequency;
	exinfo.length           = exinfo.defaultfrequency * m_byteSize * exinfo.numchannels * 2;

	unsigned int flags = FMOD_SOFTWARE | FMOD_2D | FMOD_OPENUSER;
	FMOD_ERRCHECK(fmodSys->createSound(0, flags, &exinfo, &m_fmodsnd));

	m_fmodsys = fmodSys;

    m_data.resize(channels);
}
开发者ID:kalineh,项目名称:nao-gm,代码行数:36,代码来源:MicrophoneRecorder.cpp

示例14: setup

void StepTwoApp::setup()
{
    FMODListDevices();
    FMODErrorCheck(FMOD::System_Create( &mSystem ));
    FMODErrorCheck(mSystem->setDriver(0));
	FMOD_INITFLAGS flags = FMOD_INIT_NORMAL; // right-click, Go To Definition
	FMODErrorCheck(mSystem->init( 32, flags, NULL ));

    vector<fs::path> paths;
    paths.push_back( getAssetPath("gong-loud-hit.mp3") );
    paths.push_back( getAssetPath("orch-hit.wav") );
    paths.push_back( getAssetPath("trumpethit07.wav") );
    
    for(auto& path: paths) {
        FMOD::Sound* sound;
        mSystem->createSound( path.string().c_str(), FMOD_SOFTWARE, NULL, &sound );
        
        // You can change the mode of sounds at any time.
        FMOD_MODE mode = FMOD_SOFTWARE | FMOD_2D | FMOD_LOOP_OFF;
        FMODErrorCheck( sound->setMode( mode ) );
        
        mSounds.push_back(sound);
    }
}
开发者ID:KitchenTableCoders,项目名称:3daudio,代码行数:24,代码来源:StepTwoApp.cpp

示例15: draw

void _TBOX_PREFIX_App::draw()
{
	gl::clear();
	
	// grab 512 samples of the wave data
	float waveData[512];
	mSystem->getWaveData( waveData, 512, 0 );
	
	// render the 512 samples to a VertBatch
	gl::VertBatch vb( GL_LINE_STRIP );
	for( int i = 0; i < 512; ++i )
		vb.vertex( getWindowWidth() / 512.0f * i, getWindowCenter().y + 100 * waveData[i] );

	// draw the points as a line strip
	gl::color( Color( 1.0f, 0.5f, 0.25f ) );
	vb.draw();
}
开发者ID:AbdelghaniDr,项目名称:Cinder,代码行数:17,代码来源:_TBOX_PREFIX_App.cpp


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