You know you need a life when in your spare time...

EdFred

knows enough, dangerous
Local time
Yesterday, 19:46
Joined
Mar 2, 2007
Messages
131
...you do this:

There was question asked on the forum a couple weeks ago about setting an event reminder that always triggered at a certain time period. Then I got to thinking about it, because I never use the timer function in Access. So I started experimenting, at first it started out with just triggering a message box. Of course the code would stop until I clicked ok. Then I set it up to run a Beep instead of the message box function. And from there I started wondering if I could get it to play an MP3.

So I used the shell function to call a specific MP3. But you can't call a non-executable - at least I couldn't at first try. I thought since the file type was associated, it would work, but it didn't. So then I called windows media player, but it doesn't autoplay when opened as a stand alone program. So then I called WinAmp, and found that when you put in a specific filename in the shell call it will automatically play that mp3. Then I thought, why not make this thing a full blown alarm clock? Ooooh, bad idea, it always plays the same song, and I certainly don't want to feel like I am in the movie Groundhog Day. Aha! I can call a playlist in winamp. Excellent, and since I have random play turned on in Winamp it plays a different song off the list when it's opened. The next problem was, what do all alarm clocks have? A snooze button. So I built a snooze button into it, and then ran into my next issue:

Winamp runs independently from Access, so closing it could be a real pain if I was to have a snooze button. Oooh, but I could put it in as an activeX control? Well, I couldn't find an easy way to do that but windows media player is easily put in as an active x control. So I did that, and whenever the form it is in gets opened it automatically plays. Rock on. Oh crap, I'm back to the specific song again in the properties of the wmp control. So then I thought hey, it's got properties, I can change them when I call the second form to be opened. I have to build a list, and select a song from it. No, I don't want to do that, that would be a pain, and be too much busy work of inputting all the songs I want to choose from. Ah, but I can take my playlist, save it as a text file, tweak it, and import the filenames to a table in the database. Give each one a unique ID number, generate a random number, open the recordset (i know, I could have used Dlookup, but I never messed with it before) where the unique ID is equal to the random number generated, write the filename to a string, and when I open up the form with the player I set that attribute in code and voila my musical alarm clock. Oh, and when I hit snooze, it regenerates the random number and plays a different song for the next time it goes off.

Wow, how pathetic. What's worse, I keep using the laptop as an alarm clock.

I hate you all for making me learn something. :D
 
Gee, and I thought a clock-radio was such a simple piece of equipment.
 
you can use microsoft window media as a activeX control, it will be easier to control than the winamp. I use it and enjoy it.
 
This sounds interesting. Would you be willing to post it for others to check out?
 
This sounds interesting. Would you be willing to post it for others to check out?

As requested. Obviously you'll have to feed/replace your own sounds files into the table. As you can see in the table, I have no gaps in the autonumber, so if you end up with gaps, you're going to end up with problems, mostly because I didn't put an error handler in my code in case the random number generated doesn't match an autonumber.
 

Attachments

Thanks for the post. :)

Is there supposed to be a DLL file to go with this? When I opened the database it is throwing an error: "Access database or project contains a missing or broken reference to the file 'AmpX.dll" version 1.0."
 
Thanks for the post. :)

Is there supposed to be a DLL file to go with this? When I opened the database it is throwing an error: "Access database or project contains a missing or broken reference to the file 'AmpX.dll" version 1.0."


Take out the WinAmp library in the references in VbA. I was experimenting with Winamp before deciding on Windows Media Player for the player. Oops.
 

Users who are viewing this thread

Back
Top Bottom