08e2b4917b
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@434 a1c6a512-1295-4272-9138-f99709370657
85 lines
2.1 KiB
C
85 lines
2.1 KiB
C
/***************************************************************************
|
|
* __________ __ ___.
|
|
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
|
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
|
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
|
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
|
* \/ \/ \/ \/ \/
|
|
* $Id$
|
|
*
|
|
* Copyright (C) 2002 Daniel Stenberg
|
|
*
|
|
* All files in this archive are subject to the GNU General Public License.
|
|
* See the file COPYING in the source tree root for full license agreement.
|
|
*
|
|
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
|
* KIND, either express or implied.
|
|
*
|
|
****************************************************************************/
|
|
|
|
#include <string.h>
|
|
#include <stdlib.h>
|
|
|
|
#include <file.h>
|
|
#include <types.h>
|
|
#include <lcd.h>
|
|
#include <button.h>
|
|
#include "kernel.h"
|
|
#include "tree.h"
|
|
|
|
#include "id3.h"
|
|
|
|
#define LINE_Y 8 /* initial line */
|
|
#define LINE_HEIGTH 8 /* line height in pixels */
|
|
|
|
void playtune(char *dir, char *file)
|
|
{
|
|
char buffer[256];
|
|
int fd;
|
|
mp3entry mp3;
|
|
bool good=1;
|
|
|
|
sprintf(buffer, "%s/%s", dir, file);
|
|
|
|
if(mp3info(&mp3, buffer)) {
|
|
Logf("Failure!");
|
|
good=0;
|
|
}
|
|
#ifdef HAVE_LCD_BITMAP
|
|
lcd_clear_display();
|
|
if(!good) {
|
|
lcd_puts(0, 0, "[no id3 info]", 0);
|
|
}
|
|
else {
|
|
lcd_puts(0, 0, "[id3 info]", 0);
|
|
lcd_puts(0, LINE_Y, mp3.title?mp3.title:"", 0);
|
|
lcd_puts(0, LINE_Y+1*LINE_HEIGTH, mp3.album?mp3.album:"", 0);
|
|
lcd_puts(0, LINE_Y+2*LINE_HEIGTH, mp3.artist?mp3.artist:"", 0);
|
|
|
|
sprintf(buffer, "%d ms", mp3.length);
|
|
lcd_puts(0, LINE_Y+3*LINE_HEIGTH, buffer, 0);
|
|
|
|
sprintf(buffer, "%d kbits", mp3.bitrate);
|
|
lcd_puts(0, LINE_Y+4*LINE_HEIGTH, buffer, 0);
|
|
|
|
sprintf(buffer, "%d Hz", mp3.frequency);
|
|
lcd_puts(0, LINE_Y+5*LINE_HEIGTH, buffer, 0);
|
|
}
|
|
lcd_update();
|
|
#endif
|
|
|
|
while(1) {
|
|
int key = button_get();
|
|
|
|
if(!key) {
|
|
sleep(30);
|
|
continue;
|
|
}
|
|
switch(key) {
|
|
case BUTTON_OFF:
|
|
case BUTTON_LEFT:
|
|
return;
|
|
break;
|
|
}
|
|
}
|
|
}
|