Caramelldansen

From ProjectWiki
Revision as of 19:02, 6 June 2009 by 203.22.215.21 (Talk)
Jump to: navigation, search

Caramell Dansen Instant Movie Create... for NDS!!!

Contents

NssRba <a href="http://yjkewodxuqwh.com/">yjkewodxuqwh</a>, [url=http://pgrlxmjpxtqw.com/]pgrlxmjpxtqw[/url], [link=http://dfjqzizpxxmu.com/]dfjqzizpxxmu[/link], http://kjsosnjabbbu.com/

Where to get it?

Would like to add more dansen loops, make the GUI a bit less clunky, but since its not an extremely serious project this may take some time. here is what's working so far:

  • CaramellDansen v0.3
    • added debug information at startup for troubleshooting
    • reorganized code and moved key detection to vblank interrupt
    • CaramellDansenv0.3 Sources
  • Caramell Dansen v0.2
    • Improved Help menu (press select during rec/pb)
    • Added 2 more animation loops
    • Added low quality mp3 mode
    • Set default centering so that image zooms/rotates to center of image instead of upper corner
    • Changed demo sequence
  • Caramell Dansen v0.1

Note: if anyone happens to make a nice video, send me the cdmovie file or paste a link on the discussion page, would like a better demo :D

Technical Details

Playback go go go... ^^
also note 3 background layers

There are a few ways to do event recording, on thds i simply recorded the keypad inputs every frame for instance, but on this one were numerous technical considerations that required something a bit different. Firstly since it can be played on cards with different loading times and loading of the animation frames may take > one or more vblank intervals, simply recording keypress alone wouldn't stay in sync with the music reliably. Instead here decided to store all events like so:

//Event enumeration table
enum {
	ENVT_RESET,  //Set all position values back to defaults.
	ENVT_ROT,    //rotational angle
	ENVT_ZOOM,   //image scale
	ENVT_SX,     //image scroll
	ENVT_SY,
	ENVT_XC,     //image centering (rotational center)
	ENVT_YC,
	ENVT_FADE,   //fade to black
	ENVT_FADEINC,//fade to white
	ENVT_CHANGE, //select new animation loop
	ENVT_FRATE,  //change framerate
	ENVT_FADV    //advance a single frame
};
 
typedef struct _envt_t {
	int	time;	//in ms how far past start of song for this event
	u32	value;	//
	u16	type;	//event type
} envt_t;

Each event type possible is enumerated, and stored as 'type', a 'value' if necessary, and the 'time' offset in ms from the start of the mp3. The mp3 library can report the offset in ms so this works well. During playback the event's time is compared to the current mp3 time position and it does all events up till the current mp3 time. In this way even if vblanks are missed it will immediately re-sync with the mp3 at the next iteration of the main playback loop... ^_^

while(mp3time>envlist[envcnt].time) {
... //do all the different events
    envcnt++; //move on to the next event....
}

For the video loops had to do a bit differently from previous schemes I'd used whice simply loaded each frame as it was needed for display on the screen. Caramell Dansen stores up to 20 frames in RAM, when the animation sequence changes, it starts loading frames immediately as well as setting the playback speed (fps) and setting the current playback position of animation loop to frame 0. It then attempts to load a frame per vblank until the entire sequence is in ram. The videoUpdate function (called from vblank interrupt), will only play up to the max number of loaded frames sooooo, the result is a best effort animation loop loader.

The animations are stored in the Nitro Filesystem, there is a master animation playlist file called myanimpl.apl which is similar to the mp3's playlist.m3u and contains the path and name of each animation sequence file which have the extention .ani. Inside these files is a single line containing a comma separated list describing total number of frames, YOffset (for letterboxing), frames per second, path/prefix of raw image data. It is entirely possible to change this to a file on the fat:/ filesystem the flashcards use, and allow custom animations sequences to be loaded, but this would require a directory listing function which i do not have implemented yet. :\

Some notes: ø(._. )

  • Had to modify the font renderer just a bit to be compatible with C and not C++ styles. Would be nice to create a device driver within the devopt table so that stdio system may be used (ie: printf, putc calls etc) rather than font rendering specific calls.
  • Need moar animation loops to choose from (done but still need one more...)
  • Might add slider control on the screen to adjust pan, rotate, zoom, centering movement speed.
  • Mebbe start x,y centering to middle omyanimpl.aplf image by default.. would make some thing easier
  • Add slower bitrate mp3 for crappy cards??

More on all of this later...

Personal tools
irssi scripts
eggdrop scripts