21 May '13 - 05:28 *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
 
   Home   Help Search Login Register  
Pages: [1]
  Reply  |  Print  
Author Topic: Microphone  (Read 575 times)
Ops2011
Posts: 41


« on: 21 Jun '11 - 08:48 »
Reply with quoteQuote

Hello again,
I want to use a microphone  Huh
What is the best and simple solution code for this, including BASS_SetDevice
I don't need recording. Just to hear my voice.
Regards,
Eduard.
Logged
radio42
Posts: 4012


« Reply #1 on: 21 Jun '11 - 09:05 »
Reply with quoteQuote

If you are on Vista/Win7 and don't even want to record from your Mic, you can control the Mic settings in your Windows system sound control panel, ie. here you can tell Windows, that you want to 'hear' your Mic on one of your default output devices.
Logged
Ops2011
Posts: 41


« Reply #2 on: 21 Jun '11 - 09:15 »
Reply with quoteQuote

Thanks,
We want to control it in my BASS application. Your solution is good but not what i need.
Microphone like a stream. Maybe recording to a NULL device.
Example: I have a Jukebox playing and by clicking a button i can speak.  "Thank you, table 5 is ready"
Through the BASS codex.
Logged
Ops2011
Posts: 41


« Reply #3 on: 21 Jun '11 - 11:43 »
Reply with quoteQuote

I don't need any sources. Only a trigger point.
Can i call or open a stream from microphone input? 
In my test application i use:
// Used by 'GetSilenceLength' en 'BASS_InputOpen'
function BAudioWrapper.StreamCreateFile(Fn: WideString; Flags: Cardinal) : HSTREAM;
Var Chan: HSTREAM;
begin
  Chan := BASS_StreamCreateFile(False, PWideChar(Fn), 0, 0, Flags); // MP3 & WAV
  If (Chan = 0) Then Chan := BASS_FLAC_StreamCreateFile(False, PWideChar(Fn), 0, 0, Flags); // FLAC & OGG
  If (Chan = 0) Then Chan := BASS_WMA_StreamCreateFile(False, PWideChar(Fn), 0, 0, Flags); // WMA
  If (Chan = 0) Then Chan := BASS_APE_StreamCreateFile(False, PWideChar(Fn), 0, 0, Flags); // APE
  If (Chan = 0) then Chan := BASS_AAC_StreamCreateFile(False, PWideChar(Fn), 0, 0, Flags); // AAC
  if (Chan = 0) then Chan := BASS_ALAC_StreamCreateFile(False, PWideChar(Fn), 0, 0, Flags); // M4A (ALAC)
  if (Chan = 0) then Chan := BASS_MP4_StreamCreateFile(False, PWideChar(Fn), 0, 0, Flags); // MP4
  ErrorRec.StreamCreate := BASS_ErrorGetCode; // Error?
  Result := Chan;
end;
So, i want to open a channel for mic?
No commercial purpose here. Code available if someone needs it.
Regards,
Eduard.
Logged
eyyYo
Posts: 6


« Reply #4 on: 21 Jun '11 - 15:45 »
Reply with quoteQuote

Use BASS_RecordInit() and BASS_RecordStart() to get the recording to a callback function. In the callback function, you push all your received audio into a stream.
HSTREAM handle = NULL;

// This gets called every time there is new data from the recording
BOOL CALLBACK MyRecordingWriter(HRECORD handle, void *buf, DWORD len, void *user)
{
    if (handle != NULL)
    {
        BASS_StreamPutData(handle, buf, len); // We put the recorded data into the play stream
    }
    return TRUE; // continue recording
}

BASS_RecordInit(-1); // Choose input device here (-1 default)
BASS_RecordStart(44100, 1, 0, &MyRecordingWriter, NULL); // Start recording here (2nd arg = 1 = mono)

BASS_Init(-1, 44100, 0, 0, NULL);  // Choose output device (-1 default)
handle = BASS_StreamCreate(44100, 1, 0, STREAMPROC_PUSH, NULL); // Create the stream that plays the stuff

This is not at all tested in any way and its probably broken, but just to give you an idea. I think you need to play the stream ( BASS_ChannelPlay(handle, false); ), also.
Logged
Ops2011
Posts: 41


« Reply #5 on: 21 Jun '11 - 16:19 »
Reply with quoteQuote

Thank you Smiley
I think that is the way If not i ask again.
Here is my test version of BASS?
Thank you Ian, ich liebe dier.
www.6letters.nl/Install.zip
Bedankt!
Logged
Pages: [1]
  Reply  |  Print  
 
Jump to:  

Powered by SMF 1.1.18 | SMF © 2013, Simple Machines