kwave  18.07.70
Record-OSS.cpp File Reference
#include "config.h"
#include <errno.h>
#include <fcntl.h>
#include <math.h>
#include <sys/ioctl.h>
#include <sys/soundcard.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>
#include <QDir>
#include <QFile>
#include <QLatin1Char>
#include <QtGlobal>
#include "libkwave/Compression.h"
#include "libkwave/SampleFormat.h"
#include "libkwave/String.h"
#include "libkwave/Utils.h"
#include "Record-OSS.h"
Include dependency graph for Record-OSS.cpp:

Go to the source code of this file.

Macros

#define AFMT_S24_LE   0x00008000
 
#define AFMT_S24_BE   0x00010000
 
#define AFMT_S32_LE   0x00001000
 
#define AFMT_S32_BE   0x00002000
 
#define SNDCTL_DSP_SPEED   SOUND_PCM_WRITE_RATE
 
#define SNDCTL_DSP_CHANNELS   SOUND_PCM_WRITE_CHANNELS
 
#define SOUND_PCM_SETFMT   SOUND_PCM_WRITE_BITS
 
#define SNDCTL_DSP_SETFMT   SOUND_PCM_SETFMT
 
#define MAX_CHANNELS   2
 

Functions

static bool addIfExists (QStringList &list, const QString &name)
 
static void scanFiles (QStringList &list, const QString &dirname, const QString &mask)
 
static void scanDirectory (QStringList &list, const QString &dir)
 

Macro Definition Documentation

◆ AFMT_S24_BE

◆ AFMT_S24_LE

◆ AFMT_S32_BE

◆ AFMT_S32_LE

◆ MAX_CHANNELS

#define MAX_CHANNELS   2

highest available number of channels

Definition at line 74 of file Record-OSS.cpp.

Referenced by Kwave::RecordOSS::detectTracks().

◆ SNDCTL_DSP_CHANNELS

#define SNDCTL_DSP_CHANNELS   SOUND_PCM_WRITE_CHANNELS

Definition at line 62 of file Record-OSS.cpp.

Referenced by Kwave::RecordOSS::detectTracks(), and Kwave::RecordOSS::setTracks().

◆ SNDCTL_DSP_SETFMT

◆ SNDCTL_DSP_SPEED

#define SNDCTL_DSP_SPEED   SOUND_PCM_WRITE_RATE

◆ SOUND_PCM_SETFMT

#define SOUND_PCM_SETFMT   SOUND_PCM_WRITE_BITS

Definition at line 66 of file Record-OSS.cpp.

Function Documentation

◆ addIfExists()

static bool addIfExists ( QStringList &  list,
const QString &  name 
)
static

Definition at line 231 of file Record-OSS.cpp.

References _.

Referenced by scanFiles().

232 {
233  QFile file;
234 
235  if (name.contains(_("%1"))) {
236  // test for the name without suffix first
237  addIfExists(list, name.arg(_("")));
238 
239  // loop over the list and try until a suffix does not exist
240  for (unsigned int index=0; index < 64; index++)
241  addIfExists(list, name.arg(index));
242  } else {
243  // check a single name
244  file.setFileName(name);
245  if (!file.exists())
246  return false;
247 
248  if (!list.contains(name))
249  list.append(name);
250  }
251 
252  return true;
253 }
const char name[16]
Definition: memcpy.c:510
static bool addIfExists(QStringList &list, const QString &name)
Definition: Record-OSS.cpp:231
#define _(m)
Definition: memcpy.c:66
Here is the caller graph for this function:

◆ scanDirectory()

static void scanDirectory ( QStringList &  list,
const QString &  dir 
)
static

Definition at line 275 of file Record-OSS.cpp.

References _, and scanFiles().

Referenced by Kwave::RecordOSS::supportedDevices().

276 {
277  scanFiles(list, dir, _("*audio*"));
278  scanFiles(list, dir, _("adsp*"));
279  scanFiles(list, dir, _("dsp*"));
280  scanFiles(list, dir, _("dio*"));
281  scanFiles(list, dir, _("pcm*"));
282 }
static void scanFiles(QStringList &list, const QString &dirname, const QString &mask)
Definition: Record-OSS.cpp:256
#define _(m)
Definition: memcpy.c:66
Here is the call graph for this function:
Here is the caller graph for this function:

◆ scanFiles()

static void scanFiles ( QStringList &  list,
const QString &  dirname,
const QString &  mask 
)
static

Definition at line 256 of file Record-OSS.cpp.

References addIfExists().

Referenced by scanDirectory(), and Kwave::RecordOSS::supportedDevices().

258 {
259  QStringList files;
260  QDir dir;
261 
262  dir.setPath(dirname);
263  dir.setNameFilters(mask.split(QLatin1Char(' ')));
264  dir.setFilter(QDir::Files | QDir::Readable | QDir::System);
265  dir.setSorting(QDir::Name);
266  files = dir.entryList();
267 
268  for (QStringList::Iterator it = files.begin(); it != files.end(); ++it) {
269  QString devicename = dirname + QDir::separator() + (*it);
270  addIfExists(list, devicename);
271  }
272 }
static bool addIfExists(QStringList &list, const QString &name)
Definition: Record-OSS.cpp:231
Here is the call graph for this function:
Here is the caller graph for this function: