Skip to content

Commit

Permalink
Update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
daniellga committed Jun 21, 2024
1 parent c648f79 commit ab1e756
Show file tree
Hide file tree
Showing 35 changed files with 405 additions and 397 deletions.
28 changes: 14 additions & 14 deletions _docs/contents/harray.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ An array representation. \

## new_from_values

`new_from_values(arr: array, dtype: HDataType) -> HArray` <span style="float: right;"> [source](https://github.com/daniellga/harmonium/tree/master/r-harmonium/src/rust/src/harray.rs#L53) </span> \
`new_from_values(arr: array, dtype: HDataType) -> HArray` \<span style="float: right;"> [source](https://github.com/daniellga/harmonium/tree/master/r-harmonium/src/rust/src/harray.rs#L53) </span> \

Creates a new `HArray` from an R array. \

Expand Down Expand Up @@ -37,7 +37,7 @@ _________

## len

`len() -> integer` <span style="float: right;"> [source](https://github.com/daniellga/harmonium/tree/master/r-harmonium/src/rust/src/harray.rs#L121) </span> \
`len() -> integer` \<span style="float: right;"> [source](https://github.com/daniellga/harmonium/tree/master/r-harmonium/src/rust/src/harray.rs#L121) </span> \

Returns the number of elements of this `Harray`. \

Expand All @@ -59,7 +59,7 @@ _________

## shape

`shape() -> integers` <span style="float: right;"> [source](https://github.com/daniellga/harmonium/tree/master/r-harmonium/src/rust/src/harray.rs#L149) </span> \
`shape() -> integers` \<span style="float: right;"> [source](https://github.com/daniellga/harmonium/tree/master/r-harmonium/src/rust/src/harray.rs#L149) </span> \

Returns the shape of this `HArray`. \

Expand All @@ -81,7 +81,7 @@ _________

## ndim

`ndim() -> integer` <span style="float: right;"> [source](https://github.com/daniellga/harmonium/tree/master/r-harmonium/src/rust/src/harray.rs#L183) </span> \
`ndim() -> integer` \<span style="float: right;"> [source](https://github.com/daniellga/harmonium/tree/master/r-harmonium/src/rust/src/harray.rs#L183) </span> \

Returns the number of dimensions of this `HArray`. \

Expand All @@ -103,7 +103,7 @@ _________

## slice

`slice(range: list[atomicvector]) -> HArray` <span style="float: right;"> [source](https://github.com/daniellga/harmonium/tree/master/r-harmonium/src/rust/src/harray.rs#L221) </span> \
`slice(range: list[atomicvector]) -> HArray` \<span style="float: right;"> [source](https://github.com/daniellga/harmonium/tree/master/r-harmonium/src/rust/src/harray.rs#L221) </span> \

Slices the HArray. \
This operation has a COW ([clone-on-write](https://doc.rust-lang.org/std/borrow/enum.Cow.html)) behaviour. The created slice shares the inner data with
Expand Down Expand Up @@ -135,7 +135,7 @@ _________

## print

`print()` <span style="float: right;"> [source](https://github.com/daniellga/harmonium/tree/master/r-harmonium/src/rust/src/harray.rs#L279) </span> \
`print()` \<span style="float: right;"> [source](https://github.com/daniellga/harmonium/tree/master/r-harmonium/src/rust/src/harray.rs#L279) </span> \

Prints the `HArray`. \
Differently from R's normal behaviour, `print` doesn't return the value invisibly. \
Expand All @@ -157,7 +157,7 @@ _________

## eq

`eq(other: HArray) -> bool` <span style="float: right;"> [source](https://github.com/daniellga/harmonium/tree/master/r-harmonium/src/rust/src/harray.rs#L322) </span> \
`eq(other: HArray) -> bool` \<span style="float: right;"> [source](https://github.com/daniellga/harmonium/tree/master/r-harmonium/src/rust/src/harray.rs#L322) </span> \

Equality with another `HArray`. \
The comparison only checks if the dtype and the values are the same. To compare if the
Expand Down Expand Up @@ -194,7 +194,7 @@ _________

## ne

`ne(other: HArray) -> bool` <span style="float: right;"> [source](https://github.com/daniellga/harmonium/tree/master/r-harmonium/src/rust/src/harray.rs#L366) </span> \
`ne(other: HArray) -> bool` \<span style="float: right;"> [source](https://github.com/daniellga/harmonium/tree/master/r-harmonium/src/rust/src/harray.rs#L366) </span> \

Difference with another `HArray`. \
The comparison only checks if the dtype and the values are the same. To compare if the
Expand Down Expand Up @@ -231,7 +231,7 @@ _________

## clone

`clone() -> HArray` <span style="float: right;"> [source](https://github.com/daniellga/harmonium/tree/master/r-harmonium/src/rust/src/harray.rs#L396) </span> \
`clone() -> HArray` \<span style="float: right;"> [source](https://github.com/daniellga/harmonium/tree/master/r-harmonium/src/rust/src/harray.rs#L396) </span> \

Creates a new `HArray`, with the underlying data pointing to the same place in memory.

Expand All @@ -254,7 +254,7 @@ _________

## collect

`collect() -> array` <span style="float: right;"> [source](https://github.com/daniellga/harmonium/tree/master/r-harmonium/src/rust/src/harray.rs#L423) </span> \
`collect() -> array` \<span style="float: right;"> [source](https://github.com/daniellga/harmonium/tree/master/r-harmonium/src/rust/src/harray.rs#L423) </span> \

Creates an R array from an `HArray`. The type of the array created (`double` or `complex`) will depend on the `HArray`'s dtype.

Expand All @@ -276,7 +276,7 @@ _________

## dtype

`dtype() -> HDataType` <span style="float: right;"> [source](https://github.com/daniellga/harmonium/tree/master/r-harmonium/src/rust/src/harray.rs#L450) </span> \
`dtype() -> HDataType` \<span style="float: right;"> [source](https://github.com/daniellga/harmonium/tree/master/r-harmonium/src/rust/src/harray.rs#L450) </span> \

Gets the `HArray`'s dtype as an `HDataType`.

Expand All @@ -298,7 +298,7 @@ _________

## is_shared

`is_shared() -> bool` <span style="float: right;"> [source](https://github.com/daniellga/harmonium/tree/master/r-harmonium/src/rust/src/harray.rs#L482) </span> \
`is_shared() -> bool` \<span style="float: right;"> [source](https://github.com/daniellga/harmonium/tree/master/r-harmonium/src/rust/src/harray.rs#L482) </span> \

Checks if the object is shared. \
Since `HArray` has a COW ([clone-on-write](https://doc.rust-lang.org/std/borrow/enum.Cow.html)) behaviour, this function is useful to check if a new
Expand All @@ -325,7 +325,7 @@ _________

## mem_adress

`mem_adress() -> string` <span style="float: right;"> [source](https://github.com/daniellga/harmonium/tree/master/r-harmonium/src/rust/src/harray.rs#L512) </span> \
`mem_adress() -> string` \<span style="float: right;"> [source](https://github.com/daniellga/harmonium/tree/master/r-harmonium/src/rust/src/harray.rs#L512) </span> \

The memory adress of the first element of the inner array. \
This is useful to check if different objects share the same underlying data. \
Expand All @@ -348,7 +348,7 @@ _________

## invalidate

`invalidate()` <span style="float: right;"> [source](https://github.com/daniellga/harmonium/tree/master/r-harmonium/src/rust/src/harray.rs#L537) </span> \
`invalidate()` \<span style="float: right;"> [source](https://github.com/daniellga/harmonium/tree/master/r-harmonium/src/rust/src/harray.rs#L537) </span> \

Replaces the inner value of the external pointer, invalidating it. \
This function is useful to remove one of the shared references of the inner pointer in rust. \
Expand Down
8 changes: 4 additions & 4 deletions _docs/contents/haudioop.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ A collection of methods that can be applied to float 1D or 2D `HArray`s which re

## nchannels

`nchannels() -> integer` <span style="float: right;"> [source](https://github.com/daniellga/harmonium/tree/master/r-harmonium/src/rust/src/haudioop.rs#L41) </span> \
`nchannels() -> integer` \<span style="float: right;"> [source](https://github.com/daniellga/harmonium/tree/master/r-harmonium/src/rust/src/haudioop.rs#L41) </span> \

Returns the number of channels. \
This is the same as the number of rows of a 1D or 2D HArray. \
Expand All @@ -31,7 +31,7 @@ _________

## nframes

`nframes() -> integer` <span style="float: right;"> [source](https://github.com/daniellga/harmonium/tree/master/r-harmonium/src/rust/src/haudioop.rs#L72) </span> \
`nframes() -> integer` \<span style="float: right;"> [source](https://github.com/daniellga/harmonium/tree/master/r-harmonium/src/rust/src/haudioop.rs#L72) </span> \

Returns the number of frames. \
This is the same as the number of cols of a 1D or 2D HArray. \
Expand All @@ -55,7 +55,7 @@ _________

## db_to_amplitude

`db_to_amplitude(harray: HArray, reference: double)` <span style="float: right;"> [source](https://github.com/daniellga/harmonium/tree/master/r-harmonium/src/rust/src/haudioop.rs#L108) </span> \
`db_to_amplitude(harray: HArray, reference: double)` \<span style="float: right;"> [source](https://github.com/daniellga/harmonium/tree/master/r-harmonium/src/rust/src/haudioop.rs#L108) </span> \

Converts the `HArray` input from dB to amplitude. \
$db_to_amplitude(x) = reference * (10.0**(x * 0.1))**power$ \
Expand Down Expand Up @@ -84,7 +84,7 @@ _________

## to_mono

`to_mono(harray: HArray)` <span style="float: right;"> [source](https://github.com/daniellga/harmonium/tree/master/r-harmonium/src/rust/src/haudioop.rs#L140) </span> \
`to_mono(harray: HArray)` \<span style="float: right;"> [source](https://github.com/daniellga/harmonium/tree/master/r-harmonium/src/rust/src/haudioop.rs#L140) </span> \

Convert to 1 channel by taking the average across channels. \
The operation is done in-place. A new inner array is created. \
Expand Down
40 changes: 20 additions & 20 deletions _docs/contents/haudiosink.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Handle to a device that outputs sounds. \

## new

`new() -> HAudioSink` <span style="float: right;"> [source](https://github.com/daniellga/harmonium/tree/master/r-harmonium/src/rust/src/haudiosink.rs#L43) </span> \
`new() -> HAudioSink` \<span style="float: right;"> [source](https://github.com/daniellga/harmonium/tree/master/r-harmonium/src/rust/src/haudiosink.rs#L43) </span> \

Creates a new `HAudioSink` instance. \
The sink is set on "play" mode from the start. \
Expand All @@ -28,7 +28,7 @@ _________

## append_from_harray

`append_from_harray(harray: HArray, sr: integer)` <span style="float: right;"> [source](https://github.com/daniellga/harmonium/tree/master/r-harmonium/src/rust/src/haudiosink.rs#L74) </span> \
`append_from_harray(harray: HArray, sr: integer)` \<span style="float: right;"> [source](https://github.com/daniellga/harmonium/tree/master/r-harmonium/src/rust/src/haudiosink.rs#L74) </span> \

Appends a sound to the queue of sounds to play. \

Expand All @@ -54,7 +54,7 @@ _________

## append_from_file

`append_from_file(fpath: string)` <span style="float: right;"> [source](https://github.com/daniellga/harmonium/tree/master/r-harmonium/src/rust/src/haudiosink.rs#L133) </span> \
`append_from_file(fpath: string)` \<span style="float: right;"> [source](https://github.com/daniellga/harmonium/tree/master/r-harmonium/src/rust/src/haudiosink.rs#L133) </span> \

Appends a sound to the queue of sounds to play. \

Expand All @@ -75,7 +75,7 @@ _________

## audio_default_device

`audio_default_device() -> string` <span style="float: right;"> [source](https://github.com/daniellga/harmonium/tree/master/r-harmonium/src/rust/src/haudiosink.rs#L162) </span> \
`audio_default_device() -> string` \<span style="float: right;"> [source](https://github.com/daniellga/harmonium/tree/master/r-harmonium/src/rust/src/haudiosink.rs#L162) </span> \

Informs the default audio output device. \

Expand All @@ -94,7 +94,7 @@ _________

## audio_output_devices

`audio_output_devices() -> atomicvector` <span style="float: right;"> [source](https://github.com/daniellga/harmonium/tree/master/r-harmonium/src/rust/src/haudiosink.rs#L188) </span> \
`audio_output_devices() -> atomicvector` \<span style="float: right;"> [source](https://github.com/daniellga/harmonium/tree/master/r-harmonium/src/rust/src/haudiosink.rs#L188) </span> \

Provides a list of available audio output devices. \

Expand All @@ -113,7 +113,7 @@ _________

## audio_supported_configs

`audio_supported_configs() -> atomicvector` <span style="float: right;"> [source](https://github.com/daniellga/harmonium/tree/master/r-harmonium/src/rust/src/haudiosink.rs#L220) </span> \
`audio_supported_configs() -> atomicvector` \<span style="float: right;"> [source](https://github.com/daniellga/harmonium/tree/master/r-harmonium/src/rust/src/haudiosink.rs#L220) </span> \

Provides the supported configurations for the default audio output device. \
The following informations are given: \
Expand All @@ -138,7 +138,7 @@ _________

## clear

`clear()` <span style="float: right;"> [source](https://github.com/daniellga/harmonium/tree/master/r-harmonium/src/rust/src/haudiosink.rs#L246) </span> \
`clear()` \<span style="float: right;"> [source](https://github.com/daniellga/harmonium/tree/master/r-harmonium/src/rust/src/haudiosink.rs#L246) </span> \

Removes all currently loaded `Source`s from the `Sink` and pauses it. \

Expand All @@ -157,7 +157,7 @@ _________

## is_empty

`is_empty() -> bool` <span style="float: right;"> [source](https://github.com/daniellga/harmonium/tree/master/r-harmonium/src/rust/src/haudiosink.rs#L272) </span> \
`is_empty() -> bool` \<span style="float: right;"> [source](https://github.com/daniellga/harmonium/tree/master/r-harmonium/src/rust/src/haudiosink.rs#L272) </span> \

Returns true if this sink has no more sounds to play. \

Expand All @@ -177,7 +177,7 @@ _________

## is_paused

`is_paused() -> bool` <span style="float: right;"> [source](https://github.com/daniellga/harmonium/tree/master/r-harmonium/src/rust/src/haudiosink.rs#L303) </span> \
`is_paused() -> bool` \<span style="float: right;"> [source](https://github.com/daniellga/harmonium/tree/master/r-harmonium/src/rust/src/haudiosink.rs#L303) </span> \

Gets if a sink is paused. \
Sinks can be paused and resumed using pause() and play(). This returns true if the sink is paused. \
Expand All @@ -201,7 +201,7 @@ _________

## len

`len() -> integer` <span style="float: right;"> [source](https://github.com/daniellga/harmonium/tree/master/r-harmonium/src/rust/src/haudiosink.rs#L333) </span> \
`len() -> integer` \<span style="float: right;"> [source](https://github.com/daniellga/harmonium/tree/master/r-harmonium/src/rust/src/haudiosink.rs#L333) </span> \

Returns the number of sounds currently in the queue. \

Expand All @@ -224,7 +224,7 @@ _________

## pause

`pause()` <span style="float: right;"> [source](https://github.com/daniellga/harmonium/tree/master/r-harmonium/src/rust/src/haudiosink.rs#L360) </span> \
`pause()` \<span style="float: right;"> [source](https://github.com/daniellga/harmonium/tree/master/r-harmonium/src/rust/src/haudiosink.rs#L360) </span> \

Pauses playback of this sink. \
No effect if already paused. \
Expand All @@ -245,7 +245,7 @@ _________

## play

`play()` <span style="float: right;"> [source](https://github.com/daniellga/harmonium/tree/master/r-harmonium/src/rust/src/haudiosink.rs#L387) </span> \
`play()` \<span style="float: right;"> [source](https://github.com/daniellga/harmonium/tree/master/r-harmonium/src/rust/src/haudiosink.rs#L387) </span> \

Resumes playback of a paused sink. \
No effect if not paused. \
Expand All @@ -266,7 +266,7 @@ _________

## set_speed

`set_speed(value: double)` <span style="float: right;"> [source](https://github.com/daniellga/harmonium/tree/master/r-harmonium/src/rust/src/haudiosink.rs#L417) </span> \
`set_speed(value: double)` \<span style="float: right;"> [source](https://github.com/daniellga/harmonium/tree/master/r-harmonium/src/rust/src/haudiosink.rs#L417) </span> \

Changes the speed of the sound. \
The value 1.0 is the “normal” speed (unfiltered input). Any value other than 1.0 will change the play speed of the sound. \
Expand All @@ -290,7 +290,7 @@ _________

## set_volume

`set_volume(value: double)` <span style="float: right;"> [source](https://github.com/daniellga/harmonium/tree/master/r-harmonium/src/rust/src/haudiosink.rs#L448) </span> \
`set_volume(value: double)` \<span style="float: right;"> [source](https://github.com/daniellga/harmonium/tree/master/r-harmonium/src/rust/src/haudiosink.rs#L448) </span> \

Changes the volume of the sound. \
The value 1.0 is the “normal” volume (unfiltered input). Any value other than 1.0 will multiply each sample by this value. \
Expand All @@ -314,7 +314,7 @@ _________

## skip_one

`skip_one()` <span style="float: right;"> [source](https://github.com/daniellga/harmonium/tree/master/r-harmonium/src/rust/src/haudiosink.rs#L477) </span> \
`skip_one()` \<span style="float: right;"> [source](https://github.com/daniellga/harmonium/tree/master/r-harmonium/src/rust/src/haudiosink.rs#L477) </span> \

Skips to the next `Source` in the `Sink`. \
If there are more `Source`s appended to the `Sink` at the time, it will play the next one.
Expand All @@ -336,7 +336,7 @@ _________

## sleep_until_end

`sleep_until_end()` <span style="float: right;"> [source](https://github.com/daniellga/harmonium/tree/master/r-harmonium/src/rust/src/haudiosink.rs#L500) </span> \
`sleep_until_end()` \<span style="float: right;"> [source](https://github.com/daniellga/harmonium/tree/master/r-harmonium/src/rust/src/haudiosink.rs#L500) </span> \

Sleeps the current thread until the sound ends. \

Expand All @@ -353,7 +353,7 @@ _________

## speed

`speed() -> double` <span style="float: right;"> [source](https://github.com/daniellga/harmonium/tree/master/r-harmonium/src/rust/src/haudiosink.rs#L528) </span> \
`speed() -> double` \<span style="float: right;"> [source](https://github.com/daniellga/harmonium/tree/master/r-harmonium/src/rust/src/haudiosink.rs#L528) </span> \

Gets the speed of the sound. \
The value 1.0 is the “normal” speed (unfiltered input). Any value other than 1.0 will change the play speed of the sound. \
Expand All @@ -375,7 +375,7 @@ _________

## stop

`stop()` <span style="float: right;"> [source](https://github.com/daniellga/harmonium/tree/master/r-harmonium/src/rust/src/haudiosink.rs#L557) </span> \
`stop()` \<span style="float: right;"> [source](https://github.com/daniellga/harmonium/tree/master/r-harmonium/src/rust/src/haudiosink.rs#L557) </span> \

Stops the sink by emptying the queue. \
The sink will keep its previous state (play or pause). \
Expand All @@ -397,7 +397,7 @@ _________

## try_seek

`try_seek(pos: f64)` <span style="float: right;"> [source](https://github.com/daniellga/harmonium/tree/master/r-harmonium/src/rust/src/haudiosink.rs#L593) </span> \
`try_seek(pos: f64)` \<span style="float: right;"> [source](https://github.com/daniellga/harmonium/tree/master/r-harmonium/src/rust/src/haudiosink.rs#L593) </span> \

Attempts to seek to a given position in the current source. \
This blocks between 0 and ~5 milliseconds. \
Expand Down Expand Up @@ -427,7 +427,7 @@ _________

## volume

`volume() -> double` <span style="float: right;"> [source](https://github.com/daniellga/harmonium/tree/master/r-harmonium/src/rust/src/haudiosink.rs#L623) </span> \
`volume() -> double` \<span style="float: right;"> [source](https://github.com/daniellga/harmonium/tree/master/r-harmonium/src/rust/src/haudiosink.rs#L623) </span> \

Gets the volume of the sound. \
The value 1.0 is the “normal” volume (unfiltered input). Any value other than 1.0 will multiply each sample by this value. \
Expand Down
6 changes: 3 additions & 3 deletions _docs/contents/hdatatype.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Supports `Float32`, `Float64`, `Complex32` and `Complex64` types. \

## print

`print()` <span style="float: right;"> [source](https://github.com/daniellga/harmonium/tree/master/r-harmonium/src/rust/src/hdatatype.rs#L42) </span> \
`print()` \<span style="float: right;"> [source](https://github.com/daniellga/harmonium/tree/master/r-harmonium/src/rust/src/hdatatype.rs#L42) </span> \

Prints the `HDataType`. \
Differently from R's behaviour, `print` doesn't return the value invisibly. \
Expand All @@ -29,7 +29,7 @@ _________

## eq

`eq(other: HDataType) -> bool` <span style="float: right;"> [source](https://github.com/daniellga/harmonium/tree/master/r-harmonium/src/rust/src/hdatatype.rs#L77) </span> \
`eq(other: HDataType) -> bool` \<span style="float: right;"> [source](https://github.com/daniellga/harmonium/tree/master/r-harmonium/src/rust/src/hdatatype.rs#L77) </span> \

Equality with another `HDataType`. \

Expand Down Expand Up @@ -58,7 +58,7 @@ _________

## ne

`ne(other: HDataType) -> bool` <span style="float: right;"> [source](https://github.com/daniellga/harmonium/tree/master/r-harmonium/src/rust/src/hdatatype.rs#L113) </span> \
`ne(other: HDataType) -> bool` \<span style="float: right;"> [source](https://github.com/daniellga/harmonium/tree/master/r-harmonium/src/rust/src/hdatatype.rs#L113) </span> \

Difference with another `HDataType`. \

Expand Down
Loading

0 comments on commit ab1e756

Please sign in to comment.