Rockbox Technical Forums

Support and General Use => Recording => Topic started by: Mmmm on September 04, 2006, 07:55:41 AM

Title: Recording countdown timer
Post by: Mmmm on September 04, 2006, 07:55:41 AM
How would you like a countdown timer so you can set your unit up to start recording in a few hours?

Here's a patch to do just that.. I've only just finished it so it may have a couple of bugs.

As yet, when you leave the recording screen the timer pauses and resumes when you re-enter (so you need to be constantly in the recording screen for the timer to work properly). I realise this is not ideal and it'd be great if it just kept ticking away while you were doing other things, but that would take me ages to work out how to do. But I'll be thinking about it.

So, to get it to work, you set the timer in the settings and then press record as usual in the recording screen - press record again to pause the countdown etc... I've set the max time as 25 hours - is this enough do you think?

I also still have to do the lang files..(it's hardcoded in English at the mo).

Any other ideas or any bugs, just post here....

(reply#16 has latest patch)
Title: Re: Recording countdown timer
Post by: mlind on September 04, 2006, 08:13:39 AM
GREAT!

How about a button for "immediate start" if the band starts early or if you by misstake have entered the wrong countdown time.
Title: Re: Recording countdown timer
Post by: Mmmm on September 04, 2006, 08:20:35 AM
Good idea, an override button would be useful....
If you entered the wrong time though you can easily go back into the menu and change it.

Maybe the play/pause button should act as start/stop timer and the newfile button should always be newfile....
Title: Re: Recording countdown timer
Post by: Mmmm on September 04, 2006, 08:34:44 AM
Ok, so now the ON button starts/pauses the timer and the REC button starts a new file as usual and resets the timer to 0.

Also I've enabled long presses of the up/down buttons and the stop in the timer settings...seems more obvious to use now.

[attachment deleted by admin, too old]
Title: Re: Recording countdown timer
Post by: Rincewind on September 04, 2006, 10:40:19 AM
great idea!
Title: Re: Recording countdown timer
Post by: mborus on September 04, 2006, 01:26:11 PM
Quote
So, to get it to work, you set the timer in the settings and then press record as usual in the recording screen - press record again to pause the countdown etc... I've set the max time as 25 hours - is this enough do you think?

For me, longer periods might be useful. Like 72 hours, so I can go away for a weekend on friday and still set the countdown to record on sunday...
Title: Re: Recording countdown timer
Post by: Mmmm on September 04, 2006, 02:36:16 PM
WOW..72 hours...the problem there is the battery I think...although it would be ok if it was plugged in I suppose...hmmmm what do you think might be your maximum? I have to assign a certain number of bits to hold the values you see so it has to be finite (and the more unused assigned bits the more memory wasted).
Title: Re: Recording countdown timer
Post by: Llorean on September 04, 2006, 02:40:06 PM
I think one solution could be an option to set a time/date to begin recording for RTC targets only, that way those with an RTC can set *any* arbitrary time. Not removing the other option, but expanding it.
Title: Re: Recording countdown timer
Post by: Mmmm on September 04, 2006, 02:51:26 PM
I think one solution could be an option to set a time/date to begin recording for RTC targets only, that way those with an RTC can set *any* arbitrary time. Not removing the other option, but expanding it.
Yes, this is the possible next step, although I dont have a clock on my player so the motivation isn't quite so high. That's why I went for a countdown timer first! :)
Title: Re: Recording countdown timer
Post by: Mmmm on September 04, 2006, 04:22:09 PM
Hmmm the timer doesn't seem to be very accurate, it loses about 3 seconds per minute...the peakmeter seems to be taking a lot of juice... If I disable it it is spot on... I wonder what happens if I boost the CPU... Or maybe a disabled peakmeter while it is ticking would be ok as you wont be looking at the unit while it is counting down. What do you think?
Title: Re: Recording countdown timer
Post by: Rincewind on September 04, 2006, 04:36:52 PM
maybe you could get your time from the runtime counter?
but this won't be possible when the player is plugged in  :(
Perhaps there is some code there how to get an exact time.

I haven't seen your code yet, but I suppose you did something like

    sleep(HZ*x);

Disabeling everything that uses cpu time (and wastes battery) when the player is waiting is a good idea anyway. Make it an option ;D
Title: Re: Recording countdown timer
Post by: Mmmm on September 04, 2006, 04:45:05 PM
maybe you could get your time from the runtime counter?
but this won't be possible when the player is plugged in  :(
Perhaps there is some code there how to get an exact time.

I haven't seen your code yet, but I suppose you did something like

 Â   sleep(HZ*x);

Disabeling everything that uses cpu time (and wastes battery) when the player is waiting is a good idea anyway. Make it an option ;D
Boosted it only loses 2 seconds per minute...that's rubbish!

To get the timing i'm setting last_tick = current_tick as soon as it is activated and then decreasing by one when current_tick - last_tick >= HZ.
I'm running the whole of the recording loop while I do this as well.

It's fast enough to work without the peakmeter unboosted but it just wont work with it... maybe I should try decreasing within the peakmeter code instead....

If I used a sleep then nothing else would happen while it slept, so then there would definitely be no peakmeters! But it would give spot on timing.
Title: Re: Recording countdown timer
Post by: Mmmm on September 05, 2006, 05:31:32 AM
\o/
\o/

it's working...

It's ticking in time...

\o/

but not only that.....

... it keeps ticking no matter what you are doing!!!!!!!!!!!!!  :o

Too good to believe eh?
It certainly is....
I'm not going to post the patch until i've checked it over a bit more.. I still don't believe it! :D
Title: Re: Recording countdown timer
Post by: Mmmm on September 05, 2006, 08:33:32 AM
Alright then, heres the new patch..bug free... ahem...

The timer is now accurate and ticks at all times (not sure about plugins though).

I had it so that it automatically started the recording screen wherever you are too but calling the recording screen from the timer was a bad idea....it crashed quite often but it worked often too..however, that's not good enough.

So if the timer reaches 0 while you are away from the recording screen nothing will happen... when you enter the recording screen next it will automatically start recording.

I thought that a good idea would be to have an icon in the statusbar that is always on when the timer is ticking and flashes or something when it reaches 0. Unfortunately the statusbar is full on the Archos...hmmmm... That'll be for version 4 I think! :D

PS. mborus you can now have up to 128 hours timing! Is that enough? ;D

[attachment deleted by admin, too old]
Title: Re: Recording countdown timer
Post by: whatboutbob on September 05, 2006, 09:36:11 AM
Only 128 hours?  Oh man...but there's this gig next monday I wanna record...and I wanted to get started early...  ;)
Title: Re: Recording countdown timer
Post by: Mmmm on September 06, 2006, 06:14:00 AM
An update...well, actually two..

Version4: A nice little watch icon in the bottom right corner of the screen while the timer is ticking. This Icon appears in all screens no matter what you are doing. When the timer runs out the Icon flashes to remind you to go back into the recording screen where the recording will begin.

Version5: 128 hours? how long is that? Now you can only have 24 hours.. but you also have a day setting so you can have the timer running for 7 days! a whole week! Madness...I think that is long enough :D
Also settings wrap, so on reaching 59 minutes you just press up to get to 0 instead of going all the way back down again.

While mucking about I plugged in the remote just to see if the info fitted on the screen (will have to look at the Archos too) and guess what? The remote goes bonkers when the timer is running! hmmmm

[attachment deleted by admin, too old]
Title: Re: Recording countdown timer
Post by: Mmmm on September 06, 2006, 07:18:40 AM
Ok, the bonkers remote was just because it doesn't like being written to simultaneously so we can have no icon on the remote..no great loss.... I just hope the other targets (ie archos) dont have the same problem or they wont be able to have an icon at all.

Also the remote buttons dont work properly in the timer menu(for both remotes) so I've fixed that in this version.

Go on, give it a go... it hopefully works for all targets (that record), tell me what you think, or if it doesn't work ;)

[attachment deleted by admin, too old]
Title: Re: Recording countdown timer
Post by: Rincewind on September 06, 2006, 11:10:56 AM
I don't think the icon is a good idea. If I set a timer I don't want to babysit it to see if something starts flashing. Make it easy: show a splash "recording timer finished!!" or something like that for a few seconds if the player is not in recording screen. So when you are using the player you get the notice and if you leave it alone you leave it in recording screen.

A WPS Tag to show the remaining time could be nice, but I suppose that's overkill.

I'm just curious: have you created an own thread for the timer?
Title: Re: Recording countdown timer
Post by: pabouk on September 06, 2006, 11:26:54 AM
I had it so that it automatically started the recording screen wherever you are too but calling the recording screen from the timer was a bad idea....it crashed quite often but it worked often too..however, that's not good enough.
Does not the timer run in a different thread than the one that is used for UI? If so the correct solution should be to pass a message to the UI (Main) thread which will invoke the Recording Screen. Unfortunately I do not know much about the Rockbox architecture but the basics should be documented here: http://www.rockbox.org/twiki/bin/view/Main/RockboxArchitecture.
Title: Re: Recording countdown timer
Post by: Mmmm on September 07, 2006, 03:13:16 AM
I don't think the icon is a good idea. If I set a timer I don't want to babysit it to see if something starts flashing. Make it easy: show a splash "recording timer finished!!" or something like that for a few seconds if the player is not in recording screen. So when you are using the player you get the notice and if you leave it alone you leave it in recording screen.
Why is that preferable to an icon? It does the same thing only the Icon keeps flashing in the corner. A splash would turn off and you might miss it or it could permanently stay on and get in the way.

Quote
I'm just curious: have you created an own thread for the timer?
Well, I used the timer thread that the backlight fade uses, That is why the backlight won't fade while the timer is running! When it has finished it gives it back though.

I had it so that it automatically started the recording screen wherever you are too but calling the recording screen from the timer was a bad idea....it crashed quite often but it worked often too..however, that's not good enough.
Does not the timer run in a different thread than the one that is used for UI? If so the correct solution should be to pass a message to the UI (Main) thread which will invoke the Recording Screen. Unfortunately I do not know much about the Rockbox architecture but the basics should be documented here: http://www.rockbox.org/twiki/bin/view/Main/RockboxArchitecture
Yes, that would be good... I don't know how to do that either, though... yet :)
Title: Re: Recording countdown timer
Post by: k1spanish on September 07, 2006, 05:02:18 AM
This is a great thing - timed recording is the only reason I still use my iFP for FM-recording. Question: is there already a build available with timer included? Yours, Mmmmm?
Title: Re: Recording countdown timer
Post by: Mmmm on September 07, 2006, 06:16:21 AM
This is a great thing - timed recording is the only reason I still use my iFP for FM-recording. Question: is there already a build available with timer included? Yours, Mmmmm?
There wasn't but there is now...try this: rockbox_rectimer.zip (http://homepage.ntlworld.com/martin.scarratt/Rockbox/rockbox_rectimer.zip ) (for H120/H140) only
Title: Re: Recording countdown timer
Post by: k1spanish on September 07, 2006, 06:52:04 AM
Wow, quick response! Thanks!! I will test the build and report if there is anything to report.
Title: Re: Recording countdown timer
Post by: k1spanish on September 12, 2006, 07:30:04 AM
Hi!

Timer works perfect. One question: is the the reported and fixed bug while mp3 recording (Topic: New Codec and FM Recording for iAudio and iRiver) already fixed in your build?
Title: Re: Recording countdown timer
Post by: Mmmm on September 12, 2006, 08:49:50 AM
Hi!

Timer works perfect. One question: is the the reported and fixed bug while mp3 recording (Topic: New Codec and FM Recording for iAudio and iRiver) already fixed in your build?
Nope, my build was made on the 7th and thefix was on the 9th..but here's a build with it included:rockbox_rectimer.zip (http://homepage.ntlworld.com/martin.scarratt/Rockbox/rockbox_rectimer.zip ) (for H120/H140) only

Although I think there is still something  wrong with recording in general..I seem to keep getting crashes (with digital in anyway)...

Anyway, about the countdown timer. There are now 2 things keeping me from committing it.
i) Noone has tested it on the recorder (I'm not sure if the screen can handle the icon as the H1xx remote screen can't) I really need to know if it works or not.
ii) This is not specific to this patch but I'm having problems compiling the Recorder V2...I'm always getting REGION FLASH FULL errors seemingly with any patch I apply... It's driving me mad... I'm not sure if its the fault of my compiler specifically or that the code (meaning the entire rockbox code) is just now too big for this target...and if the latter it needs fixing somehow. But how is well beyond me!
Title: Re: Recording countdown timer
Post by: jaybeee on September 13, 2006, 03:12:33 AM
Wow! Thanks so much Mmmm. I was just thinking about how I was going to miss recording something this weekend cos I'm gonna be away, but now it looks like I can use your countdown patch; brilliant.

