QB64 Community

Development => Development => Topic started by: Johny B. on August 11, 2017, 05:17:36 am

Title: Changes to sound output
Post by: Johny B. on August 11, 2017, 05:17:36 am
This will be in revision 60, available on qb64.net sometime in the next few hours or right now on qb64.org

_SNDBAL now looks like this:
Code: [Select]
_SNDBAL handle&, x!, y!, z!, channel&If any of the x/y/z values are not passed they are unchanged. If channel& is omitted it defaults to 1 (the left channel for stereo sound, or the only channel for mono sound). To adjust the right channel of stereo sound use channel 2. All other values are invalid - but adjusting channel 2 for a mono sound will simply do nothing.

The default positions for sound sources are now as follows:
 - mono sound: (0, 0, 0)
 - stereo sound: left channel at (-1, 0, 0), right channel at (1, 0, 0)
This gives the results you would expect, with mono sound playing equally from both sides and stereo properly split.

_SNDVOL adjusts the volume of both channels. To make one channel quieter, just position it further away (I can't really imagine why you'd want to do that, though).

The second parameter to _SNDOPEN and concept of "sound capabilities" is gone. You no longer need to pass a string like "SYNC,PAUSE,VOL", as all sound formats support all abilities all the time. To avoid breaking existing code _SNDOPEN and _SNDPLAYFILE will still accept the capabilities string as an optional argument, but its contents will be ignored. This also means the concept of non-SYNC sounds and restrictions on playing simultaneous sounds is gone.

Please test, test, test. Wiki will be updated in the coming days to reflect changes. Finally, for your gratification, I've attached the program I was using to test things:
Code: [Select]
s& = _SNDOPEN("song.ogg")
PRINT "READY"; s&
_SNDPLAY s&
_SNDLOOP s&


xleft = -1
xright = 1
DO
    k$ = INKEY$
    SELECT CASE k$
        CASE "f"
            xleft = xleft - 0.1
            _SNDBAL s&, xleft, , , 1
        CASE "g"
            xleft = xleft + 0.1
            _SNDBAL s&, xleft, , , 1
        CASE "h"
            xright = xright - 0.1
            _SNDBAL s&, xright, , , 2
        CASE "j"
            xright = xright + 0.1
            _SNDBAL s&, xright, , , 2
        CASE "n"
            volume = volume - 0.1
            _SNDVOL s&, volume
        CASE "m"
            volume = volume + 0.1
            _SNDVOL s&, volume
        CASE "p"
            _SNDPAUSE s&
        CASE " "
            _SNDPLAY s&
        CASE "i"
            PRINT _SNDPLAYING(s&)
            PRINT _SNDPAUSED(s&)
            SLEEP
        CASE "b"
            _SNDSETPOS s&, 110
        CASE "l"
            _SNDLIMIT s&, 10
            PRINT "LIM"
            SLEEP
        CASE "k"
            _SNDSTOP s&
        CASE "c"
            _SNDCLOSE s&
            SLEEP
            s2& = _SNDOPEN("song.ogg")
        CASE "d"
            s2& = _SNDCOPY(s&)
            _SNDPLAY s2&
    END SELECT
    LOCATE 1, 1
    PRINT xleft, xright, volume, _SNDGETPOS(s&); "   "
LOOP
Title: Re: Changes to sound output
Post by: Clippy on August 14, 2017, 03:58:26 am
Opened sound files must have the "VOL" capability to use _SNDBAL so now what happens to files without that capability?

Why couldn't the channel parameter be used as 1 or 2 to designate the number of channels instead of having to use _SNDBAL twice?

Who is going to edit the WIKI as the old capabilities will still need to be documented for older versions?

 
Title: Re: Changes to sound output
Post by: Johny B. on August 14, 2017, 05:23:13 am
Opened sound files must have the "VOL" capability to use _SNDBAL so now what happens to files without that capability?
There are no capabilities. All sound files can do everything. Just open the file and use it.

