Skip to content

Commit

Permalink
Switched tests to AIFF, My test format + wav_source + -O3 optomizatio…
Browse files Browse the repository at this point in the history
…n causes error
  • Loading branch information
Hrick87 committed Feb 27, 2024
1 parent 58b62e0 commit 87da0fb
Show file tree
Hide file tree
Showing 5 changed files with 69 additions and 39 deletions.
10 changes: 1 addition & 9 deletions 3rdparty/SConscript
Original file line number Diff line number Diff line change
Expand Up @@ -236,19 +236,11 @@ elif 'speexdsp' in system_dependencies:

# dep: sndfile
if 'sndfile' in autobuild_dependencies:
#sndfile_deps = []

# DELETE?
env.BuildThirdParty(thirdparty_versions, 'sndfile')

conf = Configure(env, custom_tests=env.CustomTests)

#if not 'alsa' in autobuild_dependencies:
# for lib in [
# 'asound',
# ]:
# conf.CheckLib(lib)

env = conf.Finish()

elif 'sndfile' in system_dependencies:
Expand All @@ -259,7 +251,7 @@ elif 'sndfile' in system_dependencies:

if not is_crosscompiling:
if not conf.CheckLibWithHeaderExt(
'sndfile', 'sndfile.h', 'C'): #fix
'sndfile', 'sndfile.h', 'C'):
env.Die("libsndfile >= 1.0.25 not found (see 'config.log' for details)")
else:
if not conf.CheckLibWithHeaderExt('sndfile', 'sndfile.h', 'C', run=False):
Expand Down
6 changes: 6 additions & 0 deletions debian/copyright
Original file line number Diff line number Diff line change
Expand Up @@ -68,4 +68,10 @@ Copyright:
ForeverASilver <https://github.com/ForeverASilver>
JJ <https://github.com/computerscienceiscool>
Hunter Rick <[email protected]>
Pekureda <[email protected]>
Anurag Soni <[email protected]>
Samad Khan <[email protected]>
Alyssa Ross <[email protected]>
Arseniy136 <[email protected]>
Amandeep Singh <[email protected]>
License: MPL-2.0
22 changes: 11 additions & 11 deletions src/tests/roc_sndio/test_backend_sink.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,12 @@ TEST_GROUP(backend_sink) {
* sink_config.sample_spec.num_channels());
}

