def samplefile(self, filesamplefile):

		samplefile=filesamplefile.split('file:///')[1]

		if self._samplefile != osgDB.findDataFile(samplefile):

			ext=osgDB.getFileExtension(osgDB.findDataFile(samplefile))

			ss=self.soundstatecallback.getSoundState()
			
			ss.setPlay(False)
			#ss.setLooping(False)
			ss.setSample(None)
			ss.setStream(None)
			ss.allocateSource()
			if ext=='wav':
				ss.setSample(osgAudio.SoundManager.instance().getSample(osgDB.findDataFile(samplefile),True))
			else:
				stream=osgAudio.SoundManager.instance().getStream(osgDB.findDataFile(samplefile))
				ss.setStream(stream)

			self._samplefile=osgDB.findDataFile(samplefile)
			self.samplefileChanged.emit()
			self.isLoopingChanged.emit()
			self.isPlayingChanged.emit()
			self.pitchChanged.emit()
Esempio n. 2
0
    def samplefile(self, filesamplefile):

        samplefile = filesamplefile.split('file:///')[1]

        if self._samplefile != osgDB.findDataFile(samplefile):

            ext = osgDB.getFileExtension(osgDB.findDataFile(samplefile))

            ss = self.soundstatecallback.getSoundState()

            ss.setPlay(False)
            #ss.setLooping(False)
            ss.setSample(None)
            ss.setStream(None)
            ss.allocateSource()
            if ext == 'wav':
                ss.setSample(osgAudio.SoundManager.instance().getSample(
                    osgDB.findDataFile(samplefile), True))
            else:
                stream = osgAudio.SoundManager.instance().getStream(
                    osgDB.findDataFile(samplefile))
                ss.setStream(stream)

            self._samplefile = osgDB.findDataFile(samplefile)
            self.samplefileChanged.emit()
            self.isLoopingChanged.emit()
            self.isPlayingChanged.emit()
            self.pitchChanged.emit()
	def setModel(self,soundstatecallback):
		sys.stderr.write("\nsetModelsoundstatecallback\n")
		self.soundstatecallback=soundstatecallback
		#setGeneralsoundstatecallbackProperties



		#TODOtry to cast in tubtypes


		sounds=self.soundstatecallback.getSoundState()
		sample=sounds.getSample()
		stream=sounds.getStream()
		if sample:
			self._samplefile=sample.getFilename()

		if stream:
			conv = DownCast.osgAudio_Stream()
			fs=conv.as_osgAudio_FileStream(stream);
			if fs:
				self._samplefile=fs.getFilename()


		self._ext=osgDB.getFileExtension(self._samplefile)
		self.samplefileChanged.emit()
		#add a stateset if possible
		'''ss=self.soundstatecallback.getStateSet()
		self.sslist=None
		if ss:
			self.sslist=self.createNode4.getQuickItem4OSGItem(ss)'''

		print("setModelend")
Esempio n. 4
0
    def setModel(self, soundstatecallback):
        sys.stderr.write("\nsetModelsoundstatecallback\n")
        self.soundstatecallback = soundstatecallback
        #setGeneralsoundstatecallbackProperties

        #TODOtry to cast in tubtypes

        sounds = self.soundstatecallback.getSoundState()
        sample = sounds.getSample()
        stream = sounds.getStream()
        if sample:
            self._samplefile = sample.getFilename()

        if stream:
            conv = DownCast.osgAudio_Stream()
            fs = conv.as_osgAudio_FileStream(stream)
            if fs:
                self._samplefile = fs.getFilename()

        self._ext = osgDB.getFileExtension(self._samplefile)
        self.samplefileChanged.emit()
        #add a stateset if possible
        '''ss=self.soundstatecallback.getStateSet()
		self.sslist=None
		if ss:
			self.sslist=self.createNode4.getQuickItem4OSGItem(ss)'''

        print("setModelend")