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

Pages: [1]
1
Audio / Re: Sound not played through left speaker
« on: June 15, 2015, 02:10:30 pm »
Thank you all for your help.

Sorry for the delay in replying.

I got it working on an ARM board like I wanted.

Cheers!

2
Audio / Re: Sound not played through left speaker
« on: January 20, 2015, 06:26:21 am »
Thanks for the heads up. I converted the audio to mono using Audacity but the problem still persists. Just to give a little more scenario. I am using Sublime Text and compiling using g++.

I changed the code to what is seen below. Still no change.

    sf::Listener::setPosition(0.f, 0.f, 0.f);
    sf::Listener::setDirection(1.f, 0.f, 0.f);
    sf::Sound::setPosition(10.f, 0.f, 0.f);
    sf::Sound::SetRelativeToListener(true);
 

3
Audio / Sound not played through left speaker
« on: January 19, 2015, 02:03:38 pm »
Hello

I am writing a program to play audio only through the right earphone. The code is below. Why is it not working? Audio plays through both.

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

using namespace std;
using namespace sf;

void playSound() {
    SoundBuffer Buffer;                            
   
    // Load a sound buffer from a wav file

    if (!Buffer.loadFromFile("right.wav"))                  
        cout << "ERROR!" << endl;
   
    sf::Listener::setPosition(10.f, 0.f, 5.f);
    sf::Listener::setDirection(1.f, 0.f, 0.f);

    // Load a sound buffer from a wav file

    Sound Sound(Buffer);                                    
    Sound.play();                                          

    // Loop while the sound is playing

    while (Sound.getStatus() == sf::Sound::Playing) {      
       
        sf::Time t1 = sf::seconds(0.1f);
        sf::sleep(t1);

        // Display the playing position

        cout << "\rPlaying... " << endl;
    }
}

int main() {
    playSound();
    cout << "Done" << endl;
    return EXIT_SUCCESS;
}

4
Audio / Re: No Sound in Terminal
« on: January 18, 2015, 06:23:20 am »
Thank you. After a little bit of research, I got it working using the below code.

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

using namespace std;
using namespace sf;

void playSound()
{
    // Load a sound buffer from a wav file
    SoundBuffer Buffer;
    if (!Buffer.loadFromFile("left.wav"))
        cout << "ERROR!" << endl;
    // Create a sound instance and play it
    Sound Sound(Buffer);
    Sound.play();

    // Loop while the sound is playing
    while (Sound.getStatus() == sf::Sound::Playing)
    {
        // Leave some CPU time for other processes
        sf::Time t1 = sf::seconds(0.1f);
        sf::sleep(t1);

        // Display the playing position
        cout << "\rPlaying... " << endl;
    }
}
int main()
{
    playSound();
    cout << "Done" << endl;
    return EXIT_SUCCESS;
}

5
Audio / [SOLVED] No Sound in Terminal
« on: January 18, 2015, 05:36:34 am »
This is my first program using SFML. I am unable to get any sound output.

#include <SFML/Audio.hpp>

int main()
{
    sf::SoundBuffer buffer;
    if (!buffer.loadFromFile("left.wav"))
        return -1;
    sf::Sound sound;
    sound.setBuffer(buffer);
    sound.play();
    return 0;
}

The program compiles and runs without errors but there is no sound. What seems to be the problem?

Pages: [1]
anything