Allegro.cc - Online Community

Allegro.cc Forums » Programming Questions » Distortion playing this ogg file

This thread is locked; no one can reply to it. rss feed Print
Distortion playing this ogg file
roger levy
Member #2,513
July 2002

Can anyone confirm crazy distortion playing this ogg file with Allegro? (streaming or play_sample)

https://www.dropbox.com/s/cu9jolhfrr4zojj/asdf.ogg?dl=0

EDIT: Actually I seem to be having this distortion problem with all ogg files. I have already tested WAV, IT, and XM files and those play fine.

Chris Katko
Member #1,881
January 2002
avatar

What operating system? What version of Allegro?

Do the Allegro examples have the same problem?

-----sig:
“Programs should be written for people to read, and only incidentally for machines to execute.” - Structure and Interpretation of Computer Programs
"Political Correctness is fascism disguised as manners" --George Carlin

roger levy
Member #2,513
July 2002

SiegeLord
Member #7,827
October 2006
avatar

Works fine here (Linux, ogg 1.3.2-1, vorbis 1.3.5-3ubuntu0.2). I'd have guessed it was the audio driver, but that doesn't explain wav etc being fine.

"For in much wisdom is much grief: and he that increases knowledge increases sorrow."-Ecclesiastes 1:18
[SiegeLord's Abode][Codes]:[DAllegro5]:[RustAllegro]

roger levy
Member #2,513
July 2002

SiegeLord how do I query the ogg and vorbis versions on my system?

EDIT: I should mention that I'm using the 32-bit Allegro packages available through apt-get

EDIT 2: Confirmed ogg files play fine in the ex_stream_file example.

Chris Katko
Member #1,881
January 2002
avatar

EDIT 2: Confirmed ogg files play fine in the ex_stream_file example.

That's a good clue. Post some code you're using in yours.

-----sig:
“Programs should be written for people to read, and only incidentally for machines to execute.” - Structure and Interpretation of Computer Programs
"Political Correctness is fascism disguised as manners" --George Carlin

roger levy
Member #2,513
July 2002

From what I can tell I am doing exactly the same thing as the example ... at first I was not creating my own mixer, so to try and fix it I added that, but it didn't make a difference.

BTW I just tested on Windows with 5.2.3 (doubt the version matters) and it works fine.


0 value mixer
0 value voice

: -audio
    mixer -exit
    mixer al_destroy_mixer
    voice al_destroy_voice
;

: +audio
    mixer ?exit
    #44100 ALLEGRO_AUDIO_DEPTH_INT16 ALLEGRO_CHANNEL_CONF_2 al_create_voice to voice
    #44100 ALLEGRO_AUDIO_DEPTH_FLOAT32 ALLEGRO_CHANNEL_CONF_2 al_create_mixer to mixer
    mixer voice al_attach_mixer_to_voice 0= abort" Couldn't initialize audio"
    mixer al_set_default_mixer
    mixer #1 al_set_mixer_playing drop
;

: initaudio
    0 to mixer  0 to voice
    al_init_acodec_addon not if  " Allegro: Couldn't initialize audio codec addon." alert -1 abort  then
    al_install_audio not if  " Allegro: Couldn't initialize audio." alert -1 abort  then
    #32 al_reserve_samples not if  " Allegro: Error reserving samples." alert -1 abort  then
    +audio
;

assetdef sample
    sample int svar sample.smp
    sample int svar sample.loop

: reload-sample  ( sample -- )
    >r  r@ srcfile count  zstring al_load_sample  r> sample.smp ! ;

: init-sample  ( looping adr c sample -- )
    >r  ['] reload-sample r@ !  findfile r@ srcfile place
    r@ reload  r@ sample.loop !  r> register ;

: sample:  ( loopmode adr c -- <name> )
    create sample sizeof buffer init-sample ;

: >smp  sample.smp @ ;

variable sid
: play  ( sample -- ) dup >r  >smp 1e 0e 1e  r>  sid  al_play_sample ;

ALLEGRO_PLAYMODE_ONCE  constant once
ALLEGRO_PLAYMODE_BIDIR constant bidir
ALLEGRO_PLAYMODE_LOOP  constant looping

variable strm
: stream ( adr c loopmode -- )
    >r
    zstring   #3 #2048  al_load_audio_stream strm !
    strm @ r> al_set_audio_stream_playmode drop
    strm @ mixer al_attach_audio_stream_to_mixer drop ;

...

\ test code follows

include ramen/dev
$10000 include ramen/lib/audio1
s" ramen/test/data/asdf.ogg" looping stream

Here are the commands I use to install the 32-bit binaries.

sudo apt-get install liballegro5.2:i386 \
liballegro-acodec5.2:i386 \
liballegro-audio5.2:i386 \
liballegro-dialog5.2:i386 \
liballegro-image5.2:i386 \
liballegro-physfs5.2:i386 \
liballegro-ttf5.2:i386 \
liballegro-video5.2:i386 

Chris Katko
Member #1,881
January 2002
avatar

Syntax highlighting!

{"name":"khNFFr4.png","src":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/f\/3\/f35e0db3bab1f0c840a365d86d858f8e.png","w":768,"h":1161,"tn":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/f\/3\/f35e0db3bab1f0c840a365d86d858f8e"}khNFFr4.png

-----sig:
“Programs should be written for people to read, and only incidentally for machines to execute.” - Structure and Interpretation of Computer Programs
"Political Correctness is fascism disguised as manners" --George Carlin

roger levy
Member #2,513
July 2002

Chris Katko
Member #1,881
January 2002
avatar

Oh, I just dumped it here:

https://tohtml.com/

-----sig:
“Programs should be written for people to read, and only incidentally for machines to execute.” - Structure and Interpretation of Computer Programs
"Political Correctness is fascism disguised as manners" --George Carlin

roger levy
Member #2,513
July 2002

Heh. It's listed under "Rare". I'm just like rub it in why don't you! XD

No ideas on this?

bamccaig
Member #7,536
July 2006
avatar

As an aside, this language is very foreign to me. I have no idea what it is even is. Memory says maybe Forth, but I have no idea if that's even correct because I know next to nothing about Forth. When you post code, you can give a filename by using <code name="foo.fs">teh codes</code>. That will at least give us a hint about what you're posting so that we can attempt to interpret it. I imagine the "unique" language choice interferes with people's ability to help you, particular if it is in fact a stack-based language as I believe Forth is since that requires some thought processes normally not required in other languages. In that case, you may wish to do a Forth <-> C conversion before posting code, albeit, you could introduce errors that way so it's a gamble either way... May depend on how severe the issue is for you.

roger levy
Member #2,513
July 2002

It is indeed Forth! Read it from left to right. Calls go AFTER the parameters, which are pushed onto an implicit stack. >R R@ and R> are commands for using another stack for quick stashing. Code can be compiled or immediately interpreted. I use Forth because I hate variables and types! ;) (Not really)

I used to go through the trouble to convert to psuedocode but you are right it introduces another variable and Forth has gotten a bit of a boost in visibility lately, so I figured most people at least recognize it. ForthStar on Github stars like 20 new projects a day!

Go to: