public Chiptune(string ModFilename) { mod = ModuleLoader.Instance.LoadModule(ModFilename); player = new ModulePlayer(mod); XnaSoundRenderer drv = new XnaSoundRenderer(new DynamicSoundEffectInstance(48000, AudioChannels.Stereo)); player.RegisterRenderer(drv); }
///<summary> ///</summary> public SharpModApp() { _graphics = new GraphicsDeviceManager(this); Content.RootDirectory = "Content"; #if WINDOWS_PHONE // Handle hiding of the battery status bar when used on windows phone _graphics.IsFullScreen = true; _graphics.PreferredBackBufferWidth = 480; _graphics.PreferredBackBufferHeight = 800; // Frame rate is 30 fps by default for Windows Phone. TargetElapsedTime = TimeSpan.FromSeconds(1 / 30.0); #else /*now handle hires screens for xbox and windows*/ _graphics.IsFullScreen = false; _graphics.PreparingDeviceSettings += GraphicsPreparingDeviceSettings; // Frame Rate is 60 fps by default for Xbox 360 and Windows. TargetElapsedTime = TimeSpan.FromSeconds(1 / 60.0); #endif var dsei = new DynamicSoundEffectInstance(48000, AudioChannels.Stereo); var ms = new MemoryStream(ModResources.Babylon); _sm = ModuleLoader.Instance.LoadModule(ms); _mp = new ModulePlayer(_sm); _mp.RegisterRenderer(new XnaSoundRenderer(dsei)); _mp.DspAudioProcessor = new AudioProcessor(1024, 50); _mp.DspAudioProcessor.OnCurrentSampleChanged += DspAudioProcessor_OnCurrentSampleChanged; _mp.Start(); }
private void Form1_Load(object sender, EventArgs e) { Assembly asm = Assembly.GetExecutingAssembly(); List <string> a = new List <string>(); var type = typeof(Base.iDemo); foreach (Type t in asm.GetTypes()) { if (type.IsAssignableFrom(t) && t.Name.ToUpper() != "IDEMO") { a.Add(t.Name); } } a.Sort(); for (int i = 0; i < a.Count; i++) { listBox1.Items.Add(a[i]); } init(); string mod = Application.StartupPath + @"\starlitdeception.mod"; myMod = ModuleLoader.Instance.LoadModule(mod); player = new ModulePlayer(myMod); player.MixCfg.Rate = 48000; NAudioWaveChannelDriver drv = new NAudioWaveChannelDriver(NAudioWaveChannelDriver.Output.WaveOut); player.RegisterRenderer(drv); player.Start(); }
/// <summary> /// Use This For XM Files /// </summary> public static void Init_XM() { byte[] bytes = null;//Properties.Resources.BRD___Teleport_Prokg; myMod = ModuleLoader.Instance.LoadModule(new MemoryStream(bytes)); player = new ModulePlayer(myMod); // Or NAudio Driver player.DspAudioProcessor = new AudioProcessor(1024, 50); player.MixCfg.Rate = 48000; player.MixCfg.Style = SharpMod.Player.RenderingStyle.Stereo; player.DspAudioProcessor.OnCurrentSampleChanged += new AudioProcessor.CurrentSampleChangedHandler(DspAudioProcessor_OnCurrentSampleChanged); player.OnGetPlayerInfos += Player_OnGetPlayerInfos;; NAudioWaveChannelDriver drv = new NAudioWaveChannelDriver(NAudioWaveChannelDriver.Output.WaveOut); player.RegisterRenderer(drv); }
private void PeXploit_Main_Load(object sender, EventArgs e) { packagelist.Items.Clear(); edatlist.Items.Clear(); SFO_link.Visible = false; this.Visible = false; if (FirstLoad.IsBusy == false) { FirstLoad.RunWorkerAsync(); } Welcome.INFO = " Please Wait A Few Seconds ..."; CheckUpdate(); Thread.Sleep(1000); Welcome.INFO = ("Welcome....."); backgroundbox.Image = Properties.Resources.Yo; if (File.Exists(Application.StartupPath + "\\idps.bin") == true) { txtIDPS.Text = "idps.bin Located"; label10.Visible = true; } FirstLoad.CancelAsync(); FirstLoad.Dispose(); Thread.Sleep(1000); this.Visible = true; try { myMod = ModuleLoader.Instance.LoadModule(Application.StartupPath + "\\Main.xm"); player = new ModulePlayer(myMod); // Or NAudio Driver player.DspAudioProcessor = new AudioProcessor(1024, 50); player.MixCfg.Rate = 48000; player.MixCfg.Style = SharpMod.Player.RenderingStyle.Stereo; player.DspAudioProcessor.OnCurrentSampleChanged += new AudioProcessor.CurrentSampleChangedHandler(DspAudioProcessor_OnCurrentSampleChanged); player.OnGetPlayerInfos += new GetPlayerInfosHandler(player_OnGetPlayerInfos); NAudioWaveChannelDriver drv = new NAudioWaveChannelDriver(NAudioWaveChannelDriver.Output.WaveOut); player.RegisterRenderer(drv); } catch(Exception ex) { MessageBox.Show(ex.Message); } }
private void BtnOpenClick(object sender, EventArgs e) { if (ofdModFile.ShowDialog() == DialogResult.OK) { if (Player != null) { Player.Stop(); btnPlayStop.Text = Resources.PlayText; } MyMod = ModuleLoader.Instance.LoadModule(ofdModFile.OpenFile()); /* MyMod.Patterns[1].Tracks[1].Cells[63].Effect = 0xB; * MyMod.Patterns[1].Tracks[1].Cells[63].EffectData = 0; * MyMod.Patterns[1].Tracks[1].ValidateChanges();*/ Player = new ModulePlayer(MyMod) { MixCfg = { Rate = 48000, Is16Bits = checkBox1.Checked, Interpolate = checkBox3.Checked } }; if (radioButton1.Checked) { Player.MixCfg.Style = SharpMod.Player.RenderingStyle.Mono; } else if (radioButton2.Checked) { Player.MixCfg.Style = SharpMod.Player.RenderingStyle.Stereo; } else if (radioButton3.Checked) { Player.MixCfg.Style = SharpMod.Player.RenderingStyle.Surround; } var drv = new NAudioWaveChannelDriver(NAudioWaveChannelDriver.Output.DirectSound) { Latency = 125 }; Player.RegisterRenderer(drv); //Player.DspAudioProcessor = new AudioProcessor(1024, 50); // Player.DspAudioProcessor.OnCurrentSampleChanged += DspAudioProcessor_OnCurrentSampleChanged; Player.OnGetPlayerInfos += player_OnGetPlayerInfos; var sb = new StringBuilder(); sb.AppendLine(String.Format("Mod Name: {0}", MyMod.SongName)); sb.AppendLine(String.Format("Channels: {0:00}", MyMod.ChannelsCount)); sb.AppendLine(String.Format("Base BPM: {0:000}", MyMod.InitialTempo)); sb.AppendLine(String.Format("Mod Type: {0}", MyMod.ModType)); tbModNfo.Text = sb.ToString(); listView1.Items.Clear(); int i = 0; foreach (var val in MyMod.Positions) { listView1.Items.Add(new ListViewItem(string.Format("{0:00}:{1:000}", i++, val)) { Tag = val }); } } }