Author Topic: Re: microphone example with C#?  (Read 166 times)

coder1448

  • Posts: 2
Re: microphone example with C#?
« on: 13 May '19 - 17:30 »
Help please microphone to progressbar value change example code

Ian @ un4seen

  • Administrator
  • Posts: 21861
Re: microphone example with C#?
« Reply #1 on: 14 May '19 - 12:43 »
Please do not post the same question in multiple threads (I have removed your other posts).

Do you want to monitor the level of a recording device? If so, you would use BASS_RecordInit and BASS_RecordStart to start the recording and BASS_ChannelGetLevel(Ex) to get the level of it. I am not a .Net user myself, so I cannot advise on the specifics of that but the BASS function calls would look something like this:

Code: [Select]
BASS_RecordInit(device); // initalize recording device
recording = BASS_RecordStart(44100, 1, 0, RecordProc, NULL); // start recording

...

BOOL CALLBACK RecordProc(HRECORD handle, const void *buffer, DWORD length, void *user)
{
return TRUE; // continue recording
}

...

// get a mono level
float level[1];
BASS_ChannelGetLevelEx(recording, level, 0.05, BASS_LEVEL_MONO);
// display "level" here, eg. in your progress bar

Please see the documentation for details on the mentioned functions. Also see the "Callbacks and Delegates" section of the "Interoperating with Unmanaged Code" page in the BASS.Net documentation.