aboutsummaryrefslogtreecommitdiff
path: root/tests/include/pcm_test_device.h
diff options
context:
space:
mode:
authorSimon Wilson <simonrules@users.noreply.github.com>2021-06-02 09:22:23 -0600
committerGitHub <noreply@github.com>2021-06-02 09:22:23 -0600
commit496e653335d27557bbd1f795b1eacd2948ab192a (patch)
tree7cf42df6c5c17b207be376eb00fe91d42bd9e352 /tests/include/pcm_test_device.h
parent36f9078ef5410279725207daa00943ee48b05253 (diff)
parentea4546b237269915e832fd74a9883a2dadf46093 (diff)
Merge pull request #208 from dvdli/tinyalsa-pcm-open-blocked
force pcm_open to open device with the non-blocking flag
Diffstat (limited to 'tests/include/pcm_test_device.h')
-rw-r--r--tests/include/pcm_test_device.h24
1 files changed, 21 insertions, 3 deletions
diff --git a/tests/include/pcm_test_device.h b/tests/include/pcm_test_device.h
index 7ced192..a0ea811 100644
--- a/tests/include/pcm_test_device.h
+++ b/tests/include/pcm_test_device.h
@@ -29,6 +29,8 @@
#ifndef TINYALSA_TESTS_PCM_TEST_H_
#define TINYALSA_TESTS_PCM_TEST_H_
+#include "tinyalsa/pcm.h"
+
namespace tinyalsa {
namespace testing {
@@ -44,9 +46,25 @@ namespace testing {
#define TEST_LOOPBACK_CAPTURE_DEVICE 1
#endif
-constexpr unsigned int kLoopbackCard = TEST_LOOPBACK_CARD;
-constexpr unsigned int kLoopbackPlaybackDevice = TEST_LOOPBACK_PLAYBACK_DEVICE;
-constexpr unsigned int kLoopbackCaptureDevice = TEST_LOOPBACK_CAPTURE_DEVICE;
+static constexpr unsigned int kLoopbackCard = TEST_LOOPBACK_CARD;
+static constexpr unsigned int kLoopbackPlaybackDevice = TEST_LOOPBACK_PLAYBACK_DEVICE;
+static constexpr unsigned int kLoopbackCaptureDevice = TEST_LOOPBACK_CAPTURE_DEVICE;
+
+static constexpr unsigned int kDefaultChannels = 2;
+static constexpr unsigned int kDefaultSamplingRate = 48000;
+static constexpr unsigned int kDefaultPeriodSize = 1024;
+static constexpr unsigned int kDefaultPeriodCount = 3;
+static constexpr pcm_config kDefaultConfig = {
+ .channels = kDefaultChannels,
+ .rate = kDefaultSamplingRate,
+ .period_size = kDefaultPeriodSize,
+ .period_count = kDefaultPeriodCount,
+ .format = PCM_FORMAT_S16_LE,
+ .start_threshold = kDefaultPeriodSize,
+ .stop_threshold = kDefaultPeriodSize * kDefaultPeriodCount,
+ .silence_threshold = 0,
+ .silence_size = 0,
+};
} // namespace testing
} // namespace tinyalsa