synthizer
Advanced tools
| /* Test that repeatedly seeks to the beginning. Not automated, needs to be run manually and listened to. */ | ||
| #include <algorithm> | ||
| #include <array> | ||
| #include <math.h> | ||
| #include <memory> | ||
| #include <stdio.h> | ||
| #include <stdlib.h> | ||
| #include <thread> | ||
| #include <cmath> | ||
| #include <cstddef> | ||
| #include "synthizer.h" | ||
| #include "synthizer_constants.h" | ||
| #define PI 3.1415926535 | ||
| #define CHECKED(x) \ | ||
| do { \ | ||
| auto ret = x; \ | ||
| if (ret) { \ | ||
| printf(#x ": Synthizer error code %i message %s\n", ret, syz_getLastErrorMessage()); \ | ||
| ecode = 1; \ | ||
| if (ending == 0) \ | ||
| goto end; \ | ||
| else \ | ||
| goto end2; \ | ||
| } \ | ||
| } while (0) | ||
| int main(int argc, char *argv[]) { | ||
| struct syz_LibraryConfig library_config; | ||
| syz_Handle context = 0, generator = 0, source = 0, buffer = 0; | ||
| int ecode = 0, ending = 0; | ||
| double angle = 0.0, angle_per_second = 45.0; | ||
| if (argc != 2) { | ||
| printf("Specify file\n"); | ||
| return 1; | ||
| } | ||
| syz_libraryConfigSetDefaults(&library_config); | ||
| library_config.log_level = SYZ_LOG_LEVEL_DEBUG; | ||
| library_config.logging_backend = SYZ_LOGGING_BACKEND_STDERR; | ||
| CHECKED(syz_initializeWithConfig(&library_config)); | ||
| CHECKED(syz_createContext(&context, NULL, NULL)); | ||
| CHECKED(syz_createDirectSource(&source, context, NULL, NULL, NULL)); | ||
| CHECKED(syz_createBufferFromStreamParams(&buffer, "file", argv[1], NULL, NULL, NULL)); | ||
| CHECKED(syz_createBufferGenerator(&generator, context, NULL, NULL, NULL)); | ||
| CHECKED(syz_setO(generator, SYZ_P_BUFFER, buffer)); | ||
| CHECKED(syz_sourceAddGenerator(source, generator)); | ||
| while (true) { | ||
| CHECKED(syz_setD(generator, SYZ_P_PLAYBACK_POSITION, 0.0)); | ||
| std::this_thread::sleep_for(std::chrono::milliseconds(2000)); | ||
| } | ||
| end: | ||
| ending = 1; | ||
| CHECKED(syz_handleDecRef(source)); | ||
| CHECKED(syz_handleDecRef(generator)); | ||
| CHECKED(syz_handleDecRef(context)); | ||
| end2: | ||
| CHECKED(syz_shutdown()); | ||
| return ecode; | ||
| } |
+1
-1
| Metadata-Version: 1.0 | ||
| Name: synthizer | ||
| Version: 0.11.4 | ||
| Version: 0.11.5 | ||
| Summary: UNKNOWN | ||
@@ -5,0 +5,0 @@ Home-page: https://synthizer.github.io |
+1
-1
@@ -11,3 +11,3 @@ import os | ||
| VERSION = "0.11.4" | ||
| VERSION = "0.11.5" | ||
@@ -14,0 +14,0 @@ # A helper for rmtree. On Windows, read-only files can't be deleted by rmtree, so we make them not readonly. |
@@ -9,3 +9,3 @@ cmake_minimum_required(VERSION 3.15.0) | ||
| # Synthizer version. | ||
| add_compile_definitions(SYZ_MAJOR=0 SYZ_MINOR=11 SYZ_PATCH=1) | ||
| add_compile_definitions(SYZ_MAJOR=0 SYZ_MINOR=11 SYZ_PATCH=2) | ||
@@ -254,2 +254,6 @@ include(CTest) | ||
| add_executable(test_seeking test/seeking.cpp) | ||
| target_link_libraries(test_seeking synthizer) | ||
| add_test(NAME delay_line COMMAND delay_line_test) | ||
@@ -256,0 +260,0 @@ add_test(NAME latch COMMAND test_latch) |
@@ -91,5 +91,17 @@ #pragma once | ||
| /** | ||
| * Return whether the timeline is finished. Finished is defined as "won't change value anymore" and can go to false if | ||
| * the user appends more points. | ||
| * | ||
| * This value is updated when the timeline ticks, not when points are added. It exists to solve the feedback loop | ||
| * between user-set properties and synthizer-set properties, where the user-supplied value "locks" the synthizer-side | ||
| * value in an infinite feedback loop. For example, this can happen with SYZ_P_PLAYBACK_POSITION, which will "hold" | ||
| * at whatever the user last set it to, and cause the node to seek forever. | ||
| * */ | ||
| bool isFinished() { return this->finished; } | ||
| private: | ||
| GenericTimeline<PropertyAutomationPoint<N>, 1> inner; | ||
| std::optional<std::array<double, N>> current_value = std::nullopt; | ||
| bool finished; | ||
| }; | ||
@@ -127,2 +139,4 @@ | ||
| template <std::size_t N> inline void PropertyAutomationTimeline<N>::tick(double time) { | ||
| this->finished = false; | ||
| this->inner.tick(time); | ||
@@ -133,2 +147,3 @@ | ||
| // Timeline is empty. | ||
| this->finished = true; | ||
| this->current_value = std::nullopt; | ||
@@ -143,2 +158,3 @@ return; | ||
| if (cur->automation_time <= time) { | ||
| this->finished = true; | ||
| this->current_value = cur->values; | ||
@@ -151,2 +167,3 @@ return; | ||
| if (!maybe_last) { | ||
| this->finished = true; | ||
| this->current_value = std::nullopt; | ||
@@ -153,0 +170,0 @@ return; |
@@ -123,7 +123,3 @@ /* | ||
| \ | ||
| void mark##CAMEL_NAME##Unchanged() { STANDARD_UNCHANGED(UNDERSCORE_NAME); } \ | ||
| \ | ||
| std::optional<double> get##CAMEL_NAME##NextBlockValue() { \ | ||
| return this->PROPFIELD_NAME.UNDERSCORE_NAME.getValueForNextBlock(); \ | ||
| } | ||
| void mark##CAMEL_NAME##Unchanged() { STANDARD_UNCHANGED(UNDERSCORE_NAME); } | ||
@@ -130,0 +126,0 @@ #define DOUBLE3_P(E, UNDERSCORE_NAME, CAMEL_NAME, ...) \ |
@@ -120,7 +120,2 @@ #pragma once | ||
| // Relies on the time which is passed to be one block, and to always advance by one block (e.g. time must be an | ||
| // integer number of samples and a multiple of config::BLOCK_SIZE). | ||
| // | ||
| // This isn't ideal, but automation is complicated and we need to be able to give callers the value of the property at | ||
| // the next block, so they can fade properly. | ||
| void tickAutomation(double time) { | ||
@@ -133,16 +128,9 @@ this->timeline.tick(time); | ||
| this->timeline.tick(time + config::BLOCK_SIZE); | ||
| this->next_block_value = std::nullopt; | ||
| auto maybe_v = this->timeline.getValue(); | ||
| if (maybe_v) { | ||
| this->next_block_value = (*maybe_v)[0]; | ||
| if (this->timeline.isFinished()) { | ||
| this->timeline.clear(); | ||
| } | ||
| } | ||
| // nullopt if the next block doesn't have a value yet because automation is finished. | ||
| std::optional<double> getValueForNextBlock() { return this->next_block_value; } | ||
| private: | ||
| PropertyAutomationTimeline<1> timeline; | ||
| std::optional<double> next_block_value; | ||
| }; | ||
@@ -201,2 +189,6 @@ | ||
| } | ||
| if (this->timeline.isFinished()) { | ||
| this->timeline.clear(); | ||
| } | ||
| } | ||
@@ -230,2 +222,6 @@ | ||
| } | ||
| if (this->timeline.isFinished()) { | ||
| this->timeline.clear(); | ||
| } | ||
| } | ||
@@ -232,0 +228,0 @@ |
| Metadata-Version: 1.0 | ||
| Name: synthizer | ||
| Version: 0.11.4 | ||
| Version: 0.11.5 | ||
| Summary: UNKNOWN | ||
@@ -5,0 +5,0 @@ Home-page: https://synthizer.github.io |
@@ -175,2 +175,3 @@ MANIFEST.in | ||
| synthizer-vendored/test/random_float.cpp | ||
| synthizer-vendored/test/seeking.cpp | ||
| synthizer-vendored/test/verify_properties.cpp | ||
@@ -177,0 +178,0 @@ synthizer-vendored/third_party/concurrentqueue/blockingconcurrentqueue.h |
Alert delta unavailable
Currently unable to show alert delta for PyPI packages.
22197676
0.01%728
0.14%