Author Topic: How can I know which devices I can use for recording ?  (Read 148 times)

scarboni

  • Posts: 43
I'm trying to add the possibility to change the recording device on my app.
http://www.un4seen.com/doc/#bass/BASS_RecordSetDevice.html
This function seems to work fine, but, the info I'm getting from BASS_RecordGetDeviceInfo doesn't make enough sense to me. I know there is a flag for microphone, but, It seems that headphone with mic are treated differently, as well as handset, and, I'm not sure I'm doing what I should to identify input devices.
Here is my code to get recording devices

Code: [Select]
    let a = 0;
    let devices = [];

    let info = BASS_DEVICEINFO();
    for (a = 0; BASS_RecordGetDeviceInfo(a, info.ref()); a++)
      if (
        info.flags &
          BASS_DEVICEINFOflags.BASS_DEVICE_ENABLED &&
        ((info.flags &
          BASS_DEVICEINFOflags.BASS_DEVICE_TYPE_MASK) ==
          BASS_DEVICEINFOflags.BASS_DEVICE_TYPE_MICROPHONE ||
          (info.flags &
            BASS_DEVICEINFOflags.BASS_DEVICE_TYPE_MASK) ==
            BASS_DEVICEINFOflags.BASS_DEVICE_TYPE_HANDSET ||
          (info.flags &
            objBass.BASS_DEVICEINFOflags.BASS_DEVICE_TYPE_MASK) ==
            objBass.BASS_DEVICEINFOflags.BASS_DEVICE_TYPE_HEADSET)
      ) {
        console.log(info.name, info.flags);
        devices.push({ info: info, id: a });
        info = BASS_DEVICEINFO();
      }
    return devices;

The current result that I'm getting right now with this, is a microphone (the default one, which works fine), and twice my bluetooth handset. I think I get the recording part and the speaker part, since, I can change the mic to one of those option and it kind of work (can't hear anything by my headphone speaker, but the sound is recorded), but the other seems to be failing.

I want to be able to set any recording option instead of default.

Thank you !
« Last Edit: 14 Apr '21 - 09:44 by scarboni »

Ian @ un4seen

  • Administrator
  • Posts: 23550
The current result that I'm getting right now with this, is a microphone (the default one, which works fine), and twice my bluetooth handset. I think I get the recording part and the speaker part...

Yes, the 2nd bluetooth handset is probably a "loopback" device that captures the speaker part. If wanted, you can exclude that from your device list by checking for the BASS_DEVICE_LOOPBACK flag, ie. ignore the device if that is set. Alternatively, if you will never want to record from loopback devices then you can disable them via the BASS_CONFIG_REC_LOOPBACK option:

Code: [Select]
BASS_SetConfig(BASS_CONFIG_REC_LOOPBACK, 0);

Note that needs to be done first thing, before any device enumeration/initialization.

scarboni

  • Posts: 43
Hello !

Ok thank you, I took this one out. But, there is still another issue, when I choose the mic from my headset, I can't hear what i'm playing anymore. It does play, but goes into oblivion. If I record what I play and what Is say, I get the recording right.
But, I can't hear what i'm playing from my speaker's headset.

But still, there is sound in my speaker's headset, it's like i'm hearing exactly what my mic is capturing in real time, not the replayed version of what i'm recording, I have no idea why.

Ian @ un4seen

  • Administrator
  • Posts: 23550
If I understand correctly, you don't hear anything from the headset's speakers when you record from its microphone? If so, that seems strange. Is it only your app's sound that isn't heard, ie. if you play sound in another app at the same time then you do hear that?

scarboni

  • Posts: 43
No, it suddenly blocks out all my computer sound.
And just before switching microphone, I have all my computer sound playing on my headset speaker.
After switching to the mic on my headset, it still works fine. The issue occurs as soon as I'm starting to record from that mic.

My headset is an active sound suppressing device, there is microphone to capture the voice, and other to capture outside sound, like wind and other annoying stuff.
It then use the detected annoying sound, to suppress it from the speaker sound, to leave us with a feeling of not hearing all those interférences.

I don't have other headset with microphone to test this with, but, maybe for some reason, the particularity of my headset is causing issue ?

Ian @ un4seen

  • Administrator
  • Posts: 23550
That's strange. I don't think BASS is doing anything special to cause that. If you try recording from the headset's mic in other software, do you have the same problem?

One thing you could try is enabling WASAPI recording (instead of DirectSound) via the BASS_CONFIG_REC_WASAPI option:

Code: [Select]
BASS_SetConfig(BASS_CONFIG_REC_WASAPI, 1);

scarboni

  • Posts: 43
Hello !

thank you for your input !

Yes, it was actually my headset that must be doing it... I didn't realize it earlier.

I will try the wasapi then. Thank you !