Exemple #1
0
 def adjust_volume(self, x):
     """
     Change the sound and music volume (keeping in mind if this menu was
     called from the pause screen).
     """
     if self.pause_menu:
         audio.set_volume(music=x / 20)
     else:
         audio.set_volume(music=x / 10)
Exemple #2
0
 def OnPlay(self):
     self.parent.ListBox.List.pending.SkipStopIcon = True
     audio.set_volume(self.cue.hStream, 0.0)
     self.AudioControl.resume = 0.0
     self.pending.dbresp = True
     self.pending.mdx = True
     self.pending.mfeats = True
     self.SetHighlightSkipOff()
     self.SetTrackOffsetTime(0.0)
     self.parent.ListBox.List.pending.SkipStopIcon = True
     self.parent.ListTab.reInitBuffer = True
     self.parent.ListBox.List.reInitBuffer = True
Exemple #3
0
 def unpause(self):
     """
     Goes through the process of resuming the game and retaking control from
     the pause screen.
     """
     audio.resume_sounds()
     audio.set_volume(music=data.config.music_volume)
     if not self.aborting: control.set_exit_callback(self.pause)
     self.event_queue.add_event(0, self.controller.acquire)
     if (not self.aborting) and self.player and self.player.item_collisions:
         self.event_queue.add_event(0, self.player.controller.acquire)
     scene.update = self.update
     self.pause_screen = None
Exemple #4
0
 def LoopFadeInEvent(self):
     # if self.parent.IsHighlightOn() is False: return
     if self.fadein.cnt == 0.0:
         return
     self.fadein.cnt -= self.interval
     if self.fadein.cnt < 0.0:
         self.fadein.cnt = 0.0
     ratio = 1.0 - self.fadein.cnt / self.fadein.time
     target_volume = self.parent.GetVolume()
     if self.parent.IsAutoGainOn():
         target_volume = target_volume\
             * self.parent.cue.autogain * self.parent.cue.agc_headroom
     audio.set_volume(self.hStream, target_volume * ratio)
Exemple #5
0
 def SetVolume(self, value=None):
     if value is None:
         value = self.GetVolume()
     if value < 0.0:
         value = 0.0
     elif value > 1.0:
         value = 1.0
     self.cue.volume = value
     if self.IsAutoGainOn():
         value = value * self.cue.autogain
         value = value * self.cue.agc_headroom
         if value > 1.0:
             value = 1.0
     audio.set_volume(self.cue.hStream, value)
Exemple #6
0
 def LoopFadeOutEvent(self):
     # if self.parent.IsHighlightOn() is False: return
     if self.fadein.cnt > 0.0:
         self.fadeout.cnt = 0.0
         return
     if self.fadeout.cnt == 0.0:
         return
     self.fadeout.cnt -= self.interval
     if self.fadeout.cnt < 0.0:
         self.fadeout.cnt = 0.0
     ratio = self.fadeout.cnt / self.fadeout.time
     target_volume = self.parent.GetVolume()
     if self.parent.IsAutoGainOn():
         target_volume = target_volume * self.parent.cue.autogain
     audio.set_volume(self.hStream, target_volume * ratio)
Exemple #7
0
 def pause(self):
     """
     Goes through the process of pausing the game and passing control over
     too the pause screen.
     """
     if not self.pause_screen:
         audio.pause_sounds()
         audio.set_volume(music=data.config.music_volume / 2)
         audio.play_sound(MENU_PAUSE_SOUND, CHANNEL_MENU)
         control.set_exit_callback(sys.exit)
         self.pause_screen = PauseScreen(self)
         self.pause_screen.event_queue.add_event(0, self.controller.release)
         if self.player:
             self.pause_screen.event_queue.add_event(0,
                                             self.player.controller.release)
         scene.update = self.pause_screen.update
Exemple #8
0
 def __init__(self, exit_callback, input_callback,
              from_pause=False, start_y=180):
     self.pause_menu = from_pause
     menu.MenuArray.__init__(self, (VolumeControl((120, start_y),
                                                  "SFX VOLUME",
                             start_value=int(data.config.sound_volume * 10),
                         callback=lambda x: audio.set_volume(sound=x / 10)),
                                    VolumeControl((120, start_y + 16),
                                                  "BGM VOLUME",
                             start_value=int(data.config.music_volume * 10),
                         callback=self.adjust_volume),
                                    MenuSwitch((120, start_y + 32),
                                               "SCREEN SCALE",
                                                (("1X", 1), ("2X", 2),
                                                 ("3X", 3), ("4X", 4)),
                                   start_value=data.config.screen_scale - 1,
                                              callback=self.adjust_display),
                                    MenuSwitch((120, start_y + 48),
                                               "FULLSCREEN",
                                               (("OFF", 0),
                                                ("ON", pygame.FULLSCREEN)),
                                  start_value=bool(data.config.full_screen),
                                              callback=self.adjust_display),
                                    MenuSwitch((120, start_y + 64),
                                               "FRAME SKIP",
                                               (("OFF", 0), ("ON", 1)),
                                         start_value=data.config.frame_skip,
                                         callback=self.toggle_frameskip),
                                    menu.MenuEntry((100, start_y + 80),
                                                   "INPUT ASSIGNMENT&",
                                                   input_callback),
                                    menu.MenuEntry((56, start_y + 96),
                                                   "RETURN",
                                                   self.exit_cmd),
                                    ))
     self.exit_callback = exit_callback
     self.cancel = self.exit_cmd
     self.escape = self.exit_cmd
Exemple #9
0
 def init():
     audio.recorder_init()
     audio.set_volume(0)
