diff --git a/game/config.ini b/game/config.ini index 9f70f30d4..d0fc89cf3 100644 --- a/game/config.ini +++ b/game/config.ini @@ -1,200 +1,216 @@ -[Game] -Players=6 -Difficulty=Easy -Language=English -Tabs=Off -SongMenu=Roulette -Sorting=Artist -ShowScores=On -Debug=Off -AVDelay=0 -MicDelay=140 - -[Graphics] -Screens=1 -Split=Off -FullScreen=Off -Visualization=Off -Resolution=1024x768 -Depth=32 bit -TextureSize=256 -Oscilloscope=On -MovieSize=Full [BG+Vid] -VideoPreview=On -VideoEnabled=On -MaxFramerate=60 -ResolutionFullscreen=1920x1080 -PositionX=0 -PositionY=0 - -[Sound] -ClickAssist=Off -BeatClick=Off -AudioOutputBufferSize=Auto -BackgroundMusic=On -PreviewVolume=70% -PreviewFading=3 Secs -SavePlayback=Off -VoicePassthrough=Off -MusicAutoGain=Off - -[Lyrics] -LyricsFont=Noto Sans -LyricsStyle=Outline -LyricsEffect=Slide -NoteLines=On -Encoding=Auto - -[Themes] -Theme=Modern -Skin=Blue -Color=Blue - -[Record] -MicBoost=+12dB -Threshold=15% -DeviceName[1]=Mikrofon (2- Realtek High Definition Audio) -Input[1]=0 -Latency[1]=-1 -Channel1[1]=1 -Channel2[1]=2 -DeviceName[2]=Mikrofon (Realtek High Definition Audio) -Input[2]=0 -Latency[2]=-1 -Channel1[2]=0 -Channel2[2]=0 -DeviceName[3]=Mikrofon (USBMIC Serial# 101113608 ) -Input[3]=0 -Latency[3]=-1 -Channel1[3]=1 -Channel2[3]=2 -DeviceName[4]=CABLE Output (VB-Audio Virtual Cable) -Input[4]=0 - -[Advanced] -LoadAnimation=On -EffectSing=On -ScreenFade=On -AskbeforeDel=On -OnSongClick=Sing -LineBonus=On -PartyPopup=On -SingScores=On -TopScores=All -SyncTo=Music -SingTimebarMode=Remaining -JukeboxTimebarMode=Current - -[Controller] -Joypad=Off -Mouse=Game - -[Directories] -WebScoresDir= -SongDir1= - -[Jukebox] -LyricsFont=Noto Sans -LyricsStyle=Outline -LyricsEffect=Slide -LyricsAlpha=0.90 -SingLineColor=FFFF00 -ActualLineColor=FFFFFF -NextLineColor=D6D6D6 -SingLineOColor=000000 -ActualLineOColor=000000 -NextLineOColor=000000 - -[Name] -P1=USDXstyle -P2=Player2 -P3=Player3 -P4=Player4 -P5=Player5 -P6=Player6 -P7=Player7 -P8=Player8 -P9=Player9 -P10=Player10 -P11=Player11 -P12=Player12 -P13= -P14= -P15= -P16= - -[NameTeam] -T1=Team1 -T2=Team2 -T3=Team3 - -[NameTemplate] -Name1=Template1 -Name2=Template2 -Name3=Template3 -Name4=Template4 -Name5=Template5 -Name6=Template6 -Name7=Template7 -Name8=Template8 -Name9=Template9 -Name10=Template10 -Name11=Template11 -Name12=Template12 - -[PlayerColor] -P1=1 -P2=4 -P3=3 -P4=2 -P5=5 -P6=6 -P7=7 -P8=8 -P9=9 -P10=10 -P11=11 -P12=12 - -[PlayerAvatar] -P1= -P2= -P3= -P4= -P5= -P6= -P7= -P8= -P9= -P10= -P11= -P12= - -[PlayerLevel] -P1=0 -P2=0 -P3=0 -P4=0 -P5=0 -P6=0 -P7=0 -P8=0 -P9=0 -P10=0 -P11=0 -P12=0 - -[Webcam] -ID=1 -Resolution=800x600 -FPS=30 -Flip=On -Brightness=0 -Saturation=0 -Hue=0 -Effect=0 - -[TeamColor] -T1=1 -T2=2 -T3=3 +[Game] +Players=1 +Difficulty=Easy +Language=English +Tabs=Off +SongMenu=List +Sorting=Artist +ShowScores=On +Debug=Off +AVDelay=0 +MicDelay=280 + +[Graphics] +Screens=1 +Split=Off +FullScreen=Off +Visualization=Off +Resolution=1600x900 +Depth=32 bit +TextureSize=256 +Oscilloscope=Off +MovieSize=Full [BG+Vid] +VideoPreview=On +VideoEnabled=On +MaxFramerate=60 +ResolutionFullscreen=1920x1080 +PositionX=0 +PositionY=0 + +[Sound] +ClickAssist=Off +BeatClick=Off +AudioOutputBufferSize=Auto +BackgroundMusic=Off +PreviewVolume=70% +PreviewFading=3 Secs +SavePlayback=Off +VoicePassthrough=Off +MusicAutoGain=Off + +[Lyrics] +LyricsFont=Noto Sans +LyricsStyle=Outline +LyricsEffect=Slide +NoteLines=On +Encoding=Auto + +[Themes] +Theme=Modern +Skin=Blue +Color=Blue + +[Record] +MicBoost=+12dB +Threshold=15% +DeviceName[1]=Mikrofon (2- Realtek High Definition Audio) +Input[1]=0 +Latency[1]=-1 +Channel1[1]=1 +Channel2[1]=2 +DeviceName[2]=Mikrofon (Realtek High Definition Audio) +Input[2]=0 +Latency[2]=-1 +DeviceName[3]=Mikrofon (USBMIC Serial# 101113608 ) +Input[3]=0 +Latency[3]=-1 +Channel1[3]=1 +Channel2[3]=2 +DeviceName[4]=CABLE Output (VB-Audio Virtual Cable) +Input[4]=0 +Latency[4]=-1 +DeviceName[5]=Analogue 1 + 2 (2- Focusrite USB Audio) +Input[5]=0 +Latency[5]=-1 +DeviceName[6]=VoiceMeeter Output (VB-Audio VoiceMeeter VAIO) +Input[6]=0 +Latency[6]=-1 +DeviceName[7]=VoiceMeeter Aux Output (VB-Audio VoiceMeeter AUX VAIO) +Input[7]=0 +Latency[7]=-1 +DeviceName[8]=Microphone (Logitech BRIO) +Input[8]=0 +Latency[8]=-1 +Channel1[8]=1 + +[Advanced] +LoadAnimation=On +EffectSing=On +ScreenFade=Off +AskbeforeDel=On +OnSongClick=Sing +LineBonus=On +PartyPopup=On +SingScores=On +TopScores=All +SyncTo=Music +SingTimebarMode=Remaining +JukeboxTimebarMode=Current + +[Controller] +Joypad=Off +Mouse=Off + +[Directories] +WebScoresDir= +SongDir1= + +[Jukebox] +LyricsFont=Noto Sans +LyricsStyle=Outline +LyricsEffect=Slide +LyricsAlpha=0.90 +SingLineColor=FFFF00 +ActualLineColor=FFFFFF +NextLineColor=D6D6D6 +SingLineOColor=000000 +ActualLineOColor=000000 +NextLineOColor=000000 + +[Name] +P1=USDXstyle +P2=Player2 +P3=Player3 +P4=Player4 +P5=Player5 +P6=Player6 +P7=Player7 +P8=Player8 +P9=Player9 +P10=Player10 +P11=Player11 +P12=Player12 +P13= +P14= +P15= +P16= + +[NameTeam] +T1=Team1 +T2=Team2 +T3=Team3 + +[NameTemplate] +Name1=Template1 +Name2=Template2 +Name3=Template3 +Name4=Template4 +Name5=Template5 +Name6=Template6 +Name7=Template7 +Name8=Template8 +Name9=Template9 +Name10=Template10 +Name11=Template11 +Name12=Template12 + +[PlayerColor] +P1=1 +P2=4 +P3=3 +P4=2 +P5=5 +P6=6 +P7=7 +P8=8 +P9=9 +P10=10 +P11=11 +P12=12 + +[PlayerAvatar] +P1= +P2= +P3= +P4= +P5= +P6= +P7= +P8= +P9= +P10= +P11= +P12= + +[PlayerLevel] +P1=0 +P2=0 +P3=0 +P4=0 +P5=0 +P6=0 +P7=0 +P8=0 +P9=0 +P10=0 +P11=0 +P12=0 + +[Webcam] +ID=1 +Resolution=800x600 +FPS=30 +Flip=On +Brightness=0 +Saturation=0 +Hue=0 +Effect=0 + +[TeamColor] +T1=1 +T2=2 +T3=3 + +[KeyBindings] +PianoKeysLow=92,97,122,115,120,100,99,118,103,98,104,110,109,107,44,108,46,59,47 +PianoKeysHigh=49,113,50,119,51,101,114,53,116,54,121,117,56,105,57,111,48,112,91,61,93 diff --git a/game/languages/English.ini b/game/languages/English.ini index 446dbde30..142c696f3 100644 --- a/game/languages/English.ini +++ b/game/languages/English.ini @@ -2113,6 +2113,7 @@ CTRL_SHIFT_4 = Paste LYRICS+NOTES over each of the next 4 lines CTRL_SHIFT_ALT_4 = Paste LYRICS+NOTES+LINE-END 4 times CTRL_SHIFT_5 = Paste LYRICS+NOTES over each of the next 5 lines CTRL_SHIFT_ALT_5 = Paste LYRICS+NOTES+LINE-END 5 times +F6 = Toggle Piano edit mode ;-------------------------------------------------------; ; ID_070: UScreenOptions ; ;-------------------------------------------------------; diff --git a/src/base/UCommon.pas b/src/base/UCommon.pas index 03f2b056e..478b43e56 100644 --- a/src/base/UCommon.pas +++ b/src/base/UCommon.pas @@ -69,11 +69,15 @@ interface function SplitString(const Str: string; MaxCount: integer = 0; Separators: TSysCharSet = SepWhitespace; RemoveEmpty: boolean = true): TStringDynArray; function StringInArray(const Value: string; Strings: array of string): Boolean; +function SplitStringToIntArray(const S: string): TArray; function StringDeleteFromArray(var InArray: TIntegerDynArray; const InIndex: integer): Boolean; overload; function StringDeleteFromArray(var InStrings: TStringDynArray; const InIndex: integer): Boolean; overload; function StringDeleteFromArray(var InStrings: TUTF8StringDynArray; const InIndex: integer): Boolean; overload; +type + TPianoKeyArray = array of Cardinal; + type TRGB = record R: single; @@ -134,6 +138,22 @@ implementation UMain, UUnicodeUtils; +function SplitStringToIntArray(const S: string): TArray; +var + StrList: TStringList; + I: Integer; +begin + StrList := TStringList.Create; + try + StrList.CommaText := S; + SetLength(Result, StrList.Count); + for I := 0 to StrList.Count - 1 do + Result[I] := StrToInt(StrList[I]); + finally + StrList.Free; + end; +end; + function StringInArray(const Value: string; Strings: array of string): Boolean; var I: Integer; begin diff --git a/src/base/UIni.pas b/src/base/UIni.pas index 9ed9bce79..553f45bae 100644 --- a/src/base/UIni.pas +++ b/src/base/UIni.pas @@ -268,6 +268,8 @@ TIni = class JukeboxNextLineOtherOColorG: integer; JukeboxNextLineOtherOColorB: integer; + PianoKeysLow: TPianoKeyArray; + PianoKeysHigh: TPianoKeyArray; // default encoding for texts (lyrics, song-name, ...) DefaultEncoding: TEncoding; @@ -1383,6 +1385,10 @@ procedure TIni.Load(); IShowWebScore: array of UTF8String; HexColor: string; Col: TRGB; + KeysLow: string; + KeysHigh: string; + ReadPianoKeysLow: TPianoKeyArray; + ReadPianoKeysHigh: TPianoKeyArray; begin LoadFontFamilyNames; ILyricsFont := FontFamilyNames; @@ -1713,6 +1719,20 @@ procedure TIni.Load(); Ini.JukeboxNextLineOtherOColorB := Round(Col.B); end; + KeysLow := IniFile.ReadString('KeyBindings', 'PianoKeysLow', ''); + KeysHigh := IniFile.ReadString('KeyBindings', 'PianoKeysHigh', ''); + PianoKeysLow := [60, 97, 121, 115, 120, 100, 99, 118, 103, 98, 104, 110, 109, 107, 44, 108, 46, 246, 45]; + PianoKeysHigh := [49, 113, 50, 119, 51, 101, 114, 53, 116, 54, 122, 117, 56, 105, 57, 111, 48, 112, 252, 96, 43]; + ReadPianoKeysLow := SplitStringToIntArray(KeysLow); + ReadPianoKeysHigh := SplitStringToIntArray(KeysHigh); + Log.LogWarn('Got ' + IntToStr(Length(ReadPianoKeysLow)) + ' Low keys', 'ScreenEditSub'); + Log.LogWarn('Got ' + IntToStr(Length(ReadPianoKeysHigh)) + ' high keys', 'ScreenEditSub'); + + if Length(ReadPianoKeysLow) = 19 then + PianoKeysLow := ReadPianoKeysLow; + if Length(ReadPianoKeysHigh) = 21 then + PianoKeysHigh := ReadPianoKeysHigh; + LoadPaths(IniFile); TranslateOptionValues; diff --git a/src/screens/UScreenEditSub.pas b/src/screens/UScreenEditSub.pas index 87642ddce..a7c3a6467 100644 --- a/src/screens/UScreenEditSub.pas +++ b/src/screens/UScreenEditSub.pas @@ -147,6 +147,9 @@ TScreenEditSub = class(TMenu) P2EditMode: boolean; BPMEditMode: boolean; PianoEditMode: boolean; + + PianoKeysLow: TPianoKeyArray; + PianoKeysHigh: TPianoKeyArray; // to interactive divide note LastClickTime: Integer; @@ -1440,7 +1443,7 @@ function TScreenEditSub.ParseInput(PressedKey: cardinal; CharCode: UCS4Char; Pre ShowInteractiveBackground; end; - SDLK_SLASH, SDLK_HASH: + SDLK_SLASH, SDLK_HASH, SDLK_KP_DIVIDE: begin CopyToUndo; if SDL_ModState = 0 then @@ -2439,7 +2442,7 @@ function TScreenEditSub.ParseInputEditText(PressedKey: cardinal; CharCode: UCS4C end; end; end; - SDLK_SLASH: + SDLK_SLASH, SDLK_KP_DIVIDE: begin CopyToUndo; if SDL_ModState = KMOD_LCTRL then @@ -2571,6 +2574,7 @@ function TScreenEditSub.ParseInputEditPiano(PressedKey: cardinal; CharCode: UCS4 SDL_ModState: word; Shift: Integer; NewNote: Integer; + i: Integer; begin // used when in Piano Edit Mode Result := true; @@ -2584,8 +2588,10 @@ function TScreenEditSub.ParseInputEditPiano(PressedKey: cardinal; CharCode: UCS4 Shift := 12; end; - if (PressedDown) then + + if PressedDown then begin + Log.LogWarn('Pressed Key' + IntToStr(PressedKey), 'ScreenEditSub'); // check special keys case PressedKey of SDLK_ESCAPE, SDLK_F6: @@ -2593,74 +2599,43 @@ function TScreenEditSub.ParseInputEditPiano(PressedKey: cardinal; CharCode: UCS4 PianoEditMode := false; end; else - // check normal keys - case PressedKey of - SDLK_LESS: NewNote := -7 + Shift; - SDLK_A: NewNote := -6 + Shift; - SDLK_Y: NewNote := -5 + Shift; - SDLK_S: NewNote := -4 + Shift; - SDLK_X: NewNote := -3 + Shift; - SDLK_D: NewNote := -2 + Shift; - SDLK_C: NewNote := -1 + Shift; - SDLK_F: ; - SDLK_V: NewNote := 0 + Shift; - SDLK_G: NewNote := 1 + Shift; - SDLK_B: NewNote := 2 + Shift; - SDLK_H: NewNote := 3 + Shift; - SDLK_N: NewNote := 4 + Shift; - SDLK_J: ; - SDLK_M: NewNote := 5 + Shift; - SDLK_K: NewNote := 6 + Shift; - SDLK_COMMA: NewNote := 7 + Shift; - SDLK_L: NewNote := 8 + Shift; - SDLK_PERIOD: NewNote := 9 + Shift; - 246: NewNote := 10 + Shift; - SDLK_MINUS: NewNote := 11 + Shift; - 228: ; - SDLK_1: NewNote := 6 + Shift; - SDLK_Q: NewNote := 7 + Shift; - SDLK_2: NewNote := 8 + Shift; - SDLK_W: NewNote := 9 + Shift; - SDLK_3: NewNote := 10 + Shift; - SDLK_E: NewNote := 11 + Shift; - SDLK_4: ; - SDLK_R: NewNote := 12 + Shift; - SDLK_5: NewNote := 13 + Shift; - SDLK_T: NewNote := 14 + Shift; - SDLK_6: NewNote := 15 + Shift; - SDLK_Z: NewNote := 16 + Shift; - SDLK_7: ; - SDLK_U: NewNote := 17 + Shift; - SDLK_8: NewNote := 18 + Shift; - SDLK_I: NewNote := 19 + Shift; - SDLK_9: NewNote := 20 + Shift; - SDLK_O: NewNote := 21 + Shift; - SDLK_0: NewNote := 22 + Shift; - SDLK_P: NewNote := 23 + Shift; - 223: ; - 252: NewNote := 24 + Shift; - SDLK_BACKQUOTE: NewNote := 25 + Shift; - SDLK_PLUS: NewNote := 26 + Shift; - else - Result := false; - end; //case - if (NewNote <> -1000) then + for i := Low(PianoKeysLow) to High(PianoKeysLow) do + begin + if PressedKey = PianoKeysLow[i] then + begin + NewNote := i - 7 + Shift; // Adjusted index to match existing logic + Break; + end; + end; + if NewNote = -1000 then // If not found in PianoKeysLow, check PianoKeysHigh + begin + for i := Low(PianoKeysHigh) to High(PianoKeysHigh) do begin - Tracks[CurrentTrack].Lines[Tracks[CurrentTrack].CurrentLine].Notes[CurrentNote[CurrentTrack]].Tone := NewNote; - // Play Midi - PlaySentenceMidi := false; - PlayVideo := false; - midinotefound := false; - PlayOne := true; - PlayOneMidi := true; - StopVideoPreview(); - {$IFDEF UseMIDIPort} MidiTime := USTime.GetTime; - MidiStart := GetTimeFromBeat(Tracks[CurrentTrack].Lines[Tracks[CurrentTrack].CurrentLine].Notes[CurrentNote[CurrentTrack]].StartBeat); - MidiStop := GetTimeFromBeat( - Tracks[CurrentTrack].Lines[Tracks[CurrentTrack].CurrentLine].Notes[CurrentNote[CurrentTrack]].StartBeat + - Tracks[CurrentTrack].Lines[Tracks[CurrentTrack].CurrentLine].Notes[CurrentNote[CurrentTrack]].Duration); {$ENDIF} - LastClick := -100; - end; //if (NewNote != -1000) + if PressedKey = PianoKeysHigh[i] then + begin + NewNote := i + 6 + Shift; // Adjusted index to match existing logic + Break; + end; + end; + end; + + if (NewNote <> -1000) then + begin + Tracks[CurrentTrack].Lines[Tracks[CurrentTrack].CurrentLine].Notes[CurrentNote[CurrentTrack]].Tone := NewNote; + // Play Midi + PlaySentenceMidi := false; + PlayVideo := false; + midinotefound := false; + PlayOne := true; + PlayOneMidi := true; + StopVideoPreview(); + {$IFDEF UseMIDIPort} MidiTime := USTime.GetTime; + MidiStart := GetTimeFromBeat(Tracks[CurrentTrack].Lines[Tracks[CurrentTrack].CurrentLine].Notes[CurrentNote[CurrentTrack]].StartBeat); + MidiStop := GetTimeFromBeat( + Tracks[CurrentTrack].Lines[Tracks[CurrentTrack].CurrentLine].Notes[CurrentNote[CurrentTrack]].StartBeat + + Tracks[CurrentTrack].Lines[Tracks[CurrentTrack].CurrentLine].Notes[CurrentNote[CurrentTrack]].Duration); {$ENDIF} + LastClick := -100; + end; //if (NewNote != -1000) end; //case end; //if (PressedDown) end; @@ -4711,6 +4686,11 @@ constructor TScreenEditSub.Create; // in notes place -> for move notes by mouse //NotesBackgroundId := AddSelectSlide(Theme.EditSub.NotesBackground, i, Empty); + + // Initialize Piano Keys to default values + PianoKeysLow := Ini.PianoKeysLow; + PianoKeysHigh := Ini.PianoKeysHigh; + end; procedure TScreenEditSub.OnShow;