Autor Beitrag
Bergmann89
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 1742
Erhaltene Danke: 72

Win7 x64, Ubuntu 11.10
Delphi 7 Personal, Lazarus/FPC 2.2.4, C, C++, C# (Visual Studio 2010), PHP, Java (Netbeans, Eclipse)
BeitragVerfasst: So 19.09.10 12:01 
Hey,

ich versuch grad nen Mitschnitt der aktuellen Stereo-Soundausgabe unter Windows 7 zu machen. Aber die bass.dll findet keine Aufnahme-Geräte. Unter Windows XP hatte man dann sowas wie Mono, Stereo, Mikrofon, Modem, ... Bei Win7 findet er gar nix. Gibts noch ne andere Möglichkeit den aktuellen Sound aufzunehmen?

MfG Bergmann

_________________
Ich weiß nicht viel, lern aber dafür umso schneller^^
Wishmaster
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 34



BeitragVerfasst: Do 23.09.10 08:08 
Here is a new BASSWASAPI add-on, making it possible to use WASAPI output and input (available on Windows Vista and beyond) with BASS. Both exclusive and shared modes are supported, as are both output and input devices, as well as "loopback" devices (which capture the sound from output devices).

www.un4seen.com/stuff/basswasapi.zip



or


The loopback recording feature is disabled by default, but can be enabled via the following config option...

#define BASS_CONFIG_REC_LOOPBACK 28



That should be done first thing, before calling any output/recording functions. The loopback devices can be identified by the following BASS_DEVICEINFO flag...

#define BASS_DEVICE_LOOPBACK 8



www.un4seen.com/foru...16.msg60868#msg60868
Bergmann89 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 1742
Erhaltene Danke: 72

Win7 x64, Ubuntu 11.10
Delphi 7 Personal, Lazarus/FPC 2.2.4, C, C++, C# (Visual Studio 2010), PHP, Java (Netbeans, Eclipse)
BeitragVerfasst: Do 23.09.10 19:13 
Hey,

thx. Now i can list all Devices, but i can't get the FFTData. Here is the Code i use for:
ausblenden volle Höhe Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
function RecordCallback(Buffer: Pointer; Length: Cardinal; User: Pointer): Boolean;
begin
  result := false;
end;

//[...]

  //INIT
  Dev := 0;
  InputDevCB.Items.Clear;
  while BASS_WASAPI_GetDeviceInfo(Dev, DevInfo) do begin
    inc(Dev);
    InputDevCB.Items.Add(IntToStr(Dev) + ': ' + DevInfo.name);
  end;
  InputDevCB.Text  := 'Please choose InputDevCB';
 
//[...]

  //CHOOSE DEVICE
  InputDev := InputDevCB.ItemIndex;
  BASS_WASAPI_Free;

  if not BASS_WASAPI_Init(InputDev, 00, BASS_WASAPI_BUFFER, 00, @RecordCallback, @Error) then begin
    Error := BASS_ErrorGetCode;
    case error of
      BASS_ERROR_WASAPI: ShowMessage('WASAPI is not available.');
      BASS_ERROR_DEVICE: ShowMessage('device is invalid.');
      BASS_ERROR_ALREADY: ShowMessage('The device has already been initialized. BASS_WASAPI_Free must be called before it can be initialized again.');
      BASS_ERROR_ILLPARAM: ShowMessage('A WASAPIPROC must be provided for an input device.');
      BASS_ERROR_DRIVER: ShowMessage('The driver could not be initialized.');
      BASS_ERROR_FORMAT: ShowMessage('The specified format is not supported by the device. If the BASS_WASAPI_AUTOFORMAT flag was specified, no other format could be found either.');
      BASS_ERROR_BUSY: ShowMessage('The device is already in use, eg. another process may have initialized it in exclusive mode.');
      BASS_ERROR_INIT: ShowMessage('The BASS "no sound" device has not been initialized.');
    else
      ShowMessage('Some other mystery problem!');
    end;
  end;  

//[...]

  //GET DATA  
  Level := BASS_WASAPI_GetDeviceLevel(InputDev, -1);

  if BASS_WASAPI_GetData(@FFTData, BASS_DATA_FFT512) = -1 then begin
    Error := BASS_ErrorGetCode;
    case Error of
      BASS_ERROR_INIT: ShowMessage('BASS_WASAPI_Init has not been successfully called.');
      BASS_ERROR_NOTAVAIL: ShowMessage('The BASS_WASAPI_BUFFER flag was not specified in the device''s initialization.');
    else
      ShowMessage('Some other mystery problem!');
    end;
  end;
  PaintBox1.Repaint;


