joshjaysalazar / pygkit

A collection of modular add-ons and utilities for Pygame, designed to streamline and enhance game development with easy-to-use features.
GNU Lesser General Public License v2.1
0 stars 0 forks source link

Add a VGMPlayer class #20

Open joshjaysalazar opened 1 year ago

joshjaysalazar commented 1 year ago

Feature description

A VGMPlayer class that plays VGM files, providing an additional option for playing music in Pygame games. The class will allow users to load and play VGM files directly, expanding the audio capabilities of the Pygkit library when used alongside Pygame.

Proposed solution

Introduce a VGMPlayer class with the following methods and properties:

Here's an example of how the VGMPlayer class could be used:

import pygame
import pygkit

# Setup Pygame
pygame.init()
screen = pygame.display.set_mode((800, 600))
clock = pygame.time.Clock()

# Create a VGMPlayer instance with a VGM file
vgmplayer = pygkit.VGMPlayer("example.vgm")

# Play the VGM file using the VGMPlayer
vgmplayer.play()

running = True
while running:
    event_list = pygame.event.get()
    for event in event_list:
        if event.type == pygame.QUIT:
            running = False

    # Render the game
    screen.fill((128, 128, 128))
    pygame.display.flip()
    clock.tick(60)

vgmplayer.stop()
pygame.quit()

Alternative solutions

An alternative solution could be to create a separate module for handling VGM files, which could be used in conjunction with the existing Pygame mixer module. This approach might require more extensive modifications to the existing Pygame classes and might not be as easy to integrate with the Pygkit library.

Additional context

This feature would be a valuable addition to the Pygkit library, as it provides developers with another option for playing music in their games. The ability to play VGM files directly can result in more diverse audio experiences for players, especially for games inspired by or emulating the style of retro consoles. Integrating this feature into the library would offer developers more flexibility and control over their game's audio, making it easier to create engaging and immersive gameplay experiences.

eddiedanhalen1 commented 1 year ago

What sound chips would this support?

joshjaysalazar commented 1 year ago

What sound chips would this support?

Any system using FM synthesis would be the initial target.