Exemple #10
0
    def InitAudio(self):
        ######
        # import ctypes
        # from packages.pybassex import pybassex
        # ex = pybassex()
        # path = 'C:\\Users\\tkmix\\Desktop\\WORK\\macrobox-player\\source\\packages\\bass_vst.dll'
        # bass_module = ctypes.WinDLL(path)
        # func_type = ctypes.WINFUNCTYPE
        # QWORD = ctypes.c_int64
        # HSTREAM = ctypes.c_ulong
        # BASS_VST_ChannelSetDSP = func_type(
        #     ctypes.c_ulong, ctypes.c_ulong, ctypes.c_void_p, ctypes.c_int64, ctypes.c_ulong)(('BASS_VST_ChannelSetDSP', bass_module))
        # BASS_VST_GetParam = func_type(
        #     ctypes.c_bool, HSTREAM, ctypes.c_int64)(('BASS_VST_GetParam', bass_module))
        # # BASS_VST_SetParam = func_type(
        # #     ctypes.c_bool, HSTREAM, ctypes.c_int64, ctypes.c_float)(('BASS_VST_SetParam', bass_module))
        # BASS_VST_SetParam = func_type(
        #     ctypes.c_bool, HSTREAM, ctypes.c_int64, ctypes.c_float)(('BASS_VST_SetParam', bass_module))

        # BASS_VST_EmbedEditor = func_type(
        #     ctypes.c_bool, HSTREAM, ctypes.c_int64)(('BASS_VST_EmbedEditor', bass_module))
        # BASS_VST_SetScope = func_type(
        #     ctypes.c_bool, HSTREAM, ctypes.c_int64)(('BASS_VST_SetScope', bass_module))
        # BASS_VST_GetInfo = func_type(
        #     HSTREAM, ctypes.c_ulong)(('BASS_VST_GetInfo', bass_module))
        ######

        self.parent.parent.ListBox.List.pending.SkipStopIcon = True
        if self.path == self.parent.cue.path:
            is_position_set = True
        else:
            is_position_set = False
        self.path = self.parent.cue.path
        if pybass.BASS_ChannelIsActive(self.hStream) == 1:
            pybass.BASS_StreamFree(self.hStream)
        if sys.platform.startswith('win'):
            flags = pybass.BASS_STREAM_PRESCAN | pybass.BASS_UNICODE
        elif sys.platform.startswith('darwin'):
            flags = pybass.BASS_STREAM_PRESCAN
            self.path = self.path.encode(sys.getfilesystemencoding())

        self.hStream = pybass.BASS_StreamCreateFile(False, self.path, 0, 0,
                                                    flags)

        ######
        # print(dir(pybass))
        # from pybass import pybass_vst
        vst_plugin_name = 'LoudMax64.dll'
        vst_plugin_name = 'LoudMaxLite64.dll'
        # vst_plugin_path = os.path.join(os.path.dirname(__file__), 'packages', vst_plugin_name)
        vst_plugin_path = os.path.join('assets', 'dlls', vst_plugin_name)
        if hasattr(sys, '_MEIPASS'):
            vst_plugin_path = os.path.join(sys._MEIPASS, vst_plugin_path)
        else:
            vst_plugin_path = os.path.join(
                os.path.dirname(os.path.dirname(__file__)), vst_plugin_path)
        # BASS_VST_KEEP_CHANS = 0x00000001
        flags = pybass.BASS_UNICODE | pybass.BASS_VST_KEEP_CHANS
        self.vstHandle = pybass.BASS_VST_ChannelSetDSP(self.hStream,
                                                       vst_plugin_path, flags,
                                                       0)
        pybass.BASS_VST_SetParam(self.vstHandle, 0, 0.0)
        pybass.BASS_VST_SetParam(self.vstHandle, 1, 1.0)
        pybass.BASS_VST_SetParam(self.vstHandle, 2, 0.0)
        pybass.BASS_VST_SetParam(self.vstHandle, 3, 0.0)
        # print(os.path.join(os.path.dirname(__file__), 'packages', 'LoudMax64.dll'))
        # self.parent.Show()
        # x = BASS_VST_SetScope(self.vstHandle, 123)
        # dialog = wx.TextEntryDialog(self.parent.parent.parent, 'Enter Your Name', 'Text Entry Dialog')
        # BASS_VST_EmbedEditor(self.vstHandle, dialog.GetHandle())
        # dialog.ShowModal()
        # if dialog.ShowModal() == wx.ID_OK:
        #     self.text.SetValue('Name entered:' + dialog.GetValue())
        # dialog.Destroy()

        # BASS_VST_EmbedEditor(self.vstHandle, self.parent.GetHandle())
        # print()

        # param = BASS_VST_GetParam(self.vstHandle, 0)
        # info = None
        # BASS_VST_SetParam(self.vstHandle, 1, 1.0)

        # print(param)
        # param = BASS_VST_GetParam(self.vstHandle, 1)
        # print(param)
        ######

        self.parent.cue.hStream = self.hStream
        audio.set_volume(self.hStream, 0.0)
        if self.resume is not None:
            resume = self.resume
            if self.resume < 0:
                duration = audio.get_duration(self.hStream)
                resume = duration + self.resume
            audio.set_position(self.hStream, resume)
        pybass.BASS_ChannelPlay(self.hStream, False)

        self.fadein.cnt = self.fadein.time
        if is_position_set is False and self.parent.IsLoopOn():
            self.fadein.cnt = self.fadein.time
        else:
            self.parent.SetVolume()
        self.resume = None
        self.pending = False
        # self.parent.FocusPlayingItem()
        self.parent.parent.ListTab.reInitBuffer = True
        self.parent.parent.ListBox.List.reInitBuffer = True
Exemple #11
0
def volume_callback(v):
    audio.set_volume(v)
    return (html.P("Setting volume to %d" % (v)))