Sign in to follow this  

Unity openAL timing woes (my first post)

Recommended Posts

Hello to all, This is my first post at and I'm glad to be part of the community. I am working on project using openGL(win32) and I was wanted to use openAL for the audio. My problem is with getting audio loops (.wav) to playback in sync. I've used GetClickCount() and timeGetTime() to attempt to keep track of the musical measures. Since I'm still early in the development stage of this project, I'm starting with 2 .wav files both at 80bpm. At 80bpm the time between each quarter note is 750ms (1000ms*60sec)/80bpm. My code is set to check if 750ms or more have expired and if so, I increment a "quarter note" variable. If I've got more than 4 quarter notes then I set the value to 1 and increment a "measure" variable. So it’s kind of like a metronome or measure/beat counter common in sequencing software. In my test, I count down 4 quarter notes and then start playing the first loop. On the first down note of the ninth measure, the second loop starts to play as well. So...I was doing this at work on my fat Dell XPS and hurray!!!! not only did it work, but my measure/beat counter (which is displayed on screen) seemed to be keeping "perfect" time. But when I got home to test it out on my 1.5ghz p4 boo!!!!!!!! it was starting to get out of sync by the 9th measure...which made me very very sad. As I said I've tried using both GetClickCount() and timeGetTime(). GetClickCount() worked on the Dell at work, but timeGetTime() did not, and of course neither worked at home. The only thing I have not tried is QueryPerformanceCounter which I have not figured out how to implement, and I have also seen many recommending to stay clear of it. Ultimately, I'd like to have 1 or 2 major loops (about 8 measures each) and then have maybe 10 or so other shorter sounds that would not loop but would play back in sync on user events. Seems reasonable, but its gonna sound pretty crappy if I have a bunch of 80bmp loops playing at the same time out of sync. I am hoping that someone can give me some advice on how to manage a timing system accurate enough so when a new sound plays it can do so on the next down beat or next measure. I'd be happy with that, I won’t even worry about eighth or sixteenth notes. Since I am still in early development, I would be open to options other than openAL if there are other technologies better suited. I hope that I'm not being over ambitious here. I'm optimistic that it can be done, but I have run out of ideas. Sorry for the book here. Thanks in advance dudeBot

Share this post

Link to post
Share on other sites
well...if all i get is a flame for pasting
the message I posted at devmaster and forgetting
to change it to gamedev, then maybe you are
indeed correct.

Share this post

Link to post
Share on other sites
Original post by dudeBot
well...if all i get is a flame for pasting
the message I posted at devmaster and forgetting
to change it to gamedev, then maybe you are
indeed correct.

It's just a joke, far from a flame. Chill out, dude. [cool]

Share this post

Link to post
Share on other sites
I can take a joke.
I though it was pretty funny that I did that
I guess if I had written the reponse
I would have put some kind of smile after the comment
to make sure that it was taken as a joke. :)

I guess I was more looking for some help with my post.
And I guess I got more busted than flamed.

Anyway, sorry if I over reacted, just looking for
some guidance.

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this  

  • Forum Statistics

    • Total Topics
    • Total Posts
  • Similar Content

    • By KARTHI
      Free software
      1. Lumberyard (Game engine) open-source and free tool
      Amazon Lumberyard is a free cross-platform triple-A game engine developed by Amazon and based on the architecture of Cry Engine, which was licensed from Crytek in 2015.
      2. Sculptris (sculpture tool) open-source and free tool
      Sculptris is a virtual sculpting software program, with a primary focus on the concept of modeling clay. It entered active development in early December 2009, and the most recent release was in 2011.
      3. Make human (game model creator) open-source and free tool
      Make human is an open-source 3D computer graphics software middleware designed for the prototyping of photorealistic humanoids. It is developed by a community of programmers, artists, and academics interested in 3D modeling of characters.
      4. Ipi soft (motion capture software) not free tool
      iPi Motion Capture is a scalable markerless motion capture software tool that supports 1 or 2 Kinect cameras or 3 to 6 Sony PlayStation Eye cameras to track a human action and convert it into a motion capture file
       5. Blender (Complete tool) for modeling, texturing and so on (open-source and free tool)
       Blender is a professional, free and open-source 3D computer graphics software toolset used for creating animated films, visual effects, art, 3D printed models, interactive 3D applications and video games.
      6. Audacity (music editor) open-source and free tool
      Audacity is a free open source digital audio editor and recording computer software application, available for Windows, OS X, Linux and other operating systems.
      7. Awesome bump (bump map editor) open-source and free tool (optional)
      Awesome Bump is a free program written using Qt library designed to generate normal, height, specular or ambient occlusion textures from a single image.
      8. Faceware (facial animation) not free tool
      Faceware Technologies is an American company that designs facial animation and motion capture technology. The company was established under Image Metrics and became its own company at the beginning of 2012.
      9. GIMP (image editing) open-source and free tool
      GIMP is a free and open-source raster graphics editor used for image retouching and editing, free-form drawing, converting between different image formats, and more specialized tasks. Through this you can also create bump maps
      10. Meshlab (mesh repair) open-source and free tool (Optional)
      MeshLab is an advanced 3D mesh processing software system that is oriented to the management and processing of unstructured large meshes and provides a set of tools for editing, cleaning, healing.
      11. LibreOffice (create documents) open-source and free tool
      LibreOffice is a free and open source office suite, a project of The Document Foundation. It was forked from in 2010, which was an open-sourced version of the earlier StarOffice.
      12. Atom (coding software) open-source and free tool
      Atom is a free and open-source text and source code editor for macOS, Linux, and Microsoft Windows with support for plug-ins written in Node.js, and embedded Git Control, developed by GitHub.
      Useful websites
      free image
      Reference images will be found on Pinterest
      Free Sounds
      Download the free music tracks from these websites
      I hope this information will help full to you. I am got so stress to collect this data so don't waste it 
    • By rXpSwiss
      I am looking for a team to stop developing project alone and start doing bigger things.  I would like a team that is organized and serious even of it is just a hobby. I don't want a project to be dropped every week and the team to disband after 2 months. Even though it is a hobby the quality and complexity of the game should be on par with a game that would be released on a major platform.

      I have experience with UE4, Unity and making my own engine with OpenGL. I prefer UE4 for 3D and Unity for 2D but I am willing to work with both.
      Every one of the games I worked on (personal project) involve multiplayer and netcode, I used what UE4 provided but for unity I used Forge Remastered which gave me a bigger control on how to optimize everything.
      I play several instruments, know about game design and am able to do small modeling task but I am before everything a programmer.
      I play mostly competitive fighting games these days (SFV, MvCi, GG, T7) but before I started getting serious into these types of games it was mostly FPS (CS1.6, UT2k4, Quake 3) and Dota-like. As you can see I love competitive multiplayer games but I play solo games too. I have a preference for darker theme games(F.E.A.R, HL, Shin Megami Tensei/Persona, Last of Us, SH2, RE7) even though I play everything offering me a challenge or some peace (Don't Starve, Stardew Valley, Darkest Dungeon, Zelda etc).
      I do have several ideas for games with a very clear direction gameplay, marketing and art but I am not looking for a team to work on my ideas, I just have them if needed.
      Feel free to ask questions here or PM me if you prefer.
      Best regards,
    • By KARTHI
      Please reply me about this
    • By KARTHI
      Currently I using makehuman to make a 3d models but I am not satisfied with that model. If any use this please reply about the quality and details of models. 
    • By KARTHI
      I planned to make a space game so I need a knowledge about 3d planet making so anyone help me to make it possible
  • Popular Now