Audio help

BlitzMax Forums/BlitzMax Beginners Area/Audio help

B(Posted 2012) [#1]
Hey guys,

I am having trouble getting audio to work on my windows computer.
It worked fine on my mac, but since that one died I bought a new windows laptop.

I have searched all over this site and google and cannot find a tutorial or anything for that matter that tells you how to get audio working in Blitz.

I have .ogg files I would like to use in my game.

Any help would be greatly appreciated!

Thanks!

B


Captain Wicker (crazy hillbilly)(Posted 2012) [#2]
Solution: http://code.google.com/p/maxmod/
MaxMod2.Ogg - Provides decoding for Ogg Vorbis files

This module provides a decent solution to your specific ogg using needs.
Direct Link: http://maxmod.googlecode.com/files/maxmod2_1.07.zip
For Midi: http://brucey.net/programming/blitz/modules/portmidi/portmidi.zip
Does the audio work at all? Are you trying to use only OGG audio files?

Last edited 2012


B(Posted 2012) [#3]
i can convert them to wav or mp3 or whatever, i just want to use them in blitzmax.

how can i do that in vanilla blitz, without having to install any mods.


EDIT:

My code is pretty much exactly the same as the code in the blitz help files.

Global laser:TSound = LoadSound("data/snds/laser.wav") 'Ive also tried laser.ogg here

'then I use

Playsound laser

'farther down in my code, when appropriate.

and i either get nothing/no sound.
or I crash and i get the old attempting to access null file bs thing.

I have the files in the appropriate folders.
I have moved them into the same directory as the .bmx file and taken out the path in the LoadSound("blahblah")
I have made sure to use Import BRL.Audio as I am using Framework as well.

Just cant understand why its not working.

ps- I have used
EnableOpenALAudio()
If SetAudioDriver("openal")

as well as the code in the blitz help files that lists the available audio drivers like DirectSound etc...

All those have not worked.

And lastly I have made sure my volume is not turned down.

Just to let you know what I have tried thus far.

Last edited 2012


Captain Wicker (crazy hillbilly)(Posted 2012) [#4]
without having to install any mods.

I think it to be possible but it would take a lot of work to do it.
Are you having problems building or installing modules on Windows?
To install a module, drag and drop the "whatever.mod" folder onto "C:\BlitzMax\mod\"
To build modules, follow this guide: http://www.blitzmax.com/Community/posts.php?topic=90964

Last edited 2012


B(Posted 2012) [#5]
Im not having trouble installing mods, I just thought it would easy to get it working without them. I thought it was my code.

However if you think it will be more trouble than it is worth, I will take you up on installing that MaxMod2.

And thanks for the link to installing mods, its been a while since I have installed anything.


Captain Wicker (crazy hillbilly)(Posted 2012) [#6]
No problem. :D


GaryV(Posted 2012) [#7]
ps- I have used
EnableOpenALAudio()
If SetAudioDriver("openal")



Have you actually installed OpenAL on the system you are testing on?


skidracer(Posted 2012) [#8]
Have you tested one of the sample games that come with BlitzMax?

If the audio works in say Digesteroids and doesn't in your program it is most likely your use of Framework command minus import of the default DirectSound driver modules.


B(Posted 2012) [#9]
@GaryV

you know i hadn't thought of that, I had just assumed it was.
ill search google and install it.

@skidracer
I had not thought about that either.
I just tried digesteroids and the sound did infact work.
Im going to look through that code and see what i am missing.

Thanks for the help!

Ill let you know if i still cannot get it working.
and Ill provide a link for my game so you guys can check it out.

B

EDIT:
Ok so when i turn my rem out my framework and all my imports the sound works.

But I cant figure out what im not importing.

heres my list:

Framework BRL.GLMax2D
Import BRL.StandardIO
Import BRL.Max2D
Import BRL.Blitz
Import BRL.Random
Import BRL.Pngloader
Import BRL.Oggloader
Import BRL.Audio
Import BRL.Retro

is it my framework?

Last edited 2012


B(Posted 2012) [#10]
Ok, figured it out.

I ended up going into the mod folder and looking at all the modules that have to do with sound.

I needed to import the BRL.DirectSoundAudio mod.

Thanks for the brain boost guys!

and Captain, not sure why you thought it was so hard to use vanilla Blitz with audio.
Just import BRL.DirectSoundAudio and use the loadsound, allocchannel, and playsound commands and your good to go!
Hope that helped someone!

Thanks again guys!

Last edited 2012


GaryV(Posted 2012) [#11]
you know i hadn't thought of that, I had just assumed it was.


It is rarely installed on a system. So keep this in mind if you do use it for a game you expect other people to be able to play.


GfK(Posted 2012) [#12]
and Captain, not sure why you thought it was so hard to use vanilla Blitz with audio.
That's because he doesn't know what he's talking about 90% of the time.

[edit] ...and the other 10% of the time, he doesn't know what YOU'RE talking about.

Last edited 2012


Captain Wicker (crazy hillbilly)(Posted 2012) [#13]
LOL


B(Posted 2012) [#14]
ooh harsh GfK.
:P
But I don't 100% doubt what you've said.

And good to know GaryV, ill keep that in mind.

Also,
ive been having trouble implementing incbin in my programs.
i use:
incbin "laser.png" for example
and then:
Global laser:timage = loadimage("incbin::laser.png")
and it comes up with that accessing null field error again.

Any ideas?


EDIT:
I think I found the problem.
When incbin-ing a file in a folder, ex incbin "data\imgs\laser.png"
you must include the same file path in the loadimage cmd.
ex laser:timage = loadimage("incbin::data\imgs\laser.png")

seems to work for me.

Last edited 2012

Last edited 2012


Raz(Posted 2012) [#15]
It's a bit of a hijack, but I am having problems where certain sound effects are playing, and others are not. Does this sound familiar to anyone?

Two difference samples are both Mono 44,100 32bit float wav files. One plays, the other doesn't. I'm stumped!


B(Posted 2012) [#16]
Do they each have their own TChannel?
Or are you trying to play them at the same time on the same channel?
If that is the case, whichever one is called most recently will be played, interrupting the previous one.

You could also try converting them to .ogg files with Audacity. Its free.

Last edited 2012