Author Topic: HUSH(channel%)  (Read 3870 times)

Offline Hemlos

  • To boldy go where no pixel has gone before!
  • Global Moderator
  • Prof. Inline
  • *******
  • Posts: 1635
  • Particle Hawk
    • View Profile
HUSH(channel%)
« on: 2015-Aug-16 »
HUSH(channel%)

see my sound object below, youll see how it becomes useful.

Code: (glbasic) [Select]
TYPE lib_SOUND_Object_

SndObj_Name$
SndObj_Path$
SndObj_Buff%
SndObj_Balance%
SndObj_ID%

SndObj_Channel% //internal glbasic channel id

SndObj_Volume#
SndObj_Mute%
SndObj_IS_Playing%


// This sound is an object.
// A sound object is preloaded with independant balance and volume.
// This sounds volume level, can be controlled by a master volume input at playtime.
FUNCTION _SNDOBJ_LOAD: FilePath$, FileName$, NumBuffers%, Balance%// NumBuffers% [1..4], Returns ID%
self.SndObj_Name$ = FileName$
self.SndObj_Path$ = FilePath$
self.SndObj_Buff% = NumBuffers%
self.SndObj_Balance% = Balance%
self.SndObj_ID% = GENSOUND()
LOADSOUND ( self.SndObj_Path$ + self.SndObj_Name$ ), self.SndObj_ID%, self.SndObj_Buff%
RETURN self.SndObj_ID%
ENDFUNCTION


// is this object playing?
FUNCTION _SNDOBJ_ISPLAYING:
self.SndObj_IS_Playing% = SOUNDPLAYING(self.SndObj_Channel%)
RETURN self.SndObj_IS_Playing%
ENDFUNCTION


FUNCTION _SNDOBJ_PLAY: MasterVolume% // [0..1]
self.SndObj_Channel% = PLAYSOUND( self.SndObj_ID%, self.SndObj_Balance%, ( self.SndObj_Volume% * MasterVolume% ))
RETURN self.SndObj_Channel%
ENDFUNCTION


FUNCTION _SNDOBJ_STOP:
HUSH // HUSH(channel%) command requested
RETURN self._SNDOBJ_ISPLAYING()
ENDFUNCTION


ENDTYPE

« Last Edit: 2015-Aug-16 by Hemlos »
Volume_of_Earth(km^3) = 4/3*3.14*POW(6371.392896,3)

Offline spacefractal

  • Community Developer
  • Prof. Inline
  • ******
  • Posts: 3893
    • View Profile
    • Space Fractal
Re: HUSH(channel%)
« Reply #1 on: 2015-Aug-17 »
is its not the same as STOPSOUND(Channel)? But yes its could route it to that command with HUSH as well.
Genius.Greedy Mouse - Karma Miwa - Spot Race - CatchOut - PowerUp Elevation and The beagle Jam.

Offline Hemlos

  • To boldy go where no pixel has gone before!
  • Global Moderator
  • Prof. Inline
  • *******
  • Posts: 1635
  • Particle Hawk
    • View Profile
Re: HUSH(channel%)
« Reply #2 on: 2015-Aug-18 »
Perfect, thanks.

I overlooked this command because it isnt linked to the tags in the help.
And i never even noticed it in the command list.
Volume_of_Earth(km^3) = 4/3*3.14*POW(6371.392896,3)