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 - MarkJohnson94

Pages: [1]
1
Graphics / Re: Drawing a histogram plot
« on: August 11, 2014, 03:00:26 pm »
Perfect. Jesper I understand your approach is probably better and thanks for the reply, I just wanted to know if there was a simple line or two of code that I could use to achieve the effect I needed, and using Lines not LinesStrip works great, so thanks Hapax.

2
Graphics / Drawing a histogram plot
« on: August 07, 2014, 06:09:21 pm »
Hi there,

I have been working on an audio analysis library and I am currently working on a histogram of the loudness of the audio samples for the track. I have already developed a waveform viewer that has a few hundred points which are all connected by lines and this looks very nice. However for the histogram, I would like to have hundreds of individual lines which I can set the height of to display my histogram.

Is there any nice way to do this without having to create hundreds of individual objects? I'm a bit stuck for ideas.

Thanks for any help,
Mark

3
General / Re: Placing libraries in seperate directory to executable
« on: July 21, 2014, 03:22:22 pm »
But would I also have to ensure to remove this environment variable after the program exits though, if I want to ensure I don't end up with a large amount of path variables if I end up moving my build folder around. I am only really interested in statically linking if it means all DLLs can be statically linked, am I right in thinking the audio dlls need to be present in the folder, or is it possible to statically link them?

4
General / Placing libraries in seperate directory to executable
« on: July 21, 2014, 02:11:28 pm »
Hi there,

I have compiled several programs with MinGW, using command line options to link to the libraries I need, such as the sfml-system/window/graphics dlls. To then run this program I have to place these libraries, along with the libsndfile and openal libraries (as I am using audio) into the directory of the executable. I am trying to find out how I can have these libraries in a /library folder, which I can reference, so that I keep my build folder cleaner with less files lying around.

Thanks for any help,
Mark

5
Graphics / Re: Best way to design my GUI for multiple rotations?
« on: June 30, 2014, 05:06:21 pm »
Thanks for that, just what I needed.

6
Graphics / Best way to design my GUI for multiple rotations?
« on: June 30, 2014, 03:40:42 pm »
Hi everyone,

I am creating a level meter for audio samples that rises and falls based on the loudness of the audio track. I have developed it fully for a vertical layout, and I would like to create an option (such as a user pressing a keyboard key) that transforms my gui into a horizontal gui, in which the level rises and falls across the x axis instead.

What is the most modular way to create code that does this. I know it is possible to set the rectangles rotation and position in the window, but if I went on to add a range of other shapes this isn't a great approach as it would involve me having to modify all of their properties. I was thinking there must be a cleaner way?

Generally I would try to create everything on top of a pane of sorts, which when rotated would rotate all of its members. I have looked through the API and not found a solution such as this though.

Any suggestions are welcomed.
Thanks,
Mark.

7
General / Re: Updating shape when property is modified
« on: June 30, 2014, 02:49:03 pm »
I've just done some more reading and found this wiki entry. Is this what you are describing, and is there any way to avoid this? Would this occur as surely I am only modifying the data with my calculation thread, and the gui read is simply reading it?

Thanks,
Mark

8
General / Re: Updating shape when property is modified
« on: June 30, 2014, 02:45:34 pm »
Hi,

Thanks very much for the help. Just as a side note to anyone else who comes across this problem, I found that if I didn't include the line window.setVerticalSyncEnabled(true);, then my code had the same problem as mentioned above. Another fix was to remove this line, and use window.setActive(true);. It appears as though the active thread was the one doing the calculations, not updating the gui, but using either of these lines of code solves the problem.

Thanks for your reply, although what exactly do you mean by a race condition, I'm not sure how it applies here? Do you just mean that my display could update just before a new value is given, and then by the time it updates again, there is another new value and so it skips displaying one value as it isn't fast enough?

Thanks,
Mark.

9
General / Updating shape when property is modified
« on: June 30, 2014, 02:08:55 pm »
Hi,

I have just started using SFML and it's a great resource. I have been searching for a solution to my problem but as of yet I haven't found one so I thought I would come here to see if anyone could help.

I'm developing an audio plugin that overrides the Soundstream and feeds the samples to my library before returning the average peak information, which my application can then display as a level meter (rising and falling based on the loudness of the current part of the audio). I have a global variable named levelValue which is set to the current peak after each return value from the library, and I set the rectangle outline thickness to this value. My thinking was that everytime I change the levelValue, then the thickness of the rectangle would change, allowing me to display a level meter.

However the rectangle doesn't update with the new value of levelValue unless I move my mouse/press buttons. This is my main GUI loop:
while (window.isOpen())
    {
                clock.restart();
        sf::Event event;
        while (window.pollEvent(event))
        {
                        sf::Keyboard::P;
            if (event.type == sf::Event::Closed)
                        {
                                window.close();
                        }if (window.waitEvent(event))
                        {
                                rectangle.setOutlineThickness(levelValue);
                        }                      
        }

        window.clear();
        window.draw(rectangle);
        window.display();
    }

If anyone would be able to help me so that I can easily update my GUI every time the levelValue changes then that would be great. levelValue changes approx 43 times a second as I am calculating the average peak for 512 samples at a time. It may also be worth noting that I cannot update the rectangle from the area in which levelValue is set, as this is in a separate method, also a separate thread.

Thanks,
Mark.

Pages: [1]
anything