So, the latest patch above (for H120), how do I add that to my current build? I've never done that before you see. I am actually still using your REP build from a few months ago! I was thinking it's about time I changed  :D So this patch seems as good a time as any to do just that ;)

Oh, and one more thing: the 128hrs limit seems great. I just wonder if it's possible (or indeed worthwhile) to add some functionality that allows you to start recording after a certain time (as the patch allows now) AND THEN to start recording for a second time after another countdown period... and so on? What d'ya think?
Title: Re: Recording countdown timer
Post by: Mmmm on September 13, 2006, 04:25:02 AM
It's not 128 hours anymore, it's now a week!

You cant add this to your current build.... You will have to make an entirely new one... Download source, patch with whatever patches you use, add this patch and compile. I think I'll put this in the REP today, so that should solve your problem anyway...check the REP thread, I'll post in there when I get it in.

Hmmm, to be able to have more than one countdown you would also have to have a time limit for the recording, so three timers in a row...sounds complicated....
You could have a start and end time and a set radio frequency for each timer...
You'll be asking for Videoplus next! :D
Title: Re: Recording countdown timer
Post by: jaybeee on September 13, 2006, 05:09:45 AM
A week is cool for me.

Yep, that would be great to shove it into the REP *thumbs-up*

I guess I didn't think about the extra countdown functionality enough; it was just an idea after all.
However, there is existing functionality for you to record for only a certain time (or filesize). So, if you have a (1) countdown timer initially (your new one), then a (2) "record for a certain time" (already present), the third timer would just need to be reset when the recording finishes. So yes, 3 timers I guess, but two are already there and the third is just a reset of the first one I'd've thought??

