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

Pages: [1]
1
Audio / Stereo recording
« on: April 03, 2011, 01:25:27 pm »
Ok. Thank you very much Laurent.  And definitely I will make a feature request on the task tracker (for stereo recording). I think there should by an optional parameter through which the recording format (at least AL_FORMAT_STEREO16 and AL_FORMAT_MONO_16) can be passed.

2
Audio / RE: Laurent
« on: April 03, 2011, 12:54:06 pm »
Firstly, thank you for reply. Ok it could be good solution. Unfortunately if I want to share my program I will have also share recompiled SFML, won't I.
Please if I am wrong correct me.
Quote

1) I won't be able to use libsfml-audio from repos
2) I will have to include fixed version of SFML in my sources
3) Suggestion: Isn't simpler and maybe cleaner to create own Recorder class implementing OpenAL's capture function
 


Thank you very much for any help and of course your freetime

3
Audio / Stereo recording
« on: April 03, 2011, 01:01:58 am »
Hi there. Because I am developing dualchannel "jack" scope I of course need stereo recording. Problem is that in SoundRecorder.hpp the predefined record type is set as AL_FORMAT_MONO16. I have started to solve this problem with overriding void SoundRecorder::Start(unsigned int SampleRate = 44100); but I am not sure if it's the best solution. If I try to compile, I get a lot of compile errors:
Quote
../libjop/jop_signalcatcher.cpp: In member function ‘void MyRecorder::Start(unsigned int)’:
../libjop/jop_signalcatcher.cpp:111: error: ‘CaptureDevice’ was not declared in this scope
../libjop/jop_signalcatcher.cpp:120: error: ‘CaptureDevice’ was not declared in this scope
../libjop/jop_signalcatcher.cpp:120: error: ‘AL_FORMAT_STEREO16’ was not declared in this scope
../libjop/jop_signalcatcher.cpp:120: error: ‘alcCaptureOpenDevice’ was not declared in this scope
../libjop/jop_signalcatcher.cpp:122: error: ‘CaptureDevice’ was not declared in this scope
../libjop/jop_signalcatcher.cpp:122: error: ‘AL_FORMAT_MONO16’ was not declared in this scope
../libjop/jop_signalcatcher.cpp:122: error: ‘alcCaptureOpenDevice’ was not declared in this scope
../libjop/jop_signalcatcher.cpp:124: error: ‘CaptureDevice’ was not declared in this scope
/usr/include/SFML/Audio/SoundRecorder.hpp:141: error: ‘unsigned int sf::SoundRecorder::mySampleRate’ is private
../libjop/jop_signalcatcher.cpp:134: error: within this context
/usr/include/SFML/Audio/SoundRecorder.hpp:100: error: ‘virtual bool sf::SoundRecorder::OnStart()’ is private
../libjop/jop_signalcatcher.cpp:137: error: within this context
/usr/include/SFML/Audio/SoundRecorder.hpp:100: error: ‘virtual bool sf::SoundRecorder::OnStart()’ is private
../libjop/jop_signalcatcher.cpp:137: error: within this context
../libjop/jop_signalcatcher.cpp:140: error: ‘CaptureDevice’ was not declared in this scope
../libjop/jop_signalcatcher.cpp:140: error: ‘alcCaptureStart’ was not declared in this scope
/usr/include/SFML/Audio/SoundRecorder.hpp:142: error: ‘bool sf::SoundRecorder::myIsCapturing’ is private
../libjop/jop_signalcatcher.cpp:143: error: within this context
/usr/include/SFML/System/Unix/Thread.hpp:69: error: ‘void sf::Thread::Launch()’ is inaccessible
../libjop/jop_signalcatcher.cpp:144: error: within this context
/usr/include/SFML/System/Unix/Thread.hpp:69: error: ‘void sf::Thread::Launch()’ is inaccessible
../libjop/jop_signalcatcher.cpp:144: error: within this context
../libjop/jop_signalcatcher.cpp:144: error: ‘sf::Thread’ is not an accessible base of ‘MyRecorder’

