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

Pages: [1]
1
Audio / Re: Accessing the buffer
« on: September 01, 2017, 01:41:25 pm »
Ok, thanks for the reply, i'll find out

2
Audio / Re: Accessing the buffer
« on: September 01, 2017, 12:48:09 pm »
#include <iostream>
#include <SFML/Audio.hpp>
#include <SFML/Graphics.hpp>
#include <fftw3.h>
#include <Windows.h>


int main()
{
        // Create the main window
        sf::RenderWindow window(sf::VideoMode(800, 600), "OUR TEST");
        sf::SoundBuffer buffer;
        sf::Sound sound;
        if (!buffer.loadFromFile("Etherwood - Spoken.wav"))
        {
                std::cout << "ERROR"<<std::endl;
        }
        sound.setBuffer(buffer);
        sound.setVolume(25);

        std::cout << "Sample Rate: " << buffer.getSampleRate() << std::endl;

        while (window.isOpen())
        {
                // Process events
                sf::Event event;
                while (window.pollEvent(event))
                {
                        /*while (sound.getStatus() == sf::Sound::Playing) {
                                std::cout << buffer.getSamples() << std::endl;
                                Sleep(400);
                        }*/

                        switch (event.type)
                        {
                        case sf::Event::Closed:
                                window.close();
                                break;
                        case sf::Event::KeyPressed:
                                if (event.key.code == sf::Keyboard:: P)
                                {
                                        sound.play();
                                }
                                if (event.key.code == sf::Keyboard::Escape)
                                        window.close();
                                break;
                        }
                }
                window.clear();
                window.display();
        }
        return EXIT_SUCCESS;
}

This is my entire code. I run the getSamples() on the buffer.
I want to get a real time array from my buffer that is streaming the audio

3
Audio / Accessing the buffer
« on: September 01, 2017, 11:44:13 am »
Hi guys, im quite new to SFML. I'm trying to access the samples but when i apply the sound.getSamples() function all i obtain is an Int16 value.I was expecting an array of integer values to apply FFT later on. Any tip or help?

And what should i use to get a real-time array? Sound or Music?

Pages: [1]
anything