0
0

I am creating a custom dsp. When my create function is called the instance member of FMOD_DSP_STATE does not point to a valid instance. It is in fact 0. I need to access the userdata in my create function. How do i do this?

I’m using FMOD 4.02.08 w/ visual studio 2003

Simplified test case:

include”fmod/fmod.h”

include”fmod/fmod.hpp”

include<assert.h>

include<string.h>

//note: assert used for error checking out of lazyness since this is a bug test case
//this is only valid in debug

FMOD_RESULT F_CALLBACK test_create(FMOD_DSP_STATE* dsp_state){
void* userdata;

assert(dsp_state->instance); //shouldn’t this point to something?
//this assert fails for me.

((FMOD::DSP*)(dsp_state->instance))->getUserData(&userdata);

assert((int)userdata == 123);

return FMOD_OK;
}

int main(int argc, char** argv){
FMOD_RESULT result;
FMOD::System *system;

result = FMOD::System_Create(&system);
assert(result == FMOD_OK);

result = system->init(100, FMOD_INIT_NORMAL, 0);
assert(result == FMOD_OK);

FMOD_DSP_DESCRIPTION dsp_description;

strcpy(dsp_description.name,”test”);
dsp_description.version = 1;
dsp_description.create = test_create;
dsp_description.channels = 2;
dsp_description.release = 0;
dsp_description.reset = 0;
dsp_description.read = 0;
dsp_description.setposition = 0;

dsp_description.numparameters = 0;
dsp_description.paramdesc= 0;
dsp_description.setparameter = 0;
dsp_description.getparameter = 0;

dsp_description.config = 0;
dsp_description.configwidth = 0;
dsp_description.configheight = 0;

dsp_description.userdata = (void*) 123;

FMOD::DSP* dsp;

system->createDSP(&dsp_description, &dsp);

system->release();
}

  • You must to post comments
0
0

I have gotten the new version and confirmed the fix. Thanks for the quick response!

  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.