-1
I am trying to call a function of a class that is in a DLL. But the error "Undefined object reference to an instance of an object" is showing, I don’t understand why because the IDE shows no error.
What am I doing wrong?
Follows code:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.IO;
using System.Threading;
using System.Runtime.InteropServices;
namespace player
{
public partial class frmPrincipal : Form
{
System.Media.SoundPlayer soundPlayer;
RSPOggPlayer279a.RSPOggPlayClass playerRSP;
public frmPrincipal()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
}
private void tocar()
{
playerRSP.UseEncryption(true, "988d90fsdhfnu943yrtherjh0qw9rifj");
//playerRSP.PlayFile("C:\Users\kleber.santos\7b.ogg");
//byte[] buffer = File.ReadAllBytes(@"C:\Users\kleber.santos\Downloads\africa-toto.wav");
//System.IO.File.Delete(@"C:\Users\kleber.santos\Downloads\africa-toto.wav");
//var memoryStream = new MemoryStream(buffer, true);
//soundPlayer = new System.Media.SoundPlayer(memoryStream);
//Play();
}
public void Play()
{
soundPlayer.Play();
}
private void BtnPlay_Click(object sender, EventArgs e)
{
tocar();
}
private void BtnVolume_Click(object sender, EventArgs e)
{
}
}
}
It is some object that forgot to instantiate, in which line the error occurs?
– Danielle Arruda torres
in line 36 -> playerRSP.Useencryption(true, "988d90fsdhfnu943yrtherjh0qw9rifj");, in debug it says that playerRSP is null.
– Kleber Santos