Einzelnen Beitrag anzeigen

Delphi.Narium

Registriert seit: 27. Nov 2017
2.433 Beiträge
 
Delphi 7 Professional
 
#13

AW: erweiterte Demo für BASSMIDI.DLL

  Alt 23. Nov 2020, 09:41
Habe mir mal etliche Midis im Hexeditor angeschaut. Als Zeilenumbruch kommt auch noch #10 in Frage (was eigentlich naheliegend ist - für die Unixwelt). Daher hab' ich meine Routine mal ein bisserl angepasst:
Delphi-Quellcode:
function ProcessMarkText(CaptionText, MarkText : string) : string;
begin
  if Length(MarkText) > 0 then begin
    case MarkText[1] of
      '@'     : Result := CaptionText;
      '\'     : Result := #13#10 + Copy(MarkText, 2, pred(Length(MarkText)));
      '/','<' : Result := CaptionText + #13#10 + Copy(MarkText, 2, Length(MarkText));
      '*'     : Result := CaptionText + #13#10 + MarkText + #13#10;
      #10 : Result := CaptionText + #13#10;
      #13 : Result := CaptionText + #13#10;
    else
      Result := CaptionText + MarkText;
    end;
  end else begin
    Result := CaptionText;
  end;
end;
Ob's damit besser wird, weiß ich nicht, hatte noch keine Zeit im Zusammenhang mit Deinem Programm zu testen. Bei meinem scheint es das Ergebnis aber etwas zu verbessern. Blöd wird es nur, wenn in 'ner Midi nun #13#10 als Zeilenvorschub geliefert wird, dann haben wir ggfls. 'ne Leerzeile zuviel.
Delphi-Quellcode:
function ProcessMarkText(CaptionText, MarkText : string) : string;
begin
  if Length(MarkText) > 0 then begin
    case MarkText[1] of
      '@'     : Result := CaptionText;
      '\'     : Result := #13#10 + Copy(MarkText, 2, pred(Length(MarkText)));
      '/','<' : Result := CaptionText + #13#10 + Copy(MarkText, 2, Length(MarkText));
      '*'     : Result := CaptionText + #13#10 + MarkText + #13#10;
      #10 : Result := CaptionText + #13#10;
      #13 : case MarkText[2] of
                  #10 : Copy(MarkText, 3, Length(MarkText) - 2);
                else
                  Result := CaptionText + #13#10;
                end;
    else
      Result := CaptionText + MarkText;
    end;
  end else begin
    Result := CaptionText;
  end;
end;
Keine Ahnung, ob's so noch besser wird (oder das Ergebnis eher kontraproduktiv ist).

Der Quelltext von venice2 hat einen anderen (dafür aber funktionierenden) Ansatz: Die Mdiddatei wird auf Texte / Lyrics geparst und diese werden dann ausgegeben. Will man "nur" an die Texte kommen, um sie zu speichern und benötigt keine zur Wiedergabe synchrone Anzeige der Texte, erscheint mir das die bessere Lösung zu sein.
  Mit Zitat antworten Zitat