Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use piet for drawing #6

Closed
wants to merge 35 commits into from
Closed

Use piet for drawing #6

wants to merge 35 commits into from

Conversation

raphlinus
Copy link
Contributor

This PR also includes an update to Rust 2018 and a cargo fmt.

Note: there are some warnings and rough edges, these are captured in linebender/druid#14

Use portable sound and midi libraries for platforms other than Mac.
(They would work for Mac as well, but I'm keeping that port around
because it might be useful for Audio Units later).

Also some tweaking of Send traits; it should be possible to send the
entire graph, which is necessary to run it in the cpal playback
callback.
Switch from raw pointers to NonNull, which enables optimization and
is more semantic. Add documentation.

Add Sync and Clone on sender, recognizing that it is indeed safe
in the multi-producer side. Also require Send bound on T, as it would
otherwise clearly be unsafe to send across threads.
Adds code for producing spectrograms. Right now, it's not wired up
to sound production, it's for making standalone images (as png).
The sigmoid example in the spectrogram writes wav files, so the sound
can be appreciated with the visual representation.

Also take filename on commandline rather than hardwiring it.
Add benchmarks for various implementations (some approximate) of
sigmoid functions.
Add an approximate implemention of erf to the sigmoid sample code, as
it's used in the associated blog post.
Attribute copyright to The Synthesizer IO authors. This is consistent
with Google's open source guidelines, but also reflects the new status
as a personal project. The requirement for a Contributor License
Agreement is also removed.

A slight bit more text added to README, but there's lots more that will
need to be written as the project is filled out.
This commit adapts the command line app to a graphical Windows
application, using a snapshot of xi-win-ui. The behavior is the same,
it just adds a non-functional button, so the actual UI will be the
subject of follow-on commits.
Add a widget representing a piano keyboard, capable of sending one note
at a time from mouse events. It also wires up the generated events to
the synth engine.
Track current development location of xi-win dependency, update all
deps. Also change Button to Label because it was confusing.
This commit starts the patch manipulation UI. I'm starting with just
drawing the wires.

A number of things are rough because of dependencies: it's not clipped
to widget bounds, so it draws outside, and also the layout is bad
because all widgets in the column are flex. Those'll be fixed
separately.
Now that direct2 0.1.4 supports clips, clip the drawing of the patcher
to widget bounds. Thanks Conni!
Add basic UI for placing modules on the grid. With this patch, the Rust
UI is on par with the experimental Web one.

Also some refactoring, for example the patch grid model is in its own
module now.
Have the patcher widget generate delta events, which in turn will be
used to drive the audio engine, as opposed to only locally mutating
the model.

Right now there's a listener for the deltas, but all it does is debug
print.

Also snap to latest version of xi-win to get minor improvements.
Refactor the graph driving into a more systematic module, with the
logic in core rather than the top-level application.

This patch doesn't change behavior much, preserving the intial
monosynth. It does a better job of sharing the engine state between
the UI and MIDI thread though.
Switch to an allocation discipline for graph nodes in the engine,
rather than hardcoding node ids.

Also starts the idea of an output bus which can mix multiple sources.
Plumb module instantiation from the UI to the engine.

Functionality is still very basic, adding a module just instantiates a
sine generator connected to the output bus, and wiring is just ignored.
But it's a start.
Still work in progress, but we have the basic Gaussian renderer. It's
at least optimized to bounding box, but obviously more optimization
is possible, not least of which is SIMD optimization.
Really adds to realism! Not optimized yet, but should be quite
SIMD-able.
Minor ui polish, now that flex has been added to xi-win-ui.

Also updates dependencies, to get latest xi-win-ui API's.
DO NOT COMMIT AS IS, Cargo.lock points to local tree

Add a scope display to the UI. Right now it just displays a sine wave
(it's not hooked up to the synthesizer engine), and doesn't update in an
animation; also the size of the computed bitmap is hard-coded, rather
than adapting to the layout size, but it's a start.

Also updates dependencies because we need direct2d 0.2 for the bitmap
drawing.
This patch doesn't wire up the audio, but does some refactoring to
get data flowing from the engine to the UI. At the moment, this is
just the count of received items.

Now that we are regularly polling, items don't leak.

The SynthState struct moves from being a listener to being a widget,
so that other listeners can synchronously access its state. Also, the
construction of the UI is factored out, so not as much is in main().
Add a Monitor node and support in engine. At this point, audio data is
wired all the way to the UI, but not to drawing in the Scope widget.
Scope display now works. Lots of things to be done (trigger, make
parameters tunable rather than hardwired), but it looks pretty good.
Added a trigger mode, and tweaked various parameters. It's fun!
Choose different types of modules in the patcher, display their names.

This is a bit of a checkpoint, next steps are to instantiate modules
based on their spec, and make wiring significant.
The xi-win-ui toolkit is now druid.
Add UI for placing jumpers on the grid. Nothing for deleting yet.
No real logic, just UI.

Also a bit more diversity in the appearance of modules.
Keep track of wiring and connect outputs of modules to output. So far
we're not wiring up inputs to modules.

Some reorganization, synth state is in a new file.
A bunch of cosmetic and functionality improvements. Both sin and saw
can now be patched. UI layout is better. The monosynth and module bay
get mixed. Timebase of scope is extended.
Also apply rustfmt. No semantic changes are expected.
Redo the drawing to use piet instead of Direct2D.
@raphlinus raphlinus closed this Jan 30, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant