Example #1
0
PString SoundFX::GetModTypeString(int32 index)
{
	PString type;

	type.LoadString(res, IDS_SFX_MIME);
	return (type);
}
Example #2
0
PString JamCracker::GetDescription(int32 index)
{
	PString description;

	description.LoadString(res, IDS_JAM_DESCRIPTION);
	return (description);
}
Example #3
0
PString SoundFX::GetName(int32 index)
{
	PString name;

	name.LoadString(res, IDS_SFX_NAME);
	return (name);
}
Example #4
0
PString MediaKitAgent::GetDescription(int32 index)
{
	PString description;

	description.LoadString(res, IDS_MEDIAKIT_DESCRIPTION);
	return (description);
}
Example #5
0
PString MediaKitAgent::GetName(int32 index)
{
	PString name;

	name.LoadString(res, IDS_MEDIAKIT_NAME);
	return (name);
}
Example #6
0
PString JamCracker::GetModTypeString(int32 index)
{
	PString type;

	type.LoadString(res, IDS_JAM_MIME);
	return (type);
}
Example #7
0
PString SpinSquareAgent::GetName(int32 index)
{
	PString name;

	name.LoadString(res, IDS_SPIN_NAME);
	return (name);
}
Example #8
0
PString ScopeAgent::GetDescription(int32 index)
{
	PString description;

	description.LoadString(res, IDS_SCOPE_DESCRIPTION);
	return (description);
}
PString ModuleConverterAgent::GetName(int32 index)
{
	PString name;

	name.LoadString(res, IDS_MODC_NAME);
	return (name);
}
Example #10
0
PString ScopeAgent::GetName(int32 index)
{
	PString name;

	name.LoadString(res, IDS_SCOPE_NAME);
	return (name);
}
Example #11
0
PString SpinSquareAgent::GetDescription(int32 index)
{
	PString description;

	description.LoadString(res, IDS_SPIN_DESCRIPTION);
	return (description);
}
PString ModuleConverterAgent::GetDescription(int32 index)
{
	PString description;

	description.LoadString(res, IDS_MODC_DESCRIPTION);
	return (description);
}
Example #13
0
PString SoundFX::GetDescription(int32 index)
{
	PString description;

	description.LoadString(res, IDS_SFX_DESCRIPTION);
	return (description);
}
Example #14
0
PString JamCracker::GetName(int32 index)
{
	PString name;

	name.LoadString(res, IDS_JAM_NAME);
	return (name);
}
Example #15
0
PString DecruncherAgent::GetName(int32 index)
{
	PString name;

	name.LoadString(res, IDS_DECRUNCH_NAME);
	return (name);
}
Example #16
0
PString DecruncherAgent::GetDescription(int32 index)
{
	PString description;

	description.LoadString(res, IDS_DECRUNCH_DESCRIPTION);
	return (description);
}
Example #17
0
bool SoundFX::GetInfoString(uint32 line, PString &description, PString &value)
{
	// Is the line number out of range?
	if (line >= 4)
		return (false);

	// Find out which line to take
	switch (line)
	{
		// Song Length
		case 0:
		{
			description.LoadString(res, IDS_SFX_INFODESCLINE0);
			value.SetUNumber(songLength);
			break;
		}

		// Used Patterns
		case 1:
		{
			description.LoadString(res, IDS_SFX_INFODESCLINE1);
			value.SetUNumber(maxPattern);
			break;
		}

		// Supported/Used Samples
		case 2:
		{
			description.LoadString(res, IDS_SFX_INFODESCLINE2);
			value = "31";
			break;
		}

		// Actual Speed (BPM)
		case 3:
		{
			description.LoadString(res, IDS_SFX_INFODESCLINE3);
			value.SetUNumber(GetBPMTempo());
			break;
		}
	}

	return (true);
}
Example #18
0
const APDisplayInfo *SpinSquareAgent::GetDisplayInfo(void)
{
	PString title;

	title.LoadString(res, IDS_SPIN_TITLE);
	displayInfo.window = new SpinSquareWindow(this, res, title);
	displayInfo.openIt = spinSettings->GetStringEntryValue("Window", "OpenWindow").CompareNoCase("Yes") == 0;

	return (&displayInfo);
}
Example #19
0
bool JamCracker::GetInfoString(uint32 line, PString &description, PString &value)
{
	// Is the line number out of range?
	if (line >= 3)
		return (false);

	// Find out which line to take
	switch (line)
	{
		// Song Length
		case 0:
		{
			description.LoadString(res, IDS_JAM_INFODESCLINE0);
			value.SetUNumber(songLen);
			break;
		}

		// Used Patterns
		case 1:
		{
			description.LoadString(res, IDS_JAM_INFODESCLINE1);
			value.SetUNumber(patternNum);
			break;
		}

		// Used Instruments
		case 2:
		{
			description.LoadString(res, IDS_JAM_INFODESCLINE2);
			value.SetUNumber(samplesNum);
			break;
		}
	}

	return (true);
}
Example #20
0
void FixSettings(PResource *res, PSettings *settings)
{
	PString tempStr;

	if (!settings->EntryExist("General", "OutputFormat"))
	{
		tempStr.LoadString(res, IDS_IFF8SVX_FILE_PCM);
		settings->WriteStringEntryValue("General", "OutputFormat", tempStr);
	}

	// Set window positions
	if (!settings->EntryExist("Window", "WinX"))
		settings->WriteIntEntryValue("Window", "WinX", 50);

	if (!settings->EntryExist("Window", "WinY"))
		settings->WriteIntEntryValue("Window", "WinY", 50);
}
RIFFWAVESettingsWindow::RIFFWAVESettingsWindow(PResource *resource, PString title) : BWindow(BRect(0.0f, 0.0f, 0.0f, 0.0f), NULL, B_TITLED_WINDOW, B_NOT_RESIZABLE | B_NOT_ZOOMABLE | B_ASYNCHRONOUS_CONTROLS)
{
	BRect rect;
	PString label;
	char *labelPtr, *titlePtr;
	float titWidth, winWidth;
	float controlWidth, controlHeight;
	float w, w1, x, y;
	BMessage *message;
	font_height fh;
	float fontHeight;

	// Remember the config information
	res = resource;

	// Set the window title
	SetTitle((titlePtr = title.GetString()));

	// Create background view
	rect    = Bounds();
	topView = new BView(rect, NULL, B_FOLLOW_ALL_SIDES, B_WILL_DRAW);

	// Change the color to light grey
	topView->SetViewColor(BeBackgroundGrey);

	// Add view to the window
	AddChild(topView);

	// Find font height
	topView->GetFontHeight(&fh);
	fontHeight = max(PLAIN_FONT_HEIGHT, ceil(fh.ascent + fh.descent));

	// Create the listbox with the different formats
	formatPop = new BPopUpMenu("");

	label.LoadString(res, IDS_RIFFWAVE_FORMAT_MSADPCM);
	labelPtr = label.GetString();
	w = topView->StringWidth(labelPtr);
	formatPop->AddItem(new BMenuItem(labelPtr, NULL));
	label.FreeBuffer(labelPtr);

	label.LoadString(res, IDS_RIFFWAVE_FORMAT_PCM);
	labelPtr = label.GetString();
	w = max(topView->StringWidth(labelPtr), w);
	formatPop->AddItem(new BMenuItem(labelPtr, NULL));
	label.FreeBuffer(labelPtr);

	label.LoadString(res, IDS_RIFFWAVE_FORMAT);
	labelPtr = label.GetString();
	w1 = topView->StringWidth(labelPtr) + HSPACE;

	formatField = new BMenuField(BRect(HSPACE, VSPACE, HSPACE + w + w1 + HSPACE * 8.0f, VSPACE + 1.0f), NULL, labelPtr, formatPop);
	formatField->SetDivider(w1);
	topView->AddChild(formatField);
	label.FreeBuffer(labelPtr);

	// Find the width of the window
	titWidth = topView->StringWidth(titlePtr);
	winWidth = max(titWidth + HSPACE * 20.0f, w + w1 + HSPACE * 8.0f);
	title.FreeBuffer(titlePtr);

	// Add the "save" button
	y = fontHeight + VSPACE * 5.0f;
	x = winWidth - HSPACE;
	message = new BMessage(APCFG_SAVE);
	label.LoadString(res, IDS_RIFFWAVE_SAVE);
	saveButton = new BButton(BRect(x, y, x, y), NULL, (labelPtr = label.GetString()), message, B_FOLLOW_RIGHT | B_FOLLOW_BOTTOM);
	label.FreeBuffer(labelPtr);
	saveButton->GetPreferredSize(&controlWidth, &controlHeight);
	x -= controlWidth;
	ResizeTo(winWidth, y + controlHeight + VSPACE);

	saveButton->MoveTo(x, y);
	saveButton->ResizeTo(controlWidth, controlHeight);
	topView->AddChild(saveButton);

	// Add the "Use" button
	message = new BMessage(APCFG_USE);
	label.LoadString(res, IDS_RIFFWAVE_USE);
	useButton = new BButton(BRect(x, y, x, y), NULL, (labelPtr = label.GetString()), message, B_FOLLOW_RIGHT | B_FOLLOW_BOTTOM);
	label.FreeBuffer(labelPtr);
	useButton->GetPreferredSize(&controlWidth, &controlHeight);
	x -= (controlWidth + HSPACE);
	useButton->MoveTo(x, y);
	useButton->ResizeTo(controlWidth, controlHeight);
	topView->AddChild(useButton);

	// Set the settings in the controls
	GetSettings();

	// Does any window position exists in the settings
	if (useSettings->EntryExist("Window", "WinX") && useSettings->EntryExist("Window", "WinY"))
	{
		// Yes, now set the new window positions
		x = useSettings->GetIntEntryValue("Window", "WinX");
		y = useSettings->GetIntEntryValue("Window", "WinY");
		MoveTo(x, y);
	}
}
Example #22
0
ap_result JamCracker::LoadModule(int32 index, PFile *file, PString &errorStr)
{
	int32 i, j;
	ap_result retVal = AP_ERROR;

	try
	{
		// Skip the module mark
		file->Read_B_UINT32();

		// Get the number of instruments
		samplesNum = file->Read_B_UINT16();

		// Allocate the instrument structures
		instTable = new InstInfo[samplesNum];
		if (instTable == NULL)
		{
			errorStr.LoadString(res, IDS_JAM_ERR_MEMORY);
			throw PUserException();
		}

		// Clear all pointers in the structure
		for (i = 0; i < samplesNum; i++)
			instTable[i].address = NULL;

		// Read the instrument info
		for (i = 0; i < samplesNum; i++)
		{
			file->ReadString(instTable[i].name, 31);

			instTable[i].flags = file->Read_UINT8();
			instTable[i].size  = file->Read_B_UINT32();
			file->Read_B_UINT32();		// Skip the address
		}

		// Get the number of patterns
		patternNum = file->Read_B_UINT16();

		// Allocate the pattern structures
		pattTable = new PattInfo[patternNum];
		if (pattTable == NULL)
		{
			errorStr.LoadString(res, IDS_JAM_ERR_MEMORY);
			throw PUserException();
		}

		// Clear all pointers in the structure
		for (i = 0; i < patternNum; i++)
			pattTable[i].address = NULL;

		// Read the pattern information
		for (i = 0; i < patternNum; i++)
		{
			pattTable[i].size = file->Read_B_UINT16();
			file->Read_B_UINT32();		// Skip the address
		}

		// Get the song length
		songLen = file->Read_B_UINT16();

		// Allocate and read the position array
		songTable = new uint16[songLen];
		if (songTable == NULL)
		{
			errorStr.LoadString(res, IDS_JAM_ERR_MEMORY);
			throw PUserException();
		}

		file->ReadArray_B_UINT16s(songTable, songLen);

		if (file->IsEOF())
		{
			errorStr.LoadString(res, IDS_JAM_ERR_LOADING_HEADER);
			throw PUserException();
		}

		// Get the pattern data
		for (i = 0; i < patternNum; i++)
		{
			NoteInfo *note;

			// Allocate the pattern data
			note = new NoteInfo[pattTable[i].size * 4];
			if (note == NULL)
			{
				errorStr.LoadString(res, IDS_JAM_ERR_MEMORY);
				throw PUserException();
			}

			pattTable[i].address = note;

			// Read the data from the file
			for (j = 0; j < pattTable[i].size * 4; j++)
			{
				note[j].period   = file->Read_UINT8();
				note[j].instr    = file->Read_UINT8();
				note[j].speed    = file->Read_UINT8();
				note[j].arpeggio = file->Read_UINT8();
				note[j].vibrato  = file->Read_UINT8();
				note[j].phase    = file->Read_UINT8();
				note[j].volume   = file->Read_UINT8();
				note[j].porta    = file->Read_UINT8();
			}

			if (file->IsEOF())
			{
				errorStr.LoadString(res, IDS_JAM_ERR_LOADING_PATTERNS);
				throw PUserException();
			}
		}

		// Read the samples
		for (i = 0; i < samplesNum; i++)
		{
			if (instTable[i].size != 0)
			{
				instTable[i].address = new int8[instTable[i].size];

				// Bug fix for some corrupted modules
				memset(instTable[i].address, 0, instTable[i].size);

				file->Read(instTable[i].address, instTable[i].size);

				if ((file->IsEOF()) && (i != samplesNum - 1))
				{
					errorStr.LoadString(res, IDS_JAM_ERR_LOADING_SAMPLES);
					throw PUserException();
				}
			}
		}

		// Ok, we're done
		retVal = AP_OK;
	}
	catch(PUserException e)
	{
		// Just delete the exception and clean up
		Cleanup();
	}
	catch(...)
	{
		// Clean up
		Cleanup();
		throw;
	}

	return (retVal);
}
Example #23
0
ap_result SoundFX::LoadModule(int32 index, PFile *file, PString &errorStr)
{
	uint32 i;
	uint32 sampleSizes[31];
	ap_result retVal = AP_ERROR;

	try
	{
		// Read the sample size table
		file->ReadArray_B_UINT32s(sampleSizes, 31);

		// Skip the module mark
		file->Seek(4, PFile::pSeekCurrent);

		// Read the delay value
		delay = file->Read_B_UINT16();

		// Skip the pads
		file->Seek(14, PFile::pSeekCurrent);

		// Clear the sample information array
		memset(samples, 0, sizeof(samples));

		// Read the sample information
		for (i = 0; i < 31; i++)
		{
			file->ReadString(samples[i].name, 22);

			samples[i].length     = file->Read_B_UINT16() * 2;
			samples[i].volume     = file->Read_B_UINT16();
			samples[i].loopStart  = file->Read_B_UINT16();
			samples[i].loopLength = file->Read_B_UINT16() * 2;

			// Sample loop fix
			if ((samples[i].length != 0) && (samples[i].loopStart == samples[i].length))
				samples[i].length += samples[i].loopLength;

			// Adjust the sample length
			if (samples[i].loopLength > 2)
				samples[i].length = max(samples[i].length, samples[i].loopStart + samples[i].loopLength);

			// Volume fix
			if (samples[i].volume > 64)
				samples[i].volume = 64;

			if (file->IsEOF())
			{
				errorStr.LoadString(res, IDS_SFX_ERR_LOADING_HEADER);
				throw PUserException();
			}
		}

		// Read the song length
		songLength = file->Read_UINT8();
		file->Read_UINT8();

		// Read the orders
		file->Read(orders, 128);
		file->Seek(4, PFile::pSeekCurrent);

		if (file->IsEOF())
		{
			errorStr.LoadString(res, IDS_SFX_ERR_LOADING_HEADER);
			throw PUserException();
		}

		// Find heighest pattern number
		maxPattern = 0;

		for (i = 0; i < songLength; i++)
		{
			if (orders[i] > maxPattern)
				maxPattern = orders[i];
		}

		maxPattern++;

		// Allocate pattern pointer table
		patterns = new uint32 *[maxPattern];
		if (patterns == NULL)
		{
			errorStr.LoadString(res, IDS_SFX_ERR_MEMORY);
			throw PUserException();
		}

		memset(patterns, 0, maxPattern * sizeof(uint32 *));

		// Allocate and load the patterns
		for (i = 0; i < maxPattern; i++)
		{
			// Allocate space to hold the pattern
			patterns[i] = new uint32[4 * 64];
			if (patterns[i] == NULL)
			{
				errorStr.LoadString(res, IDS_SFX_ERR_MEMORY);
				throw PUserException();
			}

			// Read the pattern data
			file->ReadArray_B_UINT32s(patterns[i], 4 * 64);

			if (file->IsEOF())
			{
				errorStr.LoadString(res, IDS_SFX_ERR_LOADING_PATTERNS);
				throw PUserException();
			}
		}

		// Now it's time to read the sample data
		for (i = 0; i < 31; i++)
		{
			int8 *sampData;
			int32 length;

			// Allocate space to hold the sample
			length = sampleSizes[i];

			if (length != 0)
			{
				sampData = new int8[length];
				if (sampData == NULL)
				{
					errorStr.LoadString(res, IDS_SFX_ERR_MEMORY);
					throw PUserException();
				}

				memset(sampData, 0, length);
				samples[i].sampleAdr = sampData;

				// Check the see if we miss too much from the last sample
				if (file->GetLength() - file->GetPosition() < (length - 512))
				{
					errorStr.LoadString(res, IDS_SFX_ERR_LOADING_SAMPLES);
					throw PUserException();
				}

				// Read the sample
				file->Read(sampData, length);
			}
		}

		// Ok, we're done
		retVal = AP_OK;
	}
	catch(PUserException e)
	{
		// Just delete the exception and clean up
		Cleanup();
	}
	catch(...)
	{
		// Clean up
		Cleanup();
		throw;
	}

	return (retVal);
}