mirror of
https://github.com/SourMesen/Mesen.git
synced 2025-04-02 10:52:48 -04:00
UI: Added shortcuts to start/stop recording video/audio/movies
This commit is contained in:
parent
d738b2b9bf
commit
77ed078899
18 changed files with 113 additions and 7 deletions
|
@ -436,6 +436,10 @@ enum class EmulatorShortcut
|
|||
|
||||
TakeScreenshot,
|
||||
|
||||
ToggleRecordVideo,
|
||||
ToggleRecordAudio,
|
||||
ToggleRecordMovie,
|
||||
|
||||
IncreaseSpeed,
|
||||
DecreaseSpeed,
|
||||
MaxSpeed,
|
||||
|
|
|
@ -54,7 +54,6 @@ void MovieManager::Stop()
|
|||
_player.reset();
|
||||
|
||||
if(_recorder) {
|
||||
_recorder->Stop();
|
||||
_recorder.reset();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,6 +21,7 @@ MovieRecorder::MovieRecorder(shared_ptr<Console> console)
|
|||
|
||||
MovieRecorder::~MovieRecorder()
|
||||
{
|
||||
Stop();
|
||||
}
|
||||
|
||||
bool MovieRecorder::Record(RecordMovieOptions options)
|
||||
|
|
|
@ -113,8 +113,7 @@ void VideoRenderer::AddRecordingSound(int16_t* soundBuffer, uint32_t sampleCount
|
|||
void VideoRenderer::StopRecording()
|
||||
{
|
||||
shared_ptr<IVideoRecorder> recorder = _recorder;
|
||||
if(recorder) {
|
||||
recorder->StopRecording();
|
||||
if(recorder) {
|
||||
MessageManager::DisplayMessage("VideoRecorder", "VideoRecorderStopped", recorder->GetOutputFile());
|
||||
}
|
||||
_recorder.reset();
|
||||
|
|
|
@ -9,9 +9,11 @@ WaveRecorder::WaveRecorder(string outputFile, uint32_t sampleRate, bool isStereo
|
|||
_streamSize = 0;
|
||||
_sampleRate = sampleRate;
|
||||
_isStereo = isStereo;
|
||||
WriteHeader();
|
||||
|
||||
MessageManager::DisplayMessage("SoundRecorder", "SoundRecorderStarted", _outputFile);
|
||||
if(_stream) {
|
||||
WriteHeader();
|
||||
MessageManager::DisplayMessage("SoundRecorder", "SoundRecorderStarted", _outputFile);
|
||||
}
|
||||
}
|
||||
|
||||
WaveRecorder::~WaveRecorder()
|
||||
|
|
|
@ -918,6 +918,11 @@
|
|||
<Message ID="EmulatorShortcutMappings_ToggleBackground">Mostra/Amaga la capa de fons</Message>
|
||||
<Message ID="EmulatorShortcutMappings_ToggleSprites">Mostra/Amaga la capa de sprites</Message>
|
||||
<Message ID="EmulatorShortcutMappings_ToggleKeyboardMode">Toggle Keyboard Mode</Message>
|
||||
|
||||
<Message ID="EmulatorShortcutMappings_ToggleRecordVideo">Start/Stop Recording Video</Message>
|
||||
<Message ID="EmulatorShortcutMappings_ToggleRecordAudio">Start/Stop Recording Audio</Message>
|
||||
<Message ID="EmulatorShortcutMappings_ToggleRecordMovie">Start/Stop Recording Movie</Message>
|
||||
|
||||
<Message ID="EmulatorShortcutMappings_MaxSpeed">Activa/Desactiva la velocitat màxima</Message>
|
||||
<Message ID="EmulatorShortcutMappings_LoadRandomGame">Carrega un joc a l'atzar</Message>
|
||||
<Message ID="EmulatorShortcutMappings_SaveStateSlot1">Desa la partida - Posició 1</Message>
|
||||
|
|
|
@ -952,6 +952,10 @@
|
|||
<Message ID="EmulatorShortcutMappings_ToggleSprites">Toggle Sprite Layer</Message>
|
||||
<Message ID="EmulatorShortcutMappings_ToggleKeyboardMode">Toggle Keyboard Mode</Message>
|
||||
|
||||
<Message ID="EmulatorShortcutMappings_ToggleRecordVideo">Start/Stop Recording Video</Message>
|
||||
<Message ID="EmulatorShortcutMappings_ToggleRecordAudio">Start/Stop Recording Audio</Message>
|
||||
<Message ID="EmulatorShortcutMappings_ToggleRecordMovie">Start/Stop Recording Movie</Message>
|
||||
|
||||
<Message ID="EmulatorShortcutMappings_MaxSpeed">Toggle Maximum Speed</Message>
|
||||
<Message ID="EmulatorShortcutMappings_LoadRandomGame">Load Random Game</Message>
|
||||
<Message ID="EmulatorShortcutMappings_SaveStateSlot1">Save State - Slot 1</Message>
|
||||
|
|
|
@ -935,6 +935,11 @@
|
|||
<Message ID="EmulatorShortcutMappings_ToggleBackground">Alternar capa de fondo</Message>
|
||||
<Message ID="EmulatorShortcutMappings_ToggleSprites">Alternar capa de sprite</Message>
|
||||
<Message ID="EmulatorShortcutMappings_ToggleKeyboardMode">Alternar modo teclado</Message>
|
||||
|
||||
<Message ID="EmulatorShortcutMappings_ToggleRecordVideo">Start/Stop Recording Video</Message>
|
||||
<Message ID="EmulatorShortcutMappings_ToggleRecordAudio">Start/Stop Recording Audio</Message>
|
||||
<Message ID="EmulatorShortcutMappings_ToggleRecordMovie">Start/Stop Recording Movie</Message>
|
||||
|
||||
<Message ID="EmulatorShortcutMappings_MaxSpeed">Alternar velocidad máxima</Message>
|
||||
<Message ID="EmulatorShortcutMappings_LoadRandomGame">Cargar juego aleatorio</Message>
|
||||
<Message ID="EmulatorShortcutMappings_SaveStateSlot1">Guardar partida - Hueco 1</Message>
|
||||
|
|
|
@ -949,6 +949,11 @@
|
|||
<Message ID="EmulatorShortcutMappings_ToggleBackground">Activer/désactiver l'arrière-plan</Message>
|
||||
<Message ID="EmulatorShortcutMappings_ToggleSprites">Activer/désactiver les sprites</Message>
|
||||
<Message ID="EmulatorShortcutMappings_ToggleKeyboardMode">Activer/désactiver le mode clavier</Message>
|
||||
|
||||
<Message ID="EmulatorShortcutMappings_ToggleRecordVideo">Démarrer/arrêter enregistrement vidéo</Message>
|
||||
<Message ID="EmulatorShortcutMappings_ToggleRecordAudio">Démarrer/arrêter enregistrement audio</Message>
|
||||
<Message ID="EmulatorShortcutMappings_ToggleRecordMovie">Démarrer/arrêter enregistrement du film</Message>
|
||||
|
||||
<Message ID="EmulatorShortcutMappings_MaxSpeed">Activer/désactiver la vitesse maximale</Message>
|
||||
<Message ID="EmulatorShortcutMappings_LoadRandomGame">Ouvrir un jeu aléatoire</Message>
|
||||
<Message ID="EmulatorShortcutMappings_SaveStateSlot1">Sauvegarde d'état - Position 1</Message>
|
||||
|
|
|
@ -951,6 +951,10 @@
|
|||
<Message ID="EmulatorShortcutMappings_ToggleSprites">Attiva/Disattiva Sprite</Message>
|
||||
<Message ID="EmulatorShortcutMappings_ToggleKeyboardMode">Attiva/Disattiva Modalità Tastiera</Message>
|
||||
|
||||
<Message ID="EmulatorShortcutMappings_ToggleRecordVideo">Start/Stop Recording Video</Message>
|
||||
<Message ID="EmulatorShortcutMappings_ToggleRecordAudio">Start/Stop Recording Audio</Message>
|
||||
<Message ID="EmulatorShortcutMappings_ToggleRecordMovie">Start/Stop Recording Movie</Message>
|
||||
|
||||
<Message ID="EmulatorShortcutMappings_MaxSpeed">Attiva/Disattiva Velocità Massima</Message>
|
||||
<Message ID="EmulatorShortcutMappings_LoadRandomGame">Carica Gioco Casuale</Message>
|
||||
<Message ID="EmulatorShortcutMappings_SaveStateSlot1">Salva Stato - Slot 1</Message>
|
||||
|
|
|
@ -74,7 +74,7 @@
|
|||
<Control ID="mnuNetPlaySpectator">観客</Control>
|
||||
<Control ID="mnuFindServer">公開セーバリストを見る</Control>
|
||||
<Control ID="mnuProfile">プロファイル設定</Control>
|
||||
<Control ID="mnuMovies">動画</Control>
|
||||
<Control ID="mnuMovies">映画</Control>
|
||||
<Control ID="mnuPlayMovie">再生</Control>
|
||||
<Control ID="mnuRecordMovie">録画</Control>
|
||||
<Control ID="mnuStopMovie">停止</Control>
|
||||
|
@ -937,6 +937,11 @@
|
|||
<Message ID="EmulatorShortcutMappings_ToggleBackground">バックグラウンドレイヤー表示</Message>
|
||||
<Message ID="EmulatorShortcutMappings_ToggleSprites">スプライトレイヤー表示</Message>
|
||||
<Message ID="EmulatorShortcutMappings_ToggleKeyboardMode">キーボードモードを無効・有効にする</Message>
|
||||
|
||||
<Message ID="EmulatorShortcutMappings_ToggleRecordVideo">動画を録画する・録画を停止する</Message>
|
||||
<Message ID="EmulatorShortcutMappings_ToggleRecordAudio">録音する・録音を停止する</Message>
|
||||
<Message ID="EmulatorShortcutMappings_ToggleRecordMovie">映画を録画する・録画を停止する</Message>
|
||||
|
||||
<Message ID="EmulatorShortcutMappings_MaxSpeed">最高速度を無効・有効にする</Message>
|
||||
<Message ID="EmulatorShortcutMappings_LoadRandomGame">ランダムゲームを開く</Message>
|
||||
<Message ID="EmulatorShortcutMappings_SaveStateSlot1">クイックセーブスロット1に保存する</Message>
|
||||
|
|
|
@ -952,6 +952,10 @@
|
|||
<Message ID="EmulatorShortcutMappings_ToggleSprites">Alternar camada de sprite</Message>
|
||||
<Message ID="EmulatorShortcutMappings_ToggleKeyboardMode">Alternar modo de teclado</Message>
|
||||
|
||||
<Message ID="EmulatorShortcutMappings_ToggleRecordVideo">Start/Stop Recording Video</Message>
|
||||
<Message ID="EmulatorShortcutMappings_ToggleRecordAudio">Start/Stop Recording Audio</Message>
|
||||
<Message ID="EmulatorShortcutMappings_ToggleRecordMovie">Start/Stop Recording Movie</Message>
|
||||
|
||||
<Message ID="EmulatorShortcutMappings_MaxSpeed">Alternar velocidade máxima</Message>
|
||||
<Message ID="EmulatorShortcutMappings_LoadRandomGame">Carregar jogo aleatório</Message>
|
||||
<Message ID="EmulatorShortcutMappings_SaveStateSlot1">Salvar estado - Compartimento 1</Message>
|
||||
|
|
|
@ -937,6 +937,11 @@
|
|||
<Message ID="EmulatorShortcutMappings_ToggleBackground">Toggle Background Layer</Message>
|
||||
<Message ID="EmulatorShortcutMappings_ToggleSprites">Toggle Sprite Layer</Message>
|
||||
<Message ID="EmulatorShortcutMappings_ToggleKeyboardMode">Toggle Keyboard Mode</Message>
|
||||
|
||||
<Message ID="EmulatorShortcutMappings_ToggleRecordVideo">Start/Stop Recording Video</Message>
|
||||
<Message ID="EmulatorShortcutMappings_ToggleRecordAudio">Start/Stop Recording Audio</Message>
|
||||
<Message ID="EmulatorShortcutMappings_ToggleRecordMovie">Start/Stop Recording Movie</Message>
|
||||
|
||||
<Message ID="EmulatorShortcutMappings_MaxSpeed">Toggle Maximum Speed</Message>
|
||||
<Message ID="EmulatorShortcutMappings_LoadRandomGame">Load Random Game</Message>
|
||||
<Message ID="EmulatorShortcutMappings_SaveStateSlot1">Save State - Slot 1</Message>
|
||||
|
|
|
@ -937,6 +937,11 @@
|
|||
<Message ID="EmulatorShortcutMappings_ToggleBackground">Увімкнути/вимкнути фон</Message>
|
||||
<Message ID="EmulatorShortcutMappings_ToggleSprites">Увімкнути/вимкнути спрайти</Message>
|
||||
<Message ID="EmulatorShortcutMappings_ToggleKeyboardMode">Увімкнути/вимкнути максимальну швидкість</Message>
|
||||
|
||||
<Message ID="EmulatorShortcutMappings_ToggleRecordVideo">Start/Stop Recording Video</Message>
|
||||
<Message ID="EmulatorShortcutMappings_ToggleRecordAudio">Start/Stop Recording Audio</Message>
|
||||
<Message ID="EmulatorShortcutMappings_ToggleRecordMovie">Start/Stop Recording Movie</Message>
|
||||
|
||||
<Message ID="EmulatorShortcutMappings_MaxSpeed">Увімкнути/вимкнути максимальну швидкість</Message>
|
||||
<Message ID="EmulatorShortcutMappings_LoadRandomGame">Завантажити випадкову гру</Message>
|
||||
<Message ID="EmulatorShortcutMappings_SaveStateSlot1">Збереження стану - Слот 1</Message>
|
||||
|
|
|
@ -963,8 +963,12 @@
|
|||
<Message ID="EmulatorShortcutMappings_ToggleBackground">显示背景</Message>
|
||||
<Message ID="EmulatorShortcutMappings_ToggleSprites">显示精灵</Message>
|
||||
<Message ID="EmulatorShortcutMappings_ToggleKeyboardMode">切换键盘模式</Message>
|
||||
<Message ID="EmulatorShortcutMappings_MaxSpeed">最快速</Message>
|
||||
|
||||
<Message ID="EmulatorShortcutMappings_ToggleRecordVideo">Start/Stop Recording Video</Message>
|
||||
<Message ID="EmulatorShortcutMappings_ToggleRecordAudio">Start/Stop Recording Audio</Message>
|
||||
<Message ID="EmulatorShortcutMappings_ToggleRecordMovie">Start/Stop Recording Movie</Message>
|
||||
|
||||
<Message ID="EmulatorShortcutMappings_MaxSpeed">最快速</Message>
|
||||
<Message ID="EmulatorShortcutMappings_LoadRandomGame">随机载入游戏</Message>
|
||||
<Message ID="EmulatorShortcutMappings_SaveStateSlot1">保存进度 1</Message>
|
||||
<Message ID="EmulatorShortcutMappings_SaveStateSlot2">保存进度 2</Message>
|
||||
|
|
|
@ -57,6 +57,10 @@ namespace Mesen.GUI.Forms.Config
|
|||
|
||||
EmulatorShortcut.InputBarcode,
|
||||
|
||||
EmulatorShortcut.ToggleRecordVideo,
|
||||
EmulatorShortcut.ToggleRecordAudio,
|
||||
EmulatorShortcut.ToggleRecordMovie,
|
||||
|
||||
EmulatorShortcut.TakeScreenshot,
|
||||
EmulatorShortcut.LoadRandomGame,
|
||||
EmulatorShortcut.RunSingleFrame,
|
||||
|
|
|
@ -989,6 +989,40 @@ namespace Mesen.GUI.Forms
|
|||
}
|
||||
break;
|
||||
|
||||
case EmulatorShortcut.ToggleRecordVideo:
|
||||
if(InteropEmu.AviIsRecording()) {
|
||||
InteropEmu.AviStop();
|
||||
} else {
|
||||
string filename = GetOutputFilename(ConfigManager.AviFolder, ConfigManager.Config.AviRecordInfo.Codec == VideoCodec.GIF ? ".gif" : ".avi");
|
||||
InteropEmu.AviRecord(filename, ConfigManager.Config.AviRecordInfo.Codec, ConfigManager.Config.AviRecordInfo.CompressionLevel);
|
||||
}
|
||||
break;
|
||||
|
||||
case EmulatorShortcut.ToggleRecordAudio:
|
||||
if(InteropEmu.WaveIsRecording()) {
|
||||
InteropEmu.WaveStop();
|
||||
} else {
|
||||
string filename = GetOutputFilename(ConfigManager.WaveFolder, ".wav");
|
||||
InteropEmu.WaveRecord(filename);
|
||||
}
|
||||
break;
|
||||
|
||||
case EmulatorShortcut.ToggleRecordMovie:
|
||||
if(!InteropEmu.MoviePlaying() && !InteropEmu.IsConnected()) {
|
||||
if(InteropEmu.MovieRecording()) {
|
||||
InteropEmu.MovieStop();
|
||||
} else {
|
||||
RecordMovieOptions options = new RecordMovieOptions(
|
||||
GetOutputFilename(ConfigManager.MovieFolder, ".mmo"),
|
||||
ConfigManager.Config.MovieRecordInfo.Author,
|
||||
ConfigManager.Config.MovieRecordInfo.Description,
|
||||
ConfigManager.Config.MovieRecordInfo.RecordFrom
|
||||
);
|
||||
InteropEmu.MovieRecord(ref options);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case EmulatorShortcut.TakeScreenshot: InteropEmu.TakeScreenshot(); break;
|
||||
case EmulatorShortcut.LoadRandomGame: LoadRandomGame(); break;
|
||||
|
||||
|
@ -1044,6 +1078,19 @@ namespace Mesen.GUI.Forms
|
|||
}
|
||||
}
|
||||
|
||||
private string GetOutputFilename(string folder, string ext)
|
||||
{
|
||||
DateTime now = DateTime.Now;
|
||||
string baseName = InteropEmu.GetRomInfo().GetRomName();
|
||||
string dateTime = " " + now.ToShortDateString() + " " + now.ToLongTimeString();
|
||||
string filename = baseName + dateTime + ext;
|
||||
|
||||
//Replace any illegal chars with _
|
||||
filename = string.Join("_", filename.Split(Path.GetInvalidFileNameChars()));
|
||||
|
||||
return Path.Combine(folder, filename);
|
||||
}
|
||||
|
||||
private void ToggleFullscreen()
|
||||
{
|
||||
SetFullscreenState(!_fullscreenMode);
|
||||
|
|
|
@ -1920,6 +1920,10 @@ namespace Mesen.GUI
|
|||
InputBarcode,
|
||||
|
||||
TakeScreenshot,
|
||||
|
||||
ToggleRecordVideo,
|
||||
ToggleRecordAudio,
|
||||
ToggleRecordMovie,
|
||||
|
||||
IncreaseSpeed,
|
||||
DecreaseSpeed,
|
||||
|
|
Loading…
Add table
Reference in a new issue