AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Thema durchsuchen
Ansicht
Themen-Optionen

Sound-Komponente

Ein Thema von Chegga · begonnen am 5. Sep 2005 · letzter Beitrag vom 14. Sep 2005
 
Sämy

Registriert seit: 4. Nov 2004
Ort: Basel (CH)
76 Beiträge
 
Delphi 2007 Professional
 
#5

Re: Sound-Komponente

  Alt 5. Sep 2005, 14:50
hab das mal gemacht. nicht genau so, aber kannst ja mal schauen, was du daraus brauchen kannst. (weiss nicht, ob ich dir alles kopiert habe, sonst fragst einfach nach...). ah und du brauchst noch die bass.dll und die zugehörige unit.

Delphi-Quellcode:
const
  PEEKSPERSEC = 15;
  DATALENGTH = 2048;

type
  TWaveData = array [0..DATALENGTH - 1] of DWORD;

var
  channel: DWORD;
  x: integer;
  y: integer;
  w: TWaveData;
begin
    channel := BASS_StreamCreateFile(FALSE, PChar(FSongFile), 0, 0, BASS_STREAM_DECODE);

    FSonginfo.Bytes := BASS_StreamGetLength(channel);
    FSonginfo.Seconds := BASS_ChannelBytes2Seconds(channel, FSonginfo.Bytes);

    BASS_ChannelGetInfo(channel, FSonginfo.info);
    z := FSonginfo.Info.freq div PEEKSPERSEC;

    if BASS_ChannelIsActive(Channel) = BASS_ACTIVE_PLAYING then
      SetLength(FWaveData, Ceil(FSonginfo.Seconds * PEEKSPERSEC));

    for x := 0 to High(w) do
      w[x] := 0;

    x := 0;
    y := 0;
    while BASS_ChannelIsActive(Channel) = BASS_ACTIVE_PLAYING do
    begin
      IntToStr(BASS_ChannelGetData(Channel, @w, DATALENGTH * 4));

      if ((((x + 1) * DATALENGTH) mod z) < DATALENGTH) then
      begin
        if y > High(FWaveData) then
          break;
        FWaveData[y] := w[((x + 1) * DATALENGTH) mod z];
        Inc(y);
      end;
      Inc(x);
    end;
end;
Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it.
  Mit Zitat antworten Zitat
 


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 13:23 Uhr.
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz