Scolring - Forum

Entraides et échanges autour de la technologie Scol - Informations and exchanges on the Scol technology

Vous pouvez changer la langue de l'interface une fois inscrit - You can change the language once registered

You are not logged in.

#1 9-Jan-2014 04:20:50

hebdemnobad
Member
From: northamerica
Registered: 20-Apr-2011
Posts: 1,541
Website

loading and playing a sound, problem with declaring path

I have a sound named incomingsound.ogg in the tests folder in the Openspace3d folder.  I'd like to be able to play the sound (as part of a chat ui, not as a sound in a 3d scene)

this isn't working:

typeof audio = AsSnd;;
///
fun blahblah()=
set audio = asSndCreate _channel nil;
asSndLoad  audio "tests/incomingsound.ogg" AS_SND_STATIC;
asSndPlay audio nil;;

os3d console is telling me:

asSndLoad  audio "tests/incomingsound.ogg" AS_SND_STATIC??;
syntax error
>>> ERROR - Type mismatch (detail):
Found:    [AsSnd S I]
Expected: [AsSnd P I]

if I try:

set audio = asSndCreate _channel nil;
let "tests/incomingsound.ogg"-> soundpath in
(
asSndLoad  audio  soundpath AS_SND_STATIC;
asSndPlay audio nil;
);

the os3d console says:

>>> ERROR - Type mismatch (detail):
Found:    [S P AsSnd]
Expected: [S S u0]

any input welcome
thx!
-h

Offline

#2 9-Jan-2014 09:05:23

arkeon
Admin. / Scol language & OpenSpace3D developer
From: Nantes
Registered: 30-Mar-2009
Posts: 5,161
Website

Re: loading and playing a sound, problem with declaring path

Hi !

asSound is a deprecated sound API (used in the old 3D engine) and don't support ogg format

use http://redmine.scolring.org/projects/au … audio.html instead.

see the example in os3dplugins\media\sound\csound.pkg

when the function take a path as a P type, this mean a scol file in partition, to get it use _checkpack "my/path..."
asSndLoad  audio (_checkpack "tests/incomingsound.ogg") AS_SND_STATIC;

Offline

#3 9-Jan-2014 12:29:54

iri
Admin. / Scol language & Scol apps developer
From: France
Registered: 22-Feb-2009
Posts: 2,024
Website

Re: loading and playing a sound, problem with declaring path

For info, the new API is in the classical documentation : http://www.scolring.org/files/doc_html/ … audio.html

For security reasons and other things, Scol can read (respectively write) only in a Scol partition : a predefined directory and its sub-directory. When you must read (write) a file, you must set a read (write) reference file given by _checkpack (_getmodifypack) :
http://www.scolring.org/files/doc_html/_checkpack.html
http://www.scolring.org/files/doc_html/ … ypack.html
If the given path name is not found (or not accessible for Scol), these functions return nil. You can check that too.

Offline

#4 9-Jan-2014 13:56:15

hebdemnobad
Member
From: northamerica
Registered: 20-Apr-2011
Posts: 1,541
Website

Re: loading and playing a sound, problem with declaring path

Thx for your replies Is auaudio what I should use for non 3d sounds, like sounds that are part of a 2d ui?

Offline

#5 9-Jan-2014 14:16:20

arkeon
Admin. / Scol language & OpenSpace3D developer
From: Nantes
Registered: 30-Mar-2009
Posts: 5,161
Website

Re: loading and playing a sound, problem with declaring path

you can use it like that :

  let _CRAudio _channel "beep" (_checkpack "sounds/beep.ogg") 0 -> snd in  
   _AudioPlay snd  0;

Offline

#6 9-Jan-2014 14:16:48

iri
Admin. / Scol language & Scol apps developer
From: France
Registered: 22-Feb-2009
Posts: 2,024
Website

Re: loading and playing a sound, problem with declaring path

You'll find an example in the doc for a 2d use : http://www.scolring.org/files/doc_html/ … audio.html (at the bottom of the page)

Offline

#7 9-Jan-2014 14:38:03

hebdemnobad
Member
From: northamerica
Registered: 20-Apr-2011
Posts: 1,541
Website

Re: loading and playing a sound, problem with declaring path

iri wrote:

You'll find an example in the doc for a 2d use : http://www.scolring.org/files/doc_html/ … audio.html (at the bottom of the page)

thx, I think I have everything I need to know now.

Offline

#8 9-Jan-2014 15:03:30

hebdemnobad
Member
From: northamerica
Registered: 20-Apr-2011
Posts: 1,541
Website

Re: loading and playing a sound, problem with declaring path

I updated my chat project with sounds triggered by incoming messages, I'll leave my browser open, come for a visit.  I'm working now but I have time to reply to an incoming waahwaah sound:
http://www.ifam.net/openspace/remote_bo … index.html

Last edited by hebdemnobad (9-Jan-2014 15:23:44)

Offline

Board footer

Powered by FluxBB