I guess it could get messy with how to implement the "should the second timer be from the finished recording or an overall time from the very beginning" (the former seems more sensible to me). So, countdown to start recording in 2hrs and then record for 3hrs, then after that countdown for another 2hrs, then record until no more disk space (for example).

I dunno, maybe a lot of work that no-one would use?? I probably would use it, but maybe not that often. Spose it depends on how much time you have ;)

Videoplus would be great btw, thanks  :P
Title: Re: Recording countdown timer
Post by: k1spanish on September 13, 2006, 05:33:30 AM
Hi Mmmm,

I ca't say I really tested the build with timer - but I played around with it and recorded different codecs with different timesplit settings to end the recording automatically. There was no crash at all, but I recorded always only brief files (about 5 min). This weekend I will use your last build with timer to record my weekly FM broadcastings. These will be mp3 files 128 kps and 60 to 90 min each. If there is any problem I'll report.
Title: Re: Recording countdown timer
Post by: Mmmm on September 13, 2006, 06:59:09 AM
A week is cool for me.

Yep, that would be great to shove it into the REP *thumbs-up*
Ok, it's there....

Quote
I guess I didn't think about the extra countdown functionality enough; it was just an idea after all.
However, there is existing functionality for you to record for only a certain time (or filesize). So, if you have a (1) countdown timer initially (your new one), then a (2) "record for a certain time" (already present), the third timer would just need to be reset when the recording finishes. So yes, 3 timers I guess, but two are already there and the third is just a reset of the first one I'd've thought??

