Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#include "tsound_t.h"
Toshihiro Shimizu 890ddd
#include "texception.h"
Toshihiro Shimizu 890ddd
#include "tthread.h"
Toshihiro Shimizu 890ddd
#include "tthreadmessage.h"
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#include <errno.h></errno.h>
Toshihiro Shimizu 890ddd
#include <unistd.h></unistd.h>
Toshihiro Shimizu 890ddd
#include <queue></queue>
Toshihiro Shimizu 890ddd
#include <set></set>
Toshihiro Shimizu 890ddd
e162db
#include <qpointer></qpointer>
Jeremy Bullock 6767be
#include <qbytearray></qbytearray>
Jeremy Bullock 6767be
#include <qaudioformat></qaudioformat>
e162db
#include <qiodevice></qiodevice>
Jeremy Bullock 6767be
#include <qaudiooutput></qaudiooutput>
Jeremy Bullock 6767be
Toshihiro Shimizu 890ddd
using namespace std;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//==============================================================================
3cd962
e162db
class TSoundOutputDeviceImp: public std::enable_shared_from_this<tsoundoutputdeviceimp> {</tsoundoutputdeviceimp>
3cd962
private:
e162db
  QMutex m_mutex;
e162db
3cd962
  double m_volume;
3cd962
  bool m_looping;
e162db
e162db
  qint64 m_bytesSent;
e162db
  qint64 m_bufferIndex;
e162db
e162db
  QByteArray m_buffer;
e162db
  QPointer<qaudiooutput> m_audioOutput;</qaudiooutput>
e162db
  QIODevice *m_audioBuffer;
Shinya Kitaoka 120a6e
3cd962
public:
Shinya Kitaoka 120a6e
  std::set<tsoundoutputdevicelistener *=""> m_listeners;</tsoundoutputdevicelistener>
Shinya Kitaoka 120a6e
e162db
  TSoundOutputDeviceImp():
e162db
    m_mutex(QMutex::Recursive),
e162db
    m_volume(0.5),
e162db
    m_looping(false),
e162db
    m_bytesSent(0),
e162db
    m_bufferIndex(0),
e162db
    m_audioBuffer()
e162db
  { }
Shinya Kitaoka 120a6e
e162db
private:
e162db
  void reset() {
e162db
    if (m_audioOutput) {
e162db
      m_audioOutput->reset();
e162db
      m_audioBuffer = m_audioOutput->start();
e162db
      m_bytesSent = 0;
e162db
    }
e162db
  }
e162db
e162db
  void sendBuffer() {
e162db
    QMutexLocker lock(&m_mutex);
e162db
e162db
    if (!m_audioOutput) return;
e162db
    if (!m_buffer.size()) return;
e162db
    if ( m_audioOutput->error() != QAudio::NoError
e162db
      && m_audioOutput->error() != QAudio::UnderrunError )
e162db
    {
e162db
      stop();
e162db
      std::cerr << "error " << m_audioOutput->error() << std::endl;
e162db
      return;
e162db
    }
e162db
e162db
    bool looping = isLooping();
e162db
    qint64 bytesRemain = m_audioOutput->bytesFree();
e162db
    while(bytesRemain > 0) {
e162db
      qint64 bytesCount = m_buffer.size() - m_bufferIndex;
e162db
      if (bytesCount <= 0) {
e162db
        if (!looping) break;
e162db
        m_bufferIndex = 0;
e162db
      }
e162db
      if (bytesCount > bytesRemain) bytesCount = bytesRemain;
e162db
e162db
      m_audioBuffer->write(m_buffer.data() + m_bufferIndex, bytesCount);
e162db
e162db
      bytesRemain -= bytesCount;
e162db
      m_bufferIndex += bytesCount;
e162db
      m_bytesSent += bytesCount;
e162db
    }
e162db
  }
e162db
e162db
public:
e162db
  double getVolume() {
e162db
    QMutexLocker lock(&m_mutex);
e162db
    return m_volume;
e162db
  }
e162db
e162db
  bool isLooping() {
e162db
    QMutexLocker lock(&m_mutex);
e162db
    return m_looping;
e162db
  }
e162db
e162db
  void prepareVolume(double x) {
e162db
    QMutexLocker lock(&m_mutex);
e162db
    m_volume = x;
e162db
  }
e162db
e162db
  bool isPlaying() {
e162db
    QMutexLocker lock(&m_mutex);
e162db
    return m_audioOutput
e162db
        && m_buffer.size()
e162db
        && ( isLooping()
e162db
          || m_bufferIndex < m_buffer.size()
e162db
          /*|| m_audioOutput->state() == QAudio::ActiveState*/ );
e162db
  }
e162db
e162db
  void setVolume(double x) {
e162db
    QMutexLocker lock(&m_mutex);
e162db
    m_volume = x;
e162db
    if (m_audioOutput) m_audioOutput->setVolume(m_volume);
e162db
  }
e162db
e162db
  void setLooping(bool x) {
e162db
    QMutexLocker lock(&m_mutex);
e162db
    if (m_looping != x) {
e162db
      m_looping = x;
e162db
      if (m_audioOutput) {
e162db
        /* audio buffer too small, so optimization not uses
e162db
        qint64 bufferSize = m_buffer.size();
e162db
        if (!m_looping && bufferSize > 0) {
e162db
          qint64 processedBytes =
e162db
            m_audioOutput->format().bytesForDuration(
e162db
              m_audioOutput->processedUSecs() );
e162db
          qint64 extraBytesSend = m_bytesSent - processedBytes;
e162db
          if (extraBytesSend > m_bufferIndex) {
e162db
            // remove extra loops from audio buffer
e162db
            m_bufferIndex -= extraBytesSend % bufferSize;
e162db
            if (m_bufferIndex < 0) m_bufferIndex += bufferSize;
e162db
            reset();
e162db
          }
e162db
        }
e162db
        */
e162db
        sendBuffer();
e162db
      }
e162db
    }
e162db
  }
Toshihiro Shimizu 890ddd
e162db
  void stop() {
e162db
    QMutexLocker lock(&m_mutex);
e162db
    //reset(); audio buffer too small, so optimization not uses
e162db
    m_buffer.clear();
e162db
    m_bufferIndex = 0;
e162db
  }
Toshihiro Shimizu 890ddd
e162db
  void play(const TSoundTrackP &st, TINT32 s0, TINT32 s1, bool loop, bool scrubbing) {
e162db
    QMutexLocker lock(&m_mutex);
e162db
e162db
    QAudioFormat format;
e162db
    format.setSampleSize(st->getBitPerSample());
e162db
    format.setCodec("audio/pcm");
e162db
    format.setChannelCount(st->getChannelCount());
e162db
    format.setByteOrder(QAudioFormat::LittleEndian);
e162db
    format.setSampleType( st->getFormat().m_signedSample
e162db
                        ? QAudioFormat::SignedInt
e162db
                        : QAudioFormat::UnSignedInt );
e162db
    format.setSampleRate(st->getSampleRate());
e162db
e162db
    QAudioDeviceInfo info(QAudioDeviceInfo::defaultOutputDevice());
e162db
    if (!info.isFormatSupported((format)))
e162db
      format = info.nearestFormat(format);
e162db
e162db
    qint64 totalPacketCount = s1 - s0;
e162db
    qint64 fileByteCount    = (s1 - s0)*st->getSampleSize();
e162db
    m_buffer.resize(fileByteCount);
e162db
    memcpy(m_buffer.data(), st->getRawData() + s0*st->getSampleSize(), fileByteCount);
e162db
    m_bufferIndex = 0;
e162db
e162db
    m_looping = loop;
e162db
    if (!m_audioOutput || m_audioOutput->format() != format) {
e162db
      if (m_audioOutput) m_audioOutput->stop();
e162db
      m_audioOutput = new QAudioOutput(format);
e162db
      m_audioOutput->setVolume(m_volume);
e162db
e162db
      // audio buffer size
e162db
      qint64 audioBufferSize = format.bytesForDuration(100000);
e162db
      m_audioOutput->setBufferSize(audioBufferSize);
e162db
      m_audioOutput->setNotifyInterval(50);
shun_iwasawa b487a5
      QObject::connect(m_audioOutput.data(), &QAudioOutput::notify, [=](){ sendBuffer(); });
e162db
e162db
      reset();
e162db
    }/* audio buffer too small, so optimization not uses
e162db
    else {
e162db
      // if less than 0.1 sec of data in audio buffer,
e162db
      // then just sent next portion of data
e162db
      // else reset audio buffer before
e162db
      qint64 sentUSecs = format.durationForBytes(m_bytesSent);
e162db
      qint64 processedUSecs = m_audioOutput->processedUSecs();
e162db
      if (sentUSecs - processedUSecs > 100000ll)
e162db
        reset();
e162db
    }
e162db
    */
e162db
e162db
    sendBuffer();
e162db
  }
Toshihiro Shimizu 890ddd
};
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//==============================================================================
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
TSoundOutputDevice::TSoundOutputDevice() : m_imp(new TSoundOutputDeviceImp) {
Shinya Kitaoka 120a6e
  try {
Shinya Kitaoka 120a6e
    supportsVolume();
Shinya Kitaoka 120a6e
  } catch (TSoundDeviceException &e) {
Shinya Kitaoka 120a6e
    throw TSoundDeviceException(e.getType(), e.getMessage());
Shinya Kitaoka 120a6e
  }
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//------------------------------------------------------------------------------
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
TSoundOutputDevice::~TSoundOutputDevice() {
Shinya Kitaoka 120a6e
  stop();
Shinya Kitaoka 120a6e
  close();
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//------------------------------------------------------------------------------
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
bool TSoundOutputDevice::installed() { return true; }
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//------------------------------------------------------------------------------
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
bool TSoundOutputDevice::open(const TSoundTrackP &st) {
Shinya Kitaoka 120a6e
  return true;
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//------------------------------------------------------------------------------
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
bool TSoundOutputDevice::close() {
Shinya Kitaoka 120a6e
  stop();
Shinya Kitaoka 120a6e
  return true;
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//------------------------------------------------------------------------------
Toshihiro Shimizu 890ddd
Jeremy Bullock 6767be
void TSoundOutputDevice::prepareVolume(double volume) {
Jeremy Bullock 6767be
    m_imp->prepareVolume(volume);
Jeremy Bullock 6767be
}
Jeremy Bullock 6767be
Jeremy Bullock 6767be
//------------------------------------------------------------------------------
Jeremy Bullock 6767be
Shinya Kitaoka 120a6e
void TSoundOutputDevice::play(const TSoundTrackP &st, TINT32 s0, TINT32 s1,
Shinya Kitaoka 120a6e
                              bool loop, bool scrubbing) {
Shinya Kitaoka 120a6e
  int lastSample = st->getSampleCount() - 1;
Shinya Kitaoka 120a6e
  notLessThan(0, s0);
Shinya Kitaoka 120a6e
  notLessThan(0, s1);
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  notMoreThan(lastSample, s0);
Shinya Kitaoka 120a6e
  notMoreThan(lastSample, s1);
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  if (s0 > s1) {
Toshihiro Shimizu 890ddd
#ifdef DEBUG
Shinya Kitaoka 120a6e
    cout << "s0 > s1; reorder" << endl;
Toshihiro Shimizu 890ddd
#endif
Shinya Kitaoka 120a6e
    swap(s0, s1);
Shinya Kitaoka 120a6e
  }
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  m_imp->play(st, s0, s1, loop, scrubbing);
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//------------------------------------------------------------------------------
3cd962
3cd962
void TSoundOutputDevice::stop() {
3cd962
  m_imp->stop();
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//------------------------------------------------------------------------------
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
void TSoundOutputDevice::attach(TSoundOutputDeviceListener *listener) {
Shinya Kitaoka 120a6e
  m_imp->m_listeners.insert(listener);
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//------------------------------------------------------------------------------
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
void TSoundOutputDevice::detach(TSoundOutputDeviceListener *listener) {
Shinya Kitaoka 120a6e
  m_imp->m_listeners.erase(listener);
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//------------------------------------------------------------------------------
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
double TSoundOutputDevice::getVolume() {
3cd962
  return m_imp->getVolume();
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//------------------------------------------------------------------------------
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
bool TSoundOutputDevice::setVolume(double volume) {
3cd962
  m_imp->setVolume(volume);
Shinya Kitaoka 120a6e
  return true;
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//------------------------------------------------------------------------------
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
bool TSoundOutputDevice::supportsVolume() { return true; }
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//------------------------------------------------------------------------------
Toshihiro Shimizu 890ddd
3cd962
bool TSoundOutputDevice::isPlaying() const { return m_imp->isPlaying(); }
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//------------------------------------------------------------------------------
Toshihiro Shimizu 890ddd
3cd962
bool TSoundOutputDevice::isLooping() { return m_imp->isLooping(); }
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//------------------------------------------------------------------------------
Toshihiro Shimizu 890ddd
3cd962
void TSoundOutputDevice::setLooping(bool loop) { m_imp->setLooping(loop); }
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//------------------------------------------------------------------------------
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
TSoundTrackFormat TSoundOutputDevice::getPreferredFormat(TUINT32 sampleRate,
Shinya Kitaoka 120a6e
                                                         int channelCount,
Shinya Kitaoka 120a6e
                                                         int bitPerSample) {
Shinya Kitaoka 120a6e
  TSoundTrackFormat fmt(sampleRate, bitPerSample, channelCount, true);
Shinya Kitaoka 120a6e
  return fmt;
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//------------------------------------------------------------------------------
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
TSoundTrackFormat TSoundOutputDevice::getPreferredFormat(
Shinya Kitaoka 120a6e
    const TSoundTrackFormat &format) {
Shinya Kitaoka 120a6e
  return getPreferredFormat(format.m_sampleRate, format.m_channelCount,
Shinya Kitaoka 120a6e
                            format.m_bitPerSample);
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//==============================================================================
Toshihiro Shimizu 890ddd
//==============================================================================
Toshihiro Shimizu 890ddd
//                REGISTRAZIONE
Toshihiro Shimizu 890ddd
//==============================================================================
Toshihiro Shimizu 890ddd
//==============================================================================
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
class TSoundInputDeviceImp {
Toshihiro Shimizu 890ddd
public:
Shinya Kitaoka 120a6e
  // ALport m_port;
Shinya Kitaoka 120a6e
  bool m_stopped;
Shinya Kitaoka 120a6e
  bool m_isRecording;
Shinya Kitaoka 120a6e
  bool m_oneShotRecording;
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  long m_recordedSampleCount;
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  TSoundTrackFormat m_currentFormat;
Shinya Kitaoka 120a6e
  TSoundTrackP m_st;
Shinya Kitaoka 120a6e
  std::set<int> m_supportedRate;</int>
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  TThread::Executor m_executor;
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  TSoundInputDeviceImp()
Shinya Kitaoka 120a6e
      : m_stopped(false)
Shinya Kitaoka 120a6e
      , m_isRecording(false)
Shinya Kitaoka 120a6e
      //   , m_port(NULL)
Shinya Kitaoka 120a6e
      , m_oneShotRecording(false)
Shinya Kitaoka 120a6e
      , m_recordedSampleCount(0)
Shinya Kitaoka 120a6e
      , m_st(0)
Shinya Kitaoka 120a6e
      , m_supportedRate(){};
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  ~TSoundInputDeviceImp(){};
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  bool doOpenDevice(const TSoundTrackFormat &format,
Shinya Kitaoka 120a6e
                    TSoundInputDevice::Source devType);
Toshihiro Shimizu 890ddd
};
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
bool TSoundInputDeviceImp::doOpenDevice(const TSoundTrackFormat &format,
Shinya Kitaoka 120a6e
                                        TSoundInputDevice::Source devType) {
Shinya Kitaoka 120a6e
  return true;
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//==============================================================================
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
class RecordTask : public TThread::Runnable {
Toshihiro Shimizu 890ddd
public:
Shinya Kitaoka 120a6e
  TSoundInputDeviceImp *m_devImp;
Shinya Kitaoka 120a6e
  int m_ByteToSample;
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  RecordTask(TSoundInputDeviceImp *devImp, int numByte)
Shinya Kitaoka 120a6e
      : TThread::Runnable(), m_devImp(devImp), m_ByteToSample(numByte){};
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  ~RecordTask(){};
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  void run();
Toshihiro Shimizu 890ddd
};
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
void RecordTask::run() {}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//==============================================================================
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
TSoundInputDevice::TSoundInputDevice() : m_imp(new TSoundInputDeviceImp) {}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//------------------------------------------------------------------------------
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
TSoundInputDevice::~TSoundInputDevice() {}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//------------------------------------------------------------------------------
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
bool TSoundInputDevice::installed() {
Shinya Kitaoka 120a6e
  /*
Shinya Kitaoka 120a6e
  if (alQueryValues(AL_SYSTEM, AL_DEFAULT_INPUT, 0, 0, 0, 0) <=0)
Shinya Kitaoka 120a6e
return false;
Shinya Kitaoka 120a6e
*/
Shinya Kitaoka 120a6e
  return true;
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//------------------------------------------------------------------------------
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
void TSoundInputDevice::record(const TSoundTrackFormat &format,
Shinya Kitaoka 120a6e
                               TSoundInputDevice::Source type) {}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//------------------------------------------------------------------------------
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
void TSoundInputDevice::record(const TSoundTrackP &st,
Shinya Kitaoka 120a6e
                               TSoundInputDevice::Source type) {}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//------------------------------------------------------------------------------
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
TSoundTrackP TSoundInputDevice::stop() {
Shinya Kitaoka 120a6e
  TSoundTrackP st;
Shinya Kitaoka 120a6e
  return st;
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//------------------------------------------------------------------------------
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
double TSoundInputDevice::getVolume() { return 0.0; }
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//------------------------------------------------------------------------------
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
bool TSoundInputDevice::setVolume(double volume) { return true; }
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//------------------------------------------------------------------------------
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
bool TSoundInputDevice::supportsVolume() { return true; }
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//------------------------------------------------------------------------------
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
TSoundTrackFormat TSoundInputDevice::getPreferredFormat(TUINT32 sampleRate,
Shinya Kitaoka 120a6e
                                                        int channelCount,
Shinya Kitaoka 120a6e
                                                        int bitPerSample) {
Shinya Kitaoka 120a6e
  TSoundTrackFormat fmt;
Shinya Kitaoka 120a6e
  return fmt;
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//------------------------------------------------------------------------------
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
TSoundTrackFormat TSoundInputDevice::getPreferredFormat(
Shinya Kitaoka 120a6e
    const TSoundTrackFormat &format) {
Shinya Kitaoka 120a6e
  /*
Shinya Kitaoka 120a6e
try {
Shinya Kitaoka 120a6e
*/
Shinya Kitaoka 120a6e
  return getPreferredFormat(format.m_sampleRate, format.m_channelCount,
Shinya Kitaoka 120a6e
                            format.m_bitPerSample);
Shinya Kitaoka 120a6e
  /*}
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
catch (TSoundDeviceException &e) {
Shinya Kitaoka 120a6e
throw TSoundDeviceException( e.getType(), e.getMessage());
Shinya Kitaoka 120a6e
}
Shinya Kitaoka 120a6e
*/
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//------------------------------------------------------------------------------
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
bool TSoundInputDevice::isRecording() { return m_imp->m_isRecording; }