void JumpToAddrLow(uint addr)
        {
            this.ReadStartAddress.Value = addr;
            this.D0.Value   = Program.ROM.u32(addr + 0);
            this.D4.Value   = Program.ROM.u32(addr + 4);
            this.D8.Value   = Program.ROM.u32(addr + 8);
            this.D12.Value  = Program.ROM.u32(addr + 12);
            this.D8.Maximum = this.D12.Value;

            if (SongUtil.IsDirectSoundWaveCompressedDPCM(addr))
            {
                J_12.Text = R._("圧縮前のサイズ");
                X_L_COMPRESSED_SIZE.Show();
                X_COMPRESSED_SIZE.Show();
                X_COMPRESSED_SIZE.Value = SongUtil.GetDirectSoundWaveDataLength(addr);
                Infomation.Text         = R._("これより下のアドレスには、圧縮されたDPCMデータが、LengthByteだけ格納されています。");
            }
            else
            {
                J_12.Text = R._("LengthByte");
                X_L_COMPRESSED_SIZE.Hide();
                X_COMPRESSED_SIZE.Hide();
                X_COMPRESSED_SIZE.Value = 0;
                Infomation.Text         = R._("これより下のアドレスには、waveデータが、LengthByteだけ格納されています。");
            }
        }
Example #2
0
            bool _prepare_DirectSound(byte[] instrument_code, string key, bool is_deps)
            {
                Debug.Assert(SongInstrumentForm.IsDirectSound(instrument_code[0]));
                uint sample_location = U.p32(instrument_code, 4);

                if (sample_location > this.Data.Length)
                {
                    this.ErrorMessage += "\r\n" +
                                         R.Error("DirectSoundの中に、おかしなデータがありました。無視します。 sample_location:{0} > {1} ROM Size"
                                                 , U.To0xHexString(sample_location), U.To0xHexString(this.Data.Length));

                    //ダメな楽器として認識する.
                    return(false);
                }
                uint sample_hz1024 = U.u32(this.Data, sample_location + 4) / 1024;
                uint sample_length = SongUtil.GetDirectSoundWaveDataLength(this.Data, sample_location);

                Log.Debug(R._("DirectSound Sample:{0} bytes ({1} *1024 hz)", sample_length, sample_hz1024));

                if (is_deps)
                {
                    if (sample_length > 1024 * 1024 * 1 || //1MB
                        sample_hz1024 > 48 * 1024          //48khz Over
                        )
                    {
                        this.ErrorMessage += "\r\n" +
                                             R.Error("Multi または Drumの中に、おかしなデータがありました。無視します。 OverHZ Sample:{0} bytes ({1} *1024 hz)", sample_length, sample_hz1024);

                        //ダメな楽器として認識する.
                        return(false);
                    }
                }

                List <byte> current_sample = U.subrangeToList(this.Data, sample_location, sample_location + 16 + sample_length);

                //4バイトアライメント
                while ((current_sample.Count % 4) != 0)
                {
                    current_sample.Add(0);
                }

                Log.Debug(Instrument_mapping.Count.ToString(), sample_length.ToString("X"), this.Sample_data.Count.ToString("X"));

                U.write_u32(instrument_code, 4, (uint)this.Sample_data.Count);
                this.Sample_data.AddRange(current_sample);
                Log.Debug(R._("SampleData:{0} bytes (append({1}bytes))", this.Sample_data.Count, current_sample.Count));

                return(true);
            }