Sdl_mixer - synchronization

hello list,

I’m newbie in SDL and I’ve one question:
Is it possible to synchronize my video fx with xm module by using sdl_mixer ?

I can’t find any functions in SDL_mixer.h for reading song and pattern position actually playing xm… (btw, it’s very important function to me).

thanks,
tomasz.

What I’ve done (in the past) is this:

1 - Write a program that plays an XM and outputs (to a file) the number of
milliseconds elapsed (since the start) whenever the row (and pattern/order)
changes. (bonus points if you output this info as a two-dimensional array
that you can compile into your code)

2 - In your main application, after you start playing the music file, start
your point of reference and render based on elapsed milliseconds. (this is
where you can use your pre-generated array from step one)

I’m working on a “player” that will do this automatically and call the
appropriate functions at the appropriate times, so in the end you could use
an editor to put your demo together and the only code you’ll have to worry
about are the effects. If you’re willing to help, shoot me an e-mail.–

Olivier A. Dagenais - Software Architect and Developer

“Tomasz M?ka” wrote in message
news:20010306220300.218f6067.tmaka at ll.pl

hello list,

I’m newbie in SDL and I’ve one question:
Is it possible to synchronize my video fx with xm module by using
sdl_mixer ?

I can’t find any functions in SDL_mixer.h for reading song and pattern
position actually playing xm… (btw, it’s very important function to me).

thanks,
tomasz.

That would work but I think you /can/ read the song and pattern positions
directly from mikmod’s data structure. You’d have to add some code to
music.c to do it though.

Look at music.c, at line 74 (v.1.1.0, anyway):
static Mix_Music * volatile music_playing = NULL;

That’s the music data. You want music_playing->data which is a union of
pointers, one of them being UNIMOD *. (same as MODULE *)

So, I think
music_playing->data.module->patpos
and
music_playing->data.module->sngpos
are what you want.

Hm, I have a question for others, though. Should I expect to have any
difficuly modifying SDL_mixer to play multiple mp3 streams at once? It
doesn’t look that way but who knows. Has anyone done this before?

Greg V. (hmaon)

    "It's today!" said Piglet.
"My favorite day," said Pooh.On Tue, 6 Mar 2001, Olivier Dagenais wrote:

What I’ve done (in the past) is this:

1 - Write a program that plays an XM and outputs (to a file) the number of
milliseconds elapsed (since the start) whenever the row (and pattern/order)
changes. (bonus points if you output this info as a two-dimensional array
that you can compile into your code)

2 - In your main application, after you start playing the music file, start
your point of reference and render based on elapsed milliseconds. (this is
where you can use your pre-generated array from step one)

I’m working on a “player” that will do this automatically and call the
appropriate functions at the appropriate times, so in the end you could use
an editor to put your demo together and the only code you’ll have to worry
about are the effects. If you’re willing to help, shoot me an e-mail.

Olivier A. Dagenais - Software Architect and Developer

“Tomasz M?ka” wrote in message
news:20010306220300.218f6067.tmaka at ll.pl

hello list,

I’m newbie in SDL and I’ve one question:
Is it possible to synchronize my video fx with xm module by using
sdl_mixer ?

I can’t find any functions in SDL_mixer.h for reading song and pattern
position actually playing xm… (btw, it’s very important function to me).

thanks,
tomasz.

hello,

I’ve made a small patch for sdl_mixer-1.1.0. Patched version has one new function - Mus_GetSynchro() which return current synchro counter.

How it works ?
Synchro counter method is old amiga-protracker replayer’s method - it increment counter when specified command occur. I choose XFF command - it’s one of free commands in all tracker’s I think.
This patch support XFF command in xm module’s only, but support for others formats is easy… just look in mikmod/load_xm.c (lines 279-291).

How it use ?
Put some XFF commands in xm module - command field :slight_smile:
in your application do something like this (in inner loop of course):

if (Mus_GetSynchro() < 2) show_radial_blur();
if (Mus_GetSynchro() >= 2) show_flares();

that’s all

I belive that Sam don’t ignore this patch - It’s useful for me… and for others I think :slight_smile:

btw, thanks to Greg and Oliver for helpful info.–
tomasz.
-------------- next part --------------
A non-text attachment was scrubbed…
Name: synchro-patch-sdl_mixer.1.1.0.gz
Type: application/x-gzip
Size: 1599 bytes
Desc: not available
URL: http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20010313/e5a37214/attachment.bin