Why couldn't the channel parameter be used as 1 or 2 to designate the number of channels instead of having to use _SNDBAL twice?
Your exact question as it stands makes no sense, so instead I'll answer "why require using _SNDBAL twice instead of setting both channels with one call?": This was initially considered (_SNDBAL handle&, xleft, yleft, zleft, xright, yright, zright) but it was pointed out that this was kind of bulky. The settled-upon syntax is much more concise and allows for future expansion to more than 2 channels (5 channel surround sound etc.)

Who is going to edit the WIKI as the old capabilities will still need to be documented for older versions?
I've prepared a list of changes for Steve, because frankly I don't have the mental strength to deal with you.
Title: Re: Changes to sound output
Post by: Clippy on August 14, 2017, 06:59:15 am
Well, poor mental strength or not, a  lot more sound files will need to be tested before anything is changed permanently. Like it or lump it...
Title: Re: Changes to sound output
Post by: SMcNeill on August 14, 2017, 07:38:09 am
Well, poor mental strength or not, a  lot more sound files will need to be tested before anything is changed permanently. Like it or lump it...

It's already been changed permanently.  The changes were pushed into the repo on 8/11.  All builds from that date forward come with the new capabilities for sound files and multiple channel support.

Quote
Why couldn't the channel parameter be used as 1 or 2 to designate the number of channels instead of having to use _SNDBAL twice?

By sound channel, Luke is referring to a sound file which has multiple channels inside it.  For surround sound, a file may have 7+ channels stored inside it for LEFT FRONT, CENTER, RIGHT FRONT, MID-RANGE LEFT, MID-RANGE RIGHT, RIGHT REAR, LEFT REAR...