I guess it could get messy with how to implement the "should the second timer be from the finished recording or an overall time from the very beginning" (the former seems more sensible to me). So, countdown to start recording in 2hrs and then record for 3hrs, then after that countdown for another 2hrs, then record until no more disk space (for example).
I think the best way would be to be able to set a timer to time in 3 hours time and another in 8 hours time. If timesplit is not set then the second one will be ignored, if the timesplit is set for say 1 hour, then (behind the scenes) when the recording stops, the timer 1 setting changes to timer2 - oldtimer 1 - filesplit time (in this case 8 - 3 -1 = 4 hours) and off it goes and starts recording again in 4 more hours....

Using sizesplit the check would be done when the recording finishes and if oldtimer 1 + recorded time < timer 2 then timer 1 = timer 2 - oldtimer 1 - recorded time. Otherwise timer 2 would be ignored...
Hmmm you know, it might just work!

We would have to reset the filesplit options after they were used once too, or it would split everything in the same way which would be no good...Which would mean that having another stage in the timers wouldnt work (unless you added a filesplit2... noooooooo)
Quote
Videoplus would be great btw, thanks  :P
Ok, give me a couple of years and I'll get on to it :p


Hi Mmmm,

I ca't say I really tested the build with timer - but I played around with it and recorded different codecs with different timesplit settings to end the recording automatically. There was no crash at all, but I recorded always only brief files (about 5 min). This weekend I will use your last build with timer to record my weekly FM broadcastings. These will be mp3 files 128 kps and 60 to 90 min each. If there is any problem I'll report.
It sounds like you're getting confused between the filesplit and the countdown timer.
Filesplit is already in CVS...The countdown timer is so that you can set it to record at some time in the future. The countdown timer shouldnt be affected by the length of the recording, just by the time before the recording.
Title: Re: Recording countdown timer
Post by: mlind on September 13, 2006, 08:45:17 AM
So... It's possible to END a recording after a specified time (let's say 2 hours) - as long as you don't want to also have automatic filesplitting (let's say every fifteen minutes).

