Gamestudio Links
Zorro Links
Newest Posts
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
Help with plotting multiple ZigZag
by degenerate_762. 04/30/24 23:23
M1 Oversampling
by 11honza11. 04/30/24 08:16
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
1 registered members (AndrewAMD), 801 guests, and 6 spiders.
Key: Admin, Global Mod, Mod
Newest Members
firatv, wandaluciaia, Mega_Rod, EternallyCurious, howardR
19050 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Issue with focus #435294
01/05/14 18:41
01/05/14 18:41
Joined: Mar 2010
Posts: 120
Switzerland
T
TehV Offline OP
Member
TehV  Offline OP
Member
T

Joined: Mar 2010
Posts: 120
Switzerland
Hi,
For a project I'm working on I need a program that runs on a secondary monitor. This has to be possible under the following conditions:

-The engine runs in fullscreen mode. This is required so that VSync is used, which is of highest importance to the program.
-The engine must be able to play sounds reliably.
-The program must continue working even if it is no longer in focus.


The problems I have are that when the engine loses focus (when I try to switch to another window):
-The engine is instantly minimized, and only becomes visible again when it regains focus.
-The snd_play functions do not play a sound when the engine is not in focus.


I have tried the following to work around these issues:
-I have tried fake fullscreens (setting an engine window without border to the same size as the monitor), but according to several sources, it is impossible to make a window mode application use VSync (I absolutely need VSync for this program).
-I have tried switching to the media_play functions, which are not suitable for this project. They appear to cut out a short bit of audio at the beginning of a sound - my sounds are only a fraction of a second long, and so it is possible (and this has happened!) that the whole sound is skipped.


Are there any possible workarounds to these problems that I may have missed?
Is it possible to trick the engine into 'thinking' it is in focus?

Re: Issue with focus [Re: TehV] #435295
01/05/14 19:06
01/05/14 19:06
Joined: Jul 2008
Posts: 2,107
Germany
rayp Offline

X
rayp  Offline

X

Joined: Jul 2008
Posts: 2,107
Germany
Quote:
Are there any possible workarounds to these problems that I may have missed?
Is it possible to trick the engine into 'thinking' it is in focus?

I dont have a solution sorry but i guess(!) this is caused by operating system / directx itself not the engine. A dirty hack would be a second (hidden) process controlled via sendmessage fex doing the job, setting focus / playing a sound then. But why do u want to switch to another window, while engine is in fullscreen ? Maybe theres a simple trick. HeelX well knows api-calls from lite-c, could be useable here. Just wild-guessing ^^. greets.


Acknex umgibt uns...zwischen Dir, mir, dem Stein dort...
"Hey Griswold ... where u gonna put a tree that big ?"
1998 i married my loved wife ... Sheeva from Mortal Kombat, not Evil-Lyn as might have been expected
rayp.flags |= UNTOUCHABLE;
Re: Issue with focus [Re: rayp] #435296
01/05/14 19:10
01/05/14 19:10
Joined: Mar 2010
Posts: 120
Switzerland
T
TehV Offline OP
Member
TehV  Offline OP
Member
T

Joined: Mar 2010
Posts: 120
Switzerland
The engine is displayed on a secondary monitor, and it's controlled through another program that runs on the primary monitor - that's why I want to switch to another window while the engine is in fullscreen.

Re: Issue with focus [Re: TehV] #435298
01/05/14 19:19
01/05/14 19:19
Joined: Feb 2006
Posts: 1,011
Germany
pegamode Offline
Serious User
pegamode  Offline
Serious User

Joined: Feb 2006
Posts: 1,011
Germany
For our Meteor Mess project we use FMOD for all audio stuff. With this the sound is played even if the engine is not in focus.

Have you checked the OpenAL sound feature? Maybe its behaviour is similiar to FMOD.

Re: Issue with focus [Re: pegamode] #435299
01/05/14 19:33
01/05/14 19:33
Joined: Mar 2010
Posts: 120
Switzerland
T
TehV Offline OP
Member
TehV  Offline OP
Member
T

Joined: Mar 2010
Posts: 120
Switzerland
OpenAL plays the sound even if the engine is out of focus. Thanks!

...only it appears unable to play the sounds I used. I'll export them again and see if that fixes the problem.

EDIT: Out of the 20 sound files I have, only one can be loaded with OpenAL for some reason. This sound was created from scratch within Audacity. The rest can't be loaded, even though they could be loaded before (snd_createoal returns NULL for those sounds).

Last edited by TehV; 01/05/14 19:46.
Re: Issue with focus [Re: TehV] #435303
01/05/14 20:10
01/05/14 20:10
Joined: Feb 2006
Posts: 1,011
Germany
pegamode Offline
Serious User
pegamode  Offline
Serious User

Joined: Feb 2006
Posts: 1,011
Germany
Did you check if those sounds are stereo or mono? I haven't used OpenAL so far, but I think I read that it can only handle mono sounds.

Re: Issue with focus [Re: pegamode] #435304
01/05/14 20:22
01/05/14 20:22
Joined: Mar 2010
Posts: 120
Switzerland
T
TehV Offline OP
Member
TehV  Offline OP
Member
T

Joined: Mar 2010
Posts: 120
Switzerland
The original sounds (apart from the one that does play) were stereo sounds, but I've converted them into mono sounds - Perhaps the stereo track wasn't fully removed. I'll further investigate this and post here whether or not the problem could be fixed.

Re: Issue with focus [Re: TehV] #435343
01/06/14 15:50
01/06/14 15:50
Joined: Mar 2010
Posts: 120
Switzerland
T
TehV Offline OP
Member
TehV  Offline OP
Member
T

Joined: Mar 2010
Posts: 120
Switzerland
Converting all my sounds to mono sounds has fixed this issue. Thanks for the help!

The problem that remains is that the engine is minimized when it loses focus. Does anyone have a workaround for this?


Moderated by  HeelX, Spirit 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1