notaz / picodrive

Fast MegaDrive/MegaCD/32X emulator
Other
292 stars 167 forks source link

Add support for ISO/CSO w/ ogg audio #11

Open 133794m3r opened 10 years ago

133794m3r commented 10 years ago

As the bug's title says. I'd like to see ogg as an option for the audio, as I'd like to take my rips and just store the ISO+ogg files on my backups instead of having to do mp3 as the bitrate required for that to be perfect is ~2x that for ogg.

I don't know the performance characteristics for the streaming of the audio on the devices that you're doing, so I'm not going to suggest FLAC as decoding flac might take up too much cputime.

sergiobenrocha2 commented 7 years ago

@notaz what tremor version do I need exactly? I tried the version from gen plus gx and revision 19599 too (main and low memory branch), and I only got noise. What I did in the source:

diff --git a/Makefile b/Makefile
index ca8ccf6..d658bc6 100644
--- a/Makefile
+++ b/Makefile
@@ -223,3 +223,4 @@ cpu/sh2/mame/sh2pico.o : cpu/sh2/mame/sh2.c
 pico/pico.o pico/cd/mcd.o pico/32x/32x.o : pico/pico_cmn.c pico/pico_int.h
 pico/memory.o pico/cd/cd_memory.o pico/32x/32x_memory.o : pico/pico_int.h pico/memory.h
 cpu/fame/famec.o: cpu/fame/famec.c cpu/fame/famec_opcodes.h
+pico/cd/cdd.o: tremor/vorbisfile.c tremor/ivorbisfile.h

diff --git a/Makefile.libretro b/Makefile.libretro
index ade5bc6..4cc3367 100644
--- a/Makefile.libretro
+++ b/Makefile.libretro
@@ -452,6 +452,25 @@ ifeq ($(findstring Haiku,$(shell uname -a)),)
        LDLIBS += $(LIBM)
 endif

+CFLAGS += -DUSE_LIBTREMOR
+CFLAGS += -DDISABLE_MANY_OGG_OPEN_FILES
+
+OBJS += tremor/bitwise.o
+OBJS += tremor/block.o
+OBJS += tremor/codebook.o
+OBJS += tremor/floor0.o
+OBJS += tremor/floor1.o
+OBJS += tremor/framing.o
+OBJS += tremor/info.o
+OBJS += tremor/mapping0.o
+OBJS += tremor/mdct.o
+OBJS += tremor/registry.o
+OBJS += tremor/res012.o
+OBJS += tremor/sharedbook.o
+OBJS += tremor/synthesis.o
+OBJS += tremor/vorbisfile.o
+OBJS += tremor/window.o
+
 SHARED ?= -shared
 LDFLAGS += $(SHARED) $(fpic)

A sample of the .cue file:

CATALOG 0000000000000
FILE "Sonic The Hedgehog CD (Japan) (Track 01).bin" BINARY
  TRACK 01 MODE1/2352
    INDEX 01 00:00:00
FILE "Sonic The Hedgehog CD (Japan) (Track 02).ogg" OGG
  TRACK 02 AUDIO
    INDEX 00 00:00:00
    INDEX 01 00:02:00
FILE "Sonic The Hedgehog CD (Japan) (Track 03).ogg" OGG
  TRACK 03 AUDIO
    INDEX 00 00:00:00
    INDEX 01 00:01:74