view src/xs_backend.h @ 957:0e60e5d56fdd

Change how the backend emulator library is initialized for libSIDPlay2 and FP, as it seems the engine configuration has some persistence despite reconfiguration between loaded files if same engine object is retained. This caused, for example, 2SID stereo tunes being played "mono" if played after a normal 1-SID tune. Duh.
author Matti Hamalainen <ccr@tnsp.org>
date Tue, 20 Nov 2012 22:13:48 +0200
parents 4c6c5247de7d
children
line wrap: on
line source

#ifndef XS_PLAYER_H
#define XS_PLAYER_H

#include "xmms-sid.h"
#include "xs_support.h"

#ifdef __cplusplus
extern "C" {
#endif

struct XSEngineState;

typedef struct
{
    gint        plrIdent;
    gboolean    (*plrProbe)(XSFile *);
    gboolean    (*plrInit)(struct XSEngineState *);
    void        (*plrClose)(struct XSEngineState *);
    gboolean    (*plrInitSong)(struct XSEngineState *);
    guint       (*plrFillBuffer)(struct XSEngineState *, gchar *, guint);
    gboolean    (*plrLoadSID)(struct XSEngineState *, gchar *);
    void        (*plrDeleteSID)(struct XSEngineState *);
    XSTuneInfo* (*plrGetSIDInfo)(const gchar *);
    gboolean    (*plrUpdateSIDInfo)(struct XSEngineState *);
    void        (*plrFlush)(struct XSEngineState *);
} XSEngine;


typedef struct XSEngineState
{
    gint        audioFrequency,    /* Audio settings */
                audioChannels,
                audioBitsPerSample;
    AFormat     audioFormat;

    void        *internal;         /* SID-emulation internal engine data */
    XSEngine    *engine;           /* Selected player engine */
    gboolean    error,
                playing,
                paused;
    gint        currSong,          /* Current sub-tune */
                lastTime;

    XSTuneInfo *tuneInfo;
} XSEngineState;


typedef struct
{
    gchar *name;
    gchar *filename;
    size_t size;
} XSROMImageData;

#define XS_C64_ROM_IMAGES 3
extern const XSROMImageData xs_rom_images[XS_C64_ROM_IMAGES];

gboolean xs_init_emu_backend(XSEngineState *state, gint *preferred);

gboolean xs_load_rom_image(gint index, guint8 **data);
void     xs_free_rom_images(guint8 **roms);
gboolean xs_load_rom_images(guint8 **roms);


#ifdef __cplusplus
}
#endif
#endif /* XS_PLAYER_H */