Announcement

Collapse
No announcement yet.

Crackly sound

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • #16
    Originally posted by Baker View Post
    Me thinks you are chasing ghosts.

    I could easily add -sndspeed parameter to ProQuake in any given 3 minutes of spare time.

    But at this time, if I were to do an update to ProQuake Windows there would probably be 50 things I wanted to do it at the same time.

    The code goes like this ... it is simple ...

    Code:
    	do
    	{
    		int sound_hz = 11025;  // Default
    		
    		do
    		{
    			int argnum = COM_CheckParm("-sndspeed");
    			int sound_requested_hz;
    
    			if (!argnum)
    				break; // Command line param not found
    
    			if (argnum + 1 >= com_argc)
    				break; // Isn't a next argument
    
    			sound_requested_hz = Q_atoi (com_argv[ argnum + 1]);
    	
    			if (sound_requested_hz != 44100 && sound_requested_hz != 22050 && sound_requested_hz != 11025)
    				break; // Isn't one of the three accepted values		
    	
    			sound_hz = sound_requested_hz;
    	
    		} while (0);
    
    		shm->speed = sound_hz;
    
    	} while (0);
    my brain exploded on line 1
    Want to get into playing Quake again? Click here for the Multiplayer-Startup kit! laissez bon temps rouler!

    Comment


    • #17
      Well I fixed the problem. I feel stupid now, I had the AC'97 driver installed along with the HD Driver for some reason. I uninstalled both, reinstalled the HD Driver, restarted, and it was fine. Sorry for your trouble, I probably should have noticed this earlier.

      Comment


      • #18
        Originally posted by F. B. I. Guy View Post
        Well I fixed the problem. I feel stupid now, I had the AC'97 driver installed along with the HD Driver for some reason. I uninstalled both, reinstalled the HD Driver, restarted, and it was fine. Sorry for your trouble, I probably should have noticed this earlier.
        Hey, your goal is our end-game. Basically, whatever it takes brah.
        Want to get into playing Quake again? Click here for the Multiplayer-Startup kit! laissez bon temps rouler!

        Comment


        • #19
          Baker, the pedantic side of me urges you to drop the do while(0);
          While I realise you have breaks in there, they're basically no different from gotos, and not really any less 'harmful'.
          Also, you should support 48000 too, as that's the native rate of most cards nowadays (dvd standard sample rate). The mixer doesn't really care what rate is used, so long as its above 1...
          Some Game Thing

          Comment


          • #20
            Originally posted by Spike View Post
            Baker, the pedantic side of me urges you to drop the do while(0);
            Hehe, I've been trying. Hey, I got that from MH in an old DirectQ where he killed a goto. What really needs to happen is C99 in Visual Studio so I can do declares any place, yet I understand Microsoft will never do this ... and ... since I write stuff multiplatform as possible I still need it to compile on Visual Studio, meaing I can't use C99 enhancements at all.

            My new little project has 0.0 "do ... whiles". And only a single "while" in the entire code base .
            Quakeone.com - Being exactly one-half good and one-half evil has advantages. When a portal opens to the antimatter universe, my opposite is just me with a goatee.

            So while you guys all have to fight your anti-matter counterparts, me and my evil twin will be drinking a beer laughing at you guys ...

            Comment


            • #21
              {
              int argnum = COM_CheckParm("-sndspeed");
              shm->speed = 11025; // Default
              if (argnum && argnum+1 < com_argc)
              {
              int sound_requested_hz = Q_atoi (com_argv[ argnum + 1]);
              if (sound_requested_hz >= 8000 && sound_requested_hz <= 512000)
              shm->speed = sound_requested_hz;
              else
              Con_Printf("-sndspeed value failed sanity check\n");
              }
              }

              is fine for c89, and closer to how I'd personally write that chunk.

              c89 scopes definitions to the block that contains them, which means just {} rather than requiring a loop or other keyword, so no need for the do while(0) - you only need the braces/curly brackets.

              With the whole 'goto considered harmful' thing, the harm comes from random jumps rather than gotos themselves, as you cannot just look and see the flow from purely the indentation. a break instead of a goto is no different from a goto, other than to please people who take 'goto considered harmful' literally, and universally.

              I hope that clarified something... if it didn't then I'm sorry for being an annoying arse/coding nazi, but meh.
              Some Game Thing

              Comment


              • #22
                You can just brace it separately like Spike said. My old "do...while (0)" was most likely a case of me just arsing around that ended up being released. In terms of the assembly generated by your compiler they should be identical, but goto is definitely much clearer about what the programmers intentions are (especially if you use a nice descriptive label name). Splitting it out into it's own function would be better again.

                OpenGL is not open source, by the way.
                IT LIVES! http://directq.blogspot.com/

                Comment


                • #23
                  Originally posted by MH View Post
                  OpenGL is not open source, by the way.
                  Wow, why's it called "Open"GL then? Thanks for informing me about this.

                  Comment


                  • #24
                    Originally posted by F. B. I. Guy View Post
                    Wow, why's it called "Open"GL then? Thanks for informing me about this.
                    I've just been taught a valuable lesson I keep forgetting but try to remember.

                    I think "Open" meant open like as in "open standards" in an implementation that anyone can use. Not "open" how most people think of it today.

                    Whenever OpenGL was conceived (1994 ish? 1993?) I don't think the idea of "open source" was even on the radar too far outside Stallman's and his friend's brains.
                    Quakeone.com - Being exactly one-half good and one-half evil has advantages. When a portal opens to the antimatter universe, my opposite is just me with a goatee.

                    So while you guys all have to fight your anti-matter counterparts, me and my evil twin will be drinking a beer laughing at you guys ...

                    Comment


                    • #25
                      OpenGL 1.0 was released in 1992: History of OpenGL - OpenGL.org

                      The term "open source" as we know it today was first used in 1998: History of the OSI | Open Source Initiative

                      It doesn't even make sense to talk of source code when referring to OpenGL. The first sentence of any OpenGL spec goes: "OpenGL is a software interface (changed to 'API' in recent versions) to graphics hardware", meaning two main things: it's the graphics hardware that does all the work with OpenGL just telling it what work to do, and any given implementation of OpenGL is going to be dependent on the graphics hardware used.

                      The workflow goes like this. A program makes OpenGL calls, your driver understands these and translates them into some hardware-specific format, passing them onto the hardware, then the hardware actually does stuff. So all that OpenGL is is a thin layer between a program and your hardware (that's how you know that when someone talks about something like "an image looks better with OpenGL or D3D" they're either talking nonsense or getting a placebo - on the same hardware they will look identical).

                      Because an implementation of OpenGL is hardware specific, it is tied to how that hardware works, and because of that it is normally provided by the hardware vendor, and as such is just as proprietary and closed as D3D.

                      There are pure software implementations - such as the original SGI sample implementation, Microsoft's software implementation that ships with Windows, and MESA - but they're all but useless for any practical purpose and will typically get you less than 1 fps performance. Some of these do have source code available.

                      There are also open source drivers available for use with Linux, but it's important to understand that a driver is just the implementation whereas the term "OpenGL" defines the interface. So OpenGL cannot be "open source" because there isn't even any source code involved - it's just a definition of an interface. An OpenGL implementation can be, but it doesn't have to be and most are not.
                      IT LIVES! http://directq.blogspot.com/

                      Comment


                      • #26
                        Alright that makes sense, thanks for the info, MH.

                        Comment

                        Working...
                        X