A user might have a program where they want all the sounds to come out equally from ALL the channels (my mother does this with her surround  sound as she's 80 years old and hard of hearing).  They may only have 2 speakers and want to move the rear channels to play in the front left and right speakers.  Various solutions for various people...

So the following was agreed upon:

_SNDBAL handle, x, y, z, channel   -- everything is the EXACT same as before, except now you can specify where you want a second channel to play from with your sound file.  (Think of a game where the footsteps echo from behind you.. Channel 1 is the main sound, channel 2 is the echo footfall..)

So if we have 2 speakers and a 5 sound channel file, we could do something like:

_SNDBAL handle, -1, , , 1 -- This puts the first channel to the left speaker
_SNDBAL handle, 1, , , 1 -- This puts the second channel to the right speaker
_SNDBAL handle, 0, , , 1 -- This splits the third channel between both left and right speaker
_SNDBAL handle, -1, , , 1 -- This puts the fourth channel to the left speaker
_SNDBAL handle, 1, , , 1 -- This puts the fifth channel to the right speaker
Title: Re: Changes to sound output
Post by: Mal-2 on August 14, 2017, 11:45:33 pm
_SNDBAL handle, -1, , , 1 -- This puts the first channel to the left speaker
_SNDBAL handle, 1, , , 1 -- This puts the second channel to the right speaker
_SNDBAL handle, 0, , , 1 -- This splits the third channel between both left and right speaker
_SNDBAL handle, -1, , , 1 -- This puts the fourth channel to the left speaker
_SNDBAL handle, 1, , , 1 -- This puts the fifth channel to the right speaker

I think you meant:
_SNDBAL handle, -1, , , 1
_SNDBAL handle, 1, , , 2
_SNDBAL handle, 0, , , 3
_SNDBAL handle, -1, , , 4
_SNDBAL handle, 1, , , 5

But the point still stands.
Title: Re: Changes to sound output
Post by: SMcNeill on August 15, 2017, 02:38:09 am
_SNDBAL handle, -1, , , 1 -- This puts the first channel to the left speaker
_SNDBAL handle, 1, , , 1 -- This puts the second channel to the right speaker
_SNDBAL handle, 0, , , 1 -- This splits the third channel between both left and right speaker
_SNDBAL handle, -1, , , 1 -- This puts the fourth channel to the left speaker
_SNDBAL handle, 1, , , 1 -- This puts the fifth channel to the right speaker

I think you meant:
_SNDBAL handle, -1, , , 1
_SNDBAL handle, 1, , , 2
_SNDBAL handle, 0, , , 3
_SNDBAL handle, -1, , , 4
_SNDBAL handle, 1, , , 5

But the point still stands.

Aye.  Sorry; I was lazy and did a copy/paste and didn't change the channel parameter.  Good catch.  :D
Title: Re: Changes to sound output
Post by: Clippy on August 15, 2017, 06:45:44 am
Steve WTF do you think you are doing? You cannot just remove old descriptions from the WIKI! They are needed for SDL and older versions!

Also you changed _SNDBAL and never mentioned the new channel parameter values such as 3,4, or 5
Title: Re: Changes to sound output
Post by: Johny B. on August 15, 2017, 06:54:25 am
To quote myself:
Quote
To adjust the right channel of stereo sound use channel 2. All other values are invalid
Higher channel numbers may become available in a future version of QB64.

Quote
You cannot just remove old descriptions from the WIKI! They are needed for SDL and older versions!
This bullshit is precisely the reason I didn't want to have to deal with you. The wiki documents QB64 as it is, not how it was 5 years ago. Keep your fingers off of my documentation, Ted.
Title: Re: Changes to sound output
Post by: Clippy on August 15, 2017, 07:13:01 am
The WIKI must document all versions, not just the latest version.

ANY ADDITIONS must also specify the new version info with the date they became effective.

REMOVING PREVIOUS INFO IS GROUNDS TO LOSE EDITING PRIVILEGES
Title: Re: Changes to sound output
Post by: SMcNeill on August 15, 2017, 07:36:35 am
The WIKI must document all versions, not just the latest version.

ANY ADDITIONS must also specify the new version info with the date they became effective.

REMOVING PREVIOUS INFO IS GROUNDS TO LOSE EDITING PRIVILEGES

There's no need for the wiki to continue to be full of useless crap which dates back to the SDL days.   Galleon has dropped ALL support for the SDL version, or did you forget?  http://www.qb64.net/forum/index.php?topic=12479.msg107737#msg107737

Quote
I will be discontinuing all support for the SDL version of QB64 at qb64.net on Feb 1st 2015. All downloads (official and unofficial) for QB64-SDL will be removed. The reason is simple. QB64 cannot afford to have its development/support efforts split across multiple versions.

If you feel passionately about this, let me remind you that QB64-SDL (like QB64-GL) is open source and you are entitled to host and/or continue its development off-site if you so wish.

The changes removed applied to SDL versions of QB64.  "VOL,SYNC,LEN,PAUSE" requirements have been obsolete ever since the switch over to the GL version -- just nobody noticed before now!!   

The following is COMPLETELY wrong:
Quote
             WAV = "VOL,SYNC,LEN,PAUSE"      Free WAV to OGG GUI converter
             OGG = "VOL,SYNC,LEN,PAUSE"      Free WAV to OGG converter
             AIF = "VOL,SYNC,LEN,PAUSE"
             RIF = "VOL,SYNC,LEN,PAUSE"
             VOC = "VOL,SYNC,LEN,PAUSE"
             MID = "VOL"
             MOD = "VOL,PAUSE"
             MP3 = "VOL,PAUSE,SETPOS" 

GL only supports three sound types:  WAV, OGG, MP3 -- and it supports ALL the options for ALL those formats.

Confusing people with SDL requirements, and claiming that we offer support for formats -- when we plainly do NOT -- is NOT a good means of documenting the wiki.

SDL crap has to go!!  Support for SDL has been OFFICIALLY dropped, and the junk you're leaving in the wiki is nothing more than that -- JUNK to confuse people about what the behavior of the commands in GL really is.


QB64 cannot afford to have its development/support efforts split across multiple versions.

The wiki *is* the official support effort, and it doesn't need to be split across multiple versions.
Title: Re: Changes to sound output
Post by: Clippy on August 15, 2017, 08:56:49 am
http://www.qb64.net/wiki/index.php/SNDBAL (http://www.qb64.net/wiki/index.php/SNDBAL)

SDL is not the only version affected! There are thousands of older GL versions IN USE!

3 sound file versions is more of a limitation than an improvement...

Let me know what else needs to be documented.

You can document on your own sites as well...
Title: Re: Changes to sound output
Post by: SMcNeill on August 15, 2017, 12:36:08 pm
http://www.qb64.net/wiki/index.php/SNDBAL (http://www.qb64.net/wiki/index.php/SNDBAL)

SDL is not the only version affected! There are thousands of older GL versions IN USE!

3 sound file versions is more of a limitation than an improvement...

Umm....   Have you tried to use any sound format other than WAV, OGG, MP3 in the last few years??  The recent changes hasn't caused any of the others to stop functioning; support for them was never implemented (just like how _LOADIMAGE no longer loads 256 color images).

Sound capabilities such as "VOL, LEN, and all" have had ZERO affect since the first GL version was introduced.  They do literally NOTHING. 

(Well, there was a BUG which basically made VOL not work unless the flag was set, but that's been corrected.  If folks encounter VOL issues, then they just need to upgrade to the newer builds where the problem was corrected.)
Title: Re: Changes to sound output
Post by: SkyCharger001 on August 15, 2017, 04:28:50 pm
Mayor problem: the GL versions suffer from a (for many) crippling bug in how keyboard input is handled that doesn't exist in the SDL versions, with the only 'fix' being offered is the productivity-destroying abandon US-international.
Title: Re: Changes to sound output
Post by: SMcNeill on August 15, 2017, 07:46:51 pm
Mayor problem: the GL versions suffer from a (for many) crippling bug in how keyboard input is handled that doesn't exist in the SDL versions, with the only 'fix' being offered is the productivity-destroying abandon US-international.

Post a bug report on it and include a bit of code to highlight what the issue is.  Be certain to explain how the changes to sound output affected keyboard input.  First I've heard of any keyboard issues from this change.

Title: Re: Changes to sound output
Post by: SkyCharger001 on August 15, 2017, 11:05:37 pm
you misunderstand, this was in response to your statement that there was no need to maintain the SDL references of the WIKI. (and that is one of the oldest GL-bugs, and it still hasn't been fixed)

to put it simple: There are many who simply can't use GL for one reason or another.
Title: Re: Changes to sound output
Post by: SMcNeill on August 16, 2017, 02:10:06 am
you misunderstand, this was in response to your statement that there was no need to maintain the SDL references of the WIKI. (and that is one of the oldest GL-bugs, and it still hasn't been fixed)

to put it simple: There are many who simply can't use GL for one reason or another.


SDL support ended two and a half years ago.  Versions of it haven't been offered on the forums here, in all that time.

If folks have somehow managed to get or maintain a version of QB64-SDL, then they should've prepared by getting a copy of the wiki from 2015 to go with it.  There's no need for us to keep stuff up which is no longer relevant to the language, hasn't been relevant to the language for many years, and which will not be relevant in the future.

It's fine if folks want to remain stuck in time, but if they're going to make that choice, they should do so FULLY.  When HappyChickenProgram v12 comes out, do they document HappyChickenProgram v1.1296??  If you want a copy of HCP v1.2396 documentation, you look for a v1.2396 manual.  You don't expect v12's manual to be your "goto source" for all quirks of the syntax of the software.
Title: Re: Changes to sound output
Post by: Clippy on August 16, 2017, 03:58:37 am
Yes they do! They usually document all changes in each new version.

What we have now is little or no documentation of  ANY changes, just blind revisions!

I used to document changes until Galleon stopped documenting the GL revisions.

Now we have 4 or 5 people adding anything they want...
Title: Re: Changes to sound output
Post by: SMcNeill on August 16, 2017, 04:39:01 am
What we have now is little or no documentation of  ANY changes, just blind revisions!

I used to document changes until Galleon stopped documenting the GL revisions.


Doing a really bang up job on it then....

Sound pages claim half a dozen formats are supported, when we support THREE....
Image pages claim you can use about a dozen image formats.  You can actually only use FOUR -- and only then as 32-bit color images.  256 color images auto-convert up to 32-bit automatically...
Fonts don't use "bold, italic, underline" for anything...

We've swapped over to GL "officially", two and a half years ago, and YOU still haven't documented these alterations, even though they've been pointed out over and over and over by various users...

Do you know WHY there's little to no documentation??

YOU.

If someone other than you makes a change to the wiki, you revert it or alter it into oblivion.  You're an ass and your toxic personality drives people to just say, "SCREW IT."  YOU don't care a whit about whether something is documented properly or not.  You just like to pretend to have a position of authority, when you actually are completely clueless about what the language supports, no longer supports, or what it may support in the future.

Galleon needs to kick you to the curb ASAP and let others take over the wiki who are willing to get our documentation up to date and relevant for the current user base. 

We don't need to document GW-BASIC junk.  We don't need to document QB45 junk.  We don't need to document QB64-Obsolete-SDL junk.


If we don't even have proper documentation for sound, images, or fonts -- because everything is stuck teaching folks about what worked in the no longer available SDL version -- exactly what use is there in even bothering to have a wiki anymore??  It's worthless.


What we need is a set of documentation which reflects what we DO support, and as of 2015, that's ONLY been the QB64-GL version.

Everything else is just junk that makes it more difficult for the end users to be able to sort out what is actually relevant to them.
Title: Re: Changes to sound output
Post by: SMcNeill on August 16, 2017, 06:08:32 am
To give an example of how screwed up the current documentation is look at http://www.qb64.net/wiki/index.php?title=LOADIMAGE

Quote
Optional mode INTEGER values can be any valid screen mode except zero, 256 color, 32 bit or 33 hardware image.

So _LOADIMAGE doesn't work for SCREEN 0, 256-color, or 32-bit images??

...

And yet example 2 shows mode being 256 and example 3 shows it being 32-bit...   Documentation says explicitly that 256 and 32 doesn't work -- and then a demo claims that it will -- which it WON'T for the 256 color image, but WILL for 32-bit....

Example 1 won't compile or run.  Neither will example 2.  Half the demos are invalid...

QB64-GL will NOT work with: PNM, XPM, XCF, PCX, TIF, LBM, and TGA...



There's more junk wrong on the page than there is right.






Title: Re: Changes to sound output
Post by: Clippy on August 16, 2017, 06:52:08 am
YOU took months to never document YOUR OWN functions!

You have editing so why did you not fix the page info? No you just WANT THE LATEST INFO and the hell with ALL of the older versions...

BTW many of those GL limitations were projected to be fixed eventually. Where is your crack team of developers?
Title: Re: Changes to sound output
Post by: SMcNeill on August 16, 2017, 08:09:13 am
YOU took months to never document YOUR OWN functions!

You have editing so why did you not fix the page info? No you just WANT THE LATEST INFO and the hell with ALL of the older versions...

BTW many of those GL limitations were projected to be fixed eventually. Where is your crack team of developers?

I never documented anything because YOU were ass enough to go in, alter it, and screw it up.  Why even bother with the effort when you go out of your way to undo things faster than someone else can do them???

Fixed EVENTUALLY??   So you feel there's no need to document what folks use NOW, because of what MIGHT be added later??

I'm all for documenting older versions OF QB64-GL, but keeping reams of SDL-specific stuff in the wiki has got to go the way of the dodo! A person can't even get an "official" version of QB64-SDL any more; they have to get a copy from some stranger from the Internet, who could be passing them all sorts of virus, spyware, Trojan-filled crap!!

We dropped support for SDL two and a half years ago.  Keeping SDL specific info in the wiki at this point is just obfuscating the site.  QB64-SDL is dead and gone.  Remove it from the wiki.

If it means that much to you, as you say:

Quote
You can document on your own sites as well...



Personally, I think Galleon said it best though:
Quote

I will be discontinuing all support for the SDL version of QB64 at qb64.net on Feb 1st 2015. All downloads (official and unofficial) for QB64-SDL will be removed. The reason is simple. QB64 cannot afford to have its development/support efforts split across multiple versions.

If you feel passionately about this, let me remind you that QB64-SDL (like QB64-GL) is open source and you are entitled to host and/or continue its development off-site if you so wish.

Feel free to host and continue to document SDL stuff off-site.
Title: Re: Changes to sound output
Post by: Clippy on August 19, 2017, 03:29:26 am
_HYPOT still needs documented... GL Version numbers and dates too please.

SDL is available in my signature. Why? Because GL has to include open sound code.

Add all the documentation necessary, just don't remove old info.

Plenty of people still need and use it! I get notified of all edits. No problems with your recent edits. Hope you developers keep the new keywords to a minimum...