Code Monkey home page Code Monkey logo

sdl1's Issues

Can't get mp3 to play

I'm not 100% sure this is related to the binding, but I'm also not really sure why I can't get this to work.

When I use https://github.com/nim-lang/sdl2/blob/master/src/sdl2/mixer.nim, I am able to play an mp3 file. With the exact same code, but using the sdl_mixer in this repository, I get Unrecognized music format printed out. I believe this means I have all of the dynamic libraries properly installed and configured, otherwise I wouldn't be able to get SDL2 to work.

import sdl
import sdl_mixer
discard sdl.init(INIT_EVERYTHING)
discard openAudio(22050, AUDIO_S16SYS, 2, 640)
var music = loadMus("music.mp3")
echo getError()
discard music.playMusic(1)

EDIT:
I tried reproducing a similar example in C, and noticed the Mix_Init function (which this wrapper omits, but the SDL2 wrapper has this function). After running that and checking for errors, I get Mix_Init: Mixer not built with MP3 support. Not sure if this is solvable on the end of this wrapper, but I'm also not sure if the Mix_Init function needs to be wrapped.

Fails to compile

/home/david/.nimble/pkgs/sdl1-1.0.0/sdl.nim(1064, 27) Error: undeclared identifier: 'expr'

I think it comes from use of 'expr' in this template:

template evconv(procName: expr, ptrName: typedesc, assertions: EventSeq): stmt {.immediate.} =
  proc `procName`*(event: PEvent): ptrName =
    assert(contains(assertions, event.kind))
    result = cast[ptrName](event)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.