Is it so hard to have both?
Doesn't seem like a good idea to record until the HD is full.

To me this seems more important than to have several timers for recording start.
Title: Re: Recording countdown timer
Post by: Rincewind on September 13, 2006, 08:55:34 AM
if I had a h3xx I would have a cool feature request:
integrate the recording timer with the calender plugin.

But I only have a 120 without RTC, so thats not so great for me.

Another thing would be a playback timer (wake up timer), so instead of starting recording it starts playback. But thats so much work, i don't want to ask anybody to do it  ;D
Title: Re: Recording countdown timer
Post by: Mmmm on September 13, 2006, 09:23:45 AM
So... It's possible to END a recording after a specified time (let's say 2 hours) - as long as you don't want to also have automatic filesplitting (let's say every fifteen minutes).

Is it so hard to have both?
Doesn't seem like a good idea to record until the HD is full.
You are talking about the filesplit options right? and not the timer?
Yes, at the moment it is either split or stop and not both.

Quote
To me this seems more important than to have several timers for recording start.
Is it one or the other?


if I had a h3xx I would have a cool feature request:
integrate the recording timer with the calender plugin.

But I only have a 120 without RTC, so thats not so great for me.
same here...that's why I went for a timer instead of RTC

Quote
Another thing would be a playback timer (wake up timer), so instead of starting recording it starts playback. But thats so much work, i don't want to ask anybody to do it  ;D
Hmmm...something for you to be getting on with... ;)
Title: Re: Recording countdown timer
Post by: mlind on September 13, 2006, 12:20:05 PM
So... It's possible to END a recording after a specified time (let's say 2 hours) - as long as you don't want to also have automatic filesplitting (let's say every fifteen minutes).

Is it so hard to have both?
Doesn't seem like a good idea to record until the HD is full.
You are talking about the filesplit options right? and not the timer?
Yes, at the moment it is either split or stop and not both.

Quote
To me this seems more important than to have several timers for recording start.
Is it one or the other?

Maybe not :-)
Keep the good stuff coming! :-D

Any committing on the horizon?
Title: Re: Recording countdown timer
Post by: Rincewind on September 13, 2006, 02:44:25 PM
Quote from: Mmmm link=topic=6297.msg50351#msg50351

