diff --git a/src/prMiniDexedCC.lpi b/src/prMiniDexedCC.lpi index 3d0b836..9edd057 100644 --- a/src/prMiniDexedCC.lpi +++ b/src/prMiniDexedCC.lpi @@ -19,7 +19,8 @@ - + + diff --git a/src/prMiniDexedCC.res b/src/prMiniDexedCC.res index d202d52..b9d249f 100644 Binary files a/src/prMiniDexedCC.res and b/src/prMiniDexedCC.res differ diff --git a/src/untMain.lfm b/src/untMain.lfm index 5d13c98..85a42d0 100644 --- a/src/untMain.lfm +++ b/src/untMain.lfm @@ -46,9 +46,9 @@ object frmMain: TfrmMain Hint = 'Drag&Drop to re-arrange'#13#10'Double-click for sending to Librarian tab' Top = 0 Width = 1510 - ActivePage = tsSDCard + ActivePage = tsLibrarian Align = alClient - TabIndex = 2 + TabIndex = 0 TabOrder = 1 object tsLibrarian: TTabSheet Caption = 'Librarian' @@ -69,9 +69,9 @@ object frmMain: TfrmMain Height = 835 Top = 0 Width = 680 - ActivePage = tsDatabase + ActivePage = tsFiles Align = alClient - TabIndex = 1 + TabIndex = 0 TabOrder = 0 object tsFiles: TTabSheet Caption = 'Files' @@ -205,16 +205,16 @@ object frmMain: TfrmMain Columns = < item Title.Caption = 'Voice' - Width = 200 + Width = 206 end item ButtonStyle = cbsPickList Title.Caption = 'Category' - Width = 200 + Width = 206 end item Title.Caption = 'Origin' - Width = 200 + Width = 206 end item ReadOnly = True @@ -239,9 +239,9 @@ object frmMain: TfrmMain OnEditingDone = sgDBEditingDone OnStartDrag = sgDBStartDrag ColWidths = ( - 200 - 200 - 200 + 206 + 206 + 206 0 50 ) @@ -13605,7 +13605,7 @@ object frmMain: TfrmMain item ReadOnly = True Title.Caption = 'Title' - Width = 100 + Width = 91 end item Alignment = taRightJustify @@ -13640,7 +13640,7 @@ object frmMain: TfrmMain Alignment = taRightJustify ReadOnly = True Title.Caption = 'Title' - Width = 100 + Width = 92 end> FixedCols = 0 FixedRows = 0 @@ -13654,12 +13654,12 @@ object frmMain: TfrmMain TabOrder = 7 OnDrawCell = sgGPIODrawCell ColWidths = ( - 100 + 91 54 20 20 54 - 100 + 92 ) Cells = ( 40 diff --git a/src/untMain.pas b/src/untMain.pas index c7d1031..e007225 100644 --- a/src/untMain.pas +++ b/src/untMain.pas @@ -1372,7 +1372,8 @@ function TfrmMain.SanitizeNames(tmp: string): string; if UTF8pos(UTF8copy(tmp, 1, 1), ('*°/\<>^?~#+-!$%&()[]`.,')) > 0 then tmp := UTF8copy(tmp, 2, UTF8Length(tmp) - 1); if cgSanitize.Checked[2] then - if UTF8pos(UTF8copy(tmp, UTF8Length(tmp), 1), ('*°/\<>^?~#+-!$%&()[]`.,')) > 0 then + if UTF8pos(UTF8copy(tmp, UTF8Length(tmp), 1), + ('*°/\<>^?~#+-!$%&()[]`.,')) > 0 then tmp := UTF8copy(tmp, 1, UTF8Length(tmp) - 1); if cgSanitize.Checked[3] then begin @@ -1903,7 +1904,11 @@ procedure TfrmMain.FormCreate(Sender: TObject); begin FMidiIn := cbMidiIn.Text; FMidiInInt := cbMidiIn.ItemIndex; - MidiInput.Open(FMidiInInt); + try + MidiInput.Open(FMidiInInt); + except + on e: Exception do PopUp('Could not open' + #13#10 + 'MIDI Input', 2); + end; FMidiIsActive := True; end; cbMidiOut.ItemIndex := cbMidiOut.Items.IndexOf(ini.ReadString('MIDIOutput', '')); @@ -1911,7 +1916,11 @@ procedure TfrmMain.FormCreate(Sender: TObject); begin FMidiOut := cbMidiOut.Text; FMidiOutInt := cbMidiOut.ItemIndex; - MidiOutput.Open(FMidiOutInt); + try + MidiOutput.Open(FMidiOutInt); + except + on e: Exception do PopUp('Could not open' + #13#10 + 'MIDI Output', 2); + end; FMidiIsActive := True; end; LastSysExOpenDir := ini.ReadString('LastSysExOpenDir', ''); @@ -2197,53 +2206,56 @@ procedure TfrmMain.OpenSysEx(aName: string); FTmpCCBank.CSetVoice(1, dxv); lbVoices.Items.Add(FTmpCCBank.CGetVoiceName(1)); dxv.Free; - end; - - i := 0; //read from the begining of the stream again - if ContainsDX7BankDump(dmp, i, j) then - begin - lbVoices.Items.Clear; - FTmpCCBank.CLoadVoiceBankFromStream(dmp, j); - for nr := 1 to 32 do - begin - lbVoices.Items.Add(FTmpCCBank.CGetVoiceName(nr)); - end; - //k := dmp.Position; - k := 0; // got files where AMEM comes before VMEM - i := k; - if ContainsDX7IISupplBankDump(dmp, i, j) then - FTmpCCBank.CLoadSupplBankFromStream(dmp, j) - else - FTmpCCBank.CInitSuppl; - //i := k; - i := 0; // if PMEM is before VMEM in file - if ContainsTX7FunctBankDump(dmp, i, j) then - FTmpCCBank.CLoadFunctBankFromStream(dmp, j) - else - FTmpCCBank.CInitFunct; end else begin - mmLog.Lines.Add('Not a valid DX SysEx'); - feedback := ''; - if RepairDX7SysEx(aName, feedback) then + + i := 0; //read from the begining of the stream again + if ContainsDX7BankDump(dmp, i, j) then begin - FillFilesList(edbtSelSysExDir.Text); - mmLog.Lines.Add(feedback); - mmLog.Lines.Add('Reparation: It is maybe a DX7 VMEM file'); - Inc(lastClickedFile); + lbVoices.Items.Clear; + FTmpCCBank.CLoadVoiceBankFromStream(dmp, j); + for nr := 1 to 32 do + begin + lbVoices.Items.Add(FTmpCCBank.CGetVoiceName(nr)); + end; + //k := dmp.Position; + k := 0; // got files where AMEM comes before VMEM + i := k; + if ContainsDX7IISupplBankDump(dmp, i, j) then + FTmpCCBank.CLoadSupplBankFromStream(dmp, j) + else + FTmpCCBank.CInitSuppl; + //i := k; + i := 0; // if PMEM is before VMEM in file + if ContainsTX7FunctBankDump(dmp, i, j) then + FTmpCCBank.CLoadFunctBankFromStream(dmp, j) + else + FTmpCCBank.CInitFunct; end else begin - mmLog.Lines.Add(feedback); - mmLog.Lines.Add('Could not repair'); + mmLog.Lines.Add('Not a valid DX7 Bank SysEx'); + feedback := ''; + if RepairDX7SysEx(aName, feedback) then + begin + FillFilesList(edbtSelSysExDir.Text); + mmLog.Lines.Add(feedback); + mmLog.Lines.Add('Reparation: It is maybe a DX7 VMEM file'); + Inc(lastClickedFile); + end + else + begin + mmLog.Lines.Add(feedback); + mmLog.Lines.Add('Could not repair'); + end; end; end; end else begin //mmLog.Lines.Clear; - mmLog.Lines.Add('Not a valid DX SysEx'); + mmLog.Lines.Add('Not a valid DX7 SysEx'); feedback := ''; if RepairDX7SysEx(aName, feedback) then begin @@ -2833,7 +2845,9 @@ procedure TfrmMain.sgDBBeforeSelection(Sender: TObject; aCol, aRow: integer); Unused(aCol); for c := 0 to 3 do begin - compArray[c] := sgDB.Cells[c, aRow]; + if aRow < sgDB.RowCount then + //sometimes aRow is greater than the row count + compArray[c] := sgDB.Cells[c, aRow]; end; end; diff --git a/units/untDX7Voice.pas b/units/untDX7Voice.pas index ae0c688..8bc8405 100644 --- a/units/untDX7Voice.pas +++ b/units/untDX7Voice.pas @@ -359,6 +359,7 @@ TDX7VoiceContainer = class(TPersistent) function Add_VCED_ToStream(var aStream: TMemoryStream): boolean; function GetChecksumPart: integer; function GetChecksum: integer; + function GetVCEDChecksum: byte; procedure SysExVoiceToStream(aCh: integer; var aStream: TMemoryStream); function CalculateHash: string; end; @@ -895,6 +896,22 @@ function TDX7VoiceContainer.GetChecksum: integer; end; end; +function TDX7VoiceContainer.GetVCEDChecksum: byte; +var + checksum: integer; + i: integer; + tmpStream: TMemoryStream; +begin + checksum := 0; + tmpStream := TMemoryStream.Create; + Save_VCED_ToStream(tmpStream); + tmpStream.Position := 0; + for i := 0 to 154 do + checksum := checksum + tmpStream.ReadByte; + Result := ((not (checksum and 255)) and 127) + 1; + tmpStream.Free; +end; + procedure TDX7VoiceContainer.SysExVoiceToStream(aCh: integer; var aStream: TMemoryStream); var FCh: byte; @@ -909,7 +926,7 @@ procedure TDX7VoiceContainer.SysExVoiceToStream(aCh: integer; var aStream: TMemo aStream.WriteByte($01); aStream.WriteByte($1B); Add_VCED_ToStream(aStream); - aStream.WriteByte(GetChecksum); + aStream.WriteByte(GetVCEDChecksum); aStream.WriteByte($F7); end;