View | Details | Raw Unified | Return to bug 226101
Collapse All | Expand All

(-)RtAudio.cpp (-14 / +34 lines)
Lines 8685-8690 bool RtApiPulse::probeDeviceOpen( unsign Link Here
8685
#include <errno.h>
8685
#include <errno.h>
8686
#include <math.h>
8686
#include <math.h>
8687
8687
8688
#if defined(__FreeBSD__)
8689
#define SND_DEVICE "/dev/dsp"
8690
#else
8691
#define SND_DEVICE "/dev/mixer"
8692
#endif
8693
8688
static void *ossCallbackHandler(void * ptr);
8694
static void *ossCallbackHandler(void * ptr);
8689
8695
8690
// A structure to hold various information related to the OSS API
8696
// A structure to hold various information related to the OSS API
Lines 8711-8719 RtApiOss :: ~RtApiOss() Link Here
8711
8717
8712
unsigned int RtApiOss :: getDeviceCount( void )
8718
unsigned int RtApiOss :: getDeviceCount( void )
8713
{
8719
{
8714
  int mixerfd = open( "/dev/mixer", O_RDWR, 0 );
8720
  int mixerfd = open( SND_DEVICE, O_RDWR, 0 );
8715
  if ( mixerfd == -1 ) {
8721
  if ( mixerfd == -1 ) {
8716
    errorText_ = "RtApiOss::getDeviceCount: error opening '/dev/mixer'.";
8722
    errorText_ = "RtApiOss::getDeviceCount: error opening ";
8723
    errorText_ += SND_DEVICE;
8724
    errorText_ += "'.";
8717
    error( RtAudioError::WARNING );
8725
    error( RtAudioError::WARNING );
8718
    return 0;
8726
    return 0;
8719
  }
8727
  }
Lines 8735-8743 RtAudio::DeviceInfo RtApiOss :: getDevic Link Here
8735
  RtAudio::DeviceInfo info;
8743
  RtAudio::DeviceInfo info;
8736
  info.probed = false;
8744
  info.probed = false;
8737
8745
8738
  int mixerfd = open( "/dev/mixer", O_RDWR, 0 );
8746
  int mixerfd = open( SND_DEVICE, O_RDWR, 0 );
8739
  if ( mixerfd == -1 ) {
8747
  if ( mixerfd == -1 ) {
8740
    errorText_ = "RtApiOss::getDeviceInfo: error opening '/dev/mixer'.";
8748
    errorText_ = "RtApiOss::getDeviceInfo: error opening ";
8749
    errorText_ += SND_DEVICE;
8750
    errorText_ += "'.";
8741
    error( RtAudioError::WARNING );
8751
    error( RtAudioError::WARNING );
8742
    return info;
8752
    return info;
8743
  }
8753
  }
Lines 8785-8803 RtAudio::DeviceInfo RtApiOss :: getDevic Link Here
8785
      info.duplexChannels = (info.outputChannels > info.inputChannels) ? info.inputChannels : info.outputChannels;
8795
      info.duplexChannels = (info.outputChannels > info.inputChannels) ? info.inputChannels : info.outputChannels;
8786
  }
8796
  }
8787
8797
8788
  // Probe data formats ... do for input
8798
  // Probe data formats ... merge input and output into one list
8789
  unsigned long mask = ainfo.iformats;
8799
  unsigned long imask = ainfo.iformats;
8790
  if ( mask & AFMT_S16_LE || mask & AFMT_S16_BE )
8800
  unsigned long omask = ainfo.oformats;
8801
  if (( imask & AFMT_S16_LE || imask & AFMT_S16_BE ) ||
8802
        ( omask & AFMT_S16_LE || omask & AFMT_S16_BE ))
8791
    info.nativeFormats |= RTAUDIO_SINT16;
8803
    info.nativeFormats |= RTAUDIO_SINT16;
8792
  if ( mask & AFMT_S8 )
8804
  if (( imask & AFMT_S8 ) || ( omask & AFMT_S8 ))
8793
    info.nativeFormats |= RTAUDIO_SINT8;
8805
    info.nativeFormats |= RTAUDIO_SINT8;
8794
  if ( mask & AFMT_S32_LE || mask & AFMT_S32_BE )
8806
  if (( imask & AFMT_S32_LE || imask & AFMT_S32_BE ) ||
8807
        ( omask & AFMT_S32_LE || omask & AFMT_S32_BE ))
8795
    info.nativeFormats |= RTAUDIO_SINT32;
8808
    info.nativeFormats |= RTAUDIO_SINT32;
8796
#ifdef AFMT_FLOAT
8809
#ifdef AFMT_FLOAT
8797
  if ( mask & AFMT_FLOAT )
8810
  if (( imask & AFMT_FLOAT ) || ( omask & AFMT_FLOAT ))
8798
    info.nativeFormats |= RTAUDIO_FLOAT32;
8811
    info.nativeFormats |= RTAUDIO_FLOAT32;
8799
#endif
8812
#endif
8800
  if ( mask & AFMT_S24_LE || mask & AFMT_S24_BE )
8813
  if (( imask & AFMT_S24_LE || imask & AFMT_S24_BE ) ||
8814
        ( omask & AFMT_S24_LE || omask & AFMT_S24_BE ))
8801
    info.nativeFormats |= RTAUDIO_SINT24;
8815
    info.nativeFormats |= RTAUDIO_SINT24;
8802
8816
8803
  // Check that we have at least one supported format
8817
  // Check that we have at least one supported format
Lines 8855-8863 bool RtApiOss :: probeDeviceOpen( unsign Link Here
8855
                                  RtAudioFormat format, unsigned int *bufferSize,
8869
                                  RtAudioFormat format, unsigned int *bufferSize,
8856
                                  RtAudio::StreamOptions *options )
8870
                                  RtAudio::StreamOptions *options )
8857
{
8871
{
8858
  int mixerfd = open( "/dev/mixer", O_RDWR, 0 );
8872
  int mixerfd = open( SND_DEVICE, O_RDWR, 0 );
8859
  if ( mixerfd == -1 ) {
8873
  if ( mixerfd == -1 ) {
8860
    errorText_ = "RtApiOss::probeDeviceOpen: error opening '/dev/mixer'.";
8874
    errorText_ = "RtApiOss::probeDeviceOpen: error opening ";
8875
    errorText_ += SND_DEVICE;
8876
    errorText_ += "'.";
8861
    return FAILURE;
8877
    return FAILURE;
8862
  }
8878
  }
8863
8879
Lines 8885-8891 bool RtApiOss :: probeDeviceOpen( unsign Link Here
8885
  }
8901
  }
8886
8902
8887
  oss_audioinfo ainfo;
8903
  oss_audioinfo ainfo;
8888
  ainfo.dev = device;
8904
#if defined(__FreeBSD__)
8905
  ainfo.dev = -1; // specify -1 to get default device
8906
#else
8907
   ainfo.dev = device;
8908
#endif
8889
  result = ioctl( mixerfd, SNDCTL_AUDIOINFO, &ainfo );
8909
  result = ioctl( mixerfd, SNDCTL_AUDIOINFO, &ainfo );
8890
  close( mixerfd );
8910
  close( mixerfd );
8891
  if ( result == -1 ) {
8911
  if ( result == -1 ) {

Return to bug 226101