When I try to create a new stream:
[quote:2t3o1rnp]FMOD.RESULT rcode = _system.createStream(url, mode, ref stream);
I’m getting back ERR_INITIALIZATION if this runs in a windows service. It works fine as a standalone program.
- nirva asked 13 years ago
Brett, can you give me a debug dll or something that prints out more info on the failure? The error I’m getting is super generic and not really helping me out.
I’m waiting for my partner to finish papers with you to get the license for the src of FMOD Ex, otherwise I’d just debug it myself
after getting a source license to fmodex, i see the problem.
if you pass in NULL for the extra data to init() on windows, using directsound output device, you set the DSBCAPS_GLOBALFOCUS on the directsound secondary buffer, but then you set the extra data (the hwnd passed to to the result of GetForegroundWindow().
the technique is solid, except in a windows service, in which case there is no foreground window! GetDesktopWindow() seems to work a lot better. would you mind making this change in the real codebase?
an alternative method would be to let the caller pass in an HWND, but also somehow let them set global focus.
I think it is imposible to use sound in a Windows service and therefor FMOD fails on initializing.
What you could do is write a (tray)application that monitors your service and plays the sounds, this could then also be used as a GUI admin tool or something.
The reason sound may not work in a service is because Windows’ sound support itself (in NT-based versions of Windows, anyway) relies on a service. Since service load order is not necessarily fixed, your service can’t use sound if it happens to load before the Windows sound support service. So the smart thing to do is disable sound support in services altogether.
Of course, this is just a guess, so don’t take it as gospel.
- Bruce answered 13 years ago
[quote="ddebono":1wel7ic5]I would be really surprised if you could not use sound in a windows service.
Just think of all the services such as Anti-virus, Exchange, SQL server etc…
Why you would use sound in a service is a totally different matter 😀
As I said, this is most likely done with a control application.
Also a guess of course.
Please login first to submit.