실제로 FMOD로 사운드를 재생하려고했지만 작동하지 않았습니다.FMOD가 사운드를 재생하지 않습니다. C++
#ifndef __SOUND_HH__
#define __SOUND_HH__
#include <string>
#include <fmodex/fmod.h>
class Sound
{
FMOD_SYSTEM *sys;
FMOD_SOUND *explosion;
FMOD_RESULT resExplosion;
FMOD_CHANNEL *channel1;
public:
Sound();
~Sound();
void play(const std::string &);
};
#endif
및
#include <string>
#include <iostream>
#include "Sound.hh"
Sound::Sound()
{
FMOD_System_Create(&this->sys);
FMOD_System_Init(this->sys, 1, FMOD_INIT_NORMAL, NULL);
}
Sound::~Sound()
{
FMOD_System_Release(sys);
}
하지만 난 ("mysound.wav")를 연주 할 때 내 코드에 아무것도 추가하지 않으면 반환 값과 문제가 없는지 확인합니다. 그래서 어떤 생각? 감사합니다.
void Sound::play(const std::string &filename)
{
FMOD_System_CreateStream(this->sys, filename.c_str(), FMOD_HARDWARE | FMOD_LOOP_OFF | FMOD_2D, 0, &this->explosion);
FMOD_System_PlaySound(sys, FMOD_CHANNEL_FREE, explosion, 0 , &channel1);
std::cout << "playayayyayayayayya" << std::endl;
}
스피커를 켜거나 켰습니까? 미디어 플레이어를 통해 사운드를 재생 해 보셨습니까? –
나는 C에서 FMOD를 사용하는 다른 프로젝트를 시도해 본다. 나는 같은 소리로 시도하고 항상 작동하지 않습니다 – ago
어디에서 코드를 플레이 기능이라고 부릅니까? –