kwave
18.07.70
|
#include <Record-OSS.h>
Public Member Functions | |
RecordOSS () | |
virtual | ~RecordOSS () Q_DECL_OVERRIDE |
virtual QString | open (const QString &dev) Q_DECL_OVERRIDE |
virtual int | read (QByteArray &buffer, unsigned int offset) Q_DECL_OVERRIDE |
virtual int | close () Q_DECL_OVERRIDE |
virtual QStringList | supportedDevices () Q_DECL_OVERRIDE |
virtual QString | fileFilter () Q_DECL_OVERRIDE |
virtual int | detectTracks (unsigned int &min, unsigned int &max) Q_DECL_OVERRIDE |
virtual int | setTracks (unsigned int &tracks) Q_DECL_OVERRIDE |
virtual int | tracks () Q_DECL_OVERRIDE |
virtual QList< double > | detectSampleRates () Q_DECL_OVERRIDE |
virtual int | setSampleRate (double &new_rate) Q_DECL_OVERRIDE |
virtual double | sampleRate () Q_DECL_OVERRIDE |
virtual QList< Kwave::Compression::Type > | detectCompressions () Q_DECL_OVERRIDE |
virtual int | setCompression (Kwave::Compression::Type new_compression) Q_DECL_OVERRIDE |
virtual Kwave::Compression::Type | compression () Q_DECL_OVERRIDE |
virtual QList< unsigned int > | supportedBits () Q_DECL_OVERRIDE |
virtual int | setBitsPerSample (unsigned int new_bits) Q_DECL_OVERRIDE |
virtual int | bitsPerSample () Q_DECL_OVERRIDE |
virtual QList< Kwave::SampleFormat::Format > | detectSampleFormats () Q_DECL_OVERRIDE |
virtual int | setSampleFormat (Kwave::SampleFormat::Format new_format) Q_DECL_OVERRIDE |
virtual Kwave::SampleFormat::Format | sampleFormat () Q_DECL_OVERRIDE |
virtual Kwave::byte_order_t | endianness () Q_DECL_OVERRIDE |
![]() | |
RecordDevice () | |
virtual | ~RecordDevice () |
Private Member Functions | |
void | format2mode (int format, Kwave::Compression::Type &compression, int &bits, Kwave::SampleFormat::Format &sample_format) |
int | mode2format (Kwave::Compression::Type compression, int bits, Kwave::SampleFormat::Format sample_format) |
Private Attributes | |
int | m_fd |
int | m_rate |
int | m_tracks |
int | m_oss_version |
Definition at line 31 of file Record-OSS.h.
Kwave::RecordOSS::RecordOSS | ( | ) |
|
virtual |
Destructor
Definition at line 84 of file Record-OSS.cpp.
References close().
|
virtual |
Returns the current resolution in bits per sample or a negative error code if failed
Implements Kwave::RecordDevice.
Definition at line 757 of file Record-OSS.cpp.
References format2mode(), m_fd, and SNDCTL_DSP_SETFMT.
Referenced by detectSampleFormats().
|
virtual |
Close the device
Implements Kwave::RecordDevice.
Definition at line 220 of file Record-OSS.cpp.
References m_fd, and m_oss_version.
Referenced by open(), and ~RecordOSS().
|
virtual |
Returns the current compression type (0==none)
Implements Kwave::RecordDevice.
Definition at line 678 of file Record-OSS.cpp.
References format2mode(), m_fd, Kwave::Compression::NONE, and SNDCTL_DSP_SETFMT.
Referenced by detectSampleFormats(), setBitsPerSample(), setCompression(), setSampleFormat(), and supportedBits().
|
virtual |
Gets a list of supported compression types. If no compression is supported, the list might be empty.
Implements Kwave::RecordDevice.
Definition at line 631 of file Record-OSS.cpp.
References AFMT_S24_BE, AFMT_S24_LE, AFMT_S32_BE, AFMT_S32_LE, Kwave::Compression::G711_ALAW, Kwave::Compression::G711_ULAW, m_fd, Kwave::Compression::MPEG_LAYER_II, Kwave::Compression::MS_ADPCM, and Kwave::Compression::NONE.
|
virtual |
Gets a list of supported sample formats.
Implements Kwave::RecordDevice.
Definition at line 772 of file Record-OSS.cpp.
References bitsPerSample(), compression(), format2mode(), and m_fd.
|
virtual |
get a list of supported sample rates
Implements Kwave::RecordDevice.
Definition at line 387 of file Record-OSS.cpp.
References m_fd, m_rate, and SNDCTL_DSP_SPEED.
|
virtual |
Detect the minimum and maximum number of tracks. If the detection fails, minimum and maximum are set to zero.
min | receives the lowest supported number of tracks |
max | receives the highest supported number of tracks |
Implements Kwave::RecordDevice.
Definition at line 319 of file Record-OSS.cpp.
References m_fd, m_tracks, MAX_CHANNELS, SNDCTL_DSP_CHANNELS, and Kwave::toInt().
|
virtual |
Returns the current endianness (big/little/cpu)
Implements Kwave::RecordDevice.
Definition at line 848 of file Record-OSS.cpp.
References AFMT_S24_BE, AFMT_S24_LE, AFMT_S32_BE, AFMT_S32_LE, Kwave::BigEndian, Kwave::CpuEndian, Kwave::LittleEndian, m_fd, SNDCTL_DSP_SETFMT, and Kwave::UnknownEndian.
|
virtual |
return a string suitable for a "File Open..." dialog
Reimplemented from Kwave::RecordDevice.
Definition at line 301 of file Record-OSS.cpp.
References _.
|
private |
split a device format bitmask into it's parameters.
format | the device specific format |
compression | receives a compression type |
bits | receives the number of bits per sample, related to the decoded stream |
sample_format | receives the sample format, as defined in libaudiofile (signed or unsigned) |
Definition at line 483 of file Record-OSS.cpp.
References AFMT_S24_BE, AFMT_S24_LE, AFMT_S32_BE, AFMT_S32_LE, Kwave::Compression::G711_ALAW, Kwave::Compression::G711_ULAW, Kwave::Compression::MPEG_LAYER_II, Kwave::Compression::MS_ADPCM, Kwave::Compression::NONE, Kwave::SampleFormat::Signed, Kwave::SampleFormat::Unknown, and Kwave::SampleFormat::Unsigned.
Referenced by bitsPerSample(), compression(), detectSampleFormats(), sampleFormat(), setBitsPerSample(), setCompression(), setSampleFormat(), and supportedBits().
|
private |
create a device format bitmask from it's parameters.
compression | the compression type |
bits | the number of bits per sample, related to the decoded stream |
sample_format | the sample format, as defined in libaudiofile (signed or unsigned) |
Definition at line 560 of file Record-OSS.cpp.
References AFMT_S24_BE, AFMT_S24_LE, AFMT_S32_BE, AFMT_S32_LE, Kwave::Compression::G711_ALAW, Kwave::Compression::G711_ULAW, m_fd, Kwave::Compression::MPEG_LAYER_II, Kwave::Compression::MS_ADPCM, Kwave::SampleFormat::Signed, and Kwave::SampleFormat::Unsigned.
Referenced by setBitsPerSample(), setCompression(), and setSampleFormat().
|
virtual |
Open the record device.
dev | path of the record device |
Implements Kwave::RecordDevice.
Definition at line 90 of file Record-OSS.cpp.
References close(), m_fd, and m_oss_version.
|
virtual |
Read the raw audio data from the record device.
buffer | array of bytes to receive the audio data might be resized for alignment |
offset | offset in bytes within the buffer |
Implements Kwave::RecordDevice.
Definition at line 130 of file Record-OSS.cpp.
References m_fd, sampleRate(), and Kwave::toInt().
|
virtual |
Returns the current sample format (signed/unsigned)
Implements Kwave::RecordDevice.
Definition at line 833 of file Record-OSS.cpp.
References format2mode(), m_fd, SNDCTL_DSP_SETFMT, and Kwave::SampleFormat::Unknown.
|
virtual |
Returns the current sample rate of the device
Implements Kwave::RecordDevice.
Definition at line 475 of file Record-OSS.cpp.
Referenced by read().
|
virtual |
Set the resolution in bits per sample
new_bits | resolution [bits/sample] |
Implements Kwave::RecordDevice.
Definition at line 731 of file Record-OSS.cpp.
References compression(), format2mode(), m_fd, mode2format(), and SNDCTL_DSP_SETFMT.
|
virtual |
Try to set a new compression type.
new_compression | the identifier of the new compression |
Implements Kwave::RecordDevice.
Definition at line 654 of file Record-OSS.cpp.
References compression(), format2mode(), m_fd, mode2format(), and SNDCTL_DSP_SETFMT.
|
virtual |
Try to set a new sample format (signed/unsigned)
new_format | the identifier for the new format |
Implements Kwave::RecordDevice.
Definition at line 807 of file Record-OSS.cpp.
References compression(), format2mode(), m_fd, mode2format(), and SNDCTL_DSP_SETFMT.
|
virtual |
Try to set a new sample rate.
new_rate | the sample rate to be set [samples/second], can be modified and rounded up/down to the nearest supported sample rate if the underlying driver supports that. |
Implements Kwave::RecordDevice.
Definition at line 457 of file Record-OSS.cpp.
References m_fd, m_rate, SNDCTL_DSP_SPEED, and Kwave::toInt().
|
virtual |
Try to set a new number of tracks.
tracks | the number of tracks to be set, can be modified and decreased to the next supported number of tracks if the underlying driver supports that. |
Implements Kwave::RecordDevice.
Definition at line 364 of file Record-OSS.cpp.
References m_fd, m_tracks, SNDCTL_DSP_CHANNELS, and tracks().
|
virtual |
Detect a list of supported bits per sample.
Implements Kwave::RecordDevice.
Definition at line 693 of file Record-OSS.cpp.
References compression(), format2mode(), m_fd, and Kwave::Compression::NONE.
|
virtual |
return a string list with supported device names
Implements Kwave::RecordDevice.
Definition at line 285 of file Record-OSS.cpp.
References _, scanDirectory(), and scanFiles().
|
virtual |
Returns the current number of tracks
Implements Kwave::RecordDevice.
Definition at line 381 of file Record-OSS.cpp.
References m_tracks.
Referenced by setTracks().
|
private |
file descriptor of the device or -1 if not open
Definition at line 198 of file Record-OSS.h.
Referenced by bitsPerSample(), close(), compression(), detectCompressions(), detectSampleFormats(), detectSampleRates(), detectTracks(), endianness(), mode2format(), open(), read(), sampleFormat(), sampleRate(), setBitsPerSample(), setCompression(), setSampleFormat(), setSampleRate(), setTracks(), and supportedBits().
|
private |
|
private |
sample rate
Definition at line 201 of file Record-OSS.h.
Referenced by detectSampleRates(), sampleRate(), and setSampleRate().
|
private |
number of tracks
Definition at line 204 of file Record-OSS.h.
Referenced by detectTracks(), setTracks(), and tracks().