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

Pages: [1]
1
Audio / Recording stereo sound
« on: August 07, 2012, 12:12:23 pm »
I have a problem with the recording of stereo sound. 
 
It is  code:

#include <SFML/Audio.hpp>
#include <iomanip>
#include <iostream>
int main( ){    
    if (sf::SoundRecorder::CanCapture() == false)
    {
        std::cout << "Sorry, audio capture is not supported by your system" << std::endl;
        return EXIT_SUCCESS;
    }  
    unsigned int SampleRate=48000;
    std::cout << "Press enter to start recording audio";
    std::cin.ignore(10000, '\n');
    sf::SoundBufferRecorder Recorder;    
    Recorder.Start(SampleRate);
    std::cout << "Recording... press enter to stop";
    std::cin.ignore(10000, '\n');
    Recorder.Stop();

    // Get the buffer containing the captured data
    const sf::SoundBuffer& Buffer = Recorder.GetBuffer();

   const short  int*hbuf;
   hbuf=Buffer.GetSamples () ;
 
   //Display 10 samples of captured sound
 
   int i;
   for (i=0; i<10;i++) std::cout << *(hbuf+i)<<"\n";

    // Display captured sound informations
    std::cout << "Sound information :" << std::endl;
    std::cout << " " << Buffer.GetDuration()      << " seconds"           << std::endl;
    std::cout << " " << Buffer.GetSampleRate()    << " samples / seconds" << std::endl;
    std::cout << " " << Buffer.GetChannelsCount() << " channels"          << std::endl;

    return EXIT_SUCCESS;
}

It works for:
CaptureDevice = alcCaptureOpenDevice (NULL, SampleRate, AL_FORMAT_MONO16, SampleRate)
 in SoundBufferRecorder

I have modified:
CaptureDevice = alcCaptureOpenDevice (NULL, SampleRate, AL_FORMAT_STEREO16, SampleRate)  in SoundBufferRecorder  and compiled SFML-audio,    but it does not work.
I think, I should do something else for stereo recording. I would be grateful for your help.

Pages: [1]