Author Topic: record text doesn't work ?  (Read 972 times)

terry_zhou82

  • Posts: 43
record text doesn't work ?
« on: 26 May '19 - 13:17 »
I use the exmple from the demo of recordtext . But It's doesn't work,in win10, it only record the mic voice,not the song from the player ? do u now why ?

Ian @ un4seen

  • Administrator
  • Posts: 22247
Re: record text doesn't work ?
« Reply #1 on: 27 May '19 - 13:21 »
Do you want to record the sound from your app? If so, you should set the encoder on the playback stream instead of using a recording device. If you are playing multiple streams then you can access the BASS output mix by using STREAMPROC_DEVICE in a BASS_StreamCreate call. For example:

Code: [Select]
devicestream = BASS_StreamCreate(0, 0, 0, STREAMPROC_DEVICE, NULL); // get device output stream
BASS_Encode_Start(devicestream, "output.wav", BASS_ENCODE_PCM | BASS_ENCODE_FP_16BIT | BASS_ENCODE_QUEUE, NULL, NULL); // start a 16-bit WAV writer on it

...

BASS_Encode_Stop(devicestream); // stop the WAV writer

terry_zhou82

  • Posts: 43
Re: record text doesn't work ?
« Reply #2 on: 28 May '19 - 14:16 »
can you give me the full example code ?

Ian @ un4seen

  • Administrator
  • Posts: 22247
Re: record text doesn't work ?
« Reply #3 on: 28 May '19 - 16:27 »
Please clarify what you are trying to do.

terry_zhou82

  • Posts: 43
Re: record text doesn't work ?
« Reply #4 on: 29 May '19 - 14:06 »
 use this code to play the radiostation
mp:=edit1.text;
 cthread := BeginThread(nil, 0, @OpenURL, PAnsiChar(mp), 0, ThreadId);

openurl //is play the radiostation
chan := BASS_StreamCreateURL(PWideChar(url), 0, BASS_STREAM_BLOCK  or BASS_STREAM_STATUS or BASS_STREAM_AUTOFREE, @StatusProc, nil);


//now,i want to record the voice,but use the code maybe it's wrong
chan:= BASS_StreamCreate(0, 0, 0, STREAMPROC_DEVICE, nil); // get device output stream
BASS_Encode_Start(chan, 'output.wav', BASS_ENCODE_PCM,nil, nil);


Ian @ un4seen

  • Administrator
  • Posts: 22247
Re: record text doesn't work ?
« Reply #5 on: 29 May '19 - 16:47 »
If you want to record a single stream then you can simply use its handle in the BASS_Encode_Start call (no need for the BASS_StreamCreate call with STREAMPROC_DEVICE).

Code: [Select]
chan := BASS_StreamCreateURL(PWideChar(url), 0, BASS_STREAM_BLOCK  or BASS_STREAM_STATUS or BASS_STREAM_AUTOFREE, @StatusProc, nil);
if (chan <> 0) then BASS_Encode_Start(chan, 'output.wav', BASS_ENCODE_PCM,nil, nil);

terry_zhou82

  • Posts: 43
Re: record text doesn't work ?
« Reply #6 on: 30 May '19 - 13:19 »
[DCC Error] Unit1.pas(161): E2003 Undeclared identifier: 'BASS_Encode_Start'
[DCC Error] Unit1.pas(161): E2003 Undeclared identifier: 'BASS_ENCODE_PCM'
Failed
Elapsed time: 00:00:00.9

if I omit use some dcu ??

Ian @ un4seen

  • Administrator
  • Posts: 22247
Re: record text doesn't work ?
« Reply #7 on: 30 May '19 - 13:42 »
Yes, you will need the BASSenc add-on, which you can get from the BASS webpage.

terry_zhou82

  • Posts: 43
Re: record text doesn't work ?
« Reply #8 on: 10 Jul '19 - 15:06 »
en , I copy the bassenc_mp3.pas in my code. but it's always shows
"File not found:BASSenc.dcu" what can I do ??

Ian @ un4seen

  • Administrator
  • Posts: 22247
Re: record text doesn't work ?
« Reply #9 on: 10 Jul '19 - 16:40 »
You will need the BASSENC.PAS file (and BASSENC.DLL) too, from the BASSenc package.

terry_zhou82

  • Posts: 43
Re: record text doesn't work ?
« Reply #10 on: 13 Jul '19 - 04:52 »
tks!!
but I found other question.I use the code like this
var fn:string;
 if rdfile  then
                  fn:=Form2.LabeledEdit1.Text+'\'+title5+' - '+FormatDateTime('yyyymmddhhnnss',now)
              else
                  fn:=Form2.LabeledEdit1.Text+'\'+title2+' - '+FormatDateTime('yyyymmddhhnnss',now);

              if (chan <> 0) then
              begin
                BASS_Encode_MP3_StartFile(chan, nil,BASS_ENCODE_LIMIT,PWideChar(fn)); //stop the record,I couldn't find the file???
    the funtion is char ? is it connection with it ? my filename is too long ??


I need your help!


terry_zhou82

  • Posts: 43
Re: record text doesn't work ?
« Reply #11 on: 13 Jul '19 - 05:36 »
I found the problem, ;D
Because of my operation is chinese version.So I lost add the BASS_UNICODE.....
now It's works!

Tks, administrator !!!