Skip to content

Commit 0b04625

Browse files
committed
Unify README.md and crate docs
Fixes #420
1 parent 07c6d0f commit 0b04625

File tree

2 files changed

+2
-36
lines changed

2 files changed

+2
-36
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ biquad.connect(&context.destination());
4646
src.start();
4747

4848
// enjoy listening
49-
loop { }
49+
std::thread::sleep(std::time::Duration::from_secs(4));
5050
```
5151

5252
Check out the [docs](https://docs.rs/web-audio-api) for more info.

src/lib.rs

Lines changed: 1 addition & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,4 @@
1-
//! A high-level API for processing and synthesizing audio.
2-
//!
3-
//! # Example
4-
//! ```no_run
5-
//! use std::fs::File;
6-
//! use web_audio_api::context::{BaseAudioContext, AudioContext};
7-
//! use web_audio_api::node::{AudioNode, AudioScheduledSourceNode};
8-
//!
9-
//! // set up AudioContext with optimized settings for your hardware
10-
//! let context = AudioContext::default();
11-
//!
12-
//! // create an audio buffer from a given file
13-
//! let file = File::open("samples/sample.wav").unwrap();
14-
//! let buffer = context.decode_audio_data_sync(file).unwrap();
15-
//!
16-
//! // play the buffer at given volume
17-
//! let volume = context.create_gain();
18-
//! volume.connect(&context.destination());
19-
//! volume.gain().set_value(0.5);
20-
//!
21-
//! let mut buffer_source = context.create_buffer_source();
22-
//! buffer_source.connect(&volume);
23-
//! buffer_source.set_buffer(buffer);
24-
//!
25-
//! // create oscillator branch
26-
//! let mut osc = context.create_oscillator();
27-
//! osc.connect(&context.destination());
28-
//!
29-
//! // start the sources
30-
//! buffer_source.start();
31-
//! osc.start();
32-
//!
33-
//! // enjoy listening
34-
//! std::thread::sleep(std::time::Duration::from_secs(4));
35-
//! ```
1+
#![doc = include_str!("../README.md")]
362

373
#![warn(rust_2018_idioms)]
384
#![warn(rust_2021_compatibility)]

0 commit comments

Comments
 (0)