hi all. i’ve scoured the documentation and cannot find a way to send a chunk of raw data to DirectSound from within a different output plugin.
for instance, in the ‘output_mp3’ example, i would like to send each sound chunk received by OutputMP3_UpdateCallback() to the speakers (and then still carry on to encode it).
is this possible? many thanks.
- hellobono asked 12 years ago
[quote="brett":14hwdtfh]the reason it is failing is because you never specified numchannels or default frequency.[/quote:14hwdtfh]
how can i tell what the number of channels and frequency will be in an output plugin callback? for the raw data in the output_mp3 example, i tried defaultfrequency = 44100 with numchannels = 1 and numchannels = 2 (all other values as per my earlier post) and neither worked.
[quote="Janus":2wco5396]Maybe you could create a second System object with DirectSound set as its output, and pass the sound data onto that System.[/quote:2wco5396]
thanks for the idea. is there much overhead associated with creating a System?
so i tried to implement what you suggested and i’m running into an error (22) Unsupported file or Audio Format. can anybody see what the problem is? this is a snippet of the code i added to OutputMP3_UpdateCallback():
[create/init system ...] createsoundexinfo.cbsize = sizeof(FMOD_CREATESOUNDEXINFO); createsoundexinfo.length = mp3->dwSamples * sizeof(SHORT); createsoundexinfo.fileoffset = 0; createsoundexinfo.numchannels = 0; createsoundexinfo.defaultfrequency = 0; createsoundexinfo.format = FMOD_SOUND_FORMAT_PCM16; createsoundexinfo.initialsubsound = 0; createsoundexinfo.numsubsounds = 0; createsoundexinfo.inclusionlist = 0; createsoundexinfo.inclusionlistnum = 0; createsoundexinfo.pcmreadcallback = 0; createsoundexinfo.pcmsetposcallback = 0; createsoundexinfo.dlsname = 0; result = FMOD_System_CreateSound(system, mp3->pWAVBuffer, (FMOD_MODE)(FMOD_SOFTWARE | FMOD_OPENMEMORY | FMOD_OPENRAW ), &createsoundexinfo, &sound); ERRCHECK(result);[/code:2wco5396]
Creating a System object and Sound [b:jhht2xsc]in[/b:jhht2xsc] the callback can’t possibly be a good idea. I think you’d want to create both System objects at startup, along with both Sounds, and then copy wave data from one to the other in the callback.
Please login first to submit.