Commit graph

6 commits

Author SHA1 Message Date
Anatol Ulrich
db04f57be4
migrate wasm example to trunk (#844)
## Description

This PR migrates the wasm example from an npm/webpack based approach to [trunk](https://trunkrs.dev/). Fixes #834.

Of note:
the `console_error_panic_hook` dependency was gated in `Cargo.toml` via `[target."cfg(debug_assertions)".dependencies]`. This is documented as nonfunctional and will throw a warning on build:
```
warning: Found `debug_assertions` in `target.'cfg(...)'.dependencies`. 
This value is not supported for selecting dependencies and will not work as expected. 
To learn more visit https://doc.rust-lang.org/cargo/reference/specifying-dependencies.html#platform-specific-dependencies
```

Since the actual usage of `console_error_panic_hook` is *also* gated in `lib.rs` behind `#[cfg(debug_assertions)]` it didn't make sense to have the cargo gate in place, hence I have removed it.

## Next steps

If this PR is merged, the [wiki page](https://github.com/RustAudio/cpal/wiki/Setting-up-a-new-CPAL-WASM-project) linked in the root README should be updated as well.
2024-02-25 01:49:53 +01:00
Greg Wiley
edecb26ff3
Fix compile issues in wasm-beep example (#723)
Fixes #721

Changes to a dependency library broke compilation of the example. Changes needed to get the example working and warning-free include:
 
1. specifying additional type constraints in local implementations
2. using the `FromSample` trait to convert samples in the handler
3. adding a default matcher in response to the non-exhaustive attribute on `SampleFormat`

Also adds a github action to ensure the wasm-beep example compiles.
2022-11-06 04:34:08 +01:00
mbodmer
0a3e8c2208
add timeout paramter to DeviceTrait stream builders (#696)
* add timeout paramter to DeviceTrait stream builders

This makes it possible for the library client to handle situations where the host
takes too long to respond or even blocks forever, eg. a retry can be applied.

if the timeout passed is "None" the current behaviour is applied, eg. blocking forever.
if the timeout passed is a Duration then it will be applied to the Device Streams.
This is only implemented for ALSA, the other hosts will ignore the parameter for now.

Signed-off-by: Marc Bodmer <marc.bodmer@securiton.ch>
2022-10-18 18:15:31 +02:00
Rémi Lauzier
ba462dad18
Fix some typo and warnings 2021-06-29 11:30:26 -04:00
mitchmindtree
4ef48cb865 Add ishitatsuyuki's wasm-beep example
This adds the `wasm-beep` example @ishitatsuyuki put together for
testing webaudio support. The example helped me to better understand how
to use the webaudio host and provided an easy way to test it, I'm sure
other contributors/users might benefit in the same way.

I guess in the future it would be nice if we could have some way of
sharing the same code between wasm-target examples and native target
examples. Still, I think it's beneficial to include this wasm-beep
example in the meantime to have at least some kind of demonstration of
how to use cpal with wasm.

Are you happy for this to be added as is @ishitatsuyuki?
2020-05-25 15:44:06 +02:00
Tatsuyuki Ishi
9dc0c04c95 Add wasm-beep example 2020-05-25 15:32:51 +02:00