I've hit another problem creating a SisPlayer I can use from C#. At the moment I am trying to create a DLL that I can use in my C# programs utilising Pinvoke. The DLL I have created contains some static functions to allow me to play sid files. I am having problems getting the DLL to build. Each time I receive a linker error:
SidplayDLL error LNK2019: unresolved external symbol "public: __thiscall Audio_DirectX::Audio_DirectX(void)" (??0Audio_DirectX@@QAE@XZ) referenced in function "void __stdcall PlaySidFile(void)" (?PlaySidFile@@YGXXZ)
This implies that I am not linking to a required lib - however, I am linking to exactly the same libs I used when i successfully built a .exe test yesterday which successfully played a sid file. I cannot see from the above error any indication of which lib file I require. Does anyone have any ideas.....?
My code is as follows:
//using namespace std;
const char* szSidFile = "C:\\One.sid";
void* pBuffer = 0;
void __stdcall PlaySidFile()
// Setup audio driver
AudioDriver *pAudioDriver = new AudioDriver;
AudioConfig* pAudioConfig = new AudioConfig;
pAudioConfig->bufSize = 22000;
pAudioConfig->frequency = 44100;
pAudioConfig->precision = 16;
pAudioConfig->channels = 2;
pBuffer = pAudioDriver->open(*pAudioConfig, szSidFile);
SidTune* pTune = new SidTune(szSidFile, 0, false);
// Select the song to play within the sid file
// Configure the sidplay2 object
sidplay2* pSidplay2 = new sidplay2;
if (pSidplay2->load(pTune) == -1)
//printf("There was a problem loading the sid tune.");
// configure chip output using the sid2_config_t structure
sid2config.frequency = pAudioConfig->frequency;
sid2config.emulateStereo = true;
sid2config.leftVolume = 255;
sid2config.rightVolume = 255;
sid2config.clockSpeed = SID2_CLOCK_PAL;
sid2config.optimisation = 1;
sid2config.sampleFormat = SID2_BIG_UNSIGNED;
sid2config.sidModel = SID2_MOS6581;
sid2config.forceDualSids = false;
sid2config.sidSamples = true;
sid2config.playback = sid2_stereo;
sid2config.environment = sid2_envR;
sid2config.precision = pAudioConfig->precision;
sid2config.sidEmulation = &resid;
// Apply the confiuguration settings
if (pSidplay2->config(sid2config) == -1)
//printf("Configuration settings successfully applied");
// Play tune - needs something other than infinity i.e. check to see if song and loop until it finishes.....
//pBuffer = pAudioDriver->write();
// Clean up - will need to implement this properly.....
At the moment I have a single function to play a tune. The project is set up as a dynamic dll, automatically created by VS2003 and customised by me. I don't understand why it worked as an .exe but will not work as a .dll. Are there fundamental differences?
Don't worry guys, fixed it, turned out to be a corrupot project file!?
Anyway now have the library playing tunes through C# using DLLImport. I'm passing a handle from the current form into the exported function and running the playback on a backgroundworked thread. Works like a charm. Now i'm going to work on building a decent C# implemtation before looking at the possibility of constructing a COM wrapper and potentially a DirectShow filter.....
Sign up for the SourceForge newsletter:
You seem to have CSS turned off.
Please don't fill out this field.