Skip to content

Commit 0ee270d

Browse files
committed
feat: Web Audio
1 parent 0d18784 commit 0ee270d

179 files changed

Lines changed: 21577 additions & 84 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

apps/demo-angular/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@
1212
"@nativescript/core": "file:../../node_modules/@nativescript/core",
1313
"three": "file:../../node_modules/three",
1414
"@nativescript/canvas-chartjs": "file:../../dist/packages/canvas-chartjs",
15-
"@nativescript/canvas-svg": "file:../../dist/packages/canvas-svg"
15+
"@nativescript/canvas-svg": "file:../../dist/packages/canvas-svg",
16+
"@nativescript/audio-context": "file:../../dist/packages/audio-context"
1617
},
1718
"devDependencies": {
1819
"@nativescript/android": "~8.8.0",

apps/demo-angular/src/app-routing.module.ts

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,19 @@ import { NativeScriptRouterModule } from '@nativescript/angular';
55
import { HomeComponent } from './home.component';
66

77
const routes: Routes = [
8-
{ path: '', redirectTo: '/home', pathMatch: 'full' },
9-
{ path: 'home', component: HomeComponent },
10-
{ path: 'canvas', loadChildren: () => import('./plugin-demos/canvas.module').then(m => m.CanvasModule) },
11-
{ path: 'canvas-babylon', loadChildren: () => import('./plugin-demos/canvas-babylon.module').then(m => m.CanvasBabylonModule) },
12-
{ path: 'canvas-chartjs', loadChildren: () => import('./plugin-demos/canvas-chartjs.module').then(m => m.CanvasChartjsModule) },
13-
{ path: 'canvas-media', loadChildren: () => import('./plugin-demos/canvas-media.module').then(m => m.CanvasMediaModule) },
14-
{ path: 'canvas-phaser', loadChildren: () => import('./plugin-demos/canvas-phaser.module').then(m => m.CanvasPhaserModule) },
15-
{ path: 'canvas-phaser-ce', loadChildren: () => import('./plugin-demos/canvas-phaser-ce.module').then(m => m.CanvasPhaserCeModule) },
16-
{ path: 'canvas-pixi', loadChildren: () => import('./plugin-demos/canvas-pixi.module').then(m => m.CanvasPixiModule) },
17-
{ path: 'canvas-polyfill', loadChildren: () => import('./plugin-demos/canvas-polyfill.module').then(m => m.CanvasPolyfillModule) },
18-
{ path: 'canvas-svg', loadChildren: () => import('./plugin-demos/canvas-svg.module').then(m => m.CanvasSvgModule) },
19-
{ path: 'canvas-three', loadChildren: () => import('./plugin-demos/canvas-three.module').then(m => m.CanvasThreeModule) }
8+
{ path: '', redirectTo: '/home', pathMatch: 'full' },
9+
{ path: 'home', component: HomeComponent },
10+
{ path: 'audio-context', loadChildren: () => import('./plugin-demos/audio-context.module').then((m) => m.AudioContextModule) },
11+
{ path: 'canvas', loadChildren: () => import('./plugin-demos/canvas.module').then((m) => m.CanvasModule) },
12+
{ path: 'canvas-babylon', loadChildren: () => import('./plugin-demos/canvas-babylon.module').then((m) => m.CanvasBabylonModule) },
13+
{ path: 'canvas-chartjs', loadChildren: () => import('./plugin-demos/canvas-chartjs.module').then((m) => m.CanvasChartjsModule) },
14+
{ path: 'canvas-media', loadChildren: () => import('./plugin-demos/canvas-media.module').then((m) => m.CanvasMediaModule) },
15+
{ path: 'canvas-phaser', loadChildren: () => import('./plugin-demos/canvas-phaser.module').then((m) => m.CanvasPhaserModule) },
16+
{ path: 'canvas-phaser-ce', loadChildren: () => import('./plugin-demos/canvas-phaser-ce.module').then((m) => m.CanvasPhaserCeModule) },
17+
{ path: 'canvas-pixi', loadChildren: () => import('./plugin-demos/canvas-pixi.module').then((m) => m.CanvasPixiModule) },
18+
{ path: 'canvas-polyfill', loadChildren: () => import('./plugin-demos/canvas-polyfill.module').then((m) => m.CanvasPolyfillModule) },
19+
{ path: 'canvas-svg', loadChildren: () => import('./plugin-demos/canvas-svg.module').then((m) => m.CanvasSvgModule) },
20+
{ path: 'canvas-three', loadChildren: () => import('./plugin-demos/canvas-three.module').then((m) => m.CanvasThreeModule) },
2021
];
2122

2223
@NgModule({

apps/demo-angular/src/home.component.ts

Lines changed: 36 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -5,39 +5,41 @@ import { RouterExtensions } from '@nativescript/angular';
55
templateUrl: 'home.component.html',
66
})
77
export class HomeComponent {
8-
9-
constructor(private router: RouterExtensions){}
8+
constructor(private router: RouterExtensions) {}
109

1110
demos = [
12-
{
13-
name: 'canvas'
14-
},
15-
{
16-
name: 'canvas-babylon'
17-
},
18-
{
19-
name: 'canvas-chartjs'
20-
},
21-
{
22-
name: 'canvas-media'
23-
},
24-
{
25-
name: 'canvas-phaser'
26-
},
27-
{
28-
name: 'canvas-phaser-ce'
29-
},
30-
{
31-
name: 'canvas-pixi'
32-
},
33-
{
34-
name: 'canvas-polyfill'
35-
},
36-
{
37-
name: 'canvas-svg'
38-
},
39-
{
40-
name: 'canvas-three'
41-
}
42-
];
43-
}
11+
{
12+
name: 'audio-context',
13+
},
14+
{
15+
name: 'canvas',
16+
},
17+
{
18+
name: 'canvas-babylon',
19+
},
20+
{
21+
name: 'canvas-chartjs',
22+
},
23+
{
24+
name: 'canvas-media',
25+
},
26+
{
27+
name: 'canvas-phaser',
28+
},
29+
{
30+
name: 'canvas-phaser-ce',
31+
},
32+
{
33+
name: 'canvas-pixi',
34+
},
35+
{
36+
name: 'canvas-polyfill',
37+
},
38+
{
39+
name: 'canvas-svg',
40+
},
41+
{
42+
name: 'canvas-three',
43+
},
44+
];
45+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<ActionBar title="audio-context" class="action-bar"> </ActionBar>
2+
<StackLayout class="p-20">
3+
<ScrollView class="h-full">
4+
<StackLayout>
5+
<Button text="Test audio-context" (tap)="demoShared.testIt()" class="btn btn-primary"></Button>
6+
</StackLayout>
7+
</ScrollView>
8+
</StackLayout>
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import { Component, NgZone } from '@angular/core';
2+
import { DemoSharedAudioContext } from '@demo/shared';
3+
import {} from '@nativescript/audio-context';
4+
5+
@Component({
6+
selector: 'demo-audio-context',
7+
templateUrl: 'audio-context.component.html',
8+
})
9+
export class AudioContextComponent {
10+
demoShared: DemoSharedAudioContext;
11+
12+
constructor(private _ngZone: NgZone) {}
13+
14+
ngOnInit() {
15+
this.demoShared = new DemoSharedAudioContext();
16+
}
17+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import { NgModule, NO_ERRORS_SCHEMA } from '@angular/core';
2+
import { NativeScriptCommonModule, NativeScriptRouterModule } from '@nativescript/angular';
3+
import { AudioContextComponent } from './audio-context.component';
4+
5+
@NgModule({
6+
imports: [NativeScriptCommonModule, NativeScriptRouterModule.forChild([{ path: '', component: AudioContextComponent }])],
7+
declarations: [AudioContextComponent],
8+
schemas: [NO_ERRORS_SCHEMA],
9+
})
10+
export class AudioContextModule {}

apps/demo-angular/tsconfig.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@
1313
"@nativescript/canvas-pixi": ["packages/canvas-pixi/index.ts"],
1414
"@nativescript/canvas-three": ["packages/canvas-three/index.ts"],
1515
"@nativescript/canvas-media": ["packages/canvas-media/index.ts"],
16-
"@nativescript/*": ["../../dist/packages/*"]
16+
"@nativescript/*": ["../../dist/packages/*"],
17+
"@nativescript/audio-context": ["../../packages/audio-context/index.d.ts"]
1718
}
1819
},
1920
"files": ["./references.d.ts", "./src/main.ts", "./src/polyfills.ts"],
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
<template>
2+
<Page>
3+
<ActionBar>
4+
<Label text="audio-context"/>
5+
</ActionBar>
6+
7+
<GridLayout>
8+
<Button class="info" :text="message"/>
9+
</GridLayout>
10+
</Page>
11+
</template>
12+
13+
<script lang="ts">
14+
import Vue from "nativescript-vue";
15+
import { DemoSharedAudioContext } from '@demo/shared';
16+
import { } from '@nativescript/audio-context';
17+
18+
export default Vue.extend({
19+
computed: {
20+
message() {
21+
return "Test audio-context";
22+
}
23+
}
24+
});
25+
</script>
26+
27+
<style scoped lang="scss">
28+
29+
.info {
30+
font-size: 20;
31+
horizontal-align: center;
32+
vertical-align: center;
33+
}
34+
</style>

