Fixed audio stuff btw
parent
d412213f0c
commit
debab3baaf
|
@ -2,9 +2,18 @@
|
|||
<project version="4">
|
||||
<component name="ChangeListManager">
|
||||
<list default="true" id="978d055d-27d3-431a-bd34-e5e79bb273b3" name="Default" comment="">
|
||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" afterPath="$PROJECT_DIR$/.idea/workspace.xml" />
|
||||
<change beforePath="$PROJECT_DIR$/asm/generated/TeaWeb-Native.js" afterPath="$PROJECT_DIR$/asm/generated/TeaWeb-Native.js" />
|
||||
<change beforePath="$PROJECT_DIR$/asm/generated/libopus.js" afterPath="$PROJECT_DIR$/asm/generated/libopus.js" />
|
||||
<change beforePath="$PROJECT_DIR$/asm/libs/opus" afterPath="$PROJECT_DIR$/asm/libs/opus" />
|
||||
<change beforePath="$PROJECT_DIR$/asm/make_opus.sh" afterPath="$PROJECT_DIR$/asm/make_opus.sh" />
|
||||
<change beforePath="$PROJECT_DIR$/asm/src/WebASMTest.cpp" afterPath="$PROJECT_DIR$/asm/src/WebASMTest.cpp" />
|
||||
<change beforePath="$PROJECT_DIR$/js/codec/Codec.js" afterPath="$PROJECT_DIR$/js/codec/Codec.js" />
|
||||
<change beforePath="$PROJECT_DIR$/js/codec/Codec.js.map" afterPath="$PROJECT_DIR$/js/codec/Codec.js.map" />
|
||||
<change beforePath="$PROJECT_DIR$/js/codec/Codec.ts" afterPath="$PROJECT_DIR$/js/codec/Codec.ts" />
|
||||
<change beforePath="$PROJECT_DIR$/js/voice.js" afterPath="$PROJECT_DIR$/js/voice.js" />
|
||||
<change beforePath="$PROJECT_DIR$/js/voice.js.map" afterPath="$PROJECT_DIR$/js/voice.js.map" />
|
||||
<change beforePath="$PROJECT_DIR$/js/voice.ts" afterPath="$PROJECT_DIR$/js/voice.ts" />
|
||||
</list>
|
||||
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
|
||||
<option name="TRACKING_ENABLED" value="true" />
|
||||
|
@ -14,54 +23,66 @@
|
|||
<option name="LAST_RESOLUTION" value="IGNORE" />
|
||||
</component>
|
||||
<component name="FileEditorManager">
|
||||
<leaf>
|
||||
<leaf SIDE_TABS_SIZE_LIMIT_KEY="300">
|
||||
<file leaf-file-name="index.html" pinned="false" current-in-tab="false">
|
||||
<entry file="file://$PROJECT_DIR$/index.html">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="1160">
|
||||
<state relative-caret-position="2898">
|
||||
<caret line="161" column="19" lean-forward="false" selection-start-line="161" selection-start-column="19" selection-end-line="161" selection-end-column="19" />
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
</file>
|
||||
<file leaf-file-name="main.js" pinned="false" current-in-tab="false">
|
||||
<entry file="file://$PROJECT_DIR$/js/main.js">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="126">
|
||||
<caret line="7" column="0" lean-forward="false" selection-start-line="7" selection-start-column="0" selection-end-line="7" selection-end-column="0" />
|
||||
<folding>
|
||||
<element signature="n#!!doc" expanded="true" />
|
||||
</folding>
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
</file>
|
||||
<file leaf-file-name="Codec.ts" pinned="false" current-in-tab="false">
|
||||
<entry file="file://$PROJECT_DIR$/js/codec/Codec.ts">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="1152">
|
||||
<caret line="64" column="27" lean-forward="false" selection-start-line="64" selection-start-column="27" selection-end-line="64" selection-end-column="27" />
|
||||
<state relative-caret-position="751">
|
||||
<caret line="99" column="102" lean-forward="false" selection-start-line="99" selection-start-column="102" selection-end-line="99" selection-end-column="102" />
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
</file>
|
||||
<file leaf-file-name="client.ts" pinned="false" current-in-tab="false">
|
||||
<entry file="file://$PROJECT_DIR$/js/client.ts">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="0">
|
||||
<caret line="0" column="0" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
|
||||
<folding>
|
||||
<element signature="n#!!doc" expanded="true" />
|
||||
</folding>
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
</file>
|
||||
<file leaf-file-name="connection.ts" pinned="false" current-in-tab="false">
|
||||
<entry file="file://$PROJECT_DIR$/js/connection.ts">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="0">
|
||||
<caret line="0" column="0" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
|
||||
<folding>
|
||||
<element signature="n#!!doc" expanded="true" />
|
||||
</folding>
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
</file>
|
||||
<file leaf-file-name="index.d.ts" pinned="false" current-in-tab="false">
|
||||
<entry file="file://$PROJECT_DIR$/node_modules/@types/emscripten/index.d.ts">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="947">
|
||||
<state relative-caret-position="1764">
|
||||
<caret line="103" column="13" lean-forward="false" selection-start-line="103" selection-start-column="13" selection-end-line="103" selection-end-column="13" />
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
</file>
|
||||
<file leaf-file-name="lib.es6.d.ts" pinned="false" current-in-tab="true">
|
||||
<file leaf-file-name="lib.es6.d.ts" pinned="false" current-in-tab="false">
|
||||
<entry file="file://$APPLICATION_HOME_DIR$/plugins/JavaScriptLanguage/jsLanguageServicesImpl/external/lib.es6.d.ts">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="668">
|
||||
<caret line="1755" column="4" lean-forward="false" selection-start-line="1755" selection-start-column="4" selection-end-line="1755" selection-end-column="4" />
|
||||
<state relative-caret-position="442">
|
||||
<caret line="14435" column="40" lean-forward="false" selection-start-line="14435" selection-start-column="34" selection-end-line="14435" selection-end-column="40" />
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
|
@ -70,18 +91,28 @@
|
|||
<file leaf-file-name="encoder.js" pinned="false" current-in-tab="false">
|
||||
<entry file="file://$PROJECT_DIR$/vendor/libopus.js/lib/encoder.js">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="1761">
|
||||
<state relative-caret-position="3294">
|
||||
<caret line="183" column="13" lean-forward="false" selection-start-line="183" selection-start-column="13" selection-end-line="183" selection-end-column="13" />
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
</file>
|
||||
<file leaf-file-name="voice.ts" pinned="false" current-in-tab="false">
|
||||
<file leaf-file-name="voice.ts" pinned="false" current-in-tab="true">
|
||||
<entry file="file://$PROJECT_DIR$/js/voice.ts">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="722">
|
||||
<caret line="105" column="41" lean-forward="false" selection-start-line="105" selection-start-column="41" selection-end-line="105" selection-end-column="41" />
|
||||
<state relative-caret-position="1201">
|
||||
<caret line="320" column="33" lean-forward="false" selection-start-line="320" selection-start-column="33" selection-end-line="320" selection-end-column="33" />
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
</file>
|
||||
<file leaf-file-name="client.ts" pinned="false" current-in-tab="false">
|
||||
<entry file="file://$PROJECT_DIR$/js/ui/client.ts">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="324">
|
||||
<caret line="18" column="25" lean-forward="false" selection-start-line="18" selection-start-column="25" selection-end-line="18" selection-end-column="25" />
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
|
@ -106,8 +137,8 @@
|
|||
<option name="CHANGED_PATHS">
|
||||
<list>
|
||||
<option value="$PROJECT_DIR$/js/main.js" />
|
||||
<option value="$PROJECT_DIR$/js/voice.ts" />
|
||||
<option value="$PROJECT_DIR$/js/codec/Codec.ts" />
|
||||
<option value="$PROJECT_DIR$/js/voice.ts" />
|
||||
</list>
|
||||
</option>
|
||||
</component>
|
||||
|
@ -144,8 +175,6 @@
|
|||
<foldersAlwaysOnTop value="true" />
|
||||
</navigator>
|
||||
<panes>
|
||||
<pane id="Scratches" />
|
||||
<pane id="Scope" />
|
||||
<pane id="ProjectPane">
|
||||
<subPane>
|
||||
<expand>
|
||||
|
@ -186,6 +215,8 @@
|
|||
<select />
|
||||
</subPane>
|
||||
</pane>
|
||||
<pane id="Scope" />
|
||||
<pane id="Scratches" />
|
||||
</panes>
|
||||
</component>
|
||||
<component name="PropertiesComponent">
|
||||
|
@ -220,36 +251,37 @@
|
|||
<option name="number" value="Default" />
|
||||
<option name="presentableId" value="Default" />
|
||||
<updated>1519749313999</updated>
|
||||
<workItem from="1519749316100" duration="6405000" />
|
||||
<workItem from="1519749316100" duration="9698000" />
|
||||
<workItem from="1520012895408" duration="6591000" />
|
||||
</task>
|
||||
<servers />
|
||||
</component>
|
||||
<component name="TimeTrackingManager">
|
||||
<option name="totallyTimeSpent" value="6405000" />
|
||||
<option name="totallyTimeSpent" value="16289000" />
|
||||
</component>
|
||||
<component name="ToolWindowManager">
|
||||
<frame x="1985" y="-4" width="3775" height="2164" extended-state="6" />
|
||||
<frame x="2028" y="357" width="3777" height="2172" extended-state="6" />
|
||||
<editor active="true" />
|
||||
<layout>
|
||||
<window_info id="TODO" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="6" side_tool="false" content_ui="tabs" />
|
||||
<window_info id="Event Log" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="-1" side_tool="true" content_ui="tabs" />
|
||||
<window_info id="Event Log" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="7" side_tool="true" content_ui="tabs" />
|
||||
<window_info id="Version Control" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
|
||||
<window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
|
||||
<window_info id="Version Control" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="-1" side_tool="false" content_ui="tabs" />
|
||||
<window_info id="npm" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="-1" side_tool="true" content_ui="tabs" />
|
||||
<window_info id="Terminal" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="-1" side_tool="false" content_ui="tabs" />
|
||||
<window_info id="TypeScript" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.32993197" sideWeight="0.5" order="-1" side_tool="false" content_ui="tabs" />
|
||||
<window_info id="npm" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="2" side_tool="true" content_ui="tabs" />
|
||||
<window_info id="Terminal" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
|
||||
<window_info id="TypeScript" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.32993197" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
|
||||
<window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.24980132" sideWeight="0.5" order="0" side_tool="false" content_ui="combo" />
|
||||
<window_info id="Hierarchy" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.24980132" sideWeight="0.5" order="2" side_tool="false" content_ui="combo" />
|
||||
<window_info id="Docker" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="false" weight="0.33" sideWeight="0.5" order="-1" side_tool="false" content_ui="tabs" />
|
||||
<window_info id="Database" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="-1" side_tool="false" content_ui="tabs" />
|
||||
<window_info id="Find" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
|
||||
<window_info id="Docker" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="false" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
|
||||
<window_info id="Database" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
|
||||
<window_info id="Structure" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
|
||||
<window_info id="Favorites" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="2" side_tool="true" content_ui="tabs" />
|
||||
<window_info id="Debug" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
|
||||
<window_info id="Favorites" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="-1" side_tool="true" content_ui="tabs" />
|
||||
<window_info id="Cvs" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="4" side_tool="false" content_ui="tabs" />
|
||||
<window_info id="Message" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
|
||||
<window_info id="Commander" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
|
||||
<window_info id="Inspection" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="5" side_tool="false" content_ui="tabs" />
|
||||
<window_info id="Find" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
|
||||
<window_info id="Ant Build" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
|
||||
</layout>
|
||||
</component>
|
||||
|
@ -308,24 +340,102 @@
|
|||
<watches-manager />
|
||||
</component>
|
||||
<component name="editorHistoryManager">
|
||||
<entry file="file://$PROJECT_DIR$/index.html">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="2898">
|
||||
<caret line="161" column="19" lean-forward="false" selection-start-line="161" selection-start-column="19" selection-end-line="161" selection-end-column="19" />
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/js/main.js">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="126">
|
||||
<state relative-caret-position="90">
|
||||
<caret line="7" column="0" lean-forward="false" selection-start-line="7" selection-start-column="0" selection-end-line="7" selection-end-column="0" />
|
||||
<folding>
|
||||
<element signature="n#!!doc" expanded="false" />
|
||||
</folding>
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/js/client.ts">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="0">
|
||||
<caret line="0" column="0" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
|
||||
<folding>
|
||||
<element signature="n#!!doc" expanded="true" />
|
||||
</folding>
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/js/connection.ts">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="0">
|
||||
<caret line="0" column="0" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
|
||||
<folding>
|
||||
<element signature="n#!!doc" expanded="true" />
|
||||
</folding>
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/node_modules/@types/emscripten/index.d.ts">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="1764">
|
||||
<caret line="103" column="13" lean-forward="false" selection-start-line="103" selection-start-column="13" selection-end-line="103" selection-end-column="13" />
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$APPLICATION_HOME_DIR$/plugins/JavaScriptLanguage/jsLanguageServicesImpl/external/lib.es6.d.ts">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="35856">
|
||||
<caret line="1992" column="4" lean-forward="false" selection-start-line="1992" selection-start-column="4" selection-end-line="1992" selection-end-column="4" />
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/vendor/libopus.js/lib/encoder.js">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="1761">
|
||||
<state relative-caret-position="3294">
|
||||
<caret line="183" column="13" lean-forward="false" selection-start-line="183" selection-start-column="13" selection-end-line="183" selection-end-column="13" />
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/js/voice.ts">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="1818">
|
||||
<caret line="101" column="40" lean-forward="true" selection-start-line="101" selection-start-column="40" selection-end-line="101" selection-end-column="40" />
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/package.json">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="0">
|
||||
<caret line="0" column="0" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/js/codec/Codec.ts">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="288">
|
||||
<caret line="16" column="0" lean-forward="false" selection-start-line="16" selection-start-column="0" selection-end-line="16" selection-end-column="0" />
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/js/main.js">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="90">
|
||||
<caret line="7" column="0" lean-forward="false" selection-start-line="7" selection-start-column="0" selection-end-line="7" selection-end-column="0" />
|
||||
<folding>
|
||||
<element signature="n#!!doc" expanded="false" />
|
||||
</folding>
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/package.json">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="0">
|
||||
|
@ -336,40 +446,76 @@
|
|||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/index.html">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="1160">
|
||||
<state relative-caret-position="2898">
|
||||
<caret line="161" column="19" lean-forward="false" selection-start-line="161" selection-start-column="19" selection-end-line="161" selection-end-column="19" />
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/js/voice.ts">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="722">
|
||||
<caret line="105" column="41" lean-forward="false" selection-start-line="105" selection-start-column="41" selection-end-line="105" selection-end-column="41" />
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/node_modules/@types/emscripten/index.d.ts">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="947">
|
||||
<state relative-caret-position="1764">
|
||||
<caret line="103" column="13" lean-forward="false" selection-start-line="103" selection-start-column="13" selection-end-line="103" selection-end-column="13" />
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/js/connection.ts">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="0">
|
||||
<caret line="0" column="0" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
|
||||
<folding>
|
||||
<element signature="n#!!doc" expanded="true" />
|
||||
</folding>
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/js/client.ts">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="0">
|
||||
<caret line="0" column="0" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
|
||||
<folding>
|
||||
<element signature="n#!!doc" expanded="true" />
|
||||
</folding>
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/vendor/libopus.js/lib/encoder.js">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="3294">
|
||||
<caret line="183" column="13" lean-forward="false" selection-start-line="183" selection-start-column="13" selection-end-line="183" selection-end-column="13" />
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/js/ui/client.ts">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="324">
|
||||
<caret line="18" column="25" lean-forward="false" selection-start-line="18" selection-start-column="25" selection-end-line="18" selection-end-column="25" />
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/js/codec/Codec.ts">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="1152">
|
||||
<caret line="64" column="27" lean-forward="false" selection-start-line="64" selection-start-column="27" selection-end-line="64" selection-end-column="27" />
|
||||
<state relative-caret-position="751">
|
||||
<caret line="99" column="102" lean-forward="false" selection-start-line="99" selection-start-column="102" selection-end-line="99" selection-end-column="102" />
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$APPLICATION_HOME_DIR$/plugins/JavaScriptLanguage/jsLanguageServicesImpl/external/lib.es6.d.ts">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="668">
|
||||
<caret line="1755" column="4" lean-forward="false" selection-start-line="1755" selection-start-column="4" selection-end-line="1755" selection-end-column="4" />
|
||||
<state relative-caret-position="442">
|
||||
<caret line="14435" column="40" lean-forward="false" selection-start-line="14435" selection-start-column="34" selection-end-line="14435" selection-end-column="40" />
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/js/voice.ts">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="1201">
|
||||
<caret line="320" column="33" lean-forward="false" selection-start-line="320" selection-start-column="33" selection-end-line="320" selection-end-column="33" />
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -1 +1 @@
|
|||
Subproject commit 610c14ce80ad1a6754a9e2743e6799cf45a093c5
|
||||
Subproject commit 655cc54c564b84ef2827f0b2152ce3811046201e
|
|
@ -1,6 +1,8 @@
|
|||
#!/usr/bin/env bash
|
||||
OPUS_FN="'_free','_malloc','_opus_strerror','_opus_get_version_string','_opus_encoder_get_size','_opus_encoder_init','_opus_encode','_opus_encode_float','_opus_encoder_ctl','_opus_decoder_get_size','_opus_decoder_init','_opus_decode','_opus_decode_float','_opus_decoder_ctl','_opus_packet_get_nb_samples'"
|
||||
cd libs/opus/
|
||||
|
||||
git checkout v1.1.2
|
||||
./autogen.sh
|
||||
emconfigure ./configure --disable-extra-programs --disable-doc --disable-rtcd
|
||||
emmake make
|
||||
|
|
|
@ -15,8 +15,11 @@ extern "C" {
|
|||
OpusHandle* codec_opus_createNativeHandle(size_t channelCount) {
|
||||
printf("inizalisized (%d)!\n", channelCount);
|
||||
auto codec = new OpusHandle;
|
||||
codec->decoder = opus_decoder_create(48000, channelCount, nullptr);
|
||||
codec->encoder = opus_encoder_create(48000, channelCount, OPUS_APPLICATION_AUDIO, nullptr);
|
||||
int error = 0;
|
||||
codec->decoder = opus_decoder_create(48000, channelCount, &error);
|
||||
printf("Status %d\n", error);
|
||||
codec->encoder = opus_encoder_create(48000, channelCount, OPUS_APPLICATION_AUDIO, &error);
|
||||
printf("Status %d\n", error);
|
||||
return codec;
|
||||
}
|
||||
|
||||
|
@ -36,9 +39,6 @@ extern "C" {
|
|||
EMSCRIPTEN_KEEPALIVE
|
||||
int codec_opus_encode(OpusHandle* handle, uint8_t* buffer, size_t length, size_t maxLength) {
|
||||
printf("codec_opus_encode(%p,%p,%d, %d)\n", handle->encoder, (void*) buffer, length, maxLength);
|
||||
float bbuffer[960];
|
||||
uint8_t rbuffer[120];
|
||||
return opus_encode_float(handle->encoder, bbuffer, 960, rbuffer, 120);
|
||||
auto result = opus_encode_float(handle->encoder, (float*) buffer, length / handle->channelCount, buffer, maxLength);
|
||||
if(result < 0) return result;
|
||||
return result;
|
||||
|
|
|
@ -1,5 +1,46 @@
|
|||
class SampleBuffer {
|
||||
constructor(buffer) {
|
||||
this.buffer = buffer;
|
||||
this.index = 0;
|
||||
}
|
||||
}
|
||||
class Codec {
|
||||
constructor() { }
|
||||
constructor() {
|
||||
this.on_encoded_data = ($) => { };
|
||||
this._sampleBuffer = [];
|
||||
this.sampleRate = 120;
|
||||
}
|
||||
bufferedSamples(max = 0) {
|
||||
let value = 0;
|
||||
for (let i = 0; i < this._sampleBuffer.length && value < max; i++)
|
||||
value += this._sampleBuffer[i].buffer.length - this._sampleBuffer[i].index;
|
||||
console.log(value + " / " + max);
|
||||
return value;
|
||||
}
|
||||
encodeSamples(array) {
|
||||
console.log("encode");
|
||||
this._sampleBuffer.push(new SampleBuffer(array));
|
||||
while (this.bufferedSamples(this.sampleRate) >= this.sampleRate) {
|
||||
let buffer = new Float32Array(this.sampleRate);
|
||||
let index = 0;
|
||||
while (index < this.sampleRate) {
|
||||
let buf = this._sampleBuffer[0];
|
||||
let len = Math.min(buf.buffer.length - buf.index, this.sampleRate - index);
|
||||
buffer.set(buf.buffer.subarray(buf.index, buf.index + len));
|
||||
index += len;
|
||||
buf.index += len;
|
||||
console.log(buf.index + " - " + buf.buffer.length);
|
||||
if (buf.index == buf.buffer.length)
|
||||
this._sampleBuffer.pop_front();
|
||||
}
|
||||
let result = this.encode(buffer);
|
||||
if (result instanceof Uint8Array)
|
||||
this.on_encoded_data(result);
|
||||
else
|
||||
return result;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
class OpusCodec extends Codec {
|
||||
constructor() {
|
||||
|
@ -27,29 +68,20 @@ class OpusCodec extends Codec {
|
|||
Module._free(buffer);
|
||||
return "invalid result on decode (" + result + ")";
|
||||
}
|
||||
let buf = Module.HEAPF32.slice(heapBytes.byteOffset / 4, (heapBytes.byteOffset / 4) + (result * 4 * this.channelCount));
|
||||
let buf = Module.HEAPF32.slice(heapBytes.byteOffset / 4, (heapBytes.byteOffset / 4) + (result * this.channelCount));
|
||||
Module._free(buffer);
|
||||
return buf;
|
||||
}
|
||||
encode(data) {
|
||||
this.encoderBufferLength = this.encoderSamplesPerChannel * this.config.numberOfChannels;
|
||||
this.encoderBufferPointer = this._malloc(this.encoderBufferLength * 4); // 4 bytes per sample
|
||||
this.encoderBuffer = this.HEAPF32.subarray(this.encoderBufferPointer >> 2, (this.encoderBufferPointer >> 2) + this.encoderBufferLength);
|
||||
this.encoderOutputMaxLength = 4000;
|
||||
this.encoderOutputPointer = this._malloc(this.encoderOutputMaxLength);
|
||||
this.encoderOutputBuffer = this.HEAPU8.subarray(this.encoderOutputPointer, this.encoderOutputPointer + this.encoderOutputMaxLength);
|
||||
Module.HEAP8.subarray(2, 3, 4);
|
||||
let maxBytes = 4096 * 1 + 4;
|
||||
let maxBytes = data.byteLength;
|
||||
let buffer = Module._malloc(maxBytes);
|
||||
console.log("X");
|
||||
let heapBytes = new Uint8Array(Module.HEAPU8.buffer, buffer, maxBytes);
|
||||
//heapBytes.set(data);
|
||||
let result = this.fn_encode(this.nativeHandle, heapBytes.byteOffset, 960, maxBytes);
|
||||
heapBytes.set(new Uint8Array(data.buffer));
|
||||
let result = this.fn_encode(this.nativeHandle, heapBytes.byteOffset, data.length, maxBytes);
|
||||
if (result < 0) {
|
||||
Module._free(buffer);
|
||||
return "invalid result on encode (" + result + ")";
|
||||
}
|
||||
console.log("Bytes: " + result);
|
||||
let buf = Module.HEAP8.slice(heapBytes.byteOffset, heapBytes.byteOffset + result);
|
||||
Module._free(buffer);
|
||||
return Uint8Array.from(buf);
|
||||
|
|
|
@ -1 +1 @@
|
|||
{"version":3,"file":"Codec.js","sourceRoot":"","sources":["Codec.ts"],"names":[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AAI,UAAU,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,GAAG,EAAE,QAAQ,CAAC,CAAC;QACpE,SAAS,CAAC,GAAG,CAAC,IAAI,UAAU,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC;QACjD,MAAM,CAAC,SAAS,CAAC;IACrB,CAAC;CACJ"}
|
|
@ -1,4 +1,19 @@
|
|||
class SampleBuffer {
|
||||
buffer: Float32Array;
|
||||
index: number;
|
||||
|
||||
constructor(buffer) {
|
||||
this.buffer = buffer;
|
||||
this.index = 0;
|
||||
}
|
||||
}
|
||||
|
||||
abstract class Codec {
|
||||
on_encoded_data: (Uint8Array) => void = ($) => {};
|
||||
|
||||
protected _sampleBuffer: SampleBuffer[] = [];
|
||||
sampleRate: number = 120;
|
||||
|
||||
constructor(){}
|
||||
|
||||
abstract name() : string;
|
||||
|
@ -7,7 +22,41 @@ abstract class Codec {
|
|||
|
||||
|
||||
abstract decode(data: Uint8Array) : Float32Array | string;
|
||||
abstract encode(data: Float32Array) : Uint8Array | string;
|
||||
|
||||
protected abstract encode(data: Float32Array) : Uint8Array | string;
|
||||
|
||||
protected bufferedSamples(max: number = 0) : number {
|
||||
let value = 0;
|
||||
for(let i = 0; i < this._sampleBuffer.length && value < max; i++)
|
||||
value += this._sampleBuffer[i].buffer.length - this._sampleBuffer[i].index;
|
||||
console.log(value + " / " + max);
|
||||
return value;
|
||||
}
|
||||
|
||||
encodeSamples(array: Float32Array) : boolean | string {
|
||||
console.log("encode");
|
||||
this._sampleBuffer.push(new SampleBuffer(array));
|
||||
|
||||
while(this.bufferedSamples(this.sampleRate) >= this.sampleRate) {
|
||||
let buffer = new Float32Array(this.sampleRate);
|
||||
let index = 0;
|
||||
while(index < this.sampleRate) {
|
||||
let buf = this._sampleBuffer[0];
|
||||
let len = Math.min(buf.buffer.length - buf.index, this.sampleRate - index);
|
||||
buffer.set(buf.buffer.subarray(buf.index, buf.index + len));
|
||||
index += len;
|
||||
buf.index += len;
|
||||
console.log(buf.index + " - " + buf.buffer.length);
|
||||
if(buf.index == buf.buffer.length)
|
||||
this._sampleBuffer.pop_front();
|
||||
}
|
||||
|
||||
let result = this.encode(buffer);
|
||||
if(result instanceof Uint8Array) this.on_encoded_data(result);
|
||||
else return result;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
class OpusCodec extends Codec {
|
||||
|
@ -48,32 +97,21 @@ class OpusCodec extends Codec {
|
|||
Module._free(buffer);
|
||||
return "invalid result on decode (" + result + ")";
|
||||
}
|
||||
let buf = Module.HEAPF32.slice(heapBytes.byteOffset / 4, (heapBytes.byteOffset / 4) + (result * 4 * this.channelCount));
|
||||
let buf = Module.HEAPF32.slice(heapBytes.byteOffset / 4, (heapBytes.byteOffset / 4) + (result * this.channelCount));
|
||||
Module._free(buffer);
|
||||
return buf;
|
||||
}
|
||||
|
||||
encode(data: Float32Array): Uint8Array | string {
|
||||
this.encoderBufferLength = this.encoderSamplesPerChannel * this.config.numberOfChannels;
|
||||
this.encoderBufferPointer = this._malloc( this.encoderBufferLength * 4 ); // 4 bytes per sample
|
||||
this.encoderBuffer = this.HEAPF32.subarray( this.encoderBufferPointer >> 2, (this.encoderBufferPointer >> 2) + this.encoderBufferLength );
|
||||
|
||||
this.encoderOutputMaxLength = 4000;
|
||||
this.encoderOutputPointer = this._malloc( this.encoderOutputMaxLength );
|
||||
this.encoderOutputBuffer = this.HEAPU8.subarray( this.encoderOutputPointer, this.encoderOutputPointer + this.encoderOutputMaxLength );
|
||||
|
||||
Module.HEAP8.subarray(2, 3, 4);
|
||||
let maxBytes = 4096 * 1 + 4;
|
||||
let maxBytes = data.byteLength;
|
||||
let buffer = Module._malloc(maxBytes);
|
||||
console.log("X");
|
||||
let heapBytes = new Uint8Array(Module.HEAPU8.buffer, buffer, maxBytes);
|
||||
//heapBytes.set(data);
|
||||
let result = this.fn_encode(this.nativeHandle, heapBytes.byteOffset, 960, maxBytes);
|
||||
heapBytes.set(new Uint8Array(data.buffer));
|
||||
let result = this.fn_encode(this.nativeHandle, heapBytes.byteOffset, data.length, maxBytes);
|
||||
if(result < 0) {
|
||||
Module._free(buffer);
|
||||
return "invalid result on encode (" + result + ")";
|
||||
}
|
||||
console.log("Bytes: " + result);
|
||||
let buf = Module.HEAP8.slice(heapBytes.byteOffset, heapBytes.byteOffset + result);
|
||||
Module._free(buffer);
|
||||
return Uint8Array.from(buf);
|
||||
|
|
70
js/voice.js
70
js/voice.js
|
@ -6,6 +6,12 @@ class VoiceConnection {
|
|||
this.voiceRecorder.on_data = data => this.sendPCMData(data);
|
||||
this.codec = new OpusCodec();
|
||||
this.codec.initialise();
|
||||
this.codec.on_encoded_data = buffer => {
|
||||
if (this.dataChannel) {
|
||||
console.log("Send buffer");
|
||||
this.dataChannel.send(buffer);
|
||||
}
|
||||
};
|
||||
}
|
||||
createSession() {
|
||||
const config = {};
|
||||
|
@ -75,17 +81,11 @@ class VoiceConnection {
|
|||
console.log("Invalid decode " + result);
|
||||
}
|
||||
sendPCMData(data) {
|
||||
console.log("SEND DATA!");
|
||||
//console.log(data);
|
||||
//FIXME just for debug
|
||||
if (this.dataChannel) {
|
||||
console.log("XXX");
|
||||
let enbcoded = this.codec.encode(data);
|
||||
if (enbcoded instanceof Uint8Array)
|
||||
this.dataChannel.send(enbcoded);
|
||||
else
|
||||
console.log("Invalid decode " + enbcoded);
|
||||
}
|
||||
/*
|
||||
let result = this.codec.encodeSamples(data);
|
||||
if(!result) console.error("Could not encode audio: " + result);
|
||||
*/
|
||||
this.client.getClient().getAudioController().play(data);
|
||||
}
|
||||
}
|
||||
class VoiceRecorder {
|
||||
|
@ -158,13 +158,8 @@ VoiceRecorder.CHANNEL = 0;
|
|||
VoiceRecorder.CHANNELS = 1;
|
||||
VoiceRecorder.BUFFER_SIZE = 4096;
|
||||
class AudioController {
|
||||
static get globalContext() {
|
||||
if (this._globalContext)
|
||||
return this._globalContext;
|
||||
this._globalContext = new AudioContext();
|
||||
return this._globalContext;
|
||||
}
|
||||
constructor() {
|
||||
this.resambler = new Resampler();
|
||||
this.speakerContext = AudioController.globalContext;
|
||||
this.nextTime = 0;
|
||||
this.last = 0;
|
||||
|
@ -174,9 +169,23 @@ class AudioController {
|
|||
this.onSpeaking = function () { };
|
||||
this.onSilence = function () { };
|
||||
}
|
||||
static get globalContext() {
|
||||
if (this._globalContext)
|
||||
return this._globalContext;
|
||||
this._globalContext = new AudioContext();
|
||||
return this._globalContext;
|
||||
}
|
||||
play(pcm) {
|
||||
let buffer = this.speakerContext.createBuffer(1, 960, 48000);
|
||||
buffer.copyToChannel(pcm, 0);
|
||||
//let buffer = this.speakerContext.createBuffer(1, 960, 48000);
|
||||
//buffer.copyToChannel(pcm, 0);
|
||||
this.resambler.resample(pcm, (buffer) => this.play0(buffer));
|
||||
//this.play0(buffer);
|
||||
}
|
||||
play0(buffer) {
|
||||
//960
|
||||
console.log(buffer);
|
||||
//let buffer = this.speakerContext.createBuffer(1, 960, 44100);
|
||||
//buffer.copyToChannel(pcm, 0);
|
||||
this.audioCache.push(buffer);
|
||||
let currentTime = new Date().getTime();
|
||||
if ((currentTime - this.last) > 50) {
|
||||
|
@ -224,4 +233,27 @@ class AudioController {
|
|||
clearTimeout(this.stimeout);
|
||||
}
|
||||
}
|
||||
class Resampler {
|
||||
constructor() {
|
||||
}
|
||||
resample(pcm, callback) {
|
||||
/*
|
||||
let buffer = AudioController.globalContext.createBuffer(1, pcm.length, 48000);
|
||||
buffer.copyToChannel(pcm, 0);
|
||||
callback(buffer);
|
||||
*/
|
||||
this.context = new OfflineAudioContext(1, 882, 44100);
|
||||
let buffer = this.context.createBuffer(1, pcm.length, 48000);
|
||||
buffer.copyToChannel(pcm, 0);
|
||||
let source = this.context.createBufferSource();
|
||||
source.buffer = buffer;
|
||||
source.connect(this.context.destination);
|
||||
source.start(0);
|
||||
//console.log(source.buffer.getChannelData(0));
|
||||
this.context.startRendering().then(e => callback(e)).catch(error => {
|
||||
console.error("Could not resample audio");
|
||||
console.error(error);
|
||||
});
|
||||
}
|
||||
}
|
||||
//# sourceMappingURL=voice.js.map
|
File diff suppressed because one or more lines are too long
69
js/voice.ts
69
js/voice.ts
|
@ -8,7 +8,7 @@ class VoiceConnection {
|
|||
voiceRecorder: VoiceRecorder;
|
||||
start: number;
|
||||
|
||||
codec: OpusCodec;
|
||||
codec: Codec;
|
||||
|
||||
constructor(client) {
|
||||
this.client = client;
|
||||
|
@ -16,6 +16,12 @@ class VoiceConnection {
|
|||
this.voiceRecorder.on_data = data => this.sendPCMData(data);
|
||||
this.codec = new OpusCodec();
|
||||
this.codec.initialise();
|
||||
this.codec.on_encoded_data = buffer => {
|
||||
if(this.dataChannel) {
|
||||
console.log("Send buffer");
|
||||
this.dataChannel.send(buffer);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
|
@ -96,17 +102,11 @@ class VoiceConnection {
|
|||
}
|
||||
|
||||
private sendPCMData(data: any) {
|
||||
console.log("SEND DATA!");
|
||||
//console.log(data);
|
||||
//FIXME just for debug
|
||||
if(this.dataChannel) {
|
||||
console.log("XXX");
|
||||
let enbcoded = this.codec.encode(data);
|
||||
if(enbcoded instanceof Uint8Array)
|
||||
this.dataChannel.send(enbcoded);
|
||||
else console.log("Invalid decode " + enbcoded);
|
||||
|
||||
}
|
||||
/*
|
||||
let result = this.codec.encodeSamples(data);
|
||||
if(!result) console.error("Could not encode audio: " + result);
|
||||
*/
|
||||
this.client.getClient().getAudioController().play(data);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -212,6 +212,7 @@ class AudioController {
|
|||
init: boolean;
|
||||
stimeout: NodeJS.Timer;
|
||||
|
||||
resambler: Resampler = new Resampler();
|
||||
//Events
|
||||
onSpeaking: () => void;
|
||||
onSilence: () => void;
|
||||
|
@ -229,9 +230,17 @@ class AudioController {
|
|||
}
|
||||
|
||||
play(pcm: Float32Array) {
|
||||
let buffer = this.speakerContext.createBuffer(1, 960, 48000);
|
||||
buffer.copyToChannel(pcm, 0);
|
||||
//let buffer = this.speakerContext.createBuffer(1, 960, 48000);
|
||||
//buffer.copyToChannel(pcm, 0);
|
||||
this.resambler.resample(pcm, (buffer: AudioBuffer) => this.play0(buffer));
|
||||
//this.play0(buffer);
|
||||
}
|
||||
|
||||
play0(buffer: AudioBuffer) {
|
||||
//960
|
||||
console.log(buffer);
|
||||
//let buffer = this.speakerContext.createBuffer(1, 960, 44100);
|
||||
//buffer.copyToChannel(pcm, 0);
|
||||
this.audioCache.push(buffer);
|
||||
|
||||
let currentTime = new Date().getTime();
|
||||
|
@ -258,6 +267,7 @@ class AudioController {
|
|||
while (cache.length) {
|
||||
var buffer = cache.shift();
|
||||
var source = this.speakerContext.createBufferSource();
|
||||
|
||||
source.buffer = buffer;
|
||||
source.connect(this.speakerContext.destination);
|
||||
if (this.nextTime == 0) {
|
||||
|
@ -281,4 +291,35 @@ class AudioController {
|
|||
close(){
|
||||
clearTimeout(this.stimeout);
|
||||
}
|
||||
}
|
||||
|
||||
class Resampler {
|
||||
context: OfflineAudioContext;
|
||||
|
||||
constructor(){
|
||||
}
|
||||
|
||||
resample(pcm: Float32Array, callback: (AudioBuffer) => void) {
|
||||
/*
|
||||
let buffer = AudioController.globalContext.createBuffer(1, pcm.length, 48000);
|
||||
buffer.copyToChannel(pcm, 0);
|
||||
callback(buffer);
|
||||
*/
|
||||
|
||||
this.context = new OfflineAudioContext(1, 882, 44100);
|
||||
let buffer = this.context.createBuffer(1, pcm.length, 48000);
|
||||
buffer.copyToChannel(pcm, 0);
|
||||
|
||||
let source = this.context.createBufferSource();
|
||||
source.buffer = buffer;
|
||||
source.connect(this.context.destination);
|
||||
source.start(0);
|
||||
//console.log(source.buffer.getChannelData(0));
|
||||
|
||||
this.context.startRendering().then(e => callback(e)).catch(error => {
|
||||
console.error("Could not resample audio");
|
||||
console.error(error);
|
||||
});
|
||||
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue