Beispiel #1
0
    int audio_engine::load(const char* filename_, size_t num_channel_){
        int res = 0;
        if(NULL == filename_){
            R_ERR("invalid filename");
            return 1;
        }
        if (!(audio_proxy_get()->state & DR_INIT)) {
            R_ERR("audio load without init");
            return 1;
        }        

        if (!(audio_proxy_get()->backend.state & DR_OPEN)) {
            R_ERR("audio load without backend open");
            return 1;
        }        
        
        if (audio_proxy_get()->nb_channels <= num_channel_) {
            R_ERR("not enought channels, requested:%d max:%d", 
                    num_channel_,
                    (audio_proxy_get()->nb_channels - 1));
            return 1;
        }        
        audio_channel_t &channel = audio_proxy_get()->channels[num_channel_];
        res = m_loader.load(filename_, channel.buffer);
        channel.normal_ratio = ((double)channel.buffer.sample_rate) / audio_proxy_get()->backend.sample_rate;
        
        
        return res;                
    }
DarkSouls::DarkSouls()
{
	if (fetchProcess(L"DARKSOULS.exe", L"DARK SOULS")) {
		D_OUT("Process found and opened.");
		fetchBasePointer();
	} else {
		R_ERR("No process has been found or failed to open the handle.");
	}

	initWrappers();
}
Beispiel #3
0
    void audio_engine::give_back() {

        if ((audio_proxy_get()->state & DR_INIT)) {

            if (DR_OPEN & audio_proxy_get()->backend.state) {
                R_ERR("free audio ressources on opened state");
                return;
            }
            audio_proxy_close();
            audio_proxy_get()->state &= ~DR_INIT;
        }
    }
Beispiel #4
0
 int audio_engine::open(size_t nb_channels_) {
     if (audio_proxy_get()->state & DR_OPEN) {
         R_ERR("audio already open");
         return 1;
     }
     if (!(audio_proxy_get()->state & DR_INIT)) {
         if( init(nb_channels_)){
             return 1;
         }
     }
     return m_backend.open(m_process.getProcessCallback());
 }