RMP - Ray's Music Player

A high-performance, extensible framework built in C with Lua scripting for creating sophisticated terminal user interfaces.

Powerful Features

🎵

Advanced Music Player

Multi-format audio support with advanced playback controls including volume, speed, and seek functionality.

📱

Rich TUI Framework

Create complex terminal interfaces with ease using our comprehensive UI toolkit.

🎮

Game Development Platform

Build 2D games directly in the terminal with our powerful game development tools.

🔧

Extensible Plugin System

Modular architecture for unlimited customization with Lua-based plugins.

🎨

Dynamic Theming Engine

Hot-swappable themes with Lua scripting for complete visual customization.

High Performance

Native C engine with Lua binding for optimal speed and efficiency.

What is RMP?

RMP (Ray Music Player) is a high-performance, extensible framework built in C with Lua scripting for creating sophisticated terminal user interfaces. Originally conceived as a music player, RMP has evolved into a comprehensive platform for terminal-based applications.

Difference Between RMP and RayMp

RayMp is a software platform that renders templates and plugins with user configurations for a better audio experience using the RMP framework. RMP is a framework with multiple classes and functions that uses C as a backend for better performance. It is used to create templates and plugins for the RayMp software and is also powerful for creating TUI applications in Lua.

Documentation

Configuration Structure

The RMP engine checks the ~/.rmp directory (~ refers to the HOME directory). The structure of the .rmp directory is:

  • init.lua - Configuration of the engine, sound keymaps, rendered templates, and plugin configurations
  • templates - Directory of templates that we created or downloaded from the plugin manager
  • plugins - Directory of plugins that we created or downloaded from the plugin manager

Example Configuration

-- Example configuration
return {
    settings = {
        fps = 60,
        help_key = api.KEY_H,
        volume = 0.5,                 -- 0 to 1
        speed = 1.0,                  -- 0.25 to 4.0
        mode = api.PlaybackMode.ONES, -- playback modes
        restart_engine = api.KEY_CTRL_R,
        exit = api.KEY_Q,

        -- inc or dec
        inc_speed = 0.1,
        inc_volume = 0.1,
        inc_seek = 5
    },
    soundMap = {
        pause_sound = api.KEY_SPACE,
        resume_sound = api.KEY_SPACE,
        next_sound = api.KEY_N,
        prev_sound = api.KEY_P,
        vol_up = api.KEY_PLUS,
        vol_down = api.KEY_MINUS,
        seek_left = api.KEY_LEFT,
        seek_right = api.KEY_RIGHT,
        speed_up = api.KEY_UP,
        speed_down = api.KEY_DOWN,
        change_playback_mode = api.KEY_TAB
    },

    template = "my_template",
    plugins = {
            {
                themewindowid = "tutorial-window",
                isactivated = true,
                names = {
                    "tutorial_rmp"
                }
            },
            {
                themewindowid = "helper-window",
                isactivated = true,
                names = {
                    {
                        "helper_keys_tutorial",
                        {
                            -- example of how to configure you plugin
                            color = api.FGColors.Brights.Red
                        }
                    }
                }
            },
    }
}

Creating Templates

To create your own template, you have to put your init.lua template file in the ~/.rmp.templates directory. Choose your template name (for example foo.lua).

foo.lua returns a table with multiple tables that represent components or windows for each table.

Component Fields:

  • id - The window ID
  • type - The type of component ["Window" , "Text"]
  • title - Window type field that contains a string value or component of type "Text"
  • width - Window field that specifies the window width
  • height - Window field that specifies the window height
  • x - Window field that specifies the window x position
  • y - Window field that specifies the window y position
  • border - Border style of the window
  • backgroundColor - Background color of the window
  • foregroundColor - Foreground color of the window (border color)
  • style - Text type component field to specify text style
  • dynamic - Text type component field of type callback function that accepts the window context and returns a string
  • condition - Window type component field of type callback function that accepts the window context and returns a boolean
-- Example template code
return {
    {
        id = "main_window",
        type = "Window",
        title = "My Custom Window",
        -- x , y , width , height : can evaluate string operations
        -- and use w and h as window width and height
        x = 1,
        y = 1,
        width = "w/2",
        height = 20,
        border = "Single",
        backgroundColor = api.BGColors.Black,
        foregroundColor = api.FGColors.White
    },
    {
        id = "text_display",
        type = "Text",
        x = 2,
        y = 2,
        width = 48,
        height = 18,
        style = api.TextStyle.Normal
    }
}

Plugin System

RMP features a powerful plugin system that allows for extensive customization and extension of functionality. Plugins are Lua files that return a callback function with 4 parameters if the plugin is integrated into a specific window; otherwise, you can ignore them.

Creating Plugins

The return function of plugins returns a VirtualTerminal object after you apply your configurations and add event listeners to it. You need to initialize the VirtualTerminal object inside the returned callback function.

-- Example plugin code
-- require rmp framework
local api = require("rmp.rmp")

-- x , y , xx , yy : are optional
-- u need them if you integrate plugin to specific window
-- otherwise you can get
-- width and height of the window by rmp framework
return function(x, y, xx, yy)
    local w = xx - x - 1
    local h = yy - y - 1
    local vterm = api.VirtualTerminal.new()

    vterm:writeText(x + 1, y + 1, "Hello from my plugin!")

    return vterm
end

Installation

Step 1: Clone the Repository

git clone https://github.com/abdorayden/raymp

Step 2: Build the Project

cd raymp/install
./install.sh help or .\install.bat help

Step 3: Install Dependencies

RMP requires Lua and other dependencies to run properly. Make sure you have them installed on your system.

Step 4: Configure

Create the ~/.rmp directory and add your configuration files as described in the documentation.

Community & Support

Join our community to get support, share your plugins, and contribute to the project.