apps/demo-vue/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@
1212
"@nativescript/canvas-polyfill": "file:../../packages/canvas-polyfill",
1313
"@nativescript/canvas-three": "file:../../packages/canvas-three",
1414
"@nativescript/canvas-chartjs": "file:../../packages/canvas-chartjs",
15-
"@nativescript/canvas-svg": "file:../../packages/canvas-svg"
15+
"@nativescript/canvas-svg": "file:../../packages/canvas-svg",
16+
"@nativescript/audio-context": "file:../../packages/audio-context"
1617
},
1718
"devDependencies": {
1819
"@nativescript/android": "~8.8.0",

apps/demo/package.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,15 @@
1212
"@nativescript/canvas-phaser-ce": "file:../../packages/canvas-phaser-ce",
1313
"@nativescript/canvas-pixi": "file:../../packages/canvas-pixi",
1414
"@nativescript/canvas-polyfill": "file:../../packages/canvas-polyfill",
15+
"@nativescript/canvas-svg": "file:../../packages/canvas-svg",
1516
"@nativescript/canvas-three": "file:../../packages/canvas-three",
1617
"@nativescript/core": "file:../../node_modules/@nativescript/core",
1718
"@pixi-essentials/svg": "file:../../node_modules/@pixi-essentials/svg",
1819
"babylonjs": "file:../../node_modules/babylonjs",
1920
"babylonjs-materials": "file:../../node_modules/babylonjs-materials",
2021
"chart.js": "file:../../node_modules/chart.js",
2122
"d3": "file:../../node_modules/d3",
23+
"gl-matrix": "file:../../node_modules/gl-matrix",
2224
"matter-js": "file:../../node_modules/matter-js",
2325
"phaser": "file:../../node_modules/phaser",
2426
"phaser-ce": "file:../../node_modules/phaser-ce",
@@ -27,13 +29,12 @@
2729
"three-stdlib": "file:../../node_modules/three-stdlib",
2830
"vexflow": "file:../../node_modules/vexflow",
2931
"zen-3d": "file:../../node_modules/zen-3d",
30-
"@nativescript/canvas-svg": "file:../../packages/canvas-svg",
31-
"gl-matrix": "file:../../node_modules/gl-matrix"
32+
"@nativescript/audio-context": "file:../../packages/audio-context"
3233
},
3334
"devDependencies": {
3435
"@nativescript/android": "~8.9.0",
3536
"@nativescript/devtools": "~0.0.1",
36-
"@nativescript/ios": "~8.9.0",
37+
"@nativescript/ios": "9.0.3",
3738
"@nativescript/visionos": "~8.9.0"
3839
}
3940
}

0 commit comments

Comments
 (0)