Thread

MIDI / WAV Play Command --- MP3 & REAL AUDIO not implimented yet, but Create URL or Send URL will make this easy (Sdk)

MIDI / WAV Play Command --- MP3 & REAL AUDIO not implimented yet, but Create URL or Send URL will make this easy // Sdk

1  |  

andon13

Jul 25, 1999, 2:44pm
ENJOY :)

NOTES:
These lines are used as the VERY first lines after the AW_EVENT_CHAT Handler
.. . .

aw_state_change ();
char *reply[255];
CString msg = aw_string (AW_CHAT_MESSAGE);
CString msg2=msg;
CString msg3=msg;

msg2.MakeLower();
msg3.MakeLower();
msg2.GetLength();
msg3.GetLength();


THESE NEXT LINES CAN BE PLACED ANYWHERE WITHIN THE HANDLER.


if(msg2.Find("play ") == -1){}

else
{
char action[255];

CString chFormat="MEDIA";
CString msg2="FILEXT";
CString SPEAKER_OBJECT="wavspk.rwx";
CString location="UNDEFINED";

msg2.Replace("FILEXT",msg3.Mid(msg3.Find("play")));
msg2.Replace("play ",NULL);
msg.Replace(msg.Left(msg3.Find(msg2)),NULL);
sprintf (action, "create noise %s", msg);

if (msg2.Find("http://") == -1){location.Replace("UNDEFINED","Local");}
else
{
location.Replace("UNDEFINED","External");
}

if (msg2.Find(".mid") == -1)
{
if (msg2.Find(".wav") == -1)
{
if (msg2.Find(".mp3") == -1)
{
if (msg2.Find(".ra") == -1){
chFormat.Replace("MEDIA","FALSE");
}

else
{
chFormat.Replace("MEDIA","Real Audio");

}}


else
{
chFormat.Replace("MEDIA","Mpeg Layer 3 Audio");
}}

else
{
chFormat.Replace("MEDIA","Wave Audio");
}}

else
{
if (msg2.Find(".midifarm.") == -1){chFormat.Replace("MEDIA","MIDI
Music");SPEAKER_OBJECT.Replace("wavspk.rwx","midispk.rwx");sprintf (action,
"create sound %s", msg);}
else
{
chFormat.Replace("MEDIA","FALSE");
}}



if (chFormat == "FALSE")
{chFormat.Replace("FALSE",msg.Mid(msg.Find(".")));sprintf
((char*)reply,"Unknown Audio Type [ '%s' ]!",chFormat);aw_whisper (aw_int
(AW_CHAT_SESSION), (char*)reply);}

else
{
sprintf ((char*)reply,"Now Playing --- %s %s file
[ '%s' ]",location,chFormat,msg);
aw_say ((char*)reply);

char description[255];

aw_int_set (AW_OBJECT_X, AW_MY_X);
aw_int_set (AW_OBJECT_Y, AW_MY_Y);
aw_int_set (AW_OBJECT_Z, AW_MY_Z);
aw_int_set (AW_OBJECT_YAW, AW_MY_YAW);
aw_string_set (AW_OBJECT_MODEL, SPEAKER_OBJECT);
aw_object_delete ();

sprintf (description, "Ultra DJ V. 0.63 --- Part of Andon13's Ultra BOT .
.. .",chFormat,msg);

aw_string_set (AW_OBJECT_ACTION, action);
aw_string_set (AW_OBJECT_DESCRIPTION, description);
aw_object_add ();

}

}

if(msg2.Find("stop play") == -1){}
else
{
aw_object_delete ();
}






AND THAT'S IT . . .

All you need to do now is type :
Play <MIDI / WAV>

where "<MIDI / WAV>" = the location of the Midi or Wave file you wish to
play . . .

walter knupe

Jul 26, 1999, 2:16pm
I find it an interesting idea for a DJBOT to build a new object and delete
it immediately..
it saves the querying..

But I think you can remove

CString msg3=msg;
msg2.GetLength();
msg3.GetLength();

from your code, its not needed :)

Walter aka Faber



Andon13 schrieb in Nachricht <379b3c25.0 at homer>...
>ENJOY :)
>
>NOTES:
>These lines are used as the VERY first lines after the AW_EVENT_CHAT
Handler
>. . .
>
>aw_state_change ();
>char *reply[255];
>CString msg = aw_string (AW_CHAT_MESSAGE);
>CString msg2=msg;
>CString msg3=msg;
>
>msg2.MakeLower();
>msg3.MakeLower();
>msg2.GetLength();
>msg3.GetLength();
>
>
>THESE NEXT LINES CAN BE PLACED ANYWHERE WITHIN THE HANDLER.
>
>
>if(msg2.Find("play ") == -1){}
>
>else
>{
>char action[255];
>
>CString chFormat="MEDIA";
>CString msg2="FILEXT";
>CString SPEAKER_OBJECT="wavspk.rwx";
>CString location="UNDEFINED";
>
>msg2.Replace("FILEXT",msg3.Mid(msg3.Find("play")));
>msg2.Replace("play ",NULL);
>msg.Replace(msg.Left(msg3.Find(msg2)),NULL);
>sprintf (action, "create noise %s", msg);
>
>if (msg2.Find("http://") == -1){location.Replace("UNDEFINED","Local");}
> else
> {
> location.Replace("UNDEFINED","External");
> }
>
>if (msg2.Find(".mid") == -1)
> {
> if (msg2.Find(".wav") == -1)
> {
> if (msg2.Find(".mp3") == -1)
> {
> if (msg2.Find(".ra") == -1){
> chFormat.Replace("MEDIA","FALSE");
> }
>
> else
> {
> chFormat.Replace("MEDIA","Real Audio");
>
> }}
>
>
> else
> {
> chFormat.Replace("MEDIA","Mpeg Layer 3 Audio");
> }}
>
> else
> {
> chFormat.Replace("MEDIA","Wave Audio");
> }}
>
>else
>{
> if (msg2.Find(".midifarm.") == -1){chFormat.Replace("MEDIA","MIDI
>Music");SPEAKER_OBJECT.Replace("wavspk.rwx","midispk.rwx");sprintf (action,
>"create sound %s", msg);}
> else
> {
> chFormat.Replace("MEDIA","FALSE");
> }}
>
>
>
>if (chFormat == "FALSE")
> {chFormat.Replace("FALSE",msg.Mid(msg.Find(".")));sprintf
>((char*)reply,"Unknown Audio Type [ '%s' ]!",chFormat);aw_whisper (aw_int
>(AW_CHAT_SESSION), (char*)reply);}
>
> else
> {
> sprintf ((char*)reply,"Now Playing --- %s %s file
>[ '%s' ]",location,chFormat,msg);
> aw_say ((char*)reply);
>
> char description[255];
>
> aw_int_set (AW_OBJECT_X, AW_MY_X);
> aw_int_set (AW_OBJECT_Y, AW_MY_Y);
> aw_int_set (AW_OBJECT_Z, AW_MY_Z);
> aw_int_set (AW_OBJECT_YAW, AW_MY_YAW);
> aw_string_set (AW_OBJECT_MODEL, SPEAKER_OBJECT);
> aw_object_delete ();
>
> sprintf (description, "Ultra DJ V. 0.63 --- Part of Andon13's Ultra BOT .
>. .",chFormat,msg);
>
> aw_string_set (AW_OBJECT_ACTION, action);
> aw_string_set (AW_OBJECT_DESCRIPTION, description);
> aw_object_add ();
>
> }
>
>}
>
>if(msg2.Find("stop play") == -1){}
>else
>{
> aw_object_delete ();
>}
>
>
>
>
>
>
>AND THAT'S IT . . .
>
>All you need to do now is type :
>Play <MIDI / WAV>
>
>where "<MIDI / WAV>" = the location of the Midi or Wave file you wish to
>play . . .
>
>

1  |  
Awportals.com is a privately held community resource website dedicated to Active Worlds.
Copyright (c) Mark Randall 2006 - 2024. All Rights Reserved.
Awportals.com   ·   ProLibraries Live   ·   Twitter   ·   LinkedIn