Help! How to set a channel for sound with the new win7 code

Everything AM users with W7 computers need to know

Moderators: time-killer-games, Vengeance66, Candle, reneuend, GM-Support

Help! How to set a channel for sound with the new win7 code

Postby reneuend » Tue Dec 21, 2010 11:32 pm

Now that GM gave us the code shown below, I haven't been able to figure out how to select a specific channel. This is necessary for some of my games because I need specific control when the sound is played and with other sounds. If anyone knows or can figure out how to specify a channel, please let the rest of us who need it know! Pleeeeeassse!

Code: Select all
sub PlaySoundWin7(SoundFile, NumRepeat)

  If Action.IsComponentInstalled("NSPlay.NSPlayCtl.1") = False Then
    MsgBox "Unable to find the media player component.", vbCritical, "Error"
  Else
    If Action.DoesComponentExist("MediaPlayer1") = false Then
      AddComponent "NSPlay.NSPlayCtl.1", "MediaPlayer1"
    End If
    Component("MediaPlayer1").Object.FileName = SoundFile '(replace with your file)
    Component("MediaPlayer1").Object.PlayCount = NumRepeat
    Component("MediaPlayer1").Object.Play
  End If

End Sub




Code: Select all
sub StopSoundWin7()

  Component("MediaPlayer1").Object.Stop

End Sub
---


Image
Image
User avatar
reneuend
Administrator
 
Posts: 2762
Joined: Sat Nov 22, 2008 8:37 pm
Location: Midwest Cornfield, USA

Postby GM-Support » Sat Dec 25, 2010 12:54 am

Hello reneuend,

I have just posted the VBScript code on the following thread:
http://www.adventuremaker.com/phpBB2/viewtopic.php?p=32145#32145

Best regards,
GM-Support
GM-Support
Forum Admin and Games Page admin
 
Posts: 2221
Joined: Thu Jun 05, 2003 7:52 pm

Postby reneuend » Sat Dec 25, 2010 5:17 pm

Thanks GM. This solves a lot of issues in my games. Very much appreciated!

(edit) I didn't realize until I got home and looked at this code closer that you are overloading VB subroutines? Is this possible? I tried it out but got an error.
---


Image
Image
User avatar
reneuend
Administrator
 
Posts: 2762
Joined: Sat Nov 22, 2008 8:37 pm
Location: Midwest Cornfield, USA

Postby GM-Support » Mon Dec 27, 2010 5:49 pm

reneuend wrote:(edit) I didn't realize until I got home and looked at this code closer that you are overloading VB subroutines? Is this possible? I tried it out but got an error.


You are right, my mistake. I just updated the code to remove the overloading.

Thanks,
GM-Support
GM-Support
Forum Admin and Games Page admin
 
Posts: 2221
Joined: Thu Jun 05, 2003 7:52 pm


Return to Windows 7 issues

Who is online

Users browsing this forum: No registered users and 0 guests

cron