User Soundtracks => Manual Looping with OpenAL

Post: #1
I have a decision to make over whether or not my game should have music included as it is the kind of game where you don't have to be fully immersed in order to play it. A lot of the time when playing games like this I like to just have iTunes running instead of listening to the in game music as it ALWAYS gets repetitive.

What are your thoughts on this?
Quote this message in a reply
Posts: 1,563
Joined: 2003.10
Post: #2
My recommendation would be to include the music, and have an option in the game preferences to not play it. If the music file(s) is (are) large and you're concerned about download size for dial-up users, you could also distribute a version without the music included, for people who would never use it anyway.

Alex Diener
Quote this message in a reply
Post: #3
That is very true and what i was originally considering however i have an ulterior motive which is that my game has very rigid timing and music would only work properly if it is time with the game. I can do this and am currently creating 'on-the-fly' music using loops and openAL however at present the timing it uses isn't accurate enough and so there are sometimes visible breaks in the loops. Telling openAl to loop it for me just sends it out of time. Unless i can use glTimerFunc to make this work better I may just take up your suggestion and use ambient music that has nearly no rhythmic content as that would kind of fit in with the 'not really concentrating' ethos of my game.

Does the uDev competition allow multiple downloads for one game?
Quote this message in a reply
Post: #4
Hmmm now that i have thought about it using glTimerFunc would have the same 'loop drift' as straight openAl loops as you I would have to recal the TimerFunc just after I tell the loop to play.

Anyone have any ideas on loop timing?

p.s. I'm moving this to the audio forum...
Quote this message in a reply
Post: #5
Please have a listen to what i have so far:

Sorry about the size (3.8mg). I personally don't think having sound justifies the additional download size but that's me. A lot of people have told me the sounds are just annoying so i'm thinking of just scrapping sound altogther.

What do you think?

Thanks for your help,

Quote this message in a reply
Posts: 28
Joined: 2003.10
Post: #6
For Oolite I settled on controlling a set group of playlists in iTunes from within the game, and then letting the user populate the playlists.

-- Giles Williams
Oolite - retro space-sim agogo
Quote this message in a reply
Posts: 1,563
Joined: 2003.10
Post: #7
drzeip Wrote:Please have a listen to what i have so far:

Your application won't run on most people's systems, because the OpenAL framework hasn't been embedded properly. Let me know if you need more info on how to do this, as I've recently done it for my own game. Of course, if you decide not to have sound, you won't even need to bother... Smile

Even after putting your OpenAL framework in /Library/Frameworks, the application doesn't seem to run properly for me. When it starts up, I get a black window with nothing in it. When I pressed a few keys, I got this crash:

Date/Time:      2004-10-21 10:25:07 -0400
OS Version:     10.3.5 (Build 7M34)
Report Version: 2

Command: CubicsRube
Path:    /Users/adiener/Desktop/
Version: ??? (0.0.1d1)
PID:     364
Thread:  0

Exception:  EXC_BAD_ACCESS (0x0001)
Codes:      KERN_PROTECTION_FAILURE (0x0002) at 0x00000000

Thread 0 Crashed:
0   <<00000000>>     0xffff8814 __memcpy + 0x74
1   libSystem.B.dylib             0x90006b74 __sfvwrite + 0x194
2   libSystem.B.dylib             0x90006df0 __sprint + 0x30
3   libSystem.B.dylib             0x90006938 __vfprintf + 0x3198
4   libSystem.B.dylib             0x90006fb0 sprintf + 0xb0
5   com.zeip.cubicsrube           0x000136f8 0x1000 + 0x126f8
6   com.zeip.cubicsrube           0x00012824 0x1000 + 0x11824
7   com.zeip.cubicsrube           0x00012b0c 0x1000 + 0x11b0c
8                0x87526da8 -[GLUTView keyDown:] + 0x154
9              0x92e02b70 -[NSWindow sendEvent:] + 0x1780
10                0x87542600 -[GLUTWindow sendEvent:] + 0x38
11              0x92df4b98 -[NSApplication sendEvent:] + 0xebc
12                0x87521cc4 -[GLUTApplication _runMainLoopUntilDate:autoreleasePool:] + 0x64
13                0x87521df4 -[GLUTApplication run] + 0xbc
14                0x8753bd28 glutMainLoop + 0xa4
15  com.zeip.cubicsrube           0x00013008 0x1000 + 0x12008
16  com.zeip.cubicsrube           0x0000a8c4 0x1000 + 0x98c4
17  dyld                          0x8fe1a558 _dyld_start + 0x64

