Registriert seit: 22. Okt 2003
Ort: Berlin
661 Beiträge
Delphi 7 Enterprise
|
Audio CD, Geschwindigkeit verändern
14. Aug 2007, 11:59
Ich bekomme es einfach nicht gebacken das Wiedergabetempo (nicht Pitch!!!) zu verändern.
Hier die relevanten Codestellen:
Delphi-Quellcode:
procedure TForm1.PlayTrack(drive, track: DWORD);
begin
if (stream[drive]) then
BASS_CD_StreamSetTrack(stream[drive],track) // already have a stream, so just set the track
else
begin
stream[drive] := BASS_CD_StreamCreate(drive, track, BASS_CD_FREEOLD); // create stream
BASS_ChannelSetSync(stream[drive], BASS_SYNC_END, 0, @EndSync, 0); // set end syc
end;
if (drive = DWORD(curdrive)) then
trkPos.Max := BASS_ChannelGetLength(stream[drive]) div 176400; // set pos scroller range
BASS_ChannelPlay(stream[drive], False); // start playing
end;
procedure TForm1.UpdateTrackList;
var
vol, spd: DWORD;
cdtext, t: PChar;
a, tc, l: Integer;
text, tag: String;
begin
tc := BASS_CD_GetTracks(curdrive);
lstTracks.Items.Clear;
if (tc = -1) then // no CD
Exit;
cdtext := BASS_CD_GetID(curdrive, BASS_CDID_TEXT); // get CD-TEXT
for a := 0 to tc - 1 do
begin
l := BASS_CD_GetTrackLength(curdrive, a);
text := Format('Track %.2d', [a + 1]);
if (cdtext <> nil) then
begin
t := cdtext;
tag := Format('TITLE%d=', [a + 1]); // the CD-TEXT tag to look for
while (t <> nil) do
begin
if (Copy(t, 1, Length(tag)) = tag) then // found the track title...
begin
text := Copy(t, Length(tag)+1, Length(t) - Length(tag)); // replace "track x" with title
Break;
end; t := t + Length(t) + 1;
end;
end;
if (l = -1) then
text := text + ' (data)'
else
begin
l := l div 176400;
text := text + Format(' (%d:%.2d)', [l div 60, l mod 60]);
end;
lstTracks.Items.Add(text)
end;
a := BASS_CD_StreamGetTrack(stream[curdrive]);
if (a <> -1) then // this drive has a stream
begin
lstTracks.ItemIndex := LOWORD(a); // select current track
trkPos.Max := BASS_ChannelGetLength(stream[curdrive]) div 176400; // set pos scroller range
end
vol := 100;
spd := 44100;
BASS_ChannelGetAttributes(stream[curdrive], spd, vol, l); // get speed & volume
trkVol.Position := 100 - vol; // set volume slider pos
trkSpeed.Position := spd div 441; // set speed slider pos
GroupBox2.Caption := Format('Speed - %d%%', [trkVol.Position]);
end;
//ab hier scheitert es
procedure TCDPlayer.Button2Click(Sender: TObject);
begin
chan2:=stream[curdrive];
BASS_FX_TempoCreate(chan2, BASS_STREAM_DECODE);
BASS_FX_TempoGetSource(chan2);
BASS_FX_TempoSet(chan2, LMDTrackBar10.Position, 44100, +100);
Label50.Caption := Format('%d %%', [LMDTrackBar10.Position]);
end;
chan2 ist vom Typ HSTREAM
|
|
Zitat
|