aboutsummaryrefslogtreecommitdiffstats
path: root/oss.h
diff options
context:
space:
mode:
Diffstat (limited to 'oss.h')
-rw-r--r--oss.h68
1 files changed, 68 insertions, 0 deletions
diff --git a/oss.h b/oss.h
new file mode 100644
index 0000000..1cb128b
--- /dev/null
+++ b/oss.h
@@ -0,0 +1,68 @@
+#ifndef OSS_H
+#define OSS_H
+
+#include <qobject.h>
+#include <qsocketnotifier.h>
+
+/* ---------------------------------------------------------------------- */
+
+#define STATUS_CLOSED 0
+#define STATUS_RECORD 1
+#define STATUS_PLAYBACK 2
+
+class Soundcard : public QObject
+{
+ Q_OBJECT;
+
+private:
+ /* sound card capabilities */
+ char devname[32];
+ int init_done;
+ int afmt_hw;
+ int afmt_sw;
+ int channels_hw;
+
+ int trigger;
+ char driver_name[64];
+
+ /* current settings */
+ int afmt;
+ int channels;
+ int rate;
+ int blocksize;
+ int latency;
+
+ /* file handle, reference count */
+ int fd, stat;
+ char buffer[65536];
+ QSocketNotifier *telmi;
+
+ /* internal functions */
+ void get_capabilities();
+ int open_dev(int record);
+ void close_dev();
+
+public:
+ Soundcard(const char *dev);
+ ~Soundcard();
+ char *driver();
+ void setparams(struct SOUNDPARAMS *params);
+ int start_record();
+ int start_playback();
+ int kill_buffer();
+ int stop();
+
+ int has_channels(); /* # of channels (1=mono,2=stereo) */
+ int has_format(int f); /* check format availibity */
+
+public slots:
+ void sounddata(int);
+
+signals:
+ void senddata(void *data);
+ /* !!! only one should be connected to receivedata !!! */
+ void receivedata(void *data);
+ void newparams(struct SOUNDPARAMS *params);
+};
+
+#endif