I have found that in SoundRecorder.cpp are defined following includes:
Quote
00028 #include <SFML/Audio/SoundRecorder.hpp>
00029 #include <SFML/Audio/AudioDevice.hpp>
00030 #include <SFML/Audio/OpenAL.hpp>
00031 #include <SFML/System/Sleep.hpp>
00032 #include <iostream>

The problem is AudioDevice.hpp and OpenAL.hpp are not found, if I try to include them in the file with my new SoundRecorder::Start(...) definition .. I know it is ok because these headers aren't located in  /usr/include/SFML/Audio. These libraries are located only in sfml source. So how can I get rid of these errors? Will I have to add sfml sources to my project?? Or if my solution is bad please suggest cleaner solution. I believe I have described my problem enough. Thanks in advance for any solutions or suggestions :wink:

For a better explanation I included my sources:
 JOP_Signal_Catcher.h
Code: [Select]
#ifndef JOP_SIGNALCATCHER_H
#define JOP_SIGNALCATCHER_H

#include <SFML/Audio.hpp>
#include <SFML/Audio/SoundRecorder.hpp>
#include "jop_core.h"


class MyRecorder : public QObject, public sf::SoundRecorder
{
    Q_OBJECT

private:
    bool loop;

public:
    MyRecorder(int myLimit, bool loop);
    MyRecorder();
    virtual bool OnProcessSamples(const sf::Int16* Samples, std::size_t SamplesCount);
    // predefinovani defaultni funkce start -> uprava pro spusteni stereo nahravani
    void Start(unsigned int SampleRate);
    std::vector<sf::Int16> mySamples;
    std::size_t myLimit;

signals:
    void processFinished();
};


JOP_Signal_Catcher.cpp
Code: [Select]
#include "jop_signalcatcher.h"
#include <SFML/Audio/SoundRecorder.hpp>
#include <SFML/Audio/SoundRecorder.hpp>
#include <SFML/Audio/AudioDevice.hpp> // error, not found
#include <SFML/Audio/OpenAL.hpp> // error, not found
#include <SFML/System/Sleep.hpp>
#include <iostream>

// copied from sfml, changed only capture mod (AL_FORMAT_MONO16 ->AL_FORMAT_STEREO16)
void MyRecorder::Start(unsigned int SampleRate)
 {
     // Check if the device can do audio capture
     if (!CanCapture())
     {
         std::cerr << "Failed to start capture : your system cannot capture audio data (call SoundRecorder::CanCapture to check it)" << std::endl;
         return;
     }

     // Check that another capture is not already running
     if (CaptureDevice)
     {
         std::cerr << "Trying to start audio capture, but another capture is already running" << std::endl;
         return;
     }

     // Open the capture device for capturing 16 bits MONO or STEREO samples
     // -> depends on [bool] loop (modificated)
     if(this->loop)
        CaptureDevice = alcCaptureOpenDevice(NULL, SampleRate, AL_FORMAT_STEREO16, SampleRate);
     else
         CaptureDevice = alcCaptureOpenDevice(NULL, SampleRate, AL_FORMAT_MONO16, SampleRate);

     if (!CaptureDevice)
     {
         std::cerr << "Failed to open the audio capture device" << std::endl;
         return;
     }

     // Clear the sample array
     mySamples.clear();

     // Store the sample rate
     mySampleRate = SampleRate;

     // Notify derived class
     if (OnStart())
     {
         // Start the capture
         alcCaptureStart(CaptureDevice);

         // Start the capture in a new thread, to avoid blocking the main thread
         myIsCapturing = true;
         Launch();
     }
 }

4
Audio / Thanks
« on: November 23, 2010, 11:59:00 pm »
Thank u very much. U have helped me a lot.  :)

5
Audio / SFML linking problems
« on: November 23, 2010, 12:34:16 am »
Hi there, I have a following problem. I am trying to run my test program for making some sound but I am getting linking problems.
error: undefined reference to `sf::SoundBuffer::SoundBuffer()'
 error: undefined reference to `sf::Sound::Sound()'

I know I have to link some libraries but I am pretty confused what parameters and where to place it. I use QT Creator as IDE. Thank you for your help

Pages: [1]