Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Window Display Background Noise with VC++ 2008 and SFML 1.6 (RESOLVED)  (Read 4114 times)

0 Members and 1 Guest are viewing this topic.

The Good King

  • Newbie
  • *
  • Posts: 5
    • View Profile
Hello,

 I am currently working on a game project using SFML 1.6 and Visual Studio 2008, and it seems sf::Window.Display() is causing a high-pitched background noise. Console applications work just fine with no noise, as well as the other SFML classes/functions.

 If I just create a window without invoking Display, again no noise is present. Only when I add a App.Display() invocation to the main game loop this high-pitched noise appears. Here is the code producing the noise:

#include <iostream>
#include <SFML/Window.hpp>

int main (){
   sf::Window App(sf::VideoMode(640, 480, 32), "Testits");
   sf::Event Main_Event;

   while(App.IsOpened()){
      while(App.GetEvent(Main_Event)){
         if(Main_Event.Type == sf::Event::Closed){
            App.Close();
         }
      }

      App.Display();
   }

   return 0;
}

 I tried looking up this issue on Google, but it seems only post on was made mentioning this problem. Unfortunately the poster asked several questions in his one post and thus received only one answer for one of the other issues he had.
« Last Edit: June 01, 2012, 10:10:51 pm by The Good King »

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: Window Display Background Noise with VC++ 2008 and SFML 1.6
« Reply #1 on: May 30, 2012, 11:45:25 pm »
This is the expected behaviour: you don't draw anything to the window so it can show anything.

Start reading the "Graphics" tutorials if you want to see something interesting in your window.
Laurent Gomila - SFML developer

The Good King

  • Newbie
  • *
  • Posts: 5
    • View Profile
Re: Window Display Background Noise with VC++ 2008 and SFML 1.6
« Reply #2 on: May 31, 2012, 12:24:20 am »
 Sorry, I may have been a bit ambiguous there with my question: I do not mean visual noise, but audible noise as in a high-pitched continuous sound. This does not change if I add images to the Window, and I notice if I re-size the window the pitch of the noise changes inversely (smaller window equals higher pitch noise).

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11030
    • View Profile
    • development blog
    • Email
Re: Window Display Background Noise with VC++ 2008 and SFML 1.6
« Reply #3 on: May 31, 2012, 01:50:20 am »
This makes no sense at all and it's clearly not SFML fault because SFML only interferes with audio if you include the audio library.
Never had anything like and never heard of anything like this...  :-\
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

The Good King

  • Newbie
  • *
  • Posts: 5
    • View Profile
Re: Window Display Background Noise with VC++ 2008 and SFML 1.6
« Reply #4 on: May 31, 2012, 03:55:13 am »
This makes no sense at all and it's clearly not SFML fault because SFML only interferes with audio if you include the audio library.

 It only occurs with SFML-made windows whether the audio library is included or not (I've tried excluding it from the project linker and everywhere else). I should also note that while manipulating the window (if I hold the window selected down while re-sizing or moving) the noise pauses until I release it. I've tried this with different sound devices (headphones, speakers) to see if it was the device causing the noise, but to no avail. If need be I'd be happy to record a video which shows my project's settings/code as well as the odd noise that results.

 If this helps, My PC is an eMachines EL1850 running Windows 7 Home Premium SP1 (64-bit) with Realtek High-Def Audio.

 Also, is it normal for playing audio to skip while the window is out of focus?

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11030
    • View Profile
    • development blog
    • Email
Re: Window Display Background Noise with VC++ 2008 and SFML 1.6
« Reply #5 on: May 31, 2012, 01:41:47 pm »
That's a hardware problem. Your GPU is generating high pitched noises.
It should also happen with other applications that max out your GPU.
To 'fix' it you just need to set a framerate limit, so your GPU won't get maxed out and you won't hear a noise.

What graphics card are you using?
« Last Edit: May 31, 2012, 06:21:29 pm by eXpl0it3r »
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

The Good King

  • Newbie
  • *
  • Posts: 5
    • View Profile
Re: Window Display Background Noise with VC++ 2008 and SFML 1.6
« Reply #6 on: June 01, 2012, 03:48:23 am »
That's a hardware problem. Your GPU is generating high pitched noises.
It should also happen with other applications that max out your GPU.
To 'fix' it you just need to set a framerate limit, so your GPU won't get maxed out and you won't hear a noise.

What graphics card are you using?

That definitely sounds like the likely cause, as this eMachine is quite incapable when it comes to graphics.

Here is my Graphics Card info:



EDIT: I see the Window method for setting a max frame rate, should I set the parameter to 533 or?
« Last Edit: June 01, 2012, 03:54:16 am by The Good King »

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11030
    • View Profile
    • development blog
    • Email
Re: Window Display Background Noise with VC++ 2008 and SFML 1.6
« Reply #7 on: June 01, 2012, 12:45:36 pm »
That definitely sounds like the likely cause, as this eMachine is quite incapable when it comes to graphics.

It doesn't have to be the incapability of a card, because the one similar case I know of uses a not so bad Nvidia card.

EDIT: I see the Window method for setting a max frame rate, should I set the parameter to 533 or?
Use window.setFramerateLimit(60);. Your monitor will probably probably only display 60 frames per second anyway. And if you don't update & draw that much it would even run with ~30fps.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

The Good King

  • Newbie
  • *
  • Posts: 5
    • View Profile
 Setting the limit to 60 definitely reduced the noise to a low grumble, which I generally hear anyways when doing anything with a window. Further lowering it to 30 reduced it a bit more, but I think it seems for the time being that it will make at least some noise unless perhaps I replace the card entirely (which I am planning on doing).

 Thanks for all your help! I think we can call this one resolved.

void

  • Newbie
  • *
  • Posts: 5
    • View Profile
I've had exactly the same problem wint Nvidia 8800 and SFML 2.0 and limiting frame rate to 60fps solved it outright.

 

anything