2021-03-20 12:13:58

Alright, so, here's the deal.
For months, and months and hell, years, I have been trying to work on a soundpool for pure basic. But I didn't get anything. I tried different libraries, I tried different methods, but there was always a problem, it always had memory issues, it always froze, crashed, didn't move properly, I got sick of it. I had an alright sound thing going with the old version of lasertag and now that old version is gone. Alright. It wasn't good.
If someone could help me getting a stable, working soundpool with 1d and 2d positioning in pure basic, I would be eternally grateful. I want to release laser tag like I promised but I just can't face this sound problem myself, and it making me really angry and worried I can't get it out there because it was a game that I enjoyed and I think other people would enjoy it too

2021-03-20 12:31:17 (edited by mohamed 2021-03-20 12:40:17)

yeah, That’s one reason i leaved pb after a bit of time when bot it, The community of it are seriously dead, And the language is broken anyway, I can’t list reasons now because I’m typing from the phone, When i return to the computer i’ll list reasons why to not bump your head with pb.
regardless though you’re unlucky, because all people that i know of and has a sound pool, They won’t give it no matter what, And who uses pb here are like 2 or 3 people, So i think you know who i mean now.

2021-03-20 15:47:54

Why won't you look at the way BGT does it? It will at least give you an idea of how it is done. Regarding memory leaks, I have no sympathy for you, it is your choice to continue working in this language after all. All I can say is welcome to the joys of lower-level stuff.

2021-03-20 16:51:39

3 is right. I enjoy low level programming personally, so I don't mind things like Rust or C, but not PB. It's just basically C, with a way over bloated standard library and a weird syntax that you can't get hired to write anywhere. This has gone slightly off topic though, so allow me to actually answer your question.

Look at how BGT does it. It comes with all kinds of weirdness, the ability to have multiple listeners because... Useful? And uses classes, a feature PB lacks, but it'll give you the basic idea. Wrap the basic namespace in a module, maybe.

Also, here's how to help with things. With sounds, memory managing is easy. When a sound is loaded, the memory is allocated, when you call LoadSound. When you don't need the sound, FreeSound is called. You don't have to use raw AllocateMemory, which you should thank  the gods for.

2021-03-20 16:54:52

yeah, there is a reason I go out of my way to warn people off this.  It's C with a weird syntax, but you don't have (say) address sanitizer to help you along with your manual memory management woes.  To do it right you need to manually implement and properly call destructors, that is (in C):

void foo_destroy(struct foo *what) {
    if (foo == NULL) return;
    /// freeing logic here, call whatever you have to for all the fields, then:
    free(what);
}

Then you have to make sure that these get called in all the right places.  It checks to see if the input object is NULL so that you can unconditionally call it.  You set all the variables that might be pointers to NULL, then modify all your functions to only return in one place wherever possible (C does this with goto, which is one of the only good uses), then whether or not the variable is null determines whether or not the destroy function does anything.  This requires a large amount of discipline.  In C you can check your work with address sanitizer and things like clang-analyzer; in Purebasic you have nothing to help you.  I know people who make me look like a junior whose entire career has been C and they still get this wrong, which isn't a huge deal because the aforementioned tools will catch it--but you don't have the aforementioned tools.  So good luck, and welcome to the world in which you understand that Purebasic manages to even be worse than C/C++.

But seriously, if you have been trying to get a sound pool working for years it probably would have taken you less time to just go rewrite the project.  Learn to give up and start over.

My Blog
Twitter: @ajhicks1992

2021-03-21 11:29:19

Couldn't I parcially implement synthizer or something like that? I just need play sound with XYZ, move sound with XYZ, volume step, and I guess pan step but probably not.

2021-03-21 14:12:36

@6, PB already provides that in its bloated stdlib

"On two occasions I have been asked [by members of Parliament!]: 'Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out ?' I am not able rightly to apprehend the kind of confusion of ideas that could provoke such a question."    — Charles Babbage.
My Github

2021-03-21 17:12:13

@7, to be fair, PB's 3D sound library is absolute crap.

2021-03-21 19:07:51

If you want to "implement" Synthizer as in use another sound library and put a convenient API on top of it, in theory, but you've already tried and failed, so the answer for you is no.  Whether it's possible doesn't matter; whether it's possible for you does.  You could keep banging your head against Purebasic's inadequacies for a long time hoping you eventually get it, but Purebasic is a C variant and that's not how learning C variants work.  It's not worth the effort for you to step back and go learn programming in a disciplined manner, probably by finding books on C/C++, so that you can use Purebasicn effectively enough to finish this project.

At the end of the day C-like languages with manual memory management aren't compatible with the way that you and the rest of this community code where you start programming and immediately try for a project.  To use them, you have to spend at least 6 months more time than you'd have to spend on (say) Python, and if those 6 months aren't spent seriously studying resources on how to make reliable software or coding every single day, you won't manage it.  It took 2 or 3 years for me to achieve competency in C/C++, and I still make mistakes that things like address sanitizer and proper debuggers have to help me catch--and Purebasic doesn't have those tools, so when you fail, and you will, nothing can help you find out how.

Everyone looks back on PB fondly, but I remember 5 years ago or so when basically every game anyone put out was either that or BGT and you'd have huge threads on the PB one where the author was just continuously fixing bugs like these.

My Blog
Twitter: @ajhicks1992

2021-03-21 19:37:41

yeah, People who like pure basic like it for 1 reason, Like bgt, It's easier because setting up a window is super, super, Super, Super easy like it's only 3  lines, And checking for events on the window is easier, That's how pb folish people, However after that you'll get stuck because of the language weirdness and it being paid and that like 0.00000000001% of programmers on the world use them, It's a vary small amount, And tools for it are a, Outdated, B, Not completed do to the owner leaving it behind and moving to a much better language, I know you'll probably ignore those posts because you think that pb is legendary pb is the best, But from what i tried and saw from pb learning cpp is better and much even understandable, Maybe harder yes, But worth it more in the end, I didn't learn cpp, But i know it as a fact because there's no way you'll compare those 2 languages, Oh and also, Pb gets a update once a year or sometimes once in 2 years, So if you found a serious bugg in the language, Have fun using it with the bugg for 1/2 years or maybe more, And the forum is pretty much dead, Are forum, Audiogames.net is more active in users than it, And most of tools you'll find in the internet about pretty much anything in it is again as i said before broken or outdated
oh also, Sound3d? That thing crashes as soon as you try loading a sound using it, It'll say program quitted unexpectedly, So that's 1 bugg in the language.

2021-03-22 01:53:13

You guys think PureBasic is weird... Have you looked at BBC BASIC source code? I'm sorry, but that derivative should've died in the 80's, and trying to add modern features to it just makes the language even weirder.

#FreeTheCheese
"The most deadly poison of our times is indifference. And this happens, although the praise of God should know no limits. Let us strive, therefore, to praise Him to the greatest extent of our powers." - St. Maximilian Kolbe

2021-03-22 02:33:05

@11, most BASIC variants don't need to exist in 2021 IMO. At least not to the level PB is at. BASIC was created in the 70s to make programming look easy, and that's where it should stay.

2021-03-22 03:02:52 (edited by Ethin 2021-03-22 03:03:51)

BASIC was created to help programmers who weren't math majors to use computers. It was never designed to be a language that one could use for pretty much everything. If you want that, go for Rust, C, C++, Go, Python, and so on.

"On two occasions I have been asked [by members of Parliament!]: 'Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out ?' I am not able rightly to apprehend the kind of confusion of ideas that could provoke such a question."    — Charles Babbage.
My Github