summaryrefslogtreecommitdiff
path: root/src/source.h
diff options
context:
space:
mode:
authorBent Bisballe Nyeng <deva@aasimon.org>2014-09-25 17:08:44 +0200
committerBent Bisballe Nyeng <deva@aasimon.org>2014-09-25 17:08:44 +0200
commit4f6b15ea26b5fa09f300f67e4ce1057c2b39a3aa (patch)
tree45d7bb4a9a90ef603b5a7a65a4d4d4309a7a1538 /src/source.h
parent0602763044f0f0f9163f2a888627213347d3dbb7 (diff)
New API, new name, new version.
Diffstat (limited to 'src/source.h')
-rw-r--r--src/source.h56
1 files changed, 56 insertions, 0 deletions
diff --git a/src/source.h b/src/source.h
new file mode 100644
index 0000000..d7e2d76
--- /dev/null
+++ b/src/source.h
@@ -0,0 +1,56 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* vim: set et sw=2 ts=2: */
+/***************************************************************************
+ * source.h
+ *
+ * Thu Sep 25 10:35:39 CEST 2014
+ * Copyright 2014 Bent Bisballe Nyeng
+ * deva@aasimon.org
+ ****************************************************************************/
+
+/*
+ * This file is part of LibAudioIO.
+ *
+ * LibAudioIO is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * LibAudioIO is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with LibAudioIO; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+#ifndef __LIBAUDIOIO_SOURCE_H__
+#define __LIBAUDIOIO_SOURCE_H__
+
+// Make API behave like ALSA 1.x.x with ALSA 0.9.x
+#define ALSA_PCM_NEW_HW_PARAMS_API
+
+#include <asoundlib.h>
+
+class Source {
+public:
+ Source(snd_pcm_t *handle, unsigned int samplerate,
+ unsigned int channels, snd_pcm_uframes_t frames);
+ ~Source();
+
+ int readSamples(char *pcm, size_t maxsize);
+
+ unsigned int samplerate();
+ unsigned int channels();
+ snd_pcm_uframes_t frames();
+
+private:
+ snd_pcm_t *handle;
+
+ unsigned int _samplerate;
+ unsigned int _channels;
+ snd_pcm_uframes_t _frames;
+};
+
+#endif/*__LIBAUDIOIO_SOURCE_H__*/