mirror of
https://github.com/KillzXGaming/Switch-Toolbox
synced 2024-12-23 03:13:08 +00:00
65 lines
1.6 KiB
C#
65 lines
1.6 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel;
|
|
using System.IO;
|
|
using System.Drawing;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using System.Windows.Forms;
|
|
using VGAudio;
|
|
using NAudio.Wave;
|
|
using WeifenLuo.WinFormsUI.Docking;
|
|
using WMPLib;
|
|
|
|
namespace FirstPlugin
|
|
{
|
|
public partial class BFAVEditor : UserControl
|
|
{
|
|
public BFAVEditor()
|
|
{
|
|
InitializeComponent();
|
|
|
|
}
|
|
|
|
public void LoadFile(BARS.AudioEntry entry)
|
|
{
|
|
propertyGrid1.SelectedObject = entry;
|
|
|
|
MemoryStream audio = new MemoryStream(entry.BfwavToWav());
|
|
|
|
if (!Directory.Exists("Temp"))
|
|
Directory.CreateDirectory("Temp");
|
|
|
|
File.WriteAllBytes($"Temp/{entry.Text}.wav", audio.ToArray());
|
|
axWindowsMediaPlayer1.URL = $"Temp/{entry.Text}.wav";
|
|
|
|
axWindowsMediaPlayer1.Ctlcontrols.play();
|
|
}
|
|
private void btnPlay_Click(object sender, EventArgs e)
|
|
{
|
|
axWindowsMediaPlayer1.settings.autoStart = true;
|
|
}
|
|
|
|
|
|
private void onPlaybackFinished(object sender, StoppedEventArgs e)
|
|
{
|
|
|
|
}
|
|
|
|
bool IsPlaying = false;
|
|
private void axWindowsMediaPlayer1_PlayStateChange(object sender, AxWMPLib._WMPOCXEvents_PlayStateChangeEvent e)
|
|
{
|
|
if (!IsPlaying)
|
|
{
|
|
axWindowsMediaPlayer1.Ctlcontrols.play();
|
|
IsPlaying = true;
|
|
}
|
|
else
|
|
{
|
|
axWindowsMediaPlayer1.Ctlcontrols.stop();
|
|
IsPlaying = false;
|
|
}
|
|
}
|
|
}
|
|
}
|