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.


Topics - Eilessa

Pages: [1]
1
Audio / getPlayingOffset returns 0 when it shouldn't
« on: August 08, 2014, 08:50:38 am »
Hi,

I must be missing something, because it doesn't work. First of all, a bit of background of what I'm trying to do: I have an assignment in school for which I need to modify audio. The bit I'm stuck on is changing volume. Because of the assignment - I'm not allowed to use the built in volume function.

What I'm trying to do: I have the original buffer, as well as a "current buffer". This is because I want to keep the original file for easy recovery after making changes (more are to come). I copy the contents of the original buffer into an sf::Int16 array that I modify, load into the current buffer and then I call my sound variable's setBuffer-method passing in the current buffer. So far so good, the sound still works.

But, this causes the sound to restart from the beginning (naturally) which I don't want. To solve that, before I change the buffer, I save the playing offset to a variable and after the buffer has been changed, I set the playing offset to that time. As this did not work, I printed the values I got from getPlayingOffset and it turns out, other than the first time, this returns 0. Why is this?

The code segment for the above:
   
int sampleCount = m_origBuffer.getSampleCount();
        const sf::Int16* origSamples = m_origBuffer.getSamples();
        sf::Int16* samples = new sf::Int16[sampleCount];

        for (int i = 0; i < sampleCount; ++i)
        {
                samples[i] = origSamples[i] * m_volume;
        }

        m_currBuffer.loadFromSamples(samples, sampleCount, m_origBuffer.getChannelCount(), m_origBuffer.getSampleRate());
        sf::Time time = m_sound.getPlayingOffset();
        std::cout << "Sound offset at change: " << time.asMilliseconds() << "\t";
        m_sound.setBuffer(m_currBuffer);
        m_sound.play();
        m_sound.setPlayingOffset(time);

        std::cout << "Offset set to time: " << time.asMilliseconds() << std::endl;

Thankful for help!

2
SFML website / Unhelpful Tutorial
« on: August 05, 2014, 04:10:19 pm »
First of all, thank you for your tutorials. They are amazing!

However, there is one I find I am not helped by at all. the http://www.sfml-dev.org/tutorials/2.1/compile-with-cmake.php. It says with windows, I need not install anything, but I cannot get it to work. Am I supposed to install CMake? I am not an unintelligent person so this is something you really should look into clarifying. If you clearly write nothing needs to be installed, then it should be specified if there is indeed something that needs to be installed.

Pages: [1]