bool supports_wav(IBackend & backend) {
bool supports_aiff(IBackend & backend) {
bool supports = false;
core::Array<DriverInfo, MaxDrivers> driver_list(arena);
backend.discover_drivers(driver_list);
for (size_t n = 0; n < driver_list.size(); n++) {
if (strcmp(driver_list[n].name, "wav") == 0) {
if (strcmp(driver_list[n].name, "aiff") == 0) {
supports = true;
break;
}
Expand All @@ -62,10 +62,10 @@ TEST(backend_sink, noop) {
for (size_t n_backend = 0; n_backend < BackendMap::instance().num_backends();
n_backend++) {
IBackend& backend = BackendMap::instance().nth_backend(n_backend);
if (!supports_wav(backend)) {
if (!supports_aiff(backend)) {
continue;
}
core::TempFile file("test.wav");
core::TempFile file("test.aiff");
IDevice* backend_device = backend.open_device(
DeviceType_Sink, DriverType_File, NULL, file.path(), sink_config, arena);
CHECK(backend_device != NULL);
Expand All @@ -78,7 +78,7 @@ TEST(backend_sink, error) {
for (size_t n_backend = 0; n_backend < BackendMap::instance().num_backends();
n_backend++) {
IBackend& backend = BackendMap::instance().nth_backend(n_backend);
if (!supports_wav(backend)) {
if (!supports_aiff(backend)) {
continue;
}
IDevice* backend_device = backend.open_device(
Expand All @@ -90,9 +90,9 @@ TEST(backend_sink, error) {
TEST(backend_sink, has_clock) {
for (size_t n_backend = 0; n_backend < BackendMap::instance().num_backends();
n_backend++) {
core::TempFile file("test.wav");
core::TempFile file("test.aiff");
IBackend& backend = BackendMap::instance().nth_backend(n_backend);
if (!supports_wav(backend)) {
if (!supports_aiff(backend)) {
continue;
}
IDevice* backend_device = backend.open_device(
Expand All @@ -108,9 +108,9 @@ TEST(backend_sink, sample_rate_auto) {
sink_config.sample_spec.set_sample_rate(0);
for (size_t n_backend = 0; n_backend < BackendMap::instance().num_backends();
n_backend++) {
core::TempFile file("test.wav");
core::TempFile file("test.aiff");
IBackend& backend = BackendMap::instance().nth_backend(n_backend);
if (!supports_wav(backend)) {
if (!supports_aiff(backend)) {
continue;
}
IDevice* backend_device = backend.open_device(
Expand All @@ -127,9 +127,9 @@ TEST(backend_sink, sample_rate_force) {
sink_config.sample_spec.set_sample_rate(SampleRate);
for (size_t n_backend = 0; n_backend < BackendMap::instance().num_backends();
n_backend++) {
core::TempFile file("test.wav");
core::TempFile file("test.aiff");
IBackend& backend = BackendMap::instance().nth_backend(n_backend);
if (!supports_wav(backend)) {
if (!supports_aiff(backend)) {
continue;
}
IDevice* backend_device = backend.open_device(
Expand Down
62 changes: 47 additions & 15 deletions src/tests/roc_sndio/test_backend_source.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,12 @@ const core::nanoseconds_t FrameDuration = FrameSize * core::Second
core::HeapArena arena;
core::BufferFactory<audio::sample_t> buffer_factory(arena, MaxBufSize);

bool supports_wav(IBackend& backend) {
bool supports_aiff(IBackend& backend) {
bool supports = false;
core::Array<DriverInfo, MaxDrivers> driver_list(arena);
backend.discover_drivers(driver_list);
for (size_t n = 0; n < driver_list.size(); n++) {
if (strcmp(driver_list[n].name, "wav") == 0) {
if (strcmp(driver_list[n].name, "aiff") == 0) {
supports = true;
break;
}
Expand All @@ -82,11 +82,43 @@ TEST_GROUP(backend_source) {
}
};

TEST(backend_source, noop) {
for (size_t n_backend = 0; n_backend < BackendMap::instance().num_backends();
n_backend++) {
core::TempFile file("test.aiff");
IBackend& backend = BackendMap::instance().nth_backend(n_backend);

if (!supports_aiff(backend)) {
continue;
}

{
test::MockSource mock_source;
IDevice* backend_device = backend.open_device(
DeviceType_Sink, DriverType_File, NULL, file.path(), sink_config, arena);
CHECK(backend_device != NULL);
core::ScopedPtr<ISink> backend_sink(backend_device->to_sink(), arena);
CHECK(backend_sink != NULL);

Pump pump(buffer_factory, mock_source, NULL, *backend_sink, FrameDuration,
SampleSpecs, Pump::ModeOneshot);
CHECK(pump.is_valid());
CHECK(pump.run());
}
IDevice* backend_device = backend.open_device(
DeviceType_Source, DriverType_File, NULL, file.path(), source_config, arena);
CHECK(backend_device != NULL);
core::ScopedPtr<ISource> backend_source(backend_device->to_source(), arena);
CHECK(backend_source != NULL);

}
}

TEST(backend_source, error) {
for (size_t n_backend = 0; n_backend < BackendMap::instance().num_backends();
n_backend++) {
IBackend& backend = BackendMap::instance().nth_backend(n_backend);
if (!supports_wav(backend)) {
if (!supports_aiff(backend)) {
continue;
}
IDevice* backend_device = backend.open_device(
Expand All @@ -98,10 +130,10 @@ TEST(backend_source, error) {
TEST(backend_source, has_clock) {
for (size_t n_backend = 0; n_backend < BackendMap::instance().num_backends();
n_backend++) {
core::TempFile file("test.wav");
core::TempFile file("test.aiff");
IBackend& backend = BackendMap::instance().nth_backend(n_backend);

if (!supports_wav(backend)) {
if (!supports_aiff(backend)) {
continue;
}

Expand Down Expand Up @@ -133,10 +165,10 @@ TEST(backend_source, has_clock) {
TEST(backend_source, sample_rate_auto) {
for (size_t n_backend = 0; n_backend < BackendMap::instance().num_backends();
n_backend++) {
core::TempFile file("test.wav");
core::TempFile file("test.aiff");
IBackend& backend = BackendMap::instance().nth_backend(n_backend);

if (!supports_wav(backend)) {
if (!supports_aiff(backend)) {
continue;
}

Expand Down Expand Up @@ -171,10 +203,10 @@ TEST(backend_source, sample_rate_auto) {
TEST(backend_source, sample_rate_mismatch) {
for (size_t n_backend = 0; n_backend < BackendMap::instance().num_backends();
n_backend++) {
core::TempFile file("test.wav");
core::TempFile file("test.aiff");
IBackend& backend = BackendMap::instance().nth_backend(n_backend);

if (!supports_wav(backend)) {
if (!supports_aiff(backend)) {
continue;
}

Expand Down Expand Up @@ -212,10 +244,10 @@ TEST(backend_source, sample_rate_mismatch) {
TEST(backend_source, pause_resume) {
for (size_t n_backend = 0; n_backend < BackendMap::instance().num_backends();
n_backend++) {
core::TempFile file("test.wav");
core::TempFile file("test.aiff");
IBackend& backend = BackendMap::instance().nth_backend(n_backend);

if (!supports_wav(backend)) {
if (!supports_aiff(backend)) {
continue;
}

Expand Down Expand Up @@ -280,10 +312,10 @@ TEST(backend_source, pause_resume) {
TEST(backend_source, pause_restart) {
for (size_t n_backend = 0; n_backend < BackendMap::instance().num_backends();
n_backend++) {
core::TempFile file("test.wav");
core::TempFile file("test.aiff");
IBackend& backend = BackendMap::instance().nth_backend(n_backend);

if (!supports_wav(backend)) {
if (!supports_aiff(backend)) {
continue;
}

Expand Down Expand Up @@ -349,10 +381,10 @@ TEST(backend_source, pause_restart) {
TEST(backend_source, eof_restart) {
for (size_t n_backend = 0; n_backend < BackendMap::instance().num_backends();
n_backend++) {
core::TempFile file("test.wav");
core::TempFile file("test.aiff");
IBackend& backend = BackendMap::instance().nth_backend(n_backend);

if (!supports_wav(backend)) {
if (!supports_aiff(backend)) {
continue;
}

Expand Down
8 changes: 4 additions & 4 deletions src/tests/roc_sndio/test_pump.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,12 @@ const core::nanoseconds_t BufDuration = BufSize * core::Second
core::HeapArena arena;
core::BufferFactory<audio::sample_t> buffer_factory(arena, BufSize);

bool supports_wav(IBackend& backend) {
bool supports_aiff(IBackend& backend) {
bool supports = false;
core::Array<DriverInfo, MaxDrivers> driver_list(arena);
backend.discover_drivers(driver_list);
for (size_t n = 0; n < driver_list.size(); n++) {
if (strcmp(driver_list[n].name, "wav") == 0) {
if (strcmp(driver_list[n].name, "aiff") == 0) {
supports = true;
break;
}
Expand Down Expand Up @@ -89,7 +89,7 @@ TEST(pump, write_read) {

IBackend& backend = BackendMap::instance().nth_backend(n_backend);

if (!supports_wav(backend)) {
if (!supports_aiff(backend)) {
continue;
}

Expand Down Expand Up @@ -135,7 +135,7 @@ TEST(pump, write_overwrite_read) {
core::TempFile file("test.wav");
IBackend& backend = BackendMap::instance().nth_backend(n_backend);

if (!supports_wav(backend)) {
if (!supports_aiff(backend)) {
continue;
}

Expand Down

0 comments on commit 87da0fb

Please sign in to comment.