I’m currently developing a multizone music player to be used in my home, and I’m of course using FMOD as the heart of my project…
I have now come across a small problem that I hope can be solved.
When trying to play a wma file from my music player server (it’s running as a windows service) it doesn’t work. The error I get is this: ERR_COM – A Win32 COM related error occured. COM failed to initialize or a QueryInterface failed meaning a Windows codec or driver was not installed properly.
The code that generates the error is:
result = system.createSound(pathToFile, FMOD.MODE.HARDWARE | FMOD.MODE.CREATESTREAM, ref sound1);
I have tried to run the windows service as both "Local system" aswell as an account with administrative access to the machine but it doesn’t work regardless.
When running the same code from a windows application everything works fine so I think the problem is related to running FMOD in a windows service.
I’m running version 4.08.03 of FMOD.
- MisterG asked 9 years ago
I think its something to do with there not being any foreground window, i’m just searching some threads and they pass a HWND to the system init function.
The other possibility is that dsound doesnt work from a service, and you should use different output modes. Just do a thread search for ‘windows service’ in the fmod forums.
Thanks for the response. I have searched the other threads and tried different outputtypes, FMOD.OUTPUTTYPE.DSOUND and FMOD.OUTPUTTYPE.WINMM when intializing the system, but both gives me the following error on init:
ERR_OUTPUT_DRIVERCALL – A call to a standard soundcard driver failed, which could possibly mean a bug in the driver or resources were missing or exhausted.
When using FMOD.OUTPUTTYPE.AUTODETECT the system initializes correctly and it is possible to play mp3 files using the service, but when trying to play wma files it still get the ERR_COM error mentioned above.
Also if i do system.setOutput(FMOD.OUTPUTTYPE.DSOUND); before i init the system i can play mp3 files using my service but still not wma.
And since I’m running the service as a specific user account (not local system) i cannot "allow the service to interact with desktop", so getting a HWND to a window and pass that as the extradriverdata parameter in init doesn’t work either…
I have also tried to use FMOD.MODE.SOFTWARE instead of FMOD.MODE.HARDWARE when creating the sound, but that doesn’t fix things either.
I guess I could change the application so that it runs in the background when logged on as a user, but it’s not an ideal solution.
Any more suggestions on my problems?
- MisterG answered 9 years ago
I had this error and it plagued me for a while.
I am not sure if this is the best solution, however I was able to get around this error by setting the main thread that the player uses to the STA apartment state. If you are using .NET, code similar to this worked for me.
thread = new Thread(new ParameterizedThreadStart(__ThreadMain));
I haven’t tried using this technique or the player in a windows service, so I am not sure if this will work for your problem. Just a thought.
- scapes23 answered 9 years ago
Please login first to submit.