MyMPx.org

MyMPx.org (http://mympx.org/forum/)
-   Mods and Themes (http://mympx.org/forum/mods-themes/)
-   -   Simple clock/timer for Rockchip's players (http://mympx.org/forum/mods-themes/44395-simple-clock-timer-rockchips-players.html)

sig11 16th Sep 2009 3:32 pm

Simple clock/timer for Rockchip's players
 
1 Attachment(s)
Hi guys,

Sorry for my English.

"Menu" - setup the clock or the timer ( "V+" - increase time, "V-" - decrease , "Menu" - for the next digit)
"Long Menu" - exit application
"|<<" - start the timer (bell on 00:00:00 )
">||" - Stop/Continue
">>|" - start the clock

The applications set up internal clock to 12 MHz ( I am not sure that it is supports for all models )

knob 17th Sep 2009 4:18 am

This is a good idea sig11.
I will test it out on my player. :D

WIZARD 17th Sep 2009 4:46 am

Thanks for this application! :)

I can't hear a bell - when the timer becomes zero, there's only quiet hissing :(

sig11 17th Sep 2009 5:31 am

Quote:

Originally Posted by WIZARD (Post 283035)
Thanks for this application! :)

I can't hear a bell - when the timer becomes zero, there's only quiet hissing :(

Do you have the sounds in the other games ( tanks,pirates, etc) ?

WIZARD 17th Sep 2009 6:50 am

Sounds
 
Yes, I have sounds and music in all games created by Rockchip company,
and simple apps for testing like Data-Viewer.
So, there's no any problem with my RK2608 320x240 player.

Were the Xonix and Chess created with sounds? :confused:

knob 17th Sep 2009 10:25 am

Another member flasher86 has made sound work, here is what he writes:-
Quote:

Yes I can put music, but currently only in PCM format, which is quite annoying (files are huge). Standard platform introduces functions to play MONO 11.025KHz 8-bit Unsigned PCM stream. You can prepare this format using e.x. Sony Sound Forge (save as RAW PCM). Make sure that you ticked UNSIGNED pcm, not signed. Otherwise you get strange noises. Also 16 bit pcm is not supported yet (also strange noises), but I've already given couple of shots, and maybe I will succeed with this.

BUT, I modded the platform to be able to play PCM streams at higher sample rate. Now I can play files at 22.050KHz, 32.000KHz and even 44100KHz (though at 44100 rate it sometimes pauses playing while running some complicated operations in your RKP file. The best is 32.000KHz which is really fine quality.

In this topic I mentioned how to mod the platform to increase sample rate. Just look through few previous pages.

ps. the pcm file must be mono, but you can actually play stereo files using some trick. Platform provides 5 channels to play sounds on, at same time mixing together. Also you can set the balance of each of these channels. Then to play stereo files you may use two pcm streams of each channel (right, left) and call them on different channel at totally opposite balance set. I successfully played STEREO 44.100KHz song.

knob 17th Sep 2009 10:57 am

This works ok on my player Rockchip Rk2608 320x240 screen.
Even the alarm sounds when it counts down to zero, it sounds like an old style telephone by the way. :p

flasher86 30th Sep 2009 2:46 pm

If someone wants to know how to increase frame rate of PCM Audio in RKP platform, you can use this code (if you dont want to digg through the forum).

Define write memory function somewhere in your header file:
Code:

#define write_mem(address, value)      (*((unsigned int volatile*)(address)) = (value))
To set a new frame rate put this AFTER calling the function MusicChannelAsk.
Default 11025Hz:
Code:

write_mem(0xF408, 0x0006);
write_mem(0xF408, 0x0055);

16000Hz:
Code:

write_mem(0xF408, 0x0006);
write_mem(0xF408, 0x0044);

22050Hz:
Code:

write_mem(0xF408, 0x0006);
write_mem(0xF408, 0x0033);

32000Hz:
Code:

write_mem(0xF408, 0x0006);
write_mem(0xF408, 0x0022);

44100Hz:
Code:

write_mem(0xF408, 0x0006);
write_mem(0xF408, 0x0011);

48000Hz: (not tested but should also work)
Code:

write_mem(0xF408, 0x0006);
write_mem(0xF408, 0x0080);


sig11 4th Oct 2009 8:50 am

Quote:

Originally Posted by flasher86 (Post 283331)
If someone wants to know how to increase frame rate of PCM Audio in RKP platform, you can use this code (if you dont want to digg through the forum).

Define write memory function somewhere in your header file:
Code:

#define write_mem(address, value)      (*((unsigned int volatile*)(address)) = (value))
To set a new frame rate put this AFTER calling the function MusicChannelAsk.
Default 11025Hz:

I used the next code for the sound:
Code:

  (*MusicOn)();
  (*MusicChannelAsk)(ResourceIdexBuff[2],9983,0,1,100);

Is this correct?
Why it not works on the all players?

flasher86 4th Oct 2009 9:05 am

It should be as follows:

Code:

#define write_mem(address, value)      (*((unsigned int volatile*)(address)) = (value))
#define IC_DATA_CMD                    ((0x1e800 + 0x10)/2)
#define P_ADD_CCR                      (0x0006)
...

(*MusicOn)();
(*MusicChannelAsk)(ResourceIdexBuff[2],9983,1,160,100);
 write_mem(IC_DATA_CMD, P_ADD_CCR);
 write_mem(IC_DATA_CMD, 0x0011); // for 44KHz

try this one with new MusicChannelAsk parameters. third parameter can be zero but it is safer to use 1. Fourth parameter is the balance set, to hear the sound in both speakers you should set it to 160 (central value in 0-320).

btw, on which players it doesnt work?

sig11 4th Oct 2009 9:21 am

Quote:

Originally Posted by flasher86 (Post 283406)
It should be as follows:

Code:

#define write_mem(address, value)      (*((unsigned int volatile*)(address)) = (value))
#define IC_DATA_CMD                    ((0x1e800 + 0x10)/2)
#define P_ADD_CCR                      (0x0006)
...
 
(*MusicOn)();
(*MusicChannelAsk)(ResourceIdexBuff[2],9983,1,160,100);
 write_mem(IC_DATA_CMD, P_ADD_CCR);
 write_mem(IC_DATA_CMD, 0x0011); // for 44KHz

try this one with new MusicChannelAsk parameters. third parameter can be zero but it is safer to use 1. Fourth parameter is the balance set, to hear the sound in both speakers you should set it to 160 (central value in 0-320).

btw, on which players it doesnt work?

Thanks, I will try.
It doesnt work on WIZARD's player

flasher86 4th Oct 2009 10:01 am

Music.rar

here you have got a sample RKP file with random song included. It's the best playback quality available on RKP platform using standard functions. The sound file is prepared using Sony Sound Forge. Its converted from mp3 file, downsampled to 8-bit stream. The left channel is located in the beginning of the file, and right channel is pasted just after left channel at the middle of the file. The output sound file should be MONO (though it has two channels sequentially), 8-bit, UNSIGNED PCM. Sample rate is unchanged 44100Hz.

The source is included.

WIZARD 5th Oct 2009 6:49 am

Music
 
I'm launching it, and...
I can hear the music! :eek: This RKP File has a working sound!
Sig11, you could implement the MoveSound into Chess by the similar way! :rolleyes:

flasher86 5th Oct 2009 11:13 am

hmmm, its good its working on your player WIZARD.

Although I am not sure why you have problems with this in your own programs.

As far as I noticed, GDK is very buggy. Sometimes it doesn't add file to the resource as it suppose to. For example "other" type of resource doesn't work at all!! I tried many times, and in many ways to add it but with no success. Maybe it's just on my system, but when you compile your program make sure that in GDK the resources are added as they should (compare file size manually). Maybe that's why there was no sound in your apps.

WIZARD 5th Oct 2009 2:12 pm

That's because this GDK I've got from chinese is Beta version.
And it's nearly impossible to get the normal one, without bugs.

knob 8th Oct 2009 12:52 pm

Hey WIZARD, can you check if this snake with sound works on your player.
http://www.sendspace.com/file/2z1bbg

I have had a problem that any game with moving graphics doesn't work (stutters)with sound at above 11025 Hz

WIZARD 9th Oct 2009 4:45 am

NewBigSnake
 
Yes, the sound is working! :rolleyes:
Is it 11025 Hz or 44100 Hz ?

knob 9th Oct 2009 4:56 am

Quote:

Originally Posted by WIZARD (Post 283469)
Yes, the sound is working! :rolleyes:
Is it 11025 Hz or 44100 Hz ?

It is 11025 Hz. problem is you can't mix quality and background music in high quality stutters the game.
anyway here is flipped screen snake.
http://www.sendspace.com/file/qkdcbj

flasher86 9th Oct 2009 5:48 am

Hmmm, don't use 44100Hz in games. I also noticed that it makes problems. Instead, use 22050 or 32000. With these you can work fine, and even 22050 is a lot better quality than 11025Hz.

If you're having problems anyway, try to increase CPU freq. I test all my projects at maximum 72MHz. Currently I am creating a nice looking game with pretty complicated real-time generated intro and it doesn't even slow down with background music and samples at 22050Hz. I decided to not include higher sample rate because I don't get better quality anyway - as we work with 8-bit sounds only.

The major issue of 8-bit sounds is a steady white noise which cannot be avoided. But the funny thing is that this noise is louder with higher sample rate. So my recommendation to use 22050 is fully reasonable.

And yes, we cannot mix sounds at different sample rates. The sounds playing at the same time must have the same sample rate.

WIZARD 30th Oct 2009 10:16 am

Snake Horizontal&Sound Version
 
I've noticed a bug: the background music plays only for two times;
so, after ~~50 eaten berries you will hear only the "WakeUp" sounds.

knob 30th Oct 2009 12:06 pm

hi WIZARD.
You can increase the number of times it plays, just change the last parameter 1 (playtimes) in the line:-
(*MusicChannelAsk)(RESOURCE_MUSIC, TUNESIZE, 1, 160, 1);//play tune in channel 1

0 is play once
1 is play 2 times
2 is play 3 times etc.
It's not a bug, I just decided that the tune might get annoying so just set it to play twice.
This version also has a pause game option.

btw here's Tetris2 with sound and mpx easter egg.
http://www.sendspace.com/file/nm0c3y


All times are GMT -7. The time now is 10:55 am.

Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2015, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.6.0 RC 2