Beispiel #1
0
void MusicClose(void)
{
   if (!has_midi)
      return;

#ifdef M59_MSS
   AIL_release_sample_handle(hseqBackground);
   AIL_release_sample_handle(hseqImmediate);

   if (pMIDIImmediate)
      AIL_mem_free_lock(pMIDIImmediate);
   if (pMIDIBackground)
      AIL_mem_free_lock(pMIDIBackground);

   AIL_shutdown();
#else
   mciSendCommand(MCI_ALL_DEVICE_ID, MCI_CLOSE, 0, 0);
#endif
}
 //
 // Destructor
 //
 ~Voice()
 {
   // Release the voice
   if (flag3D)
   {
     AIL_release_3D_sample_handle(handle3D);
   }
   else
   {
     AIL_release_sample_handle(handle2D);
   }
 }
Beispiel #3
0
bool TForm_Main::OpenFile()
{
	//  STOP!!!
	c_Button_Stop->Click();

	// Let go...
	if (m_hSample)
	{
		AIL_release_sample_handle(m_hSample);
		m_hSample = NULL;
	}

	// Get rid of the buffer if it's already been loaded
	if (m_pFileBuffer)
	{
		AIL_mem_free_lock(m_pFileBuffer);
		m_pFileBuffer = NULL;
	}

	// Remember the file name
	m_CurFile = c_Edit_FileName->Text;

	// Er, don't load if it doesn't exist...
	if (!FileExists(m_CurFile))
	{
		m_CurFile = "";
		return false;
	}

	m_hSample = AIL_allocate_sample_handle(m_hDigDriver);
	if (!m_hSample)
	{
		ChangeStatus("Error allocating sample handle");
		m_CurFile = "";
		return false;
	}

	char *pFileName = m_CurFile.c_str();

	// Bind to the file
	m_pFileBuffer = AIL_file_read(pFileName, NULL);
	if (!m_pFileBuffer)
	{
		ChangeStatus("Error opening " + m_CurFile + " (" + IntToStr(AIL_file_error()) + ")");
		m_CurFile = "";
		return false;
	}

	// Get the file size
	m_iFileSize = AIL_file_size(pFileName);

	AIL_init_sample(m_hSample);

	AIL_set_named_sample_file(m_hSample, pFileName, m_pFileBuffer, m_iFileSize, 0);

	AIL_set_sample_loop_count(m_hSample, 0);

	AIL_set_sample_volume(m_hSample, 127);

	AIL_set_sample_processor(m_hSample, DP_FILTER, m_hCurFilter);

	ChangeStatus("Loaded " + m_CurFile);

	return true;
}