MusHandleSetVolume.html 3.36 KB
<html>
<head>
<title>NINTENDO64 Sound Tools Programing Manual</title>
</head>
<body bgcolor="#d0d0d0" text="#000000" link="#008000" vlink="#008000">

<h1><font color="#000080">MusHandleSetVolume()</font></h1>

<h2><font color="#ff0000">$B%W%m%H%?%$%W@k8@(B</font></h2>

<pre>  int <strong>MusHandleSetVolume</strong>(musHandle <font color="#0000ff">handle</font>, int <font color="#0000ff">volume</font>);</pre>

<h2><font color="#ff0000">$B0z?t(B</font></h2>

<table>
  <tr>
    <td valign="top">
      <font color="#0000ff"><code>handle</code></font>
    </td>
    <td>
      $B%5%&%s%I%O%s%I%k(B
    </td>
  </tr>
  <tr>
    <td valign="top">
      <font color="#0000ff"><code>volume</code></font>
    </td>
    <td>
      $B%\%j%e!<%`%9%1!<%k(B
    </td>
  </tr>
</table>

<h2><font color="#ff0000">$B@bL@(B</font></h2>

<p>$B;XDj$5$l$?%5%&%s%I%O%s%I%k$K4XO"$7$?%A%c%s%M%k$K$D$$$F$N%\%j%e!<%`%9%1!<%k$NCM$r@_Dj$7$^$9!#$3$N4X?t$K$h$C$F%W%m%0%i%^$O!"%5%&%s%I%G!<%?Fb$G85!9Dj5A$5$l$kCM$K4XO"$7$F%=%s%0$H%5%&%s%I%(%U%'%/%H$N%\%j%e!<%`$rJQ99$9$k$3$H$,$G$-$^$9!#(B</p>

<p>$B0z?t(B<font color="#0000ff"><code>handle</code></font>$B$O(B<a href="MusStartSong.html"><code>MusStartSong()</code></a>$B!"(B <a href="MusStartSongFromMarker.html"><code>MusStartSongFromMarker()</code></a>$B!"(B <a href="MusStartEffect.html"><code>MusStartEffect()</code></a>$B$"$k$$$O(B<a href="MusStartEffect2.html"><code>MusStartEffect2()</code></a>$B$K$h$C$FJV$5$l$k%5%&%s%I%O%s%I%k$G$J$1$l$P$J$j$^$;$s!#$b$7(B<font color="#0000ff"><code>handle</code></font>$B$H$7$F(B0$B$,M?$($i$l$?$J$i!"$3$N4X?t$O>o$K(B0$B$rJV$7$^$9!#(B</p>

<p>$B0z?t(B<font color="#0000ff"><code>volume</code></font>$B$NCM$O(B0$B$+$i(B0x100(256)$B$G$J$1$l$P$J$i$:!"$3$NHO0O$O85!9$N%5%&%s%I%G!<%?$NCf$GDj5A$5$l$kCM$N(B0%$B$+$i(B200%$B$rI=8=$7$F$$$^$9!#%G%U%)%k%H$N%\%j%e!<%`%9%1!<%k$NCM$O$9$Y$F$N%A%c%s%M%k$K4X$7$F(B0x80(100%)$B$G$9!#(B</p>

<h2><font color="#ff0000">$BLa$jCM(B</font></h2>

<p>$BJQ99$5$l$?%A%c%s%M%k$N?t!#(B</p>

<h2><font color="#ff0000">$BNc(B</font></h2>

<pre>  unsigned long SongCrossFade(unsigned long handle, int *song)
  {
    int i;
    unsigned long new_handle;

    new_handle = <a href="MusStartSong.html">MusStartSong</a>(song);
    <strong>MusHandleSetVolume</strong>(song, 0);
    for (i=0x10; i&lt;0x80; i+=0x10)
    {
      WaitForVsync();
      <strong>MusHandleSetVolume</strong>(handle, 0x80-i);
      <strong>MusHandleSetVolume</strong>(new_handle, i);
    }
    <a href="MusHandleStop.html">MusHandleStop</a>(handle,0);
    return (new_handle);
  }

  void VolFromDistance(unsigned long handle, float distance)
  {
    int scale;
    int volume;

    <font color="#800000">/* calculate distance scale */</font>
    if (distance&gt;=MAX_DISTANCE)
      return (0); <font color="#800000">/* sound is too far away! */</font>
    distance = (MAX_DISTANCE-distance)*(65536.0/MAX_DISTANCE);
    scale = (int)distance;

    <font color="#800000">/* calculate volume level */</font>
    volume = (0x80*scale)&gt;&gt;16;

    <strong>MusHandleSetVolume</strong>(handle, volume);
  }
</pre>

<h2><font color="#ff0000">$B;2>H(B</font></h2>

<a href="MusHandleSetPan.html"><code>MusHandleSetPan()</code></a>,
<a href="MusStartSong.html"><code>MusStartSong()</code></a>,
<a href="MusStartEffect.html"><code>MusStartEffect()</code></a>,
<a href="MusStartEffect2.html"><code>MusStartEffect2()</code></a>

</body>
</html>