Quote
Another thing would be a playback timer (wake up timer), so instead of starting recording it starts playback. But thats so much work, i don't want to ask anybody to do it  ;D
Hmmm...something for you to be getting on with... ;)

If I only had enough time...
There are so many ideas that I would like to have in rockbox and I think that it would be possible for me to code them, but for whatever reason I'm not starting my editor :-\

Edit: fix bbcode
Title: Re: Recording countdown timer
Post by: Mmmm on September 13, 2006, 02:47:29 PM
Maybe not :-)
Keep the good stuff coming! :-D

Any committing on the horizon?
Look on the homepage my name's there for every other entry! :D

But I'm still having problems with the region FLASH full compiling errors for this patch and the recorderv2..and I'd just love to know whether it works on the normal recorder..but it seems people who own those just aren't into testing patches...I'll work something out... Apart from that it's CVS ready.
An option is to not have this feature at all on those players but I'd rather it was on all of them...

Anyway, here's the latest version, now the lang file is done and some other minor improvements that noone will notice from a users point of view (apart from the fact that it compiles again)

[attachment deleted by admin, too old]
Title: Re: Recording countdown timer
Post by: Mmmm on September 13, 2006, 02:59:21 PM
If I only had enough time...
There are so many ideas that I would like to have in rockbox and I think that it would be possible for me to code them, but for whatever reason I'm not starting my editor :-\
Go on...Push that button, you know once you start you won't be able to stop...all that other stuff you have to do isn't really important, you can do that next week ;)
Title: Re: Recording countdown timer
Post by: petur on September 13, 2006, 04:01:34 PM
all that other stuff you have to do isn't really important, you can do that next week ;)
I wish it was....
Title: Re: Recording countdown timer
Post by: mlind on September 13, 2006, 04:40:55 PM
Any committing on the horizon?
Look on the homepage my name's there for every other entry! :D

Oops... Sorry!!
I didn't know your real name.
Anyway, I really appreciate everytime things from the REP gets committed.

I wish I could contribute...
Keep up the good work!
Title: Re: Recording countdown timer
Post by: k1spanish on September 15, 2006, 03:32:38 AM
It sounds like you're getting confused between the filesplit and the countdown timer.
Filesplit is already in CVS...The countdown timer is so that you can set it to record at some time in the future. The countdown timer shouldnt be affected by the length of the recording, just by the time before the recording.

No, not confused, may be expressed not clear. I start recording with timer in the future (especially in the middle of the night... ;D)  and end with timesplit (->end recording) after a certain time. Used it yesterday, worked without any problems.

A chain of different timers should be combined with different FM-station select for each timer. Simple to do, isn't it...? ::)

Title: Re: Recording countdown timer
Post by: Mmmm on September 15, 2006, 04:07:12 AM
I wish I could contribute...
Keep up the good work!
If you're testing the patches and telling me what's wrong or right with them then you are contributing loads, thanks... :)


No, not confused, may be expressed not clear. I start recording with timer in the future (especially in the middle of the night... ;D)  and end with timesplit (->end recording) after a certain time. Used it yesterday, worked without any problems.

A chain of different timers should be combined with different FM-station select for each timer. Simple to do, isn't it...? ::)
Ahh I see... Good I'm glad it's working..thanks for testing....

I may try the multiple timers thing another day but at the moment I'm feeling a bit lethargic... especially seeing as anything I do breaks the archos players...Sigh.......
Title: Re: Recording countdown timer
Post by: renho3k on September 15, 2006, 08:47:37 PM
i just gave this a try. very nice addition indeed.

(oh and yesterday i had my first recording where i caught the remote interference. dammit! but at least i knew where the mysterious noise came from.)
Title: Re: Recording countdown timer
Post by: Mmmm on November 06, 2006, 05:09:10 AM
A new patch for the timer:
http://www.rockbox.org/tracker/task/6297

Not really much changed from a users perspective (apart from being able to see the countdown in any screen if your screen is wide enough) but it works very differently from a code perspective...much better I think :)