]> Repos - mime-chat/commitdiff
update recorder inputs
authorEnrique Hernandez <enrique.hernandez@fii-usa.com>
Thu, 4 Feb 2021 18:34:33 +0000 (12:34 -0600)
committerEnrique Hernandez <enrique.hernandez@fii-usa.com>
Thu, 4 Feb 2021 18:34:33 +0000 (12:34 -0600)
crash.log [new file with mode: 0644]
src/background.ts
src/background/recorder.ts

diff --git a/crash.log b/crash.log
new file mode 100644 (file)
index 0000000..cfecd62
--- /dev/null
+++ b/crash.log
@@ -0,0 +1,4 @@
+PID 335844 received SIGSEGV for address: 0xc
+/home/enrique/Developer/electron-app/node_modules/segfault-handler/build/Release/segfault-handler.node(+0x37a5)[0x7f1c071387a5]
+/lib/x86_64-linux-gnu/libpthread.so.0(+0x153c0)[0x7f1c10ffa3c0]
+/home/enrique/Developer/electron-app/node_modules/electron/dist/electron dist_electron(+0x72d9550)[0x55ccd61fe550]
index d3cecd9761d3f911f6d2631d48b555bdd4c33f05..4cae5f47d96ec7869ce0101f3135fc07c7a09e58 100644 (file)
@@ -7,17 +7,19 @@ var portAudio = require('naudiodon');
 // NOTE Program Begins Here
 (async () => {
 
+    console.log(portAudio.getDevices())
     const isDevelopment = process.env.NODE_ENV !== "production";
 
-    const recorder = new Recorder({
-        channelCount: 1,
-        sampleFormat: portAudio.SampleFormat16Bit,
-        sampleRate: 16000,
-        deviceId: -1, // Use -1 or omit the deviceId to select the default device
-        closeOnError: true
-    }, 'binary');
 
     try {
+
+        const recorder = new Recorder({
+            channelCount: 1,
+            sampleFormat: 16,
+            sampleRate: 16000,
+            deviceId: 24, // Use -1 or omit the deviceId to select the default device
+            closeOnError: true
+        }, 'binary');
         // await authenticate method
         initApp(isDevelopment);
     } catch (e) {
index 36f93baf73e190c1141413903c6bafb98fad9fb0..d078585f745f4c9cfe362d0eb0896a386da3bbc3 100644 (file)
@@ -11,6 +11,14 @@ interface RecorderI {
   pause(): void;
 }
 
+type inputOptions = {
+    channelCount: number,
+    sampleFormat: number,
+    sampleRate: number,
+    deviceId: number,
+    closeOnError: boolean
+}
+
 class StringWritable extends Writable {
 
   constructor(options: {
@@ -37,15 +45,6 @@ class StringWritable extends Writable {
    }
 }
 
-type inputOptions = {clear
-
-    channelCount: number,
-    sampleFormat: string,
-    sampleRate: number,
-    deviceId: number,
-    closeOnError: boolean
-}
-
 export class Recorder implements RecorderI {
 
   private ia: any;
@@ -93,21 +92,25 @@ export class Recorder implements RecorderI {
 
   private _update = (Event: any, record: boolean) => {
       if (record) {
-          console.log('recording');
-          this.micWritable.data = '';
-          if(this.ia._readableState.paused){
-            this.resume();
-            return;
-          }
-          this.ia.pipe(this.micWritable);
-
-          console.log(this.ia._readableState.paused);
+          // check for stream status
+          console.log('recording')
+
+
+          // this.ia.pipe(this.micWritable);
       } else {
-          console.log('stop recording');
-          this.ia.unpipe(this.micWritable);
-          this.micWritable.on('finish', () => {
-              console.log('hello');
-          })
+          console.log('stop recording')
+          // unpipe
+          // this.ia.unpipe(this.micWritable);
+
+          // stop stream
+          // this.ia.quit();
+          // this.ia = null;
+
+          // get stream data
+          // this.micWritable.on('finish', () => {
+          //     console.log('finished writing data');
+          // })
+          // this.restart();
       }
   }
 }