Thread 1:
0   libSystem.B.dylib             0x900074c8 mach_msg_trap + 0x8
1   libSystem.B.dylib             0x90007018 mach_msg + 0x38
2      0x90191708 __CFRunLoopRun + 0x350
3      0x90195e94 CFRunLoopRunSpecific + 0x148
4     0x90732f80 HALRunLoop::OwnThread(void*) + 0x104
5     0x907391e0 CAPThread::Entry(CAPThread*) + 0x30
6   libSystem.B.dylib             0x900246e8 _pthread_body + 0x28

Thread 2:
0   libSystem.B.dylib             0x90018be8 semaphore_timedwait_signal_trap + 0x8
1   libSystem.B.dylib             0x9000e788 _pthread_cond_wait + 0x268
2     0x907244fc CAGuard::WaitFor(unsigned long long) + 0xdc
3     0x90724130 CAGuard::WaitUntil(unsigned long long) + 0x130
4     0x90722b20 HPIOThread::WorkLoop() + 0x358
5     0x9073919c HPIOThread::ThreadEntry(HPIOThread*) + 0x1c
6     0x907391e0 CAPThread::Entry(CAPThread*) + 0x30
7   libSystem.B.dylib             0x900246e8 _pthread_body + 0x28

PPC Thread State:
  srr0: 0xffff8814 srr1: 0x0200f030                vrsave: 0x00000000
    cr: 0x8400220c  xer: 0x00000000   lr: 0x90006b74  ctr: 0x900f60c0
    r0: 0x90006b74   r1: 0xbfffead0   r2: 0x00000200   r3: 0x00000000
    r4: 0x00056994   r5: 0x0000000c   r6: 0x6f6d204c   r7: 0x00000000
    r8: 0x00000000   r9: 0x00000000  r10: 0x000d3234  r11: 0xa0003c10
   r12: 0x00000000  r13: 0x00000000  r14: 0x00a00100  r15: 0x00000000
   r16: 0x00056998  r17: 0x00000000  r18: 0xbfffef00  r19: 0x00000000
   r20: 0x00000000  r21: 0x00000000  r22: 0x00000000  r23: 0xbfffec38
   r24: 0xbfffec20  r25: 0x0000000c  r26: 0xbfffec38  r27: 0x0005698c
   r28: 0xbfffef00  r29: 0x0000000c  r30: 0x0000000c  r31: 0x900037ac

Binary Images Description:
    0x1000 -    0x64fff com.zeip.cubicsrube ??? (0.0.1d1)    /Users/adiener/Desktop/