Each Element in the FFTData-Array is 0, but the Level-Variable have the right Value?! There also is no Error-Message...

MfG Bergmann

_________________
Ich weiß nicht viel, lern aber dafür umso schneller^^
Bergmann89 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 1742
Erhaltene Danke: 72

Win7 x64, Ubuntu 11.10
Delphi 7 Personal, Lazarus/FPC 2.2.4, C, C++, C# (Visual Studio 2010), PHP, Java (Netbeans, Eclipse)
BeitragVerfasst: Fr 24.09.10 03:35 
Hey,

ich habs hin bekommen, leider steh ich jetz vor dem nächsten Problem. Und zwar hab ich mit einen Stream erstellt, der die aufgenommen Daten dann wiedergeben soll:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
  if not BASS_Init(OutputDev, 44100, BASS_DEVICE_SPEAKERS, Handle, nilthen
    LogError('OutputDevCBChange.BASS_Init')
  else begin
    OutStreams[STREAM_FRONT] :=
      BASS_StreamCreate(441001, BASS_SAMPLE_FLOAT or BASS_SPEAKER_FRONT, STREAMPROC_PUSH, nil);
    if OutStreams[STREAM_FRONT] <= 0 then
      LogError('OutputDevCBChange.[STREAM_FRONT].BASS_StreamCreate')
    else
      if not BASS_ChannelPlay(OutStreams[STREAM_FRONT], True) then
        LogError('OutputDevCBChange.[STREAM_FRONT].BASS_ChannelPlay');
Nun wollte ich die Daten in der CallbackProzedur des AufnahmeStreams auf den WiedergabeStream kopieren:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
function RecordCallback(Buffer: Pointer; Length: DWord; User: Pointer): DWord;
var
  written: Cardinal;
begin
  result := 1;
  if Length = 0 then
    exit;

  writeln(' read: '+IntToStr(length));
  with Form1 do begin
    if (OutStreams[STREAM_REAR] > 0and
        EnableRearCB.Checked then begin
      written := BASS_StreamPutData(OutStreams[STREAM_REAR], Buffer, Length);
      writeln('write: '+IntToStr(written));
      if written = High(Cardinal) then
        LogError('RecordCallback.[STREAM_REAR].BASS_StreamPutData');
    end;
  end;
end;
Und hier passiert gar nix. written ist immer 0, auch wenn der Buffer Daten enthält. Fehler spuckt er auch keine aus. Wäre toll, wenn mir da nochma jmd helfen könnte.

MfG Bergmann.

_________________
Ich weiß nicht viel, lern aber dafür umso schneller^^
ALF
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 1085
Erhaltene Danke: 53

WinXP, Win7, Win10
Delphi 7 Enterprise, XE
BeitragVerfasst: Fr 24.09.10 14:08 
Bin mir nicht sicher, aber eine Änderung des Handles auf andere ein/ausgänge ohne initialisierung :gruebel:
OutStreams[STREAM_FRONT] -> OutStreams[STREAM_REAR], wenn es den das gleich Handle ist?

Ich glaube eher das Du dafür 2 Handles brauchst Recordhandle/Wiedergabehandle und dan auf den gleichen Buffer zugreifen. Wenn es überhaupt so geht(Daten müssen erst geschrieben sein bevor ich sie wieder lesen kann)

Ist aber nur eine Vermutung

Gruss ALf

_________________
Wenn jeder alles kann oder wüsste und keiner hätt' ne Frage mehr, omg, währe dieses Forum leer!
Bergmann89 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 1742
Erhaltene Danke: 72

Win7 x64, Ubuntu 11.10
Delphi 7 Personal, Lazarus/FPC 2.2.4, C, C++, C# (Visual Studio 2010), PHP, Java (Netbeans, Eclipse)
BeitragVerfasst: Fr 24.09.10 17:42 
Hey,

bei dem Addon was Wishmaster gepostet hat gibt es keine Handles/Streams. Man initialisiert das ganze Gerät. Die Handles benutz ich ausschließlich zum Abspielen. Ich habs jetz auch endlich hinbekommen^^ Mach gleich noch n Topic im Freeware-Projekte-Forum, da könnt ihr meine Arbeit bewundern xD

MfG Bergmann

_________________
Ich weiß nicht viel, lern aber dafür umso schneller^^