2006-05-01 23:22:59 +00:00
|
|
|
/***************************************************************************
|
|
|
|
* __________ __ ___.
|
|
|
|
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
|
|
|
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
|
|
|
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
|
|
|
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
|
|
|
* \/ \/ \/ \/ \/
|
2007-09-24 15:57:32 +00:00
|
|
|
* $Id$
|
2006-05-01 23:22:59 +00:00
|
|
|
*
|
|
|
|
* Copyright (C) 2005 Karl Kurbjun based on midi2wav by Stepan Moskovchenko
|
|
|
|
*
|
2008-06-28 18:10:04 +00:00
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
2006-05-01 23:22:59 +00:00
|
|
|
*
|
|
|
|
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
|
|
|
* KIND, either express or implied.
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
2007-09-24 15:57:32 +00:00
|
|
|
#include "plugin.h"
|
|
|
|
#include "guspat.h"
|
|
|
|
#include "midiutil.h"
|
|
|
|
#include "synth.h"
|
|
|
|
#include "sequencer.h"
|
|
|
|
#include "midifile.h"
|
2006-05-01 23:22:59 +00:00
|
|
|
|
2010-08-24 14:30:46 +00:00
|
|
|
|
2006-05-07 07:27:07 +00:00
|
|
|
/* variable button definitions */
|
2009-03-28 11:27:56 +00:00
|
|
|
#if (CONFIG_KEYPAD == IRIVER_H100_PAD) || (CONFIG_KEYPAD == IRIVER_H300_PAD)
|
2016-10-01 20:09:42 +00:00
|
|
|
#define MIDI_QUIT BUTTON_OFF
|
|
|
|
#define MIDI_FFWD BUTTON_RIGHT
|
|
|
|
#define MIDI_VOL_UP BUTTON_UP
|
|
|
|
#define MIDI_VOL_DOWN BUTTON_DOWN
|
|
|
|
#define MIDI_REWIND BUTTON_LEFT
|
|
|
|
#define MIDI_RC_QUIT BUTTON_RC_STOP
|
|
|
|
#define MIDI_PLAYPAUSE BUTTON_ON
|
2006-06-30 16:43:47 +00:00
|
|
|
|
2007-07-27 09:57:27 +00:00
|
|
|
#elif (CONFIG_KEYPAD == IPOD_4G_PAD) || (CONFIG_KEYPAD == IPOD_3G_PAD) || \
|
|
|
|
(CONFIG_KEYPAD == IPOD_1G2G_PAD)
|
2016-10-01 20:09:42 +00:00
|
|
|
#define MIDI_QUIT (BUTTON_SELECT | BUTTON_MENU)
|
|
|
|
#define MIDI_FFWD BUTTON_RIGHT
|
|
|
|
#define MIDI_REWIND BUTTON_LEFT
|
|
|
|
#define MIDI_VOL_UP BUTTON_SCROLL_FWD
|
|
|
|
#define MIDI_VOL_DOWN BUTTON_SCROLL_BACK
|
|
|
|
#define MIDI_PLAYPAUSE BUTTON_PLAY
|
2008-01-02 06:35:59 +00:00
|
|
|
|
2006-05-07 07:27:07 +00:00
|
|
|
|
|
|
|
#elif (CONFIG_KEYPAD == GIGABEAT_PAD)
|
2016-10-01 20:09:42 +00:00
|
|
|
#define MIDI_QUIT BUTTON_POWER
|
|
|
|
#define MIDI_FFWD BUTTON_RIGHT
|
|
|
|
#define MIDI_REWIND BUTTON_LEFT
|
|
|
|
#define MIDI_VOL_UP BUTTON_UP
|
|
|
|
#define MIDI_VOL_DOWN BUTTON_DOWN
|
|
|
|
#define MIDI_PLAYPAUSE BUTTON_A
|
2008-01-02 06:35:59 +00:00
|
|
|
|
2006-05-07 07:27:07 +00:00
|
|
|
|
2008-05-02 00:38:11 +00:00
|
|
|
#elif (CONFIG_KEYPAD == GIGABEAT_S_PAD)
|
2016-10-01 20:09:42 +00:00
|
|
|
#define MIDI_QUIT BUTTON_POWER
|
|
|
|
#define MIDI_FFWD BUTTON_RIGHT
|
|
|
|
#define MIDI_REWIND BUTTON_LEFT
|
|
|
|
#define MIDI_VOL_UP BUTTON_UP
|
|
|
|
#define MIDI_VOL_DOWN BUTTON_DOWN
|
|
|
|
#define MIDI_PLAYPAUSE BUTTON_PLAY
|
2008-05-02 00:38:11 +00:00
|
|
|
|
|
|
|
|
2009-04-10 17:28:26 +00:00
|
|
|
#elif (CONFIG_KEYPAD == SANSA_E200_PAD)
|
2016-10-01 20:09:42 +00:00
|
|
|
#define MIDI_QUIT BUTTON_POWER
|
|
|
|
#define MIDI_FFWD BUTTON_RIGHT
|
|
|
|
#define MIDI_REWIND BUTTON_LEFT
|
|
|
|
#define MIDI_VOL_UP BUTTON_SCROLL_FWD
|
|
|
|
#define MIDI_VOL_DOWN BUTTON_SCROLL_BACK
|
|
|
|
#define MIDI_PLAYPAUSE BUTTON_UP
|
2008-01-10 08:08:31 +00:00
|
|
|
|
2009-04-10 17:28:26 +00:00
|
|
|
#elif (CONFIG_KEYPAD == SANSA_FUZE_PAD)
|
2016-10-01 20:09:42 +00:00
|
|
|
#define MIDI_QUIT (BUTTON_HOME|BUTTON_REPEAT)
|
|
|
|
#define MIDI_FFWD BUTTON_RIGHT
|
|
|
|
#define MIDI_REWIND BUTTON_LEFT
|
|
|
|
#define MIDI_VOL_UP BUTTON_SCROLL_FWD
|
|
|
|
#define MIDI_VOL_DOWN BUTTON_SCROLL_BACK
|
|
|
|
#define MIDI_PLAYPAUSE BUTTON_UP
|
2009-04-10 17:28:26 +00:00
|
|
|
|
2008-01-10 08:08:31 +00:00
|
|
|
|
2008-12-12 19:50:49 +00:00
|
|
|
#elif (CONFIG_KEYPAD == SANSA_C200_PAD) || \
|
|
|
|
(CONFIG_KEYPAD == SANSA_CLIP_PAD) || \
|
|
|
|
(CONFIG_KEYPAD == SANSA_M200_PAD)
|
2016-10-01 20:09:42 +00:00
|
|
|
#define MIDI_QUIT BUTTON_POWER
|
|
|
|
#define MIDI_FFWD BUTTON_RIGHT
|
|
|
|
#define MIDI_REWIND BUTTON_LEFT
|
|
|
|
#define MIDI_VOL_UP BUTTON_VOL_UP
|
|
|
|
#define MIDI_VOL_DOWN BUTTON_VOL_DOWN
|
|
|
|
#define MIDI_PLAYPAUSE BUTTON_UP
|
2008-01-02 06:35:59 +00:00
|
|
|
|
2006-10-26 13:38:09 +00:00
|
|
|
|
2007-03-16 23:02:39 +00:00
|
|
|
#elif CONFIG_KEYPAD == IAUDIO_X5M5_PAD
|
2016-10-01 20:09:42 +00:00
|
|
|
#define MIDI_QUIT BUTTON_POWER
|
|
|
|
#define MIDI_FFWD BUTTON_RIGHT
|
|
|
|
#define MIDI_REWIND BUTTON_LEFT
|
|
|
|
#define MIDI_VOL_UP BUTTON_UP
|
|
|
|
#define MIDI_VOL_DOWN BUTTON_DOWN
|
|
|
|
#define MIDI_PLAYPAUSE BUTTON_PLAY
|
2008-01-02 06:35:59 +00:00
|
|
|
|
2006-05-07 07:27:07 +00:00
|
|
|
|
2006-08-03 20:17:25 +00:00
|
|
|
#elif CONFIG_KEYPAD == IRIVER_H10_PAD
|
2016-10-01 20:09:42 +00:00
|
|
|
#define MIDI_QUIT BUTTON_POWER
|
|
|
|
#define MIDI_FFWD BUTTON_RIGHT
|
|
|
|
#define MIDI_REWIND BUTTON_LEFT
|
|
|
|
#define MIDI_VOL_UP BUTTON_SCROLL_UP
|
|
|
|
#define MIDI_VOL_DOWN BUTTON_SCROLL_DOWN
|
|
|
|
#define MIDI_PLAYPAUSE BUTTON_PLAY
|
2008-01-02 06:35:59 +00:00
|
|
|
|
2006-08-03 20:17:25 +00:00
|
|
|
|
2007-10-25 07:44:56 +00:00
|
|
|
#elif CONFIG_KEYPAD == MROBE500_PAD
|
2016-10-01 20:09:42 +00:00
|
|
|
#define MIDI_QUIT BUTTON_POWER
|
|
|
|
#define MIDI_FFWD BUTTON_RIGHT
|
|
|
|
#define MIDI_REWIND BUTTON_LEFT
|
|
|
|
#define MIDI_VOL_UP BUTTON_RC_PLAY
|
|
|
|
#define MIDI_VOL_DOWN BUTTON_RC_DOWN
|
|
|
|
#define MIDI_PLAYPAUSE BUTTON_RC_HEART
|
2008-01-02 06:35:59 +00:00
|
|
|
|
2007-10-25 07:44:56 +00:00
|
|
|
|
2008-03-01 22:55:09 +00:00
|
|
|
#elif (CONFIG_KEYPAD == MROBE100_PAD)
|
2016-10-01 20:09:42 +00:00
|
|
|
#define MIDI_QUIT BUTTON_POWER
|
|
|
|
#define MIDI_FFWD BUTTON_RIGHT
|
|
|
|
#define MIDI_REWIND BUTTON_LEFT
|
|
|
|
#define MIDI_VOL_UP BUTTON_UP
|
|
|
|
#define MIDI_VOL_DOWN BUTTON_DOWN
|
|
|
|
#define MIDI_PLAYPAUSE BUTTON_DISPLAY
|
2008-03-01 22:55:09 +00:00
|
|
|
|
|
|
|
|
2008-03-22 14:20:04 +00:00
|
|
|
#elif CONFIG_KEYPAD == IAUDIO_M3_PAD
|
2016-10-01 20:09:42 +00:00
|
|
|
#define MIDI_QUIT BUTTON_RC_REC
|
|
|
|
#define MIDI_FFWD BUTTON_RC_FF
|
|
|
|
#define MIDI_REWIND BUTTON_RC_REW
|
|
|
|
#define MIDI_VOL_UP BUTTON_RC_VOL_UP
|
|
|
|
#define MIDI_VOL_DOWN BUTTON_RC_VOL_DOWN
|
|
|
|
#define MIDI_PLAYPAUSE BUTTON_RC_PLAY
|
2008-03-22 14:20:04 +00:00
|
|
|
|
|
|
|
|
2009-12-15 20:51:41 +00:00
|
|
|
#elif CONFIG_KEYPAD == COWON_D2_PAD
|
2016-10-01 20:09:42 +00:00
|
|
|
#define MIDI_QUIT BUTTON_POWER
|
2008-03-22 22:03:34 +00:00
|
|
|
|
2008-12-04 21:28:56 +00:00
|
|
|
#elif CONFIG_KEYPAD == CREATIVEZVM_PAD
|
2016-10-01 20:09:42 +00:00
|
|
|
#define MIDI_QUIT BUTTON_BACK
|
|
|
|
#define MIDI_FFWD BUTTON_RIGHT
|
|
|
|
#define MIDI_REWIND BUTTON_LEFT
|
|
|
|
#define MIDI_VOL_UP BUTTON_UP
|
|
|
|
#define MIDI_VOL_DOWN BUTTON_DOWN
|
|
|
|
#define MIDI_PLAYPAUSE BUTTON_PLAY
|
2008-12-04 21:28:56 +00:00
|
|
|
|
2014-03-21 21:16:02 +00:00
|
|
|
#elif CONFIG_KEYPAD == CREATIVE_ZENXFI3_PAD
|
2016-09-23 15:45:44 +00:00
|
|
|
#define MIDI_QUIT (BUTTON_PLAY|BUTTON_REPEAT)
|
2016-10-01 20:09:42 +00:00
|
|
|
#define MIDI_FFWD BUTTON_MENU
|
|
|
|
#define MIDI_REWIND BUTTON_BACK
|
|
|
|
#define MIDI_VOL_UP BUTTON_VOL_UP
|
|
|
|
#define MIDI_VOL_DOWN BUTTON_VOL_DOWN
|
|
|
|
#define MIDI_PLAYPAUSE (BUTTON_PLAY|BUTTON_REL)
|
2014-03-21 21:16:02 +00:00
|
|
|
|
2009-01-24 22:41:55 +00:00
|
|
|
#elif CONFIG_KEYPAD == PHILIPS_HDD1630_PAD
|
2016-10-01 20:09:42 +00:00
|
|
|
#define MIDI_QUIT BUTTON_POWER
|
|
|
|
#define MIDI_FFWD BUTTON_RIGHT
|
|
|
|
#define MIDI_REWIND BUTTON_LEFT
|
|
|
|
#define MIDI_VOL_UP BUTTON_UP
|
|
|
|
#define MIDI_VOL_DOWN BUTTON_DOWN
|
|
|
|
#define MIDI_PLAYPAUSE BUTTON_MENU
|
2009-01-24 22:41:55 +00:00
|
|
|
|
2010-11-03 02:45:53 +00:00
|
|
|
#elif CONFIG_KEYPAD == PHILIPS_HDD6330_PAD
|
2016-10-01 20:09:42 +00:00
|
|
|
#define MIDI_QUIT BUTTON_POWER
|
|
|
|
#define MIDI_FFWD BUTTON_RIGHT
|
|
|
|
#define MIDI_REWIND BUTTON_LEFT
|
|
|
|
#define MIDI_VOL_UP BUTTON_UP
|
|
|
|
#define MIDI_VOL_DOWN BUTTON_DOWN
|
|
|
|
#define MIDI_PLAYPAUSE BUTTON_MENU
|
2010-11-03 02:45:53 +00:00
|
|
|
|
2009-12-09 18:20:49 +00:00
|
|
|
#elif CONFIG_KEYPAD == PHILIPS_SA9200_PAD
|
2016-10-01 20:09:42 +00:00
|
|
|
#define MIDI_QUIT BUTTON_POWER
|
|
|
|
#define MIDI_FFWD BUTTON_NEXT
|
|
|
|
#define MIDI_REWIND BUTTON_PREV
|
|
|
|
#define MIDI_VOL_UP BUTTON_UP
|
|
|
|
#define MIDI_VOL_DOWN BUTTON_DOWN
|
|
|
|
#define MIDI_PLAYPAUSE BUTTON_MENU
|
2009-12-09 18:20:49 +00:00
|
|
|
|
2009-04-07 23:41:44 +00:00
|
|
|
#elif CONFIG_KEYPAD == ONDAVX747_PAD
|
2016-10-01 20:09:42 +00:00
|
|
|
#define MIDI_QUIT BUTTON_POWER
|
2009-08-31 21:11:32 +00:00
|
|
|
#elif CONFIG_KEYPAD == ONDAVX777_PAD
|
2016-10-01 20:09:42 +00:00
|
|
|
#define MIDI_QUIT BUTTON_POWER
|
2009-04-07 23:41:44 +00:00
|
|
|
|
2014-05-22 21:34:52 +00:00
|
|
|
#elif (CONFIG_KEYPAD == SAMSUNG_YH820_PAD) || \
|
2016-01-23 14:54:08 +00:00
|
|
|
(CONFIG_KEYPAD == SAMSUNG_YH92X_PAD)
|
2016-10-01 20:09:42 +00:00
|
|
|
#define MIDI_QUIT (BUTTON_PLAY|BUTTON_REPEAT)
|
|
|
|
#define MIDI_FFWD BUTTON_RIGHT
|
|
|
|
#define MIDI_REWIND BUTTON_LEFT
|
|
|
|
#define MIDI_VOL_UP BUTTON_UP
|
|
|
|
#define MIDI_VOL_DOWN BUTTON_DOWN
|
|
|
|
#define MIDI_PLAYPAUSE BUTTON_PLAY
|
2009-08-04 03:08:32 +00:00
|
|
|
|
2010-02-14 21:56:53 +00:00
|
|
|
#elif CONFIG_KEYPAD == PBELL_VIBE500_PAD
|
2016-10-01 20:09:42 +00:00
|
|
|
#define MIDI_QUIT BUTTON_REC
|
|
|
|
#define MIDI_FFWD BUTTON_NEXT
|
|
|
|
#define MIDI_REWIND BUTTON_PREV
|
|
|
|
#define MIDI_VOL_UP BUTTON_UP
|
|
|
|
#define MIDI_VOL_DOWN BUTTON_DOWN
|
|
|
|
#define MIDI_PLAYPAUSE BUTTON_PLAY
|
2010-02-14 21:56:53 +00:00
|
|
|
|
2010-04-26 21:40:00 +00:00
|
|
|
#elif CONFIG_KEYPAD == MPIO_HD200_PAD
|
2016-10-01 20:09:42 +00:00
|
|
|
#define MIDI_QUIT (BUTTON_REC | BUTTON_PLAY)
|
|
|
|
#define MIDI_FFWD BUTTON_FF
|
|
|
|
#define MIDI_REWIND BUTTON_REW
|
|
|
|
#define MIDI_VOL_UP BUTTON_VOL_UP
|
|
|
|
#define MIDI_VOL_DOWN BUTTON_VOL_DOWN
|
|
|
|
#define MIDI_PLAYPAUSE BUTTON_PLAY
|
2010-04-26 21:40:00 +00:00
|
|
|
|
2010-11-30 10:52:14 +00:00
|
|
|
#elif CONFIG_KEYPAD == MPIO_HD300_PAD
|
2016-10-01 20:09:42 +00:00
|
|
|
#define MIDI_QUIT (BUTTON_MENU | BUTTON_REPEAT)
|
|
|
|
#define MIDI_FFWD BUTTON_FF
|
|
|
|
#define MIDI_REWIND BUTTON_REW
|
|
|
|
#define MIDI_VOL_UP BUTTON_UP
|
|
|
|
#define MIDI_VOL_DOWN BUTTON_DOWN
|
|
|
|
#define MIDI_PLAYPAUSE BUTTON_PLAY
|
2010-11-30 10:52:14 +00:00
|
|
|
|
2011-10-02 17:35:21 +00:00
|
|
|
#elif CONFIG_KEYPAD == SANSA_FUZEPLUS_PAD
|
2016-10-01 20:09:42 +00:00
|
|
|
#define MIDI_QUIT BUTTON_POWER
|
|
|
|
#define MIDI_FFWD BUTTON_RIGHT
|
|
|
|
#define MIDI_REWIND BUTTON_LEFT
|
|
|
|
#define MIDI_VOL_UP BUTTON_UP
|
|
|
|
#define MIDI_VOL_DOWN BUTTON_DOWN
|
|
|
|
#define MIDI_PLAYPAUSE BUTTON_PLAYPAUSE
|
2011-10-02 17:35:21 +00:00
|
|
|
|
2011-11-16 14:08:01 +00:00
|
|
|
#elif CONFIG_KEYPAD == SANSA_CONNECT_PAD
|
2016-10-01 20:09:42 +00:00
|
|
|
#define MIDI_QUIT BUTTON_POWER
|
|
|
|
#define MIDI_FFWD BUTTON_RIGHT
|
|
|
|
#define MIDI_REWIND BUTTON_LEFT
|
|
|
|
#define MIDI_VOL_UP BUTTON_UP
|
|
|
|
#define MIDI_VOL_DOWN BUTTON_DOWN
|
|
|
|
#define MIDI_PLAYPAUSE BUTTON_SELECT
|
2011-11-16 14:08:01 +00:00
|
|
|
|
Initial commit of the Samsung YP-R0 port.
This port is a hybrid native/RaaA port. It runs on a embedded linux system,
but is the only application. It therefore can implement lots of stuff that
native targets also implement, while leveraging the underlying linux kernel.
The port is quite advanced. User interface, audio playback, plugins work
mostly fine. Missing is e.g. power mangement and USB (see SamsungYPR0 wiki page).
Included in utils/ypr0tools are scripts and programs required to generate
a patched firmware. The patched firmware has the rootfs modified to load
Rockbox. It includes a early/safe USB mode.
This port needs a new toolchain, one that includes glibc headers and libraries.
rockboxdev.sh can generate it, but e.g. codesourcey and distro packages may
also work.
Most of the initial effort is done by Lorenzo Miori and others (on ABI),
including reverse engineering and patching of the original firmware,
initial drivers, and more. Big thanks to you.
Flyspray: FS#12348
Author: Lorenzo Miori, myself
Merry christmas to ypr0 owners! :)
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@31415 a1c6a512-1295-4272-9138-f99709370657
2011-12-24 11:56:46 +00:00
|
|
|
#elif CONFIG_KEYPAD == SAMSUNG_YPR0_PAD
|
2016-10-01 20:09:42 +00:00
|
|
|
#define MIDI_QUIT BUTTON_BACK
|
|
|
|
#define MIDI_FFWD BUTTON_RIGHT
|
|
|
|
#define MIDI_REWIND BUTTON_LEFT
|
|
|
|
#define MIDI_VOL_UP BUTTON_UP
|
|
|
|
#define MIDI_VOL_DOWN BUTTON_DOWN
|
|
|
|
#define MIDI_PLAYPAUSE BUTTON_USER
|
Initial commit of the Samsung YP-R0 port.
This port is a hybrid native/RaaA port. It runs on a embedded linux system,
but is the only application. It therefore can implement lots of stuff that
native targets also implement, while leveraging the underlying linux kernel.
The port is quite advanced. User interface, audio playback, plugins work
mostly fine. Missing is e.g. power mangement and USB (see SamsungYPR0 wiki page).
Included in utils/ypr0tools are scripts and programs required to generate
a patched firmware. The patched firmware has the rootfs modified to load
Rockbox. It includes a early/safe USB mode.
This port needs a new toolchain, one that includes glibc headers and libraries.
rockboxdev.sh can generate it, but e.g. codesourcey and distro packages may
also work.
Most of the initial effort is done by Lorenzo Miori and others (on ABI),
including reverse engineering and patching of the original firmware,
initial drivers, and more. Big thanks to you.
Flyspray: FS#12348
Author: Lorenzo Miori, myself
Merry christmas to ypr0 owners! :)
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@31415 a1c6a512-1295-4272-9138-f99709370657
2011-12-24 11:56:46 +00:00
|
|
|
|
2012-04-06 16:17:27 +00:00
|
|
|
#elif (CONFIG_KEYPAD == HM60X_PAD) || \
|
|
|
|
(CONFIG_KEYPAD == HM801_PAD)
|
2016-10-01 20:09:42 +00:00
|
|
|
#define MIDI_QUIT BUTTON_POWER
|
|
|
|
#define MIDI_FFWD BUTTON_RIGHT
|
|
|
|
#define MIDI_REWIND BUTTON_LEFT
|
|
|
|
#define MIDI_VOL_UP BUTTON_UP
|
|
|
|
#define MIDI_VOL_DOWN BUTTON_DOWN
|
|
|
|
#define MIDI_PLAYPAUSE BUTTON_SELECT
|
2012-03-23 18:32:50 +00:00
|
|
|
|
2014-06-30 18:24:15 +00:00
|
|
|
#elif (CONFIG_KEYPAD == SONY_NWZ_PAD)
|
2016-10-01 20:09:42 +00:00
|
|
|
#define MIDI_QUIT BUTTON_BACK
|
|
|
|
#define MIDI_FFWD BUTTON_RIGHT
|
|
|
|
#define MIDI_REWIND BUTTON_LEFT
|
|
|
|
#define MIDI_VOL_UP BUTTON_UP
|
|
|
|
#define MIDI_VOL_DOWN BUTTON_DOWN
|
|
|
|
#define MIDI_PLAYPAUSE BUTTON_PLAY
|
2014-06-30 18:24:15 +00:00
|
|
|
|
2014-07-17 08:40:17 +00:00
|
|
|
#elif (CONFIG_KEYPAD == CREATIVE_ZEN_PAD)
|
2016-10-01 20:09:42 +00:00
|
|
|
#define MIDI_QUIT BUTTON_BACK
|
|
|
|
#define MIDI_FFWD BUTTON_RIGHT
|
|
|
|
#define MIDI_REWIND BUTTON_LEFT
|
|
|
|
#define MIDI_VOL_UP BUTTON_UP
|
|
|
|
#define MIDI_VOL_DOWN BUTTON_DOWN
|
|
|
|
#define MIDI_PLAYPAUSE BUTTON_PLAYPAUSE
|
2014-07-17 08:40:17 +00:00
|
|
|
|
2014-08-30 11:15:53 +00:00
|
|
|
#elif CONFIG_KEYPAD == DX50_PAD
|
2016-10-01 20:09:42 +00:00
|
|
|
#define MIDI_QUIT BUTTON_POWER
|
|
|
|
#define MIDI_FFWD BUTTON_RIGHT
|
|
|
|
#define MIDI_REWIND BUTTON_LEFT
|
|
|
|
#define MIDI_VOL_UP BUTTON_VOL_UP
|
|
|
|
#define MIDI_VOL_DOWN BUTTON_VOL_DOWN
|
2014-08-30 11:15:53 +00:00
|
|
|
|
2018-02-22 22:42:29 +00:00
|
|
|
#elif CONFIG_KEYPAD == CREATIVE_ZENXFI2_PAD
|
|
|
|
#define MIDI_QUIT BUTTON_POWER
|
|
|
|
|
2018-03-02 20:53:55 +00:00
|
|
|
#elif CONFIG_KEYPAD == AGPTEK_ROCKER_PAD
|
|
|
|
#define MIDI_QUIT BUTTON_POWER
|
|
|
|
#define MIDI_FFWD BUTTON_RIGHT
|
|
|
|
#define MIDI_REWIND BUTTON_LEFT
|
|
|
|
#define MIDI_VOL_UP BUTTON_VOLUP
|
|
|
|
#define MIDI_VOL_DOWN BUTTON_VOLDOWN
|
|
|
|
#define MIDI_PLAYPAUSE BUTTON_SELECT
|
|
|
|
|
2020-10-08 13:47:40 +00:00
|
|
|
#elif CONFIG_KEYPAD == XDUOO_X3_PAD || CONFIG_KEYPAD == XDUOO_X3II_PAD || CONFIG_KEYPAD == XDUOO_X20_PAD
|
2018-11-05 12:01:55 +00:00
|
|
|
#define MIDI_QUIT BUTTON_POWER
|
|
|
|
#define MIDI_FFWD BUTTON_NEXT
|
|
|
|
#define MIDI_REWIND BUTTON_PREV
|
|
|
|
#define MIDI_VOL_UP BUTTON_VOL_UP
|
|
|
|
#define MIDI_VOL_DOWN BUTTON_VOL_DOWN
|
|
|
|
#define MIDI_PLAYPAUSE BUTTON_PLAY
|
|
|
|
|
2021-02-27 22:07:37 +00:00
|
|
|
#elif CONFIG_KEYPAD == FIIO_M3K_LINUX_PAD
|
2020-10-03 22:17:11 +00:00
|
|
|
#define MIDI_QUIT BUTTON_POWER
|
|
|
|
#define MIDI_FFWD BUTTON_NEXT
|
|
|
|
#define MIDI_REWIND BUTTON_PREV
|
|
|
|
#define MIDI_VOL_UP BUTTON_VOL_UP
|
|
|
|
#define MIDI_VOL_DOWN BUTTON_VOL_DOWN
|
|
|
|
#define MIDI_PLAYPAUSE BUTTON_PLAY
|
|
|
|
|
2020-10-08 13:47:40 +00:00
|
|
|
#elif CONFIG_KEYPAD == IHIFI_770_PAD || CONFIG_KEYPAD == IHIFI_800_PAD
|
2018-06-29 20:09:28 +00:00
|
|
|
#define MIDI_QUIT BUTTON_POWER
|
|
|
|
#define MIDI_FFWD BUTTON_VOL_DOWN
|
|
|
|
#define MIDI_REWIND BUTTON_HOME
|
|
|
|
#define MIDI_VOL_UP BUTTON_PREV
|
|
|
|
#define MIDI_VOL_DOWN BUTTON_NEXT
|
|
|
|
#define MIDI_PLAYPAUSE BUTTON_PLAY
|
2018-06-28 10:24:26 +00:00
|
|
|
|
2020-10-08 13:47:40 +00:00
|
|
|
#elif CONFIG_KEYPAD == EROSQ_PAD
|
|
|
|
#define MIDI_QUIT BUTTON_POWER
|
|
|
|
#define MIDI_FFWD BUTTON_NEXT
|
|
|
|
#define MIDI_REWIND BUTTON_PREV
|
|
|
|
#define MIDI_VOL_UP BUTTON_VOL_UP
|
|
|
|
#define MIDI_VOL_DOWN BUTTON_VOL_DOWN
|
|
|
|
#define MIDI_PLAYPAUSE BUTTON_PLAY
|
|
|
|
|
2021-02-27 22:08:58 +00:00
|
|
|
#elif CONFIG_KEYPAD == FIIO_M3K_PAD
|
|
|
|
#define MIDI_QUIT BUTTON_POWER
|
|
|
|
#define MIDI_FFWD BUTTON_LEFT
|
|
|
|
#define MIDI_REWIND BUTTON_RIGHT
|
|
|
|
#define MIDI_VOL_UP BUTTON_VOL_UP
|
|
|
|
#define MIDI_VOL_DOWN BUTTON_VOL_DOWN
|
|
|
|
#define MIDI_PLAYPAUSE BUTTON_PLAY
|
|
|
|
|
2021-05-23 16:30:58 +00:00
|
|
|
#elif CONFIG_KEYPAD == SHANLING_Q1_PAD
|
|
|
|
/* use touchscreen */
|
|
|
|
|
2008-03-01 22:55:09 +00:00
|
|
|
#else
|
|
|
|
#error No keymap defined!
|
2006-05-07 07:27:07 +00:00
|
|
|
#endif
|
|
|
|
|
2008-08-23 09:46:38 +00:00
|
|
|
#ifdef HAVE_TOUCHSCREEN
|
2016-10-01 20:09:42 +00:00
|
|
|
#ifndef MIDI_QUIT
|
|
|
|
#define MIDI_QUIT BUTTON_TOPLEFT
|
2008-04-27 15:30:19 +00:00
|
|
|
#endif
|
2016-10-01 20:09:42 +00:00
|
|
|
#ifndef MIDI_FFWD
|
|
|
|
#define MIDI_FFWD BUTTON_MIDRIGHT
|
2008-04-27 15:30:19 +00:00
|
|
|
#endif
|
2016-10-01 20:09:42 +00:00
|
|
|
#ifndef MIDI_REWIND
|
|
|
|
#define MIDI_REWIND BUTTON_MIDLEFT
|
2008-04-27 15:30:19 +00:00
|
|
|
#endif
|
2016-10-01 20:09:42 +00:00
|
|
|
#ifndef MIDI_VOL_UP
|
|
|
|
#define MIDI_VOL_UP BUTTON_TOPMIDDLE
|
2008-04-27 15:30:19 +00:00
|
|
|
#endif
|
2016-10-01 20:09:42 +00:00
|
|
|
#ifndef MIDI_VOL_DOWN
|
|
|
|
#define MIDI_VOL_DOWN BUTTON_BOTTOMMIDDLE
|
2008-04-27 15:30:19 +00:00
|
|
|
#endif
|
2016-10-01 20:09:42 +00:00
|
|
|
#ifndef MIDI_PLAYPAUSE
|
|
|
|
#define MIDI_PLAYPAUSE BUTTON_CENTER
|
2008-04-27 15:30:19 +00:00
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
2006-05-01 23:22:59 +00:00
|
|
|
#undef SYNC
|
2007-01-11 20:13:15 +00:00
|
|
|
|
|
|
|
#ifdef SIMULATOR
|
2008-01-13 14:52:31 +00:00
|
|
|
#define SYNC
|
2007-01-11 20:13:15 +00:00
|
|
|
#endif
|
|
|
|
|
2019-08-04 20:58:20 +00:00
|
|
|
#ifndef ALIGNED_ATTR
|
|
|
|
#define ALIGNED_ATTR(x) __attribute__((aligned(x)))
|
|
|
|
#endif
|
|
|
|
|
2006-05-01 23:22:59 +00:00
|
|
|
struct MIDIfile * mf IBSS_ATTR;
|
|
|
|
|
2009-03-28 11:27:56 +00:00
|
|
|
int number_of_samples IBSS_ATTR; /* the number of samples in the current tick */
|
|
|
|
int playing_time IBSS_ATTR; /* How many seconds into the file have we been playing? */
|
|
|
|
int samples_this_second IBSS_ATTR; /* How many samples produced during this second so far? */
|
2006-05-01 23:22:59 +00:00
|
|
|
long bpm IBSS_ATTR;
|
|
|
|
|
2019-08-04 20:58:20 +00:00
|
|
|
#ifndef SYNC
|
|
|
|
/* Small silence clip. ~5.80ms @ 44.1kHz */
|
|
|
|
static int32_t silence[256] ALIGNED_ATTR(4) = { 0 };
|
|
|
|
|
|
|
|
static int32_t gmbuf[BUF_SIZE * NBUF] ALIGNED_ATTR(4);
|
|
|
|
|
|
|
|
static volatile bool swap = false;
|
|
|
|
static volatile bool lastswap = true;
|
|
|
|
#else
|
|
|
|
static int32_t gmbuf[BUF_SIZE] ALIGNED_ATTR(4);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
static volatile size_t samples_in_buf;
|
2006-05-01 23:22:59 +00:00
|
|
|
|
2019-08-04 20:58:20 +00:00
|
|
|
static volatile bool midi_end = false;
|
|
|
|
static volatile bool quit = false;
|
|
|
|
|
|
|
|
static int32_t samp_buf[MAX_SAMPLES * 2] IBSS_ATTR;
|
|
|
|
|
|
|
|
static struct dsp_config *dsp;
|
|
|
|
static struct dsp_buffer src;
|
|
|
|
static struct dsp_buffer dst;
|
2006-05-01 23:22:59 +00:00
|
|
|
|
2007-09-29 16:06:16 +00:00
|
|
|
static inline void synthbuf(void)
|
2006-05-01 23:22:59 +00:00
|
|
|
{
|
2007-10-08 19:28:41 +00:00
|
|
|
int32_t *outptr;
|
2019-08-04 20:58:20 +00:00
|
|
|
int available = BUF_SIZE;
|
2006-05-01 23:22:59 +00:00
|
|
|
|
|
|
|
#ifndef SYNC
|
2009-03-28 11:27:56 +00:00
|
|
|
if (lastswap == swap)
|
|
|
|
return;
|
2006-05-01 23:22:59 +00:00
|
|
|
|
2009-03-28 11:27:56 +00:00
|
|
|
outptr = (swap ? gmbuf : gmbuf+BUF_SIZE);
|
2006-05-01 23:22:59 +00:00
|
|
|
#else
|
2009-03-28 11:27:56 +00:00
|
|
|
outptr = gmbuf;
|
2006-05-01 23:22:59 +00:00
|
|
|
#endif
|
|
|
|
|
2019-08-04 20:58:20 +00:00
|
|
|
#if defined(HAVE_ADJUSTABLE_CPU_FREQ)
|
|
|
|
rb->cpu_boost(true);
|
|
|
|
#endif
|
2007-10-15 05:11:37 +00:00
|
|
|
/* synth samples for as many whole ticks as we can fit in the buffer */
|
2019-08-04 20:58:20 +00:00
|
|
|
while (available > 0)
|
2007-10-08 19:28:41 +00:00
|
|
|
{
|
2019-08-04 20:58:20 +00:00
|
|
|
if ((dst.remcount <= 0) && !midi_end)
|
|
|
|
{
|
|
|
|
int nsamples = synthSamples(samp_buf, number_of_samples);
|
|
|
|
if (nsamples < number_of_samples)
|
|
|
|
number_of_samples -= nsamples;
|
|
|
|
else if (!tick())
|
|
|
|
midi_end = true; /* no more midi data to play */
|
|
|
|
src.remcount = nsamples;
|
|
|
|
src.pin[0] = &samp_buf[0];
|
|
|
|
src.pin[1] = &samp_buf[1];
|
|
|
|
src.proc_mask = 0;
|
|
|
|
}
|
|
|
|
dst.remcount = 0;
|
|
|
|
dst.bufcount = available;
|
|
|
|
dst.p16out = (int16_t *)outptr;
|
|
|
|
rb->dsp_process(dsp, &src, &dst);
|
|
|
|
if (dst.remcount > 0)
|
|
|
|
{
|
|
|
|
outptr += dst.remcount;
|
|
|
|
available -= dst.remcount;
|
|
|
|
}
|
|
|
|
else if (midi_end)
|
|
|
|
break;
|
2007-10-08 19:28:41 +00:00
|
|
|
}
|
|
|
|
|
2007-10-15 05:11:37 +00:00
|
|
|
/* how many samples did we write to the buffer? */
|
2019-08-04 20:58:20 +00:00
|
|
|
samples_in_buf = BUF_SIZE - available;
|
|
|
|
#ifndef SYNC
|
|
|
|
lastswap = swap;
|
|
|
|
#endif
|
2016-09-23 15:45:44 +00:00
|
|
|
#if defined(HAVE_ADJUSTABLE_CPU_FREQ)
|
|
|
|
rb->cpu_boost(false);
|
|
|
|
#endif
|
2006-05-01 23:22:59 +00:00
|
|
|
}
|
|
|
|
|
2012-02-23 13:14:46 +00:00
|
|
|
static void get_more(const void** start, size_t* size)
|
2006-05-01 23:22:59 +00:00
|
|
|
{
|
|
|
|
#ifndef SYNC
|
2019-08-04 20:58:20 +00:00
|
|
|
swap = !swap;
|
|
|
|
if(lastswap == swap)
|
2006-05-03 05:18:18 +00:00
|
|
|
{
|
2019-08-04 20:58:20 +00:00
|
|
|
*start = silence;
|
|
|
|
*size = sizeof(silence);
|
|
|
|
swap = !swap;
|
|
|
|
return;
|
2006-05-01 23:22:59 +00:00
|
|
|
}
|
2019-08-04 20:58:20 +00:00
|
|
|
else if (samples_in_buf)
|
|
|
|
*start = swap ? (gmbuf + BUF_SIZE) : gmbuf;
|
2006-05-01 23:22:59 +00:00
|
|
|
#else
|
2009-03-28 11:27:56 +00:00
|
|
|
synthbuf(); /* For some reason midiplayer crashes when an update is forced */
|
2019-08-04 20:58:20 +00:00
|
|
|
if (samples_in_buf)
|
|
|
|
*start = gmbuf;
|
2006-05-01 23:22:59 +00:00
|
|
|
#endif
|
2019-08-04 20:58:20 +00:00
|
|
|
else
|
|
|
|
{
|
2016-10-01 20:58:50 +00:00
|
|
|
*start = NULL;
|
|
|
|
quit = true; /* this was the last buffer to play */
|
|
|
|
}
|
2019-08-04 20:58:20 +00:00
|
|
|
*size = samples_in_buf*sizeof(int32_t);
|
2006-05-01 23:22:59 +00:00
|
|
|
}
|
|
|
|
|
2008-05-13 09:57:56 +00:00
|
|
|
static int midimain(const void * filename)
|
2006-05-01 23:22:59 +00:00
|
|
|
{
|
2009-03-28 11:27:56 +00:00
|
|
|
int a, notes_used, vol;
|
|
|
|
bool is_playing = true; /* false = paused */
|
|
|
|
|
2016-09-23 15:45:44 +00:00
|
|
|
#if defined(HAVE_ADJUSTABLE_CPU_FREQ)
|
|
|
|
rb->cpu_boost(true);
|
|
|
|
#endif
|
2010-07-25 19:47:07 +00:00
|
|
|
midi_debug("Loading file");
|
2009-03-28 11:27:56 +00:00
|
|
|
mf = loadFile(filename);
|
2006-05-01 23:22:59 +00:00
|
|
|
|
2009-03-28 11:27:56 +00:00
|
|
|
if (mf == NULL)
|
2006-05-08 02:43:29 +00:00
|
|
|
{
|
2010-07-25 19:47:07 +00:00
|
|
|
midi_debug("Error loading file.");
|
2016-09-23 15:45:44 +00:00
|
|
|
#if defined(HAVE_ADJUSTABLE_CPU_FREQ)
|
|
|
|
rb->cpu_boost(false);
|
|
|
|
#endif
|
2006-05-08 02:43:29 +00:00
|
|
|
return -1;
|
|
|
|
}
|
2006-05-07 07:12:07 +00:00
|
|
|
|
2007-09-10 09:46:36 +00:00
|
|
|
if (initSynth(mf, ROCKBOX_DIR "/patchset/patchset.cfg",
|
|
|
|
ROCKBOX_DIR "/patchset/drums.cfg") == -1)
|
2016-09-23 15:45:44 +00:00
|
|
|
{
|
|
|
|
#if defined(HAVE_ADJUSTABLE_CPU_FREQ)
|
|
|
|
rb->cpu_boost(false);
|
|
|
|
#endif
|
2006-05-03 05:18:18 +00:00
|
|
|
return -1;
|
2016-09-23 15:45:44 +00:00
|
|
|
}
|
2006-05-01 23:22:59 +00:00
|
|
|
|
2019-08-04 20:58:20 +00:00
|
|
|
rb->talk_force_shutup();
|
2006-05-03 05:18:18 +00:00
|
|
|
rb->pcm_play_stop();
|
2007-06-10 02:10:47 +00:00
|
|
|
#if INPUT_SRC_CAPS != 0
|
|
|
|
/* Select playback */
|
|
|
|
rb->audio_set_input_source(AUDIO_SRC_PLAYBACK, SRCF_PLAYBACK);
|
|
|
|
rb->audio_set_output_source(AUDIO_SRC_PLAYBACK);
|
|
|
|
#endif
|
2019-08-04 20:58:20 +00:00
|
|
|
|
|
|
|
dst.remcount = 0;
|
|
|
|
dsp = rb->dsp_get_config(CODEC_IDX_AUDIO);
|
|
|
|
rb->dsp_configure(dsp, DSP_RESET, 0);
|
|
|
|
rb->dsp_configure(dsp, DSP_FLUSH, 0);
|
|
|
|
rb->dsp_configure(dsp, DSP_SET_OUT_FREQUENCY, rb->mixer_get_frequency());
|
|
|
|
#ifdef HAVE_PITCHCONTROL
|
|
|
|
rb->sound_set_pitch(PITCH_SPEED_100);
|
|
|
|
rb->dsp_set_timestretch(PITCH_SPEED_100);
|
|
|
|
#endif
|
|
|
|
rb->dsp_configure(dsp, DSP_SET_SAMPLE_DEPTH, 22);
|
|
|
|
rb->dsp_configure(dsp, DSP_SET_FREQUENCY, SAMPLE_RATE); /* 44100 22050 11025 */
|
|
|
|
rb->dsp_configure(dsp, DSP_SET_STEREO_MODE, STEREO_INTERLEAVED);
|
2006-05-01 23:22:59 +00:00
|
|
|
|
2006-05-03 05:18:18 +00:00
|
|
|
/*
|
|
|
|
* tick() will do one MIDI clock tick. Then, there's a loop here that
|
|
|
|
* will generate the right number of samples per MIDI tick. The whole
|
|
|
|
* MIDI playback is timed in terms of this value.. there are no forced
|
|
|
|
* delays or anything. It just produces enough samples for each tick, and
|
|
|
|
* the playback of these samples is what makes the timings right.
|
|
|
|
*
|
|
|
|
* This seems to work quite well. On a laptop, anyway.
|
|
|
|
*/
|
2006-05-01 23:22:59 +00:00
|
|
|
|
2010-07-25 19:47:07 +00:00
|
|
|
midi_debug("Okay, starting sequencing");
|
2006-05-01 23:22:59 +00:00
|
|
|
|
2009-03-28 11:27:56 +00:00
|
|
|
bpm = mf->div*1000000/tempo;
|
|
|
|
number_of_samples = SAMPLE_RATE/bpm;
|
2006-05-07 07:12:07 +00:00
|
|
|
|
|
|
|
/* Skip over any junk in the beginning of the file, so start playing */
|
|
|
|
/* after the first note event */
|
|
|
|
do
|
|
|
|
{
|
2009-03-28 11:27:56 +00:00
|
|
|
notes_used = 0;
|
|
|
|
for (a = 0; a < MAX_VOICES; a++)
|
|
|
|
if (voices[a].isUsed)
|
|
|
|
notes_used++;
|
2006-05-07 07:12:07 +00:00
|
|
|
tick();
|
2009-03-28 11:27:56 +00:00
|
|
|
} while (notes_used == 0);
|
2006-05-01 23:22:59 +00:00
|
|
|
|
2016-09-23 15:45:44 +00:00
|
|
|
#if defined(HAVE_ADJUSTABLE_CPU_FREQ)
|
|
|
|
rb->cpu_boost(false);
|
|
|
|
#endif
|
|
|
|
|
2009-03-28 11:27:56 +00:00
|
|
|
playing_time = 0;
|
|
|
|
samples_this_second = 0;
|
2007-11-03 04:09:38 +00:00
|
|
|
|
2019-08-04 20:58:20 +00:00
|
|
|
#ifndef SYNC
|
2006-05-03 05:18:18 +00:00
|
|
|
synthbuf();
|
2019-08-04 20:58:20 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
rb->pcmbuf_fade(false, true);
|
|
|
|
rb->mixer_channel_play_data(PCM_MIXER_CHAN_PLAYBACK, get_more, NULL, 0);
|
2006-05-01 23:22:59 +00:00
|
|
|
|
2009-03-28 11:27:56 +00:00
|
|
|
while (!quit)
|
2006-05-03 05:18:18 +00:00
|
|
|
{
|
|
|
|
#ifndef SYNC
|
|
|
|
synthbuf();
|
|
|
|
#endif
|
|
|
|
rb->yield();
|
2006-05-07 07:12:07 +00:00
|
|
|
|
2007-05-19 20:37:02 +00:00
|
|
|
/* Prevent idle poweroff */
|
|
|
|
rb->reset_poweroff_timer();
|
|
|
|
|
2006-05-07 07:12:07 +00:00
|
|
|
/* Code taken from Oscilloscope plugin */
|
2009-03-28 11:27:56 +00:00
|
|
|
switch (rb->button_get(false))
|
2006-05-07 07:12:07 +00:00
|
|
|
{
|
2016-10-01 20:09:42 +00:00
|
|
|
case MIDI_VOL_UP:
|
|
|
|
case MIDI_VOL_UP | BUTTON_REPEAT:
|
2009-03-28 11:27:56 +00:00
|
|
|
{
|
|
|
|
vol = rb->global_settings->volume;
|
|
|
|
if (vol < rb->sound_max(SOUND_VOLUME))
|
2007-11-03 04:09:38 +00:00
|
|
|
{
|
2009-03-28 11:27:56 +00:00
|
|
|
vol++;
|
|
|
|
rb->sound_set(SOUND_VOLUME, vol);
|
|
|
|
rb->global_settings->volume = vol;
|
2007-11-03 04:09:38 +00:00
|
|
|
}
|
2009-03-28 11:27:56 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2016-10-01 20:09:42 +00:00
|
|
|
case MIDI_VOL_DOWN:
|
|
|
|
case MIDI_VOL_DOWN | BUTTON_REPEAT:
|
2009-03-28 11:27:56 +00:00
|
|
|
{
|
|
|
|
vol = rb->global_settings->volume;
|
|
|
|
if (vol > rb->sound_min(SOUND_VOLUME))
|
2006-05-07 07:12:07 +00:00
|
|
|
{
|
2009-03-28 11:27:56 +00:00
|
|
|
vol--;
|
|
|
|
rb->sound_set(SOUND_VOLUME, vol);
|
|
|
|
rb->global_settings->volume = vol;
|
2006-05-07 07:12:07 +00:00
|
|
|
}
|
2009-03-28 11:27:56 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2016-10-01 20:09:42 +00:00
|
|
|
case MIDI_REWIND:
|
2009-03-28 11:27:56 +00:00
|
|
|
{
|
|
|
|
/* Rewinding is tricky. Basically start the file over */
|
|
|
|
/* but run through the tracks without the synth running */
|
2019-08-04 20:58:20 +00:00
|
|
|
rb->mixer_channel_stop(PCM_MIXER_CHAN_PLAYBACK);
|
|
|
|
rb->dsp_configure(dsp, DSP_FLUSH, 0);
|
|
|
|
dst.remcount = 0;
|
2016-09-23 15:45:44 +00:00
|
|
|
#if defined(HAVE_ADJUSTABLE_CPU_FREQ)
|
|
|
|
rb->cpu_boost(true);
|
|
|
|
#endif
|
2009-03-28 11:27:56 +00:00
|
|
|
seekBackward(5);
|
2016-09-23 15:45:44 +00:00
|
|
|
#if defined(HAVE_ADJUSTABLE_CPU_FREQ)
|
|
|
|
rb->cpu_boost(false);
|
|
|
|
#endif
|
2019-08-04 20:58:20 +00:00
|
|
|
#ifndef SYNC
|
2016-10-01 20:55:31 +00:00
|
|
|
lastswap = !swap;
|
|
|
|
synthbuf();
|
2019-08-04 20:58:20 +00:00
|
|
|
#endif
|
2010-07-25 19:47:07 +00:00
|
|
|
midi_debug("Rewind to %d:%02d\n", playing_time/60, playing_time%60);
|
2009-03-28 11:27:56 +00:00
|
|
|
if (is_playing)
|
2019-08-04 20:58:20 +00:00
|
|
|
rb->mixer_channel_play_data(PCM_MIXER_CHAN_PLAYBACK, get_more, NULL, 0);
|
2009-03-28 11:27:56 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2016-10-01 20:09:42 +00:00
|
|
|
case MIDI_FFWD:
|
2009-03-28 11:27:56 +00:00
|
|
|
{
|
2019-08-04 20:58:20 +00:00
|
|
|
rb->mixer_channel_stop(PCM_MIXER_CHAN_PLAYBACK);
|
|
|
|
rb->dsp_configure(dsp, DSP_FLUSH, 0);
|
|
|
|
dst.remcount = 0;
|
|
|
|
#if defined(HAVE_ADJUSTABLE_CPU_FREQ)
|
|
|
|
rb->cpu_boost(true);
|
|
|
|
#endif
|
2009-03-28 11:27:56 +00:00
|
|
|
seekForward(5);
|
2019-08-04 20:58:20 +00:00
|
|
|
#if defined(HAVE_ADJUSTABLE_CPU_FREQ)
|
|
|
|
rb->cpu_boost(false);
|
|
|
|
#endif
|
|
|
|
#ifndef SYNC
|
2016-10-01 20:55:31 +00:00
|
|
|
lastswap = !swap;
|
|
|
|
synthbuf();
|
2019-08-04 20:58:20 +00:00
|
|
|
#endif
|
2010-07-25 19:47:07 +00:00
|
|
|
midi_debug("Skip to %d:%02d\n", playing_time/60, playing_time%60);
|
2009-03-28 11:27:56 +00:00
|
|
|
if (is_playing)
|
2019-08-04 20:58:20 +00:00
|
|
|
rb->mixer_channel_play_data(PCM_MIXER_CHAN_PLAYBACK, get_more, NULL, 0);
|
2009-03-28 11:27:56 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2016-10-01 20:09:42 +00:00
|
|
|
case MIDI_PLAYPAUSE:
|
2009-03-28 11:27:56 +00:00
|
|
|
{
|
2019-08-04 20:58:20 +00:00
|
|
|
is_playing = !is_playing;
|
|
|
|
midi_debug("%s %d:%02d\n",
|
|
|
|
is_playing ? "Playing from" : "Paused at",
|
|
|
|
playing_time/60, playing_time%60);
|
|
|
|
rb->mixer_channel_play_pause(PCM_MIXER_CHAN_PLAYBACK, is_playing);
|
2009-03-28 11:27:56 +00:00
|
|
|
break;
|
|
|
|
}
|
2007-11-03 04:09:38 +00:00
|
|
|
|
2016-10-01 20:09:42 +00:00
|
|
|
#ifdef MIDI_RC_QUIT
|
|
|
|
case MIDI_RC_QUIT:
|
2006-06-30 16:43:47 +00:00
|
|
|
#endif
|
2016-10-01 20:09:42 +00:00
|
|
|
case MIDI_QUIT:
|
2009-03-28 11:27:56 +00:00
|
|
|
quit = true;
|
2006-05-07 07:12:07 +00:00
|
|
|
}
|
2009-03-28 11:27:56 +00:00
|
|
|
}
|
2019-08-04 20:58:20 +00:00
|
|
|
|
|
|
|
rb->pcmbuf_fade(false, false);
|
|
|
|
rb->mixer_channel_stop(PCM_MIXER_CHAN_PLAYBACK);
|
|
|
|
|
2009-03-28 11:27:56 +00:00
|
|
|
return 0;
|
|
|
|
}
|
2006-05-07 07:12:07 +00:00
|
|
|
|
2009-03-28 11:27:56 +00:00
|
|
|
enum plugin_status plugin_start(const void* parameter)
|
|
|
|
{
|
|
|
|
int retval;
|
2010-05-06 21:04:40 +00:00
|
|
|
|
2009-03-28 11:27:56 +00:00
|
|
|
if (parameter == NULL)
|
|
|
|
{
|
|
|
|
rb->splash(HZ*2, " Play .MID file ");
|
|
|
|
return PLUGIN_OK;
|
2006-05-03 05:18:18 +00:00
|
|
|
}
|
2011-09-24 13:19:34 +00:00
|
|
|
rb->lcd_setfont(FONT_SYSFIXED);
|
2006-05-01 23:22:59 +00:00
|
|
|
|
2010-07-25 19:47:07 +00:00
|
|
|
midi_debug("%s", parameter);
|
2009-03-28 11:27:56 +00:00
|
|
|
/* rb->splash(HZ, true, parameter); */
|
|
|
|
|
|
|
|
#ifdef RB_PROFILE
|
|
|
|
rb->profile_thread();
|
|
|
|
#endif
|
|
|
|
|
|
|
|
retval = midimain(parameter);
|
|
|
|
|
|
|
|
#ifdef RB_PROFILE
|
|
|
|
rb->profstop();
|
|
|
|
#endif
|
|
|
|
|
|
|
|
rb->splash(HZ, "FINISHED PLAYING");
|
|
|
|
|
|
|
|
if (retval == -1)
|
|
|
|
return PLUGIN_ERROR;
|
|
|
|
return PLUGIN_OK;
|
2006-05-01 23:22:59 +00:00
|
|
|
}
|