Skip to content

Commit

Permalink
Merge pull request #6 from cad0gan/master
Browse files Browse the repository at this point in the history
Fix mplayer.h, rename the swi function, add a swi function
  • Loading branch information
Azq2 authored Mar 26, 2024
2 parents 89e8ae2 + d57e792 commit 9900036
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 28 deletions.
50 changes: 25 additions & 25 deletions swilib/include/mplayer.h
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
#pragma once

// Ôóíêöèè óïðàâëåíèÿ ìåäèàïëååðîì
// Функции управления медиаплеером
// (c) Kibab
// Âåðñèÿ 0.4
// Версия 0.4
// (r) All S-C Community

/* Ëîã èçìåíåíèé
0.4 - inline, äîáàâëåí êîìïëåêò ôóíêöèé //BoBa
0.3 - äîáàâëåíû ôóíêöèè âûêëþ÷åíèÿ ïëååðà, âûêëþ÷åíèÿ çâóêà
0.2 - äîáàâëåíà ôóíêöèÿ èçìåíåíèÿ ãðîìêîñòè
0.1 - ïåðâàÿ ïóáëè÷íàÿ âåðñèÿ
/* Лог изменений
0.4 - inline, добавлен комплект функций //BoBa
0.3 - добавлены функции выключения плеера, выключения звука
0.2 - добавлена функция изменения громкости
0.1 - первая публичная версия
*/

// Êîìàíäû ïëååðà
// Команды плеера
#define PLAYER_PREV 0x01
#define PLAYER_NEXT 0x02
#define PLAYER_RESTART 0x03
//0x04 à õç... ÷àñèêè ðèñóåò... ÁÄ??
//0x05 õðåíü êàêàÿ-òî ñ êíîïêàìè...
//0x06 ðîíÿåò
//0x07 ðåñòàðò
//0x08 ðåñòàðò
//0x09 ðåñòàðò
//0x04 а хз... часики рисует... БД??
//0x05 хрень какая-то с кнопками...
//0x06 роняет
//0x07 рестарт
//0x08 рестарт
//0x09 рестарт
#define PLAYER_MUTE 0x0A
//0x0b kill?
#define PLAYER_KILL 0x0C
Expand All @@ -39,13 +39,13 @@
#define PLAYER_REPEAT1 0x18
//0x19 error?
//0x20
//0x21 ðîíÿåò
//0x21 роняет

static inline void Send_MPlayer_Command(unsigned short cmd, short substract) { // Îòïðàâèòü êîìàíäó ïëååðó
static inline void Send_MPlayer_Command(unsigned short cmd, short substract) { // Отправить команду плееру
GBS_SendMessage(0x4209, 0x8053, 0, *((unsigned int *) RamMPlayer_CtrlCode()) - substract, cmd);
}

static inline void MPlayer_VolChange(short dir) { // Ãðîìêîñòü ââåðõ/âíèç (dir=1 / dir=-1)
static inline void MPlayer_VolChange(short dir) { // Громкость вверх/вниз (dir=1 / dir=-1)
int cmd;
if (dir == 1) {
cmd = PLAYER_VOL_UP;
Expand All @@ -56,11 +56,11 @@
Send_MPlayer_Command(cmd, 0);
}

static inline void MPlayer_Stop() {Send_MPlayer_Command(PLAYER_STOP, 0);} // Îñòàíîâèòü èãðó
static inline void MPlayer_Start() {Send_MPlayer_Command(PLAYER_PLAY, 0);} // Çàïóñê ïðîèãðûâàíèÿ
static inline void MPlayer_Next() {Send_MPlayer_Command(PLAYER_NEXT, 0);} // Ïåðåêëþ÷èòüñÿ íà ñëåäóþùóþ ïåñíþ
static inline void MPlayer_Prev() {Send_MPlayer_Command(PLAYER_PREV, 0);} // Ïåðåêëþ÷èòüñÿ íà ïðåäûäóùóþ ïåñíþ
static inline void MPlayer_Toggle() {Send_MPlayer_Command(PLAYER_TOGGLE, 0);}// Ïàóçà/âîñïðîèçâåäåíèå
static inline void MPlayer_Shutdown() {Send_MPlayer_Command(PLAYER_KILL, 0);} // Çàâåðøèòü ðàáîòó ïëååðà
static inline void MPlayer_Mute() {Send_MPlayer_Command(PLAYER_MUTE, 0);} // Âûêëþ÷èòü çâóê. Ïðè ïîâòîðíîì âûçîâå çâóê âêëþ÷àåòñÿ
static inline void MPlayer_Pause() {Send_MPlayer_Command(PLAYER_PAUSE, 0);} // Ïàóçà
static inline void MPlayer_Stop() {Send_MPlayer_Command(PLAYER_STOP, 0);} // Остановить игру
static inline void MPlayer_Start() {Send_MPlayer_Command(PLAYER_PLAY, 0);} // Запуск проигрывания
static inline void MPlayer_Next() {Send_MPlayer_Command(PLAYER_NEXT, 0);} // Переключиться на следующую песню
static inline void MPlayer_Prev() {Send_MPlayer_Command(PLAYER_PREV, 0);} // Переключиться на предыдущую песню
static inline void MPlayer_Toggle() {Send_MPlayer_Command(PLAYER_TOGGLE, 0);}// Пауза/воспроизведение
static inline void MPlayer_Shutdown() {Send_MPlayer_Command(PLAYER_KILL, 0);} // Завершить работу плеера
static inline void MPlayer_Mute() {Send_MPlayer_Command(PLAYER_MUTE, 0);} // Выключить звук. При повторном вызове звук включается
static inline void MPlayer_Pause() {Send_MPlayer_Command(PLAYER_PAUSE, 0);} // Пауза
15 changes: 12 additions & 3 deletions swilib/include/swilib/player.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,21 @@ void MEDIA_PLAYLAST()
__swi_end(0x1FF, MEDIA_PLAYLAST, ());

/**
* Get the filename of the current song in the media player.
* Get the filename of the last audio track in the media player.
* @return pointer to the WSHDR
* */
__swi_begin(0x082)
const WSHDR *GetCurrentTrackFilename()
__swi_end(0x082, GetCurrentTrackFilename, ());
const WSHDR *GetLastAudioTrackFilename()
__swi_end(0x082, GetLastAudioTrackFilename, ());

/**
* Get the directory of the last audio track in media player.
* @return pointer to the WSHDR
* */

__swi_begin(0x3B2)
const WSHDR *GetLastAudioTrackDir()
__swi_end(0x3B2, GetLastAudioTrackDir, ());

__swilib_end

Expand Down

0 comments on commit 9900036

Please sign in to comment.