From 0ea5fc66924303d1bf73ba283a383e2aadee02f2 Mon Sep 17 00:00:00 2001 From: neodarz Date: Sat, 11 Aug 2018 20:21:34 +0200 Subject: Initial commit --- .../samples/sound_sources/?sortby=date/index.html | 110 ++++++++++ .../x-cvsweb-markup&sortby=rev/index.html | Bin 0 -> 106653 bytes .../x-cvsweb-markup&sortby=rev/index.html | 222 +++++++++++++++++++++ .../nel/samples/sound_sources/tuut.wav?sortby=rev | 146 ++++++++++++++ 4 files changed, 478 insertions(+) create mode 100644 cvs/cvsweb.cgi/code/nel/samples/sound_sources/?sortby=date/index.html create mode 100644 cvs/cvsweb.cgi/code/nel/samples/sound_sources/beep.wav?rev=1.1&content-type=text/x-cvsweb-markup&sortby=rev/index.html create mode 100644 cvs/cvsweb.cgi/code/nel/samples/sound_sources/main.cpp?rev=1.6&content-type=text/x-cvsweb-markup&sortby=rev/index.html create mode 100644 cvs/cvsweb.cgi/code/nel/samples/sound_sources/tuut.wav?sortby=rev (limited to 'cvs/cvsweb.cgi/code/nel/samples/sound_sources') diff --git a/cvs/cvsweb.cgi/code/nel/samples/sound_sources/?sortby=date/index.html b/cvs/cvsweb.cgi/code/nel/samples/sound_sources/?sortby=date/index.html new file mode 100644 index 00000000..94b1b1da --- /dev/null +++ b/cvs/cvsweb.cgi/code/nel/samples/sound_sources/?sortby=date/index.html @@ -0,0 +1,110 @@ + + + + nevrax.org : cvs + + + + + + + + + + + + + + + +
# Home   # nevrax.com   
+ + + + +
Nevrax
+ + + + + + + + + + +
+ + +
+ Nevrax.org
+ + + + + + + +
#News
#Mailing-list
#Documentation
#CVS
#Bugs
#Free software
+
+ + +
+ + +
+cvs + +
+ + + +
Nevrax / code / nel / samples / sound_sources
+ + + + + + + + + + + +
FileRev.AgeAuthorLast log entry
[BACK] + Previous Directory +    
[DIR] + CVS/ +    
[TXT] + main.cpp + 1.6  4 months lecroart  #FIXED: doxygen warning +
[TXT] + sample_sounds.nss + 1.3  10 months cado  ADDED looping as a static sound property +
[TXT] + beep.wav + 1.1  11 months cado  Initial import of the NeL sound engine usage sample +
[TXT] + sound_sources.dsp + 1.1  11 months cado  Initial import of the NeL sound engine usage sample +
[TXT] + tuut.wav + 1.1  11 months cado  Initial import of the NeL sound engine usage sample +

+ +Show only files with tag: + + +
+ + +
                                                                                                                                                                    +
+ + diff --git a/cvs/cvsweb.cgi/code/nel/samples/sound_sources/beep.wav?rev=1.1&content-type=text/x-cvsweb-markup&sortby=rev/index.html b/cvs/cvsweb.cgi/code/nel/samples/sound_sources/beep.wav?rev=1.1&content-type=text/x-cvsweb-markup&sortby=rev/index.html new file mode 100644 index 00000000..6c8a78e8 Binary files /dev/null and b/cvs/cvsweb.cgi/code/nel/samples/sound_sources/beep.wav?rev=1.1&content-type=text/x-cvsweb-markup&sortby=rev/index.html differ diff --git a/cvs/cvsweb.cgi/code/nel/samples/sound_sources/main.cpp?rev=1.6&content-type=text/x-cvsweb-markup&sortby=rev/index.html b/cvs/cvsweb.cgi/code/nel/samples/sound_sources/main.cpp?rev=1.6&content-type=text/x-cvsweb-markup&sortby=rev/index.html new file mode 100644 index 00000000..244b1138 --- /dev/null +++ b/cvs/cvsweb.cgi/code/nel/samples/sound_sources/main.cpp?rev=1.6&content-type=text/x-cvsweb-markup&sortby=rev/index.html @@ -0,0 +1,222 @@ + + + +code/nel/samples/sound_sources/main.cpp - view - 1.6 + +
[BACK] Return to main.cpp + CVS log [TXT][DIR] Up to Nevrax / code / nel / samples / sound_sources

