The International Simutrans Forum

 

Author Topic: Wave audio Sound Routine - Set Volume? (MAC)  (Read 9342 times)

0 Members and 1 Guest are viewing this topic.

Offline leopard

  • Devotees (Inactive)
  • *
  • Posts: 97
  • Life in the Urban Jungle
    • A Leopard's Tail
Wave audio Sound Routine - Set Volume? (MAC)
« on: August 05, 2008, 06:44:26 PM »
managed to get a MIDI routine working for the mac, now looking at a wave audio routine for sound effects.

I notice the game interface has a slider to set the volume, the xxx_sound.cc files however don't appear to have a function to control this volume, (the MIDI one does)

Q: how is the volume set for sound effects?
« Last Edit: August 06, 2008, 06:55:46 AM by prissi »

Offline prissi

  • Developer
  • Administrator
  • *
  • Posts: 10820
  • Languages: De,EN,JP
Re: Wave audio Sound Routine - Set Volume?
« Reply #1 on: August 05, 2008, 07:04:11 PM »
It depends. Currently the MAC uses SDL for graphics and sound. If this does not work, there will be no sound. SDL_mixer will gives MIDI and sound. Allgro has already MIDI-support.

Honestly, I would think the best way would be a native Quickdraw/Quartz Graphics/sound/midi-Driver, like the GDI-driver for windows. I.e. a file like simsys_cocoa16.cc and sound_cocoa.cc and so on ...

Offline leopard

  • Devotees (Inactive)
  • *
  • Posts: 97
  • Life in the Urban Jungle
    • A Leopard's Tail
Re: Wave audio Sound Routine - Set Volume?
« Reply #2 on: August 05, 2008, 07:28:21 PM »
thats basically what I have done for the midi, "core-audio.midi.mm" compiles, and so far works fine.

I can do basically the same for the sound routine, hell the code for the midi rouitne will play mp3's it will play anything quicktime can do.

Just wondering if there was a command as for the midi routine to set the volume, not important if there isn't.

plan to get back to the main game when I find out why I'm getting "bad magic number, not a mach-o file" during the compile phase in xcode, don't fancy doing the full interface manually. but it may come to that.

managed to port a simple SDL program to cocoa (joystick example prog) with a few lines of code, basically very easy, just need to get the compile sorted.

but making it a universal binary more or less requires it to be in xcode.

still working

Offline leopard

  • Devotees (Inactive)
  • *
  • Posts: 97
  • Life in the Urban Jungle
    • A Leopard's Tail
Re: Wave audio Sound Routine - Set Volume?
« Reply #3 on: August 05, 2008, 07:35:51 PM »
ahem.


found the bit to set the voulme


*opppps*

Offline leopard

  • Devotees (Inactive)
  • *
  • Posts: 97
  • Life in the Urban Jungle
    • A Leopard's Tail
Re: Wave audio Sound Routine - Set Volume?
« Reply #4 on: August 05, 2008, 09:24:20 PM »
ok this works, in theory but not in practice.

issue #1, the game is passing a mangled file name

specifically something like

simgamepath/pak/sound//user/username/simgamepath/sound/file.wav

not too hard to resolve, with a bit of demangling, the file appears to be loaded into my little sound list fine. hell even rigged it to play every sound as they are first loaded.

the game loads horse.wav, and no other file

the routine to play the sounds is never called...

hmmm

Offline leopard

  • Devotees (Inactive)
  • *
  • Posts: 97
  • Life in the Urban Jungle
    • A Leopard's Tail
Re: Wave audio Sound Routine - Set Volume?
« Reply #5 on: August 05, 2008, 09:25:22 PM »
interestingly using the sdl_sound.cc file as opposed to my core-audio_sound.mm file leads to exactly the same results, a mangled filename leading to a failure to load, but also the play routine never firing.