OpenOffice.org Forum at OOoForum.orgThe OpenOffice.org Forum
 
 [Home]   [FAQ]   [Search]   [Memberlist]   [Usergroups]   [Register
 [Profile]   [Log in to check your private messages]   [Log in

Playing Sound from within a basic macro

 
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Macros and API
View previous topic :: View next topic  
Author Message
Fernand
OOo Enthusiast
OOo Enthusiast


Joined: 22 Jun 2004
Posts: 142

PostPosted: Wed Oct 03, 2007 6:03 am    Post subject: Playing Sound from within a basic macro Reply with quote

Needs some starting hint or maybe som code Smile

to start playing a embedded sound in a writer doc

thanks for any hints
Back to top
View user's profile Send private message Send e-mail
Fernand
OOo Enthusiast
OOo Enthusiast


Joined: 22 Jun 2004
Posts: 142

PostPosted: Fri Oct 05, 2007 6:34 am    Post subject: Reply with quote

nobody ?
found out that xraying the embededobject returns a "nullobject" do that means that this objects not can been handled by the API ?

Fernand
Back to top
View user's profile Send private message Send e-mail
ms777
Super User
Super User


Joined: 07 Feb 2004
Posts: 1355

PostPosted: Sat Oct 06, 2007 6:13 am    Post subject: Reply with quote

Hi,

this is tested on XP, other OSs may vary.

Precondition is that you inserted the sound by
Insert/Object/OLE Object/Further Objects/OK/Select file ...

See the code as a hint ...

Good luck,

ms777
Code:
Sub Main
oEO = ThisComponent.EmbeddedObjects.getByIndex(0)
oXEO = oEO.ExtendedControlOverEmbeddedObject
oSupportedVerbs = oXEO.SupportedVerbs

s = ""
for k=0 to UBound(oSupportedVerbs)
  s = s & "VerbID: " & oSupportedVerbs(k).VerbID & ", Name: " & oSupportedVerbs(k).VerbName & Chr(10)
  next k
msgbox s

oXEO.doVerb(0)

End Sub
Back to top
View user's profile Send private message
Fernand
OOo Enthusiast
OOo Enthusiast


Joined: 22 Jun 2004
Posts: 142

PostPosted: Mon Oct 08, 2007 12:14 am    Post subject: Reply with quote

Thanks it works

as we can expect from a superuser Smile

you are a genious ! but where the hell you found this information ?

Thanks
Fernand
Back to top
View user's profile Send private message Send e-mail
ms777
Super User
Super User


Joined: 07 Feb 2004
Posts: 1355

PostPosted: Mon Oct 08, 2007 11:57 am    Post subject: Reply with quote

Fernand wrote:
... but where the hell you found this information ?

I first checked the three (?) different methods to insert an audio file, and checked by the file size, if the audio file was really inluded. Then XRay on the embedded object ...

Always glad to help,

ms777
Back to top
View user's profile Send private message
Fernand
OOo Enthusiast
OOo Enthusiast


Joined: 22 Jun 2004
Posts: 142

PostPosted: Mon Oct 08, 2007 11:37 pm    Post subject: Reply with quote

I only xrayed the first way to inserting, stupid me Smile

Thanks again

Fernand
Back to top
View user's profile Send private message Send e-mail
Brivot
General User
General User


Joined: 08 Nov 2008
Posts: 9
Location: Côte d'Azur

PostPosted: Tue Mar 03, 2009 12:29 pm    Post subject: Basic macro for sounds in OOBase Forms Reply with quote

Do you think I could assign this code to a macro-button inside a OOBase Form and/or store sounds in the Database ? Could you provide general guidelines or code that you would think relevant ? Main problem is speed, each sound is a chinese caracter and last 1 second. How fast is your system running ?

I am also considering to do the opposite : embed sounds in the writer document in which I would include some access to chinese caracters from the database. Ths looks easier but less satisfactory than storing sound objects into the database itself.

I am only at the begining of the project and search for advices/guiline for sounds nevertheless all chinese characters are already stored with French translation.

Thanks for any help you could provide with.

Michel

ms777 wrote:
Hi,

this is tested on XP, other OSs may vary.

Precondition is that you inserted the sound by
Insert/Object/OLE Object/Further Objects/OK/Select file ...

See the code as a hint ...

Good luck,

ms777
Code:
Sub Main
oEO = ThisComponent.EmbeddedObjects.getByIndex(0)
oXEO = oEO.ExtendedControlOverEmbeddedObject
oSupportedVerbs = oXEO.SupportedVerbs

s = ""
for k=0 to UBound(oSupportedVerbs)
  s = s & "VerbID: " & oSupportedVerbs(k).VerbID & ", Name: " & oSupportedVerbs(k).VerbName & Chr(10)
  next k
msgbox s

oXEO.doVerb(0)

End Sub
Back to top
View user's profile Send private message
ms777
Super User
Super User


Joined: 07 Feb 2004
Posts: 1355

PostPosted: Tue Mar 03, 2009 1:10 pm    Post subject: Reply with quote

Hi,

getting the byte array of a sound from database and directly embedding as a sound into the doc or form I have no idea how to achieve ...

I would go through a Beanshell macro and use the Java AudioSystem functions. This has also the advantage of better portability

Good luck,

ms777
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Macros and API All times are GMT - 8 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group