void MusicAudioRecorderWidget::initMonitor()
{
    m_mFormatSound.setSampleSize(16); //set sample sze to 16 bit
    m_mFormatSound.setSampleType(QAudioFormat::UnSignedInt ); //Sample type as usigned integer sample
    m_mFormatSound.setByteOrder(QAudioFormat::LittleEndian); //Byte order
    m_mFormatSound.setCodec("audio/pcm"); //set codec as simple audio/pcm

    QAudioDeviceInfo infoIn(QAudioDeviceInfo::defaultInputDevice());
    if (!infoIn.isFormatSupported(m_mFormatSound))
    {
        //Default format not supported - trying to use nearest
        m_mFormatSound = infoIn.nearestFormat(m_mFormatSound);
    }

    QAudioDeviceInfo infoOut(QAudioDeviceInfo::defaultOutputDevice());
    if (!infoOut.isFormatSupported(m_mFormatSound))
    {
        //Default format not supported - trying to use nearest
        m_mFormatSound = infoOut.nearestFormat(m_mFormatSound);
    }

    createAudioInput();
    createAudioOutput();

    m_mpOutputDevSound = m_mpAudioOutputSound->start();
    m_mpInputDevSound = m_mpAudioInputSound->start();
    connect(m_mpInputDevSound, SIGNAL(readyRead()), SLOT(onReadMore()));
    connect(ui->horizontalSlider, SIGNAL(valueChanged(int)), SLOT(onSliderValueChanged(int)));
}
void AudioTest::initializeAudio()
{
    connect(m_pullTimer, SIGNAL(timeout()), SLOT(pullTimerExpired()));

    m_pullMode = true;

    m_format.setSampleRate(DataFrequencyHz);
    m_format.setChannelCount(1);
    m_format.setSampleSize(8);
    m_format.setCodec("audio/pcm");
    m_format.setByteOrder(QAudioFormat::LittleEndian);
    m_format.setSampleType(QAudioFormat::UnSignedInt);

    QAudioDeviceInfo info(QAudioDeviceInfo::defaultOutputDevice());
    if (!info.isFormatSupported(m_format)) {
        qWarning() << "Default format not supported - trying to use nearest";
        m_format = info.nearestFormat(m_format);
    }

    m_generator = new Generator(m_format, DurationSeconds*1000000, ToneFrequencyHz, this);
    //input_sender = new InputSender(this, udpSocket, "127.0.0.1" , 60000);

    createAudioOutput();
    createAudioInput();
}
Beispiel #3
0
AudioWriter::AudioWriter(QObject *parent)
    : QObject(parent),
      audioOutput(0){

    audioFormat = AudioFormatBuilder::getAudioFormat();
    createAudioOutput();
}
 void AudioTest::deviceChanged(int index)
 {
     m_pullTimer->stop();
     m_generator->stop();
     m_audioOutput->stop();
     m_audioOutput->disconnect(this);
     m_device = m_deviceBox->itemData(index).value<QAudioDeviceInfo>();
     createAudioOutput();
 }
Beispiel #5
0
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow),
    m_audioOutput(0),
    m_morse(0)

{
    ui->setupUi(this);
#ifdef SMALL_DEVICE
    resize(800,440);
#else
    resize(1000,600);
#endif

    setWindowIcon(QIcon(":/icons/64x64/cutecw.png"));

    createAudioOutput();

    m_morse = new Morse(this, m_audioOutput, ui);

    this->setFocus();

    startIt();
}