Main Site Documentation

Snippet - FEZ Game-O Utility Class Library


#1

I just posted FEZ Game-O Utility Class Library on Codeshare. Feel free to discuss and make suggestions here.


#2

When trying to compile, I am getting an unknown reference to GHI.GameO.LowLevel. Is there something I did not load correctly?


#3

Nope, you will have to wait for the new SDK to be released (very soon!), we’ve been posting Game-O software as we’ve gotten it done so when the SDK comes out, everything needed (documentation, libraries, etc.) will be in place.


#4

But, I want to play with it now! OK, I’ll try to be patient :confused:


#5

Jeff,

In developing game hardware, one of the first things that comes up is playing sounds. GHI has (2) solutions, neither of which can handle the job. Native PCM .wav playing at 8kHz (which is way too low BTW), and the external serial codec option.

Games need to play more than one .wav sound at a time. At least 3-4. Look at the game “Bop-it” for instance. It plays at least three sounds at a time. And that is on an 8-bit processor playing audio not midi tones.

If we lift the cover on PlayPCM() it is hidden in RLP (of course). The external codec solution is terrific, but mixing isn’t implemented in the OS!

Somebody is going to have to write native code which decodes multiple buffered audio streams, sums them with both volume and sample rate control, in real-time. Then it could be used with both PlayPCM and an external codec.

How do you plan on getting where you need to go?


#6

[quote=“Familyghost”]Somebody is going to have to write native code which decodes multiple buffered audio streams, sums them with both volume and sample rate control, in real-time. Then it could be used with both PlayPCM and an external codec.

How do you plan on getting where you need to go?
[/quote]

That “somebody” could a be community member … just saying.


#7

@ Familyghost - We’ve been pretty busy getting things together after the success of the Kick-Starter campaign. We are aware of audio issues & gaming. For the first issue of the SDK (out in next couple of days) nothing is going to change .

I’ve entered your suggestions into our issue tracker. As mhectorgato stated, it is possible that a community solution will pop-up.


#8

I’m really glad people are interested in the topic. It’s one of my primary end-use features.

Native coding to that degree deals with OS memory management and kernel interrupt priorities. I doubt anything hacky would work without decent OS hooks.

If the working group is interested in my current C-based API, just to cover all the features I’ve been using for a long time, I’m delighted to share it. Hope you find it useful.


typedef struct
{
	unsigned int
		numInList;
	unsigned int
		theArray[MAXSOUNDLISTSIZE];			// the array of sounds to be played
} SOUNDLIST;

typedef bool SoundExternalStart(unsigned char channelNumber,unsigned int value);
typedef void SoundExternalStop(unsigned char channelNumber);
typedef bool IsSoundExternalRunning(unsigned char channelNumber);

bool GetSoundPlaying(unsigned int channelNumber,unsigned int *soundIndex);
bool IsSoundPlaying(unsigned int channelNumber);
void StopPlayingSound(unsigned int channelNumber);
void CopySoundList(SOUNDLIST *source,SOUNDLIST *dest);
void StartSoundList(SOUNDLIST *theList);
void AddSoundToList(SOUNDLIST *theList,unsigned int theSound);
void AddSoundListToList(SOUNDLIST *theList,SOUNDLIST *theListToAdd);
void ReadyForNextSound(unsigned int channelNumber);
void PausePlayingSound(unsigned int channelNumber);
void UnPausePlayingSound(unsigned int channelNumber);
bool PlaySoundList(unsigned int channelNumber,SOUNDLIST *theList);
bool AppendPlaySoundList(unsigned int channelNumber,SOUNDLIST *theList);
void UpdateSounds();
void SetExternalSoundFunctions(unsigned int channelNumber,SoundExternalStart *startFunction,SoundExternalStop *stopFunction,IsSoundExternalRunning *runningFunction);
void UnInitSounds();
bool InitSounds();


#9

[quote=“Familyghost”]
I’m really glad people are interested in the topic. It’s one of my primary end-use features.

Native coding to that degree deals with OS memory management and kernel interrupt priorities. I doubt anything hacky would work without decent OS hooks.

If the working group is interested in my current C-based API, just to cover all the features I’ve been using for a long time, I’m delighted to share it. Hope you find it useful.[/quote]

@ Familyghost - Can’t speak for GHI, but I’m sure the community would appreciate the library, if it worked in the RLP and/or RLP-lite environments.

If you wish to contribute to the community, then you can share via the CodeShare section of this forum.

https://www.ghielectronics.com/community/codeshare/entry/create


#10

@ Jeff -


		/// <summary>
		/// Returns the current width of the display based on its orientation.
		/// </summary>
		public static int Width
		{
			get
			{
				return Display.Orientation == Orientations.Landscape || Display.Orientation == Orientations.LandscapeFlipped ? 320 : 240;
			}
		}

		/// <summary>
		/// Returns the current height of the display based on its orientation.
		/// </summary>
		public static int Height
		{
			get
			{
				return Display.Orientation == Orientations.Landscape || Display.Orientation == Orientations.LandscapeFlipped ? 240 : 320;
			}
		}

I think these supposed to be 160 and 120.


#11

@ Architect - Bad choice of names by us for these accessors, they were intended to be the sizes of the surface that can be rendered to when using the Display class’ Draw functions.

We’ve renamed, re-commented, and added two more accessors, but I’m afraid there will still be confusion. I’ll try to beef-up our documentation: http://www.ghielectronics.com/docs/225/game-o-lcd-display-handling

New file is in codeshare


#12

I see. Yeah, better now. Thanks!


#13

Thank you for pointing it out. The more of these things we discover now, the better the docs and usage will be for other users


#14

I’m not very versed on the in’s and out’s of the NTMF but, I have a question about the PlayTone method:

Why do you re-initialize the AudioOut every time? I see that it is disposed in the StopTone, it is a static variable so does it need to be disposed and set null every time a sound is stopped? Can it not just be re-used?


#15

It was a simple way to make sure that PlayWAVAudio can be called after PlayTone without pin reservation conflicts. And since StopTone is public, it can be called without calling PlayTone, we need to check for null. Feel free to modify the library to suit your specific needs.


#16

Hi Guys,

Yesterday I cleaned up this library and uploaded. Also I started tunning and implementing few new functionalities.

Thanks for starting this topic.