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

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - Ectance

Pages: [1]
1
Audio / Re: sf::SoundStream onGetData()
« on: May 08, 2014, 12:28:40 pm »
The delay is not an issue . Even 250-300ms are fine in my case , I'm coding a standalone synthesizer/wave generator by the way .
When it's generating sounds in real-time ( instead writing them to a file )  , every time a chunk is popped from a queue and passed to the internal AL queue, I get "missing" part of a waveform.Not cutted or anything just audiable flat line for 1-2ms so I asked the question to understand if the problem is in my code or the speed of which the internal queue is filling.

And the pipeline :

Create chunk of N samples -> write a sine/whatever wave -> push in queue -> pop from queue -> pass to .data


( main thread ; SoundStream thread )

2
Audio / sf::SoundStream onGetData()
« on: May 06, 2014, 03:06:51 pm »
Hello again~!

Can I ask when exactly is onGetData() called ? When the previous chunk of samples has finished being played or a bit sooner ?
Is it possible if onGetData() takes lets say 2-3ms to return true , cracks or gaps in the sound to be produced ?
Thanks.

3
General / Trapping function keys
« on: November 25, 2011, 01:19:01 pm »
no one ?

4
General / Trapping function keys
« on: November 24, 2011, 10:08:41 pm »
Code: [Select]

#include <SFML/Config.hpp>
#include <SFML/System.hpp>
#include <SFML/Graphics.hpp>



int main()
{
   sf::RenderWindow *render_window;
   sf::ContextSettings render_settings;
   unsigned char smConsoleActive = 0;
   sf::Event evt;

   render_settings.AntialiasingLevel  = 0;
   render_settings.DepthBits          = 0;
   render_settings.MajorVersion       = 2;
   render_settings.MinorVersion       = 0;
   render_settings.StencilBits        = 0;

   render_window = new sf::RenderWindow(sf::VideoMode(1024,768,32),"win",sf::Style::Titlebar | sf::Style::Close,render_settings);
   bool terminate = false;


   while(!terminate && render_window->IsOpened())
   {
      if(sf::Keyboard::IsKeyPressed(sf::Keyboard::F10))
      {
         std::cout<<"0\n";
         smConsoleActive = 0;
      }

      if(sf::Keyboard::IsKeyPressed(sf::Keyboard::F11))
      {
         std::cout<<"1\n";
         smConsoleActive = 1;
      }

      if(sf::Keyboard::IsKeyPressed(sf::Keyboard::F12))
      {
         std::cout<<"2\n";
         smConsoleActive = 2;
      }
           
      while (render_window->PollEvent(evt))
      {
         if(evt.Type == sf::Event::TextEntered)
         {
            switch(evt.Key.Code)
            {
               case 100 :
                  // do stuff :
                  break;
            }
         }
      }
      render_window->Clear();
      render_window->Display();
   }

   delete render_window;
   return 0;
}



so if you press fast the three F-keys the output in std::cout is wrong ~50% of the time

5
General / Trapping function keys
« on: November 24, 2011, 09:50:08 pm »
Code: [Select]

void loop()
{
   smTerminate = false;
   smUiMode = SM_UIMODE_CONSOLE;

   while(!smTerminate && render_window->IsOpened())
   {
      switch(smUiMode)
      {
         case SM_UIMODE_CONSOLE:
            if(sf::Keyboard::IsKeyPressed(sf::Keyboard::F10))
            {
               std::cout<<"0\n";
               smConsoleActive = 0;
            }

            if(sf::Keyboard::IsKeyPressed(sf::Keyboard::F11))
            {
               std::cout<<"1\n";
               smConsoleActive = 1;
            }

            if(sf::Keyboard::IsKeyPressed(sf::Keyboard::F12))
            {
               std::cout<<"2\n";
               smConsoleActive = 2;
            }
           
            while (render_window->PollEvent(evt))
            {
               if(evt.Type == sf::Event::TextEntered)
               {
                  switch(evt.Key.Code)
                  {
                     case 100 :
                        // do stuff :
                        break;
                  }
               }
            }
            console[smConsoleActive].Display(render_window);
            break;



         default:
            ;
      }
   }
}


if i replace F10,F11 and F12 with Num1 Num2 and Num3 it works fine

6
General / Trapping function keys
« on: November 24, 2011, 09:22:52 pm »
i have this code :

Code: [Select]

while(true)
{
   if(sf::Keyboard::IsKeyPressed(sf::Keyboard::Num1))
      smFunction = 0;
   if(sf::Keyboard::IsKeyPressed(sf::Keyboard::Num2))
      smFunction = 1;
   if(sf::Keyboard::IsKeyPressed(sf::Keyboard::Num3))
      smFunction = 2;
   std::cout<<smFunction<<std::endl;
}


and it works as expected , but if i try to get function key state the input get stucked :

Code: [Select]

while(true)
{
   if(sf::Keyboard::IsKeyPressed(sf::Keyboard::F10))
      smFunction = 0;
   if(sf::Keyboard::IsKeyPressed(sf::Keyboard::F11))
      smFunction = 1;
   if(sf::Keyboard::IsKeyPressed(sf::Keyboard::F12))
      smFunction = 2;
   std::cout<<smFunction<<std::endl;
}


if i click on the screen rapidly the values are changing but if not , the value of <smFunction> get stuck at the previous value at a random time . also when stuck , i think the window loses focus for a second.

is this a bug or I'm doing it wrong ?

ps. im using sfml 2.0 ( 1-2max week snapshot ) on win7x32 machine
ps2. sorry for my english

7
System / Callback a method inside of a class with sf::Thread?
« on: November 09, 2011, 08:51:20 pm »
yes sir , im using 1.6
will 2.0 work fine ?

8
System / Callback a method inside of a class with sf::Thread?
« on: November 09, 2011, 07:15:25 pm »
I have :

Code: [Select]

class A
{
   private :
      sf::Thread *thread;
      bool running;
      void loop();
   public :
      A();
      ~A();
      void Start();
      void Stop();
    };



A::A()
{
   thread = new sf::Thread(&A::loop,this); // <- here is the error
   running = false;
}



A::~A()
{
   Stop();
   sf::Sleep(1.0f);
   delete thread;
}



void A::Start()
{
   running = true;
   thread->Launch();
}



void A::Stop()
{
   running = false;
}



void A::loop()
{
   while(running)
      // do sth
}



I get this error :
error C2664: 'sf::Thread::Thread(sf::Thread::FuncType,void *)' : cannot convert parameter 1 from 'void (__thiscall A::* )(void)' to 'sf::Thread::FuncType'
1>          There is no context in which this conversion is possible


( MS VC++ 2010 xpress )

Pages: [1]
anything