aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--game/languages/English.ini3
-rw-r--r--game/languages/German.ini3
-rw-r--r--src/base/UIni.pas2
-rw-r--r--src/base/UMain.pas5
-rw-r--r--src/base/URecord.pas47
-rw-r--r--src/screens/UScreenOptionsRecord.pas20
6 files changed, 70 insertions, 10 deletions
diff --git a/game/languages/English.ini b/game/languages/English.ini
index cff7e7a3..5ac41efc 100644
--- a/game/languages/English.ini
+++ b/game/languages/English.ini
@@ -428,4 +428,5 @@ ERROR_CORRUPT_SONG_FILE_NOT_FOUND=Song could not be loaded: File not found
ERROR_CORRUPT_SONG_NO_NOTES=Song could not be loaded: Can''t find any notes
ERROR_CORRUPT_SONG_NO_BREAKS=Song could not be loaded: Can''t find any linebreaks
ERROR_CORRUPT_SONG_UNKNOWN_IN_LINE=Song could not be loaded: Error parsing line %0:d
-ERROR_NO_EDITOR=This feature is not available on Linux/Mac \ No newline at end of file
+ERROR_NO_EDITOR=This feature is not available on Linux/Mac
+ERROR_PLAYER_DEVICE_ASSIGNMENT=Player %d was assigned to multiple microphones. Please check your record options
diff --git a/game/languages/German.ini b/game/languages/German.ini
index bbd936c9..02124805 100644
--- a/game/languages/German.ini
+++ b/game/languages/German.ini
@@ -426,4 +426,5 @@ ERROR_CORRUPT_SONG_FILE_NOT_FOUND=Song konnte nicht geladen werden: Datei wurde
ERROR_CORRUPT_SONG_NO_NOTES=Song konnte nicht geladen werden: Es wurden keine Noten gefunden.
ERROR_CORRUPT_SONG_NO_BREAKS=Song konnte nicht geladen werden: Es wurden keine Satzwechsel gefunden.
ERROR_CORRUPT_SONG_UNKNOWN_IN_LINE=Song konnte nicht geladen werden: Fehler beim parsen der Zeile %0:d
-ERROR_NO_EDITOR=Diese Funktion ist unter Linux/Mac noch nicht verfügbar \ No newline at end of file
+ERROR_NO_EDITOR=Diese Funktion ist unter Linux/Mac noch nicht verfügbar
+ERROR_PLAYER_DEVICE_ASSIGNMENT=Mehrere Mikrofone für Spieler %d gewählt.\nAufnahmeoptionen überprüfen. \ No newline at end of file
diff --git a/src/base/UIni.pas b/src/base/UIni.pas
index ec229c54..a4c85a3b 100644
--- a/src/base/UIni.pas
+++ b/src/base/UIni.pas
@@ -632,7 +632,7 @@ begin
if (DeviceIndex >= 0) then
begin
if not IniFile.ValueExists('Record', Format('DeviceName[%d]', [DeviceIndex])) then
- break;
+ Continue;
// resize list
SetLength(InputDeviceConfig, Length(InputDeviceConfig)+1);
diff --git a/src/base/UMain.pas b/src/base/UMain.pas
index 53518d1e..8e938e52 100644
--- a/src/base/UMain.pas
+++ b/src/base/UMain.pas
@@ -78,6 +78,7 @@ uses
UPathUtils,
UPlaylist,
UMusic,
+ URecord,
UBeatTimer,
UPlatform,
USkins,
@@ -294,6 +295,10 @@ begin
Log.BenchmarkEnd(0);
Log.LogBenchmark('Loading Time', 0);
+ // check microphone settings, goto record options if they are corrupt
+ if (not AudioInputProcessor.ValidateSettings) then
+ Display.CurrentScreen^.FadeTo( @ScreenOptionsRecord );
+
//------------------------------
// Start Mainloop
//------------------------------
diff --git a/src/base/URecord.pas b/src/base/URecord.pas
index 245d85a6..c183875c 100644
--- a/src/base/URecord.pas
+++ b/src/base/URecord.pas
@@ -133,6 +133,7 @@ type
destructor Destroy; override;
procedure UpdateInputDeviceConfig;
+ function ValidateSettings: boolean;
// handle microphone input
procedure HandleMicrophoneData(Buffer: PByteArray; Size: integer;
@@ -162,6 +163,8 @@ implementation
uses
ULog,
+ UGraphic,
+ ULanguage,
UNote;
var
@@ -594,6 +597,50 @@ begin
end;
end;
+function TAudioInputProcessor.ValidateSettings: boolean;
+const
+ MAX_PLAYER_COUNT = 6; // FIXME: there should be a global variable for this
+var
+ I, J: integer;
+ PlayerID: integer;
+ PlayerMap: array [0 .. MAX_PLAYER_COUNT] of boolean;
+ InputDevice: TAudioInputDevice;
+ InputDeviceCfg: PInputDeviceConfig;
+begin
+ // mark all players as unassigned
+ for I := 0 to High(PlayerMap) do
+ PlayerMap[I] := false;
+
+ // iterate over all active devices
+ for I := 0 to High(DeviceList) do
+ begin
+ InputDevice := DeviceList[I];
+ InputDeviceCfg := @Ini.InputDeviceConfig[InputDevice.CfgIndex];
+ // iterate over all channels of the current devices
+ for J := 0 to High(InputDeviceCfg.ChannelToPlayerMap) do
+ begin
+ // get player that was mapped to the current device channel
+ PlayerID := InputDeviceCfg.ChannelToPlayerMap[J];
+ if (PlayerID <> 0) then
+ begin
+ // check if player is already assigned to another device/channel
+ if (PlayerMap[PlayerID]) then
+ begin
+ ScreenPopupError.ShowPopup(
+ Format(Language.Translate('ERROR_PLAYER_DEVICE_ASSIGNMENT'),
+ [PlayerID]));
+ Result := false;
+ Exit;
+ end;
+
+ // mark player as assigned to a device
+ PlayerMap[PlayerID] := true;
+ end;
+ end;
+ end;
+ Result := true;
+end;
+
{*
* Handles captured microphone input data.
* Params:
diff --git a/src/screens/UScreenOptionsRecord.pas b/src/screens/UScreenOptionsRecord.pas
index b7a40676..0f9cd49a 100644
--- a/src/screens/UScreenOptionsRecord.pas
+++ b/src/screens/UScreenOptionsRecord.pas
@@ -168,17 +168,23 @@ begin
SDLK_BACKSPACE:
begin
// TODO: Show Save/Abort screen
- Ini.Save;
- AudioPlayback.PlaySound(SoundLib.Back);
- FadeTo(@ScreenOptions);
+ if (AudioInputProcessor.ValidateSettings()) then
+ begin
+ Ini.Save;
+ AudioPlayback.PlaySound(SoundLib.Back);
+ FadeTo(@ScreenOptions);
+ end;
end;
SDLK_RETURN:
begin
if (SelInteraction = ExitButtonIID) then
begin
- Ini.Save;
- AudioPlayback.PlaySound(SoundLib.Back);
- FadeTo(@ScreenOptions);
+ if (AudioInputProcessor.ValidateSettings()) then
+ begin
+ Ini.Save;
+ AudioPlayback.PlaySound(SoundLib.Back);
+ FadeTo(@ScreenOptions);
+ end;
end;
end;
SDLK_DOWN:
@@ -434,7 +440,7 @@ begin
SetLength(ChannelPeak, MaxChannelCount);
- StartPreview();
+ UpdateInputDevice();
end;
procedure TScreenOptionsRecord.OnHide;