0x5f80000 -  0x5f90fff 1.3.4    /System/Library/Extensions/IOHIDFamily.kext/Contents/PlugIns/IOHIDLib.plugin/Contents/MacOS/IOHIDLib
0x5fb6000 -  0x5fb6fff 2.2.6    /System/Library/Extensions/IOAudioFamily.kext/Contents/PlugIns/AOAHALPlugin.bundle/Contents/MacOS/AOAHALPlugin
0x6169000 -  0x61a5fff 6.5.1    /Library/Audio/Plug-Ins/HAL/iSightAudio.plugin/Contents/MacOS/iSightAudio
0x6307000 -  0x63aafff 1.3.2    /System/Library/Components/CoreAudio.component/Contents/MacOS/CoreAudio
0x6cb6000 -  0x6da4fff GLEngine     /System/Library/Frameworks/OpenGL.framework/Resources/GLEngine.bundle/GLEngine
0x6f25000 -  0x6fa9fff 1.3.28 (3.2.8)    /System/Library/Extensions/GeForceFXGLDriver.bundle/Contents/MacOS/GeForceFXGLDriver
0x6fb2000 -  0x6fcbfff GLDriver     /System/Library/Frameworks/OpenGL.framework/Versions/A/Resources/GLDriver.bundle/GLDriver
0x6ff6000 -  0x700dfff GLRendererFloat     /System/Library/Frameworks/OpenGL.framework/Versions/A/Resources/GLRendererFloat.bundle/GLRendererFloat
0x77ef3000 - 0x77f14fff ??? OpenAL version 1.2.1 (1.0.1d1)    /Library/Frameworks/OpenAL.framework/Versions/A/OpenAL
0x85950000 - 0x8596afff libGLProgrammability.dylib     /System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGLProgrammability.dylib
0x87520000 - 0x87560fff 3.2.7 (GLUT-3.2.7)    /System/Library/Frameworks/GLUT.framework/Versions/A/GLUT
0x88eb0000 - 0x88ebcfff 2.5 (AGL-2.5)    /System/Library/Frameworks/AGL.framework/Versions/A/AGL
0x8c2d0000 - 0x8c2d1fff libGLSystem.dylib     /System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGLSystem.dylib
0x8fe00000 - 0x8fe4ffff dyld     /usr/lib/dyld
0x90000000 - 0x90122fff libSystem.B.dylib     /usr/lib/libSystem.B.dylib
0x90190000 - 0x9023dfff 6.3.5 (299.32)    /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation
0x90280000 - 0x904f9fff 10.3.5    /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/CarbonCore.framework/Versions/A/CarbonCore
0x90570000 - 0x905dffff 1.3.5 (???)    /System/Library/Frameworks/IOKit.framework/Versions/A/IOKit
0x90610000 - 0x9069afff 3.0.1    /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/OSServices.framework/Versions/A/OSServices
0x90700000 - 0x90700fff 10.3 (???)    /System/Library/Frameworks/CoreServices.framework/Versions/A/CoreServices
0x90720000 - 0x90787fff 2.1.2    /System/Library/Frameworks/CoreAudio.framework/Versions/A/CoreAudio
0x907c7000 - 0x907d2fff 1.3.3    /System/Library/Frameworks/OpenGL.framework/Versions/A/OpenGL
0x907f0000 - 0x907f9fff 2.0.3    /System/Library/PrivateFrameworks/DiskArbitration.framework/Versions/A/DiskArbitration
0x90810000 - 0x90810fff 1.0 (???)    /System/Library/Frameworks/ApplicationServices.framework/Versions/A/ApplicationServices
0x90830000 - 0x9089ffff libobjc.A.dylib     /usr/lib/libobjc.A.dylib
0x908c5000 - 0x908e2fff 3.8    /System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/CarbonSound.framework/Versions/A/CarbonSound
0x90910000 - 0x90983fff 1.2.2    /System/Library/PrivateFrameworks/DesktopServicesPriv.framework/Versions/A/DesktopServicesPriv
0x909f0000 - 0x90b4bfff 6.3.5 (500.56)    /System/Library/Frameworks/Foundation.framework/Versions/C/Foundation
0x90c30000 - 0x90c4afff libGL.dylib     /System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib
0x90c60000 - 0x90cc2fff libGLU.dylib     /System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGLU.dylib
0x90d00000 - 0x90d1bfff 1.7.1 (???)    /System/Library/Frameworks/SystemConfiguration.framework/Versions/A/SystemConfiguration
0x90ec0000 - 0x90ec0fff 6.3 (???)    /System/Library/Frameworks/Cocoa.framework/Versions/A/Cocoa
0x90ec2000 - 0x90f55fff 3.3    /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/PrintCore.framework/Versions/A/PrintCore
0x90fed000 - 0x91004fff 1.5.4    /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/LangAnalysis.framework/Versions/A/LangAnalysis
0x910b0000 - 0x91101fff 1.2.5 (63.2)    /System/Library/PrivateFrameworks/Bom.framework/Versions/A/Bom
0x91560000 - 0x91619fff 3.4.65 (???)    /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/QD.framework/Versions/A/QD
0x91670000 - 0x916a8fff 1.4    /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/AE.framework/Versions/A/AE
0x917e0000 - 0x917f0fff 3.3    /System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/SpeechRecognition.framework/Versions/A/SpeechRecognition
0x91810000 - 0x9182afff 1.2.1 (???)    /System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/OpenScripting.framework/Versions/A/OpenScripting
0x91850000 - 0x91860fff 2.1.5    /System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/ImageCapture.framework/Versions/A/ImageCapture
0x91890000 - 0x9189cfff 1.0.1    /System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/Help.framework/Versions/A/Help
0x918c0000 - 0x918cdfff 1.2.1 (1.0)    /System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/CommonPanels.framework/Versions/A/CommonPanels
0x918f0000 - 0x9193efff 3.3    /System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/Print.framework/Versions/A/Print
0x91990000 - 0x9199bfff 1.2 (90)    /System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/SecurityHI.framework/Versions/A/SecurityHI
0x919c0000 - 0x91a33fff 3.3.2    /System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/NavigationServices.framework/Versions/A/NavigationServices
0x91a90000 - 0x91a90fff 1.3.2    /System/Library/Frameworks/AudioUnit.framework/Versions/A/AudioUnit
0x91ab0000 - 0x91ac4fff libCGATS.A.dylib     /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/CoreGraphics.framework/Versions/A/Resources/libCGATS.A.dylib
0x91ae0000 - 0x91aebfff libCSync.A.dylib     /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/CoreGraphics.framework/Versions/A/Resources/libCSync.A.dylib
0x91b10000 - 0x91b2afff libPDFRIP.A.dylib     /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/CoreGraphics.framework/Versions/A/Resources/libPDFRIP.A.dylib
0x91b50000 - 0x91b5ffff libPSRIP.A.dylib     /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/CoreGraphics.framework/Versions/A/Resources/libPSRIP.A.dylib
0x91b80000 - 0x91b93fff libRIP.A.dylib     /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/CoreGraphics.framework/Versions/A/Resources/libRIP.A.dylib
0x91c93000 - 0x91d51fff ColorSync     /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/ColorSync.framework/Versions/A/ColorSync
0x91ebd000 - 0x91ebdfff 10.3 (???)    /System/Library/Frameworks/Carbon.framework/Versions/A/Carbon
0x92070000 - 0x92096fff 1.4 (1.2)    /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/FindByContent.framework/Versions/A/FindByContent
0x920c0000 - 0x922a7fff 2.3 (176)    /System/Library/Frameworks/Security.framework/Versions/A/Security
0x92430000 - 0x92468fff 10.3.5 (98.4)    /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/LaunchServices
0x92740000 - 0x92777fff 1.2.1 (7)    /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/CFNetwork.framework/Versions/A/CFNetwork
0x927d0000 - 0x92b54fff 1.3.4 (???)    /System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/HIToolbox.framework/Versions/A/HIToolbox
0x92d30000 - 0x92d80fff 1.4.1 (0.0.1d1)    /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/HIServices.framework/Versions/A/HIServices
0x92dc0000 - 0x932befff 6.3.4 (743.24)    /System/Library/Frameworks/AppKit.framework/Versions/C/AppKit
0x935d0000 - 0x938a8fff 1.203.26 (???)    /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/CoreGraphics.framework/Versions/A/CoreGraphics
0x93920000 - 0x93933fff 3.2    /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/SpeechSynthesis.framework/Versions/A/SpeechSynthesis
0x939a0000 - 0x939b4fff libcups.2.dylib     /usr/lib/libcups.2.dylib
0x939d0000 - 0x939d4fff libmathCommon.A.dylib     /usr/lib/system/libmathCommon.A.dylib
0x93b50000 - 0x93bf3fff 1.3.2    /System/Library/Frameworks/AudioToolbox.framework/Versions/A/AudioToolbox
0x94060000 - 0x94078fff 1.1.1 (1.1.0)    /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/WebServicesCore.framework/Versions/A/WebServicesCore
0x945b0000 - 0x945b9fff libz.1.dylib     /usr/lib/libz.1.dylib
0x94610000 - 0x9462afff libresolv.9.dylib     /usr/lib/libresolv.9.dylib
0x94650000 - 0x946affff 1.0.2    /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/SearchKit.framework/Versions/A/SearchKit
0x94a30000 - 0x94af5fff libxml2.2.dylib     /usr/lib/libxml2.2.dylib
0x94b20000 - 0x94badfff 101.1.3 (55.10)    /System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/Ink.framework/Versions/A/Ink
0x9540b000 - 0x95474fff 1.1.2    /System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/HTMLRendering.framework/Versions/A/HTMLRendering
0x954c0000 - 0x95ac6fff libBLAS.dylib     /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib
0x95b20000 - 0x95df0fff libLAPACK.dylib     /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libLAPACK.dylib
0x95e40000 - 0x95eadfff libvDSP.dylib     /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libvDSP.dylib
0x95f00000 - 0x95f20fff libvMisc.dylib     /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libvMisc.dylib
0x968d0000 - 0x969b2fff libicucore.A.dylib     /usr/lib/libicucore.A.dylib
0x96a20000 - 0x96ae2fff libcrypto.0.9.7.dylib     /usr/lib/libcrypto.0.9.7.dylib
0x96b40000 - 0x96b6efff libssl.0.9.7.dylib     /usr/lib/libssl.0.9.7.dylib
0x96bf0000 - 0x96c7ffff ATS     /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/ATS.framework/Versions/A/ATS
0x96cb0000 - 0x96d9efff libiconv.2.dylib     /usr/lib/libiconv.2.dylib
0x96e80000 - 0x96e90fff 3.0.2 (vecLib 3.0.2)    /System/Library/Frameworks/vecLib.framework/Versions/A/vecLib
0x974c0000 - 0x97503fff libGLImage.dylib     /System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGLImage.dylib
0x97510000 - 0x97518fff libbsm.dylib     /usr/lib/libbsm.dylib

Alex Diener
Quote this message in a reply
Post: #8
Yeh i thought I wasn't embedding openAl properly. I'm completely baffled by this crash though. Even more so by the screen being blank. Sad

I don't get this problem on my other computer however so do you have any idea what the problem could be?

Even if i don't decide to use sound knowing how to embed frameworks would be useful. I tried setting the 'framework style' or whatever it is to bundle but i guess there must be more to it...
Quote this message in a reply
Posts: 776
Joined: 2003.04
Post: #9
I have a "hacked"* version of OpenAL (the only thing I did was change the internal path with an hex editor, since the way you're supposed to do that didn't work), it's included in Failed [source code]

Basically, instead of putting it inside Frameworks, you put it inside Frameworksxxx (those extra "x" are padding chars so that the path stays the same lenght as the original).

It seems to work OK, but I haven't received much feedback on that game Sad

*about 5 bytes different from the official version Wink
Quote this message in a reply
Post Reply 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  Looping MP3 Carlos Camacho 7 11,913 Nov 7, 2012 07:54 PM
Last Post: PythonBlue