in my input plugin:
FMOD_RESULT F_CALLBACK setposition(FMOD_CODEC_STATE codec, int subsound, unsigned int position, FMOD_TIMEUNIT postype)
//this is ised to selects subsongs, for example "setposition(5,FMOD_TIMEUNIT_MS)" selects and plays subsong 5
gameplugin gp = (gameplugin*)codec->plugindata;
LogFile->Print( "sound: %i\n", position);
return handle_error( gme_start_track( gp->emu, position ) );
this will create the output:
And the same if call setposition with 10 and 11… position will be 10 for both calls. So every argument supplied that’s not ending with a 0 is ending up beeing 1 to small.
I open the sound like this:
system->createSound("Gradius.hes", FMOD_SOFTWARE|FMOD_CREATESTREAM, 0, &sound1);
I also tried with FMOD_ACCURATETIME but with same results. So is this a bug or is there some other way of opening the file to get correct values?
- bLAZER asked 11 years ago
And how do you make a custom timeunit value? I don’t have the source for FMOD so there’s not much code to look at how FMOD_TIMEUNIT_MODORDER is handled. I mean the only thing I can change is to add a define to fmod.h
define FMOD_TIMEUNIT_SUBSONG 0x20000000
but that obviously doesn’t do very much…
Ok apologies for the first few replies from me I realize now that you are trying to play a different timeunit, so at the end I was on the right track.
I was thinking your subsong 0x20000000 idea might have worked, but what do you mean it didnt?
Anyway the correct way to do it is create a codec with multiple subsounds, then all you have to do is call getSubSound from the main app with the track you want to play, then setposition is called with the ‘subsound’ parameter you selected (position will be 0).
In short you were using position when you should have been using the subsound parameter in the callback.
Well about the define: so I create my own define, but what next? The setposition gets another fmod time unit but there can’t be anything happening unless you change fmod’s source code…
I took a look at using subsounds to select subsongs a year ago when I did the sid input plugin and I couldn’t understand how that would work… so I gave up. I mean you can’t store the subsongs as audio data, since they only are producing the data when the emulated machinery is emulating/playing the song (nes/c64 etc). I’m not sure it can be done using subsounds – and no one else did it before either to my knowledge.
It’s a pity that FMOD_TIMEUNIT_MS skips every 10th ms otherwise is works fine. I should also mention that this "problem" occurs in two different plugins using different soundlibs (sidplay and game music emu).
I realized that I forgot to change the time unit to FMOD_TIMEUNIT_SUBSONG in the FMOD_CODEC_DESCRIPTION…
However when I use anything but FMOD_TIMEUNIT_PCM, FMOD_TIMEUNIT_MS or FMOD_TIMEUNIT_PCMBYTES in the codec description I get an FMOD_ERR_FORMAT when opening the file. So what have I missed here?
Ok, so in other words you should only use setposition to seek? It can’t be used for other purposes like selecting a subsong?
If not how do you call custom functions through a plugin? Let’s say I want to call
how do I call that function from the plugin?
Please login first to submit.