File: Nevrax / code / nel / samples / sound_sources / main.cpp (download)
+Revision 1.6, Wed Feb 20 18:07:22 2002 UTC (5 months ago) by lecroart +
Branch: MAIN +
CVS Tags: georges_v2, HEAD
Changes since 1.5: +2 -2 + lines
+#FIXED: doxygen warning
+
+

/** \file sound_sources/main.cpp
+ * Simple example of NeL sound engine usage
+ *
+ * $Id: main.cpp,v 1.6 2002/02/20 18:07:22 lecroart Exp $
+ */
+
+/* Copyright, 2001 Nevrax Ltd.
+ *
+ * This file is part of NEVRAX NEL.
+ * NEVRAX NEL is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+
+ * NEVRAX NEL is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+
+ * You should have received a copy of the GNU General Public License
+ * along with NEVRAX NEL; see the file COPYING. If not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
+ * MA 02111-1307, USA.
+ */
+
+
+/*
+ * This sample shows how to initialize the audio mixer (UAudioMixer),
+ * how to create a source (USource), and how to move the listener
+ * (UListener).
+ */
+
+
+#include "nel/misc/debug.h"
+#include "nel/misc/time_nl.h"
+#include "nel/misc/vector.h"
+using namespace NLMISC;
+
+#include "nel/sound/u_audio_mixer.h"
+#include "nel/sound/u_listener.h"
+using namespace NLSOUND;
+
+#include <stdio.h>
+
+
+// Pointer to the audio mixer object
+UAudioMixer     *AudioMixer = NULL;
+
+
+/*
+ * Initialization
+ */
+void Init()
+{
+        try
+        {
+                /*
+                 * 1. Create the audio mixer object and init it.
+                 * If the sound driver cannot be loaded, an exception is thrown.
+                 */
+                AudioMixer = UAudioMixer::createAudioMixer();
+                AudioMixer->init();
+
+                /*
+                 * 2. Load a "sources sounds file" (.nss), its sound properties and
+                 * its attached wave data files (.wav)
+                 */
+                AudioMixer->loadSoundBuffers( "sample_sounds.nss" );
+
+                /*
+                 * In this small example, we don't have any environmental effects or
+                 * environment sounds. If so we would load an "environmental effects
+                 * file" (.nef) and an "environment sounds file" (.nes):
+                 *
+                 * AudioMixer->loadEnvEffects( "effects.nef" );
+                 *
+                 * UEnvSound *root;
+                 * AudioMixer->loadEnvSounds( "envsounds.nes", &root );
+                 */
+
+                /*
+                 * 3. Initialize listener's position and orientation (in NeL coordinate system).
+                 */
+                CVector initpos ( 0.0f, 0.0f, 0.0f );
+                CVector frontvec( 0.0f, 1.0f, 0.0f );
+                CVector upvec( 0.0f, 0.0f, 1.0f );
+                AudioMixer->getListener()->setPos( initpos );
+                AudioMixer->getListener()->setOrientation( frontvec, upvec );
+
+        }
+        catch( Exception& e )
+        {
+                nlerror( "Error: %s", e.what() );
+        }
+}
+
+
+/*
+ * Adding a source
+ */
+USource *OnAddSource( const char *name, float x, float y, float z )
+{
+        /*
+         * Create a source with sound 'name', and set some of its initial properties, if successful
+         */
+        USource *source = AudioMixer->createSource( name );
+        if ( source != NULL )
+        {
+                source->setPos( CVector(x,y,z) );
+
+                /* The initial gain, pitch and looping state are stored
+                 * in the "source sounds file".
+                 */
+
+                source->play(); // start playing immediately
+        }
+        else
+        {
+                nlwarning( "Sound '%s' not found", name );
+        }
+        return source;
+}
+
+
+/*
+ * When moving the listener, wait for a short delay
+ */
+void OnMove( const CVector& listenerpos )
+{
+        // Move forward
+        AudioMixer->getListener()->setPos( listenerpos );
+
+        // Wait 20 ms
+        TTime time = CTime::getLocalTime();
+        while ( CTime::getLocalTime() < time+20 );
+
+        /* If we used spawned sources or "envsounds" or if we had
+         * a large number of sources, we should call:
+         * AudioMixer->update();
+         */
+}
+
+
+/*
+ * main
+ *
+ * Note: The NeL vector coordinate system is described as follows:
+ * \verbatim
+ *     (top)
+ *       z    
+ *       |  y (front)
+ *       | /
+ *       -----x (right)
+ * \endverbatim
+ */
+void main()
+{
+        // Initialization
+        Init();
+
+        // First step: we create two sources
+        printf( "Press ENTER to start playing the two sources\n" );
+        printf( "One is 20 meters ahead, on the right\n" );
+        printf( "The other is 5 meters ahead, on the left\n" );
+        getchar();
+        USource *src1 = OnAddSource( "Beep", 1.0f, 20.0f, 0.0f );  // Beep on the right, 20 meters ahead
+        USource *src2 = OnAddSource( "Tuut", -2.0f, 5.0f, 0.0f ); // Tuut on the left, 5 meters ahead
+
+        // Second step: we will move the listener ahead
+        printf( "Press ENTER again to start moving the listener\n" );
+        getchar();
+
+        // Listener orientation is constant in this example (see initialization)
+
+        // Move forward, then backward, twice
+        CVector listenervel;
+        CVector listenerpos ( 0.0f, 0.0f, 0.0f );
+        for ( uint i=0; i!=2; i++ )
+        {
+                printf( "%u of 2\n", i+1 );
+
+                // Forward velocity
+                listenervel.set( 0.0f, 0.5f, 0.0f );
+                AudioMixer->getListener()->setVelocity( listenervel );
+
+                // Move forward: set position every frame
+                printf( "Moving forward, going past the sources...\n" );
+                for ( listenerpos.y=0.0f; listenerpos.y<30.0f; listenerpos.y+=0.1f )
+                {
+                        OnMove( listenerpos );
+                }
+
+                // Backward velocity
+                listenervel.set( 0.0f, -0.5f, 0.0f );
+                AudioMixer->getListener()->setVelocity( listenervel );
+
+                // Move backward: set position every frame
+                printf( "Moving backward, going back to the start position...\n" );
+                for ( listenerpos.y=30.0f; listenerpos.y>0.0f; listenerpos.y-=0.1f )
+                {
+                        OnMove( listenerpos );
+                }
+        }
+
+        // Finalization
+        printf( "Press ENTER again to exit\n" );
+        getchar();
+        delete AudioMixer;
+}
\ No newline at end of file diff --git a/cvs/cvsweb.cgi/code/nel/samples/sound_sources/tuut.wav?sortby=rev b/cvs/cvsweb.cgi/code/nel/samples/sound_sources/tuut.wav?sortby=rev new file mode 100644 index 00000000..9f111d90 --- /dev/null +++ b/cvs/cvsweb.cgi/code/nel/samples/sound_sources/tuut.wav?sortby=rev @@ -0,0 +1,146 @@ + + + + nevrax.org : cvs + + + + + + + + + + + + + + + +
# Home   # nevrax.com   
+ + + + +
Nevrax
+ + + + + + + + + + +
+ + +
+ Nevrax.org
+ + + + + + + +
#News
#Mailing-list
#Documentation
#CVS
#Bugs
#Free software
+
+ + +
+ + +
+cvs + +
+ + +
Nevrax / code / nel / samples / sound_sources / tuut.wav
+ + + + + +
tuut.wav
+

+

Default branch: MAIN
+


+ Revision 1.1 / (download) - annotate - [select for diffs] +, Mon Jul 23 15:41:52 2001 UTC (12 months ago) by cado +
Branch: MAIN + +
CVS Tags: nel_0_4, +georges_v2, +demo_0_1, +HEAD +
Diff

+Initial import of the NeL sound engine usage sample
+
+ + + + + +
Request Diffs
+

+

+

+ +Diffs between + + + and + + +
Type of Diff should be a  +
+ + + + + +
Select branch
+

+

+ +

+ +View only Branch: + + +
+ +
+ +Sort log by: + + +
+ + +
                                                                                                                                                                    +
+ + -- cgit v1.2.1