From: yyagi Date: Sun, 11 Feb 2018 16:59:45 +0000 (+0900) Subject: #28263 DTX2WAV005: X-Git-Tag: Release113~45 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=3748d4def191479f44c2888c1fb58714c58331f1;p=dtxmania%2Fdtxmania.git #28263 DTX2WAV005: * wav/ogg/mp3の選択機能追加 * 出力オーディオ形式のdropdownstyleを、dropdownlistに変更。(readonlyにするため) * モニター出力on/off機能を一旦無効化。(ON固定) * マスターボリューム最大値を100から200に変更 これに伴い本体側マスターボリュームも200まで使用可能に(WASAPI/ASIO限定) * ogg/mp3の出力に対応。ただし前者はQuality=8(256kbps), 後者は128kbps設定で固定。 * 録音中のウインドウのサイズ変更を無効化 * 曲読み込み後、本体側での画面フェードアウト処理を削除(録音開始までの待ち時間を1秒短縮) --- diff --git a/DTX2WAV/App.config b/DTX2WAV/App.config index 13e2572b..266c2b1c 100644 --- a/DTX2WAV/App.config +++ b/DTX2WAV/App.config @@ -37,6 +37,9 @@ False + + 0 + \ No newline at end of file diff --git a/DTX2WAV/Form1.Designer.cs b/DTX2WAV/Form1.Designer.cs index 5dc5ce1b..c5b45a86 100644 --- a/DTX2WAV/Form1.Designer.cs +++ b/DTX2WAV/Form1.Designer.cs @@ -165,6 +165,7 @@ // // comboBox_AudioFormat // + this.comboBox_AudioFormat.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.comboBox_AudioFormat.FormattingEnabled = true; this.comboBox_AudioFormat.Items.AddRange(new object[] { resources.GetString("comboBox_AudioFormat.Items"), @@ -277,6 +278,11 @@ // this.numericUpDown_Master.DataBindings.Add(new System.Windows.Forms.Binding("Value", this.bindingSource_Master, "Value", true, System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged)); resources.ApplyResources(this.numericUpDown_Master, "numericUpDown_Master"); + this.numericUpDown_Master.Maximum = new decimal(new int[] { + 200, + 0, + 0, + 0}); this.numericUpDown_Master.Name = "numericUpDown_Master"; this.numericUpDown_Master.Value = new decimal(new int[] { 100, @@ -298,7 +304,7 @@ resources.ApplyResources(this.trackBar_Master, "trackBar_Master"); this.trackBar_Master.DataBindings.Add(new System.Windows.Forms.Binding("Value", this.bindingSource_Master, "Value", true, System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged)); this.trackBar_Master.LargeChange = 10; - this.trackBar_Master.Maximum = 100; + this.trackBar_Master.Maximum = 200; this.trackBar_Master.Name = "trackBar_Master"; this.trackBar_Master.TickFrequency = 10; this.trackBar_Master.Value = 100; diff --git a/DTX2WAV/Form1.cs b/DTX2WAV/Form1.cs index 4cbfcb94..d245f8ff 100644 --- a/DTX2WAV/Form1.cs +++ b/DTX2WAV/Form1.cs @@ -73,6 +73,7 @@ namespace DTX2WAV numericUpDown_Bass.Value = Properties.Settings.Default.nVol_Bass; numericUpDown_Master.Value = Properties.Settings.Default.nVol_Master; checkBox_MonitorSound.Checked = Properties.Settings.Default.bMonitorSound; + comboBox_AudioFormat.SelectedIndex = Properties.Settings.Default.nAudioFormat; #endregion } @@ -231,7 +232,7 @@ namespace DTX2WAV } break; - default: + default: // DTXMania本体を強制終了した、など break; } @@ -327,6 +328,7 @@ namespace DTX2WAV Properties.Settings.Default.nVol_Bass = (int)numericUpDown_Bass.Value; Properties.Settings.Default.nVol_Master = (int)numericUpDown_Master.Value; Properties.Settings.Default.bMonitorSound = checkBox_MonitorSound.Checked; + Properties.Settings.Default.nAudioFormat = comboBox_AudioFormat.SelectedIndex; #endregion Properties.Settings.Default.Save(); diff --git a/DTX2WAV/Form1.resx b/DTX2WAV/Form1.resx index b45030f4..606a8210 100644 --- a/DTX2WAV/Form1.resx +++ b/DTX2WAV/Form1.resx @@ -121,30 +121,6 @@ 17, 17 - - 93, 22 - - - E&xit - - - 37, 20 - - - &File - - - 39, 20 - - - &Edit - - - 44, 20 - - - &Help - 0, 0 @@ -170,6 +146,30 @@ 2 + + 37, 20 + + + &File + + + 93, 22 + + + E&xit + + + 39, 20 + + + &Edit + + + 44, 20 + + + &Help + 132, 17 @@ -231,6 +231,114 @@ 7 + + comboBox_AudioFormat + + + System.Windows.Forms.ComboBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBox1 + + + 0 + + + label3 + + + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBox1 + + + 1 + + + button_BrowseAudio + + + System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBox1 + + + 2 + + + textBox_BrowseAudio + + + System.Windows.Forms.TextBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBox1 + + + 3 + + + label2 + + + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBox1 + + + 4 + + + button_browseDTX + + + System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBox1 + + + 5 + + + textBox_BrowseDTX + + + System.Windows.Forms.TextBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBox1 + + + 6 + + + 6, 6 + + + 633, 138 + + + 3 + + + 変換ファイルの指定 + + + groupBox1 + + + System.Windows.Forms.GroupBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + tabPage1 + + + 3 + WAV @@ -249,9 +357,6 @@ 0 - - WAV - comboBox_AudioFormat @@ -420,30 +525,6 @@ 6 - - 6, 6 - - - 633, 138 - - - 3 - - - 変換ファイルの指定 - - - groupBox1 - - - System.Windows.Forms.GroupBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - tabPage1 - - - 3 - NoControl @@ -516,6 +597,9 @@ 録音中の音をスピーカーに出力する(しかし実現方法不明。WASAPI排他じゃなければやりようがあるのだが) + + False + checkBox_MonitorSound @@ -582,6 +666,9 @@ 2 + + 177, 56 + False @@ -1113,6 +1200,21 @@ 0 + + 17, 56 + + + 1069, 17 + + + 932, 17 + + + 783, 17 + + + 621, 17 + 388, 17 diff --git a/DTX2WAV/Form_Recording.Designer.cs b/DTX2WAV/Form_Recording.Designer.cs index 3e5e960c..53df77f5 100644 --- a/DTX2WAV/Form_Recording.Designer.cs +++ b/DTX2WAV/Form_Recording.Designer.cs @@ -140,6 +140,7 @@ this.Controls.Add(this.progressBar_Recording); this.Controls.Add(this.label_Recording); this.Controls.Add(this.button_CancelConverting); + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow; this.Name = "Form_Recording"; this.Load += new System.EventHandler(this.Form_Recording_Load); this.ResumeLayout(false); diff --git a/DTX2WAV/Properties/AssemblyInfo.cs b/DTX2WAV/Properties/AssemblyInfo.cs index f84c5b68..3c363074 100644 --- a/DTX2WAV/Properties/AssemblyInfo.cs +++ b/DTX2WAV/Properties/AssemblyInfo.cs @@ -32,5 +32,5 @@ using System.Runtime.InteropServices; // すべての値を指定するか、次を使用してビルド番号とリビジョン番号を既定に設定できます // 既定値にすることができます: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("4.0.0.0")] -[assembly: AssemblyFileVersion("4.0.0.0")] +[assembly: AssemblyVersion("5.0.0.0")] +[assembly: AssemblyFileVersion("5.0.0.0")] diff --git a/DTX2WAV/Properties/Settings.Designer.cs b/DTX2WAV/Properties/Settings.Designer.cs index 128365af..6548bfb4 100644 --- a/DTX2WAV/Properties/Settings.Designer.cs +++ b/DTX2WAV/Properties/Settings.Designer.cs @@ -130,5 +130,17 @@ namespace DTX2WAV.Properties { this["IsUpgrade"] = value; } } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("0")] + public int nAudioFormat { + get { + return ((int)(this["nAudioFormat"])); + } + set { + this["nAudioFormat"] = value; + } + } } } diff --git a/DTX2WAV/Properties/Settings.settings b/DTX2WAV/Properties/Settings.settings index e5f7c87d..9ab513b9 100644 --- a/DTX2WAV/Properties/Settings.settings +++ b/DTX2WAV/Properties/Settings.settings @@ -29,5 +29,8 @@ False + + 0 + \ No newline at end of file diff --git a/DTXMania/コード/ステージ/04.コンフィグ/CConfigXml.cs b/DTXMania/コード/ステージ/04.コンフィグ/CConfigXml.cs index b4d37d6d..e6caeb86 100644 --- a/DTXMania/コード/ステージ/04.コンフィグ/CConfigXml.cs +++ b/DTXMania/コード/ステージ/04.コンフィグ/CConfigXml.cs @@ -850,7 +850,7 @@ namespace DTXMania nChipDisplayTimeMs.Initialize("", "", 0); nChipFadeoutTimeMs.Initialize("", "", 0); - nMasterVolume.Initialize( "strCfgSysMasterVolume", 0, 101); + nMasterVolume.Initialize( "strCfgSysMasterVolume", 0, 201); nPolyphonicSounds.Initialize( "strCfgSysPolyphonicSounds", 1, 11 ); // dgb diff --git a/DTXMania/コード/ステージ/06.曲読み込み/CStage曲読み込み.cs b/DTXMania/コード/ステージ/06.曲読み込み/CStage曲読み込み.cs index 9b4e4aa5..cd7b3409 100644 --- a/DTXMania/コード/ステージ/06.曲読み込み/CStage曲読み込み.cs +++ b/DTXMania/コード/ステージ/06.曲読み込み/CStage曲読み込み.cs @@ -514,7 +514,7 @@ namespace DTXMania // if ( ( nCurrentTime - this.nBGM再生開始時刻 ) > ( this.nBGMの総再生時間ms - 1000 ) ) if ((nCurrentTime - this.nBGM再生開始時刻) >= (this.nBGMの総再生時間ms)) // #27787 2012.3.10 yyagi 1000ms == フェードイン分の時間 { - if (!CDTXMania.Instance.DTXVmode.Enabled) + if (!CDTXMania.Instance.DTXVmode.Enabled && !CDTXMania.Instance.DTX2WAVmode.Enabled) { this.actFO.tフェードアウト開始(); } @@ -524,7 +524,7 @@ namespace DTXMania } case CStage.Eフェーズ.共通_フェードアウト: - if (this.actFO.On進行描画() == 0 && !CDTXMania.Instance.DTXVmode.Enabled) // DTXVモード時は、フェードアウト省略 + if (this.actFO.On進行描画() == 0 && !CDTXMania.Instance.DTXVmode.Enabled && !CDTXMania.Instance.DTX2WAVmode.Enabled) // DTXVモード時は、フェードアウト省略 return 0; if (txFilename != null) diff --git a/DTXMania/コード/全体/CDTXMania.cs b/DTXMania/コード/全体/CDTXMania.cs index d0e0127d..ba491137 100644 --- a/DTXMania/コード/全体/CDTXMania.cs +++ b/DTXMania/コード/全体/CDTXMania.cs @@ -367,9 +367,20 @@ namespace DTXMania { FDK.CSound管理.nMixerVolume[ i ] = DTX2WAVmode.nMixerVolume[ i ]; } - ConfigIni.nMasterVolume.Value = DTX2WAVmode.nMixerVolume[(int)FDK.CSound.EInstType.Unknown]; // [5](Unknown)のところにMasterVolumeが入ってくるので注意 + ConfigIni.nMasterVolume.Value = DTX2WAVmode.nMixerVolume[(int)FDK.CSound.EInstType.Unknown]; // [5](Unknown)のところにMasterVolumeが入ってくるので注意 + // CSound管理.nMixerVolume[5]は、結局ここからは変更しないため、 + // 事実上初期値=100で固定。 #endregion #region [ 録音用の本体設定 ] + + // 本体プロセスの優先度を少し上げる (最小化状態で動作させると、処理性能が落ちるようなので + // → ほとんど効果がなかったので止めます + //Process thisProcess = System.Diagnostics.Process.GetCurrentProcess(); + //thisProcess.PriorityClass = ProcessPriorityClass.AboveNormal; + + // エンコーダーのパス設定 (=DLLフォルダ) + FDK.CSound管理.strEncoderPath = Path.Combine(strEXEのあるフォルダ, "DLL"); + CDTXMania.Instance.ConfigIni.nSoundDeviceType.Value = ESoundDeviceTypeForConfig.WASAPI_Exclusive; CDTXMania.Instance.ConfigIni.bEventDrivenWASAPI.Value = false; @@ -436,7 +447,7 @@ namespace DTXMania CDTXMania.instance.ConfigIni.nChipVolume.Value = 100; //マスターボリューム100 - CDTXMania.instance.ConfigIni.nMasterVolume.Value = 100; + //CDTXMania.instance.ConfigIni.nMasterVolume.Value = 100; // DTX2WAV側から設定するので、ここでは触らない //StageFailedオフ CDTXMania.instance.ConfigIni.bStageFailed.Value = false; @@ -472,6 +483,9 @@ namespace DTXMania CDTXMania.Instance.ConfigIni.bEmphasizePlaySound.Guitar.Value = false; CDTXMania.Instance.ConfigIni.bEmphasizePlaySound.Bass.Value = false; + // パッド入力等、基本操作の無効化 (ESCを除く) + //CDTXMania.Instance.ConfigIni.KeyAssign[][]; + #endregion } else // 通常のコンパクトモード @@ -665,7 +679,7 @@ namespace DTXMania if (DTX2WAVmode.Enabled) { - this.Window.WindowState = FormWindowState.Minimized; //DTX2WAVモード時は自動的に最小化したいが、まだうまくいかない + this.Window.WindowState = FormWindowState.Minimized; //DTX2WAVモード時は自動的に最小化 } DTX = null; @@ -1865,6 +1879,10 @@ namespace DTXMania DTX.t全チップの再生停止(); DTX.On非活性化(); r現在のステージ.On非活性化(); + if (DTX2WAVmode.Enabled) + { + Environment.Exit(0); + } if (bコンパクトモード) { base.Window.Close(); diff --git a/FDK/コード/03.サウンド/CSound.cs b/FDK/コード/03.サウンド/CSound.cs index e95356d9..7ad1234d 100644 --- a/FDK/コード/03.サウンド/CSound.cs +++ b/FDK/コード/03.サウンド/CSound.cs @@ -209,7 +209,13 @@ namespace FDK /// /// 録音機能で使うミキサーボリューム /// - public static int[] nMixerVolume = { 100, 100, 100, 100, 100, 100 }; // BGM,SE,Drums,Guitar,Bass,Unknown + public static int[] nMixerVolume = { 100, 100, 100, 100, 100, 100 }; // BGM,SE,Drums,Guitar,Bass, Unknown(Unknownだけは外部から更新されないので事実上100で固定) + + /// + /// 録音機能で使う、エンコーダーパス (DLLフォルダ) + /// + public static string strEncoderPath; + #endregion @@ -382,11 +388,11 @@ namespace FDK switch ( SoundDeviceType ) { case ESoundDeviceType.ExclusiveWASAPI: - SoundDevice = new CSoundDeviceWASAPI( CSoundDeviceWASAPI.Eデバイスモード.排他, SoundDelayExclusiveWASAPI, SoundUpdatePeriodExclusiveWASAPI ); + SoundDevice = new CSoundDeviceWASAPI( CSoundDeviceWASAPI.Eデバイスモード.排他, SoundDelayExclusiveWASAPI, SoundUpdatePeriodExclusiveWASAPI, strRecordFileType, strEncoderPath ); break; case ESoundDeviceType.SharedWASAPI: - SoundDevice = new CSoundDeviceWASAPI( CSoundDeviceWASAPI.Eデバイスモード.共有, SoundDelaySharedWASAPI, SoundUpdatePeriodSharedWASAPI ); + SoundDevice = new CSoundDeviceWASAPI( CSoundDeviceWASAPI.Eデバイスモード.共有, SoundDelaySharedWASAPI, SoundUpdatePeriodSharedWASAPI, strRecordFileType, strEncoderPath ); break; case ESoundDeviceType.ASIO: diff --git a/FDK/コード/03.サウンド/CSoundDeviceWASAPI.cs b/FDK/コード/03.サウンド/CSoundDeviceWASAPI.cs index 480d811f..f7c29bb0 100644 --- a/FDK/コード/03.サウンド/CSoundDeviceWASAPI.cs +++ b/FDK/コード/03.サウンド/CSoundDeviceWASAPI.cs @@ -29,6 +29,8 @@ namespace FDK protected set; } + public string strRecordFileType = null; + // CSoundTimer 用に公開しているプロパティ public long n経過時間ms @@ -110,7 +112,7 @@ namespace FDK /// /// WASAPIのサウンドバッファサイズ /// サウンドバッファの更新間隔 - public CSoundDeviceWASAPI( Eデバイスモード mode, long n希望バッファサイズms, long n更新間隔ms ) + public CSoundDeviceWASAPI( Eデバイスモード mode, long n希望バッファサイズms, long n更新間隔ms, string strRecordFileType, string strEncoderPath ) { // 初期化。 @@ -456,6 +458,13 @@ Trace.TraceInformation("WASAPI Device #{0}: {1}: IsDefault={2}, defPeriod={3}s, this.bIsBASSFree = true; throw new Exception( string.Format( "BASSミキサ(mixing)の作成に失敗しました。[{0}]", errcode ) ); } +// if (strRecordFileType != "") +// { +// // DTX2WAV時には、マスターボリュームをここで設定する +// // +// Bass.BASS_ChannelSetAttribute(this.hMixer, BASSAttribute.BASS_ATTRIB_VOL, CSound管理.nMixerVolume[5] / 100.0f); +//Trace.TraceInformation("Vol5: {0}", CSound管理.nMixerVolume[5]); +// } for (int i = 0; i <= (int)CSound.EInstType.Unknown; i++) { @@ -474,7 +483,7 @@ Trace.TraceInformation("WASAPI Device #{0}: {1}: IsDefault={2}, defPeriod={3}s, // Mixerのボリューム設定 Bass.BASS_ChannelSetAttribute(this.hMixer_Chips[ i ], BASSAttribute.BASS_ATTRIB_VOL, CSound管理.nMixerVolume[ i ] / 100.0f ); -Trace.TraceInformation("Vol{0}: {1}", i, CSound管理.nMixerVolume[i]); +//Trace.TraceInformation("Vol{0}: {1}", i, CSound管理.nMixerVolume[i]); bool b1 = BassMix.BASS_Mixer_StreamAddChannel(this.hMixer, this.hMixer_Chips[i], BASSFlag.BASS_DEFAULT); if (!b1) @@ -527,12 +536,44 @@ Trace.TraceInformation("Vol{0}: {1}", i, CSound管理.nMixerVolume[i]); // 録音設定(DTX2WAV) - encoder = new EncoderWAV(this.hMixer_DeviceOut); - encoder.InputFile = null; //STDIN - encoder.OutputFile = CSound管理.strRecordOutFilename; - encoder.UseAsyncQueue = true; - encoder.Start(null, IntPtr.Zero, true); // PAUSE状態で録音開始 - + if (strRecordFileType != "") + { + switch (strRecordFileType.ToUpper()) + { + case "WAV": + encoder = new EncoderWAV(this.hMixer_DeviceOut); + break; + case "OGG": + { + var e = new EncoderOGG(this.hMixer_DeviceOut); + e.EncoderDirectory = strEncoderPath; + e.OGG_UseQualityMode = true; + e.OGG_Quality = 8.0f; + //e.OGG_Bitrate = 128; + //e.OGG_MinBitrate = 0; + //e.OGG_MaxBitrate = 0; + + encoder = e; + } + break; + case "MP3": + { + var e = new EncoderLAME(this.hMixer_DeviceOut); + e.EncoderDirectory = strEncoderPath; + e.LAME_UseVBR = false; + e.LAME_Bitrate = 192; + encoder = e; + } + break; + default: + encoder = new EncoderWAV(this.hMixer_DeviceOut); + break; + } + encoder.InputFile = null; //STDIN + encoder.OutputFile = CSound管理.strRecordOutFilename; + encoder.UseAsyncQueue = true; + encoder.Start(null, IntPtr.Zero, true); // PAUSE状態で録音開始 + } //Bass.BASS_ChannelSetAttribute(this.hMixer_DeviceOut, BASSAttribute.BASS_ATTRIB_VOL, 0.10f); //Bass.BASS_SetConfig(BASSConfig.BASS_CONFIG_GVOL_SAMPLE, 1000); //Bass.BASS_SetVolume(0.1f); @@ -632,7 +673,7 @@ Trace.TraceInformation("Vol{0}: {1}", i, CSound管理.nMixerVolume[i]); protected int hMixer_Record = -1; protected int[] hMixer_Chips = new int[(int)CSound.EInstType.Unknown + 1]; //DTX2WAV対応 BGM, SE, Drums...を別々のmixerに入れて、個別に音量変更できるようにする - protected EncoderWAV encoder; + protected BaseEncoder encoder; protected int stream; protected WASAPIPROC tWasapiProc = null; diff --git a/RuntimeResources/dll/lame.exe b/RuntimeResources/dll/lame.exe new file mode 100644 index 00000000..7a623a97 Binary files /dev/null and b/RuntimeResources/dll/lame.exe differ diff --git a/RuntimeResources/dll/oggenc2.exe b/RuntimeResources/dll/oggenc2.exe new file mode 100644 index 00000000..3c40a925 Binary files /dev/null and b/RuntimeResources/dll/oggenc2.exe differ