I have written code based on the usercreatedsound example.
When I want to change the Panning for the channel of the user sound, it only works if the sound is FMOD_2D and FMOD_HARDWARE in FMOD_OUTPUT_DSOUND.
It’s the same for 3D, channel assignment sounds correct only if the sound is FMOD_3D and FMOD_HARDWARE in FMOD_OUTPUT_DSOUND.
Using FMOD_OUTPUT_WINMM or FMOD_SOFTWARE, everything is ok except the speaker assignment. (the output sound is Mono)
Is this behaviour ok ?
- artscoop asked 10 years ago
I Thank you,
I changed setSoftwareFormat from
system->setSoftwareFormat(48000, FMOD_SOUND_FORMAT_PCM16, 2, 2, FMOD_DSP_RESAMPLER_LINEAR);
system->setSoftwareFormat(48000, FMOD_SOUND_FORMAT_PCM16, 0, 2, FMOD_DSP_RESAMPLER_LINEAR);
and it works now.
However in the docs it is said that default numoutputchannels is 2.
Actually, when I set the third parameter for setSoftwareFormat to 0, it works fine, however I do not set the speaker mode using setSpeakerMode before.
here is some code :
FMOD::Channel *channel = 0, *channelb = 0;
SoundMix<short,2,2> mixer, mixer2;
FMOD::Sound *sound2, *sound3;
FMOD::DSP *dspecho=0, *dspcutoff=0, *dspvst=0;
VSTHost *vst, *vst2;
HINSTANCE instance =NULL;
// Choix des options de mixing
cout << "Press 1 for VSTi testing\nPress 2 for VST testing\nPress any other key for normal playback\n";;
case ‘1’: instance=LoadLibrary(L".\LePiano.dll");vst=new VSTHost();vst->SetInstance(&instance);vst2=NULL;break;
case ‘2’: instance=LoadLibrary(L".\BugPass.dll");vst=new VSTHost();vst->SetInstance(&instance);vst2=NULL;break;
default: vst =NULL; vst2=NULL;
// Initialiser FMOD
system->setSoftwareFormat(88200, FMOD_SOUND_FORMAT_PCM16, 2, 2, FMOD_DSP_RESAMPLER_LINEAR);
system->init(64, FMOD_INIT_NORMAL, 0);
with the code above, I have a wrong speaker assignement (same thing in both speakers)
With this line changed :
[code:3jke2r0y] system->setSoftwareFormat(88200, FMOD_SOUND_FORMAT_PCM16, 0, 2, FMOD_DSP_RESAMPLER_LINEAR);
, all is ok, panning for 2D sounds and positionning for 3D sounds.
About the documentation, indeed, I looked into it (that’s why the description of the parameter is puzzling considering the effects on my system), also, yes, I set the fourth parameter to 6 instead of 2 to save a bit of memory.
Ah ok, that’s perfect, I read the documentation multiple times without taking care.
In the code sample, the sample rate was set to such a high value to test my custom mixer at different rates. (actually, to see if VSTinstruments play ok at any rate, which is not the case in OpenMPT)
About the DSP buffer, I changed its size because when I made a test at 96kHz, I had many clicks in the sound. (I’ve just tested with setting 4 buffers of size 1024, it clicks a lot, but when I set 8 buffers of size 512, it works like a charm).
About DSOUND, I will remove the line as you recommend.
Please login first to submit.