PageRenderTime 4ms CodeModel.GetById 18ms app.highlight 53ms RepoModel.GetById 0ms app.codeStats 0ms

/example/ipy_dx/dsound/soundfx.py

http://cwcpylib.googlecode.com/
Python | 1572 lines | 1465 code | 86 blank | 21 comment | 21 complexity | 04f89ed66f17f548de2c97c3e0d33c7c MD5 | raw file

Large files files are truncated, but you can click here to view the full file

   1# -*- coding: utf-8 -*-
   2"""
   3Description: DirectSound ????
   4
   5Author: Chui-Wen Chiu <sisimi.pchome@gmail.com>
   6License: PYTHON SOFTWARE FOUNDATION LICENSE
   7"""
   8
   9__author__ = "Chui-Wen Chiu"
  10__author_email__ = "cwchiu@hotmail.com"
  11
  12import clr
  13# WinForm ????
  14clr.AddReference("System")
  15clr.AddReference("System.Drawing")
  16clr.AddReference("System.Windows.Forms")
  17
  18# DirectX ??
  19clr.AddReferenceByName("Microsoft.DirectX, Version=1.0.2902.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" )
  20clr.AddReferenceByName("Microsoft.DirectX.DirectSound, Version=1.0.2902.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" )
  21
  22from System import *
  23from System.IO import *
  24from System.Collections import *
  25from System.ComponentModel import *
  26from System.Windows.Forms import *
  27from System.Drawing import *
  28from Microsoft.DirectX import *
  29from Microsoft.DirectX.DirectSound import *
  30
  31class EffectInfo():
  32    def __init__(self):
  33        self._description=EffectDescription()
  34        self._EffectSettings=None
  35        self._Effect=None
  36
  37    @property 
  38    def Effect(self): 
  39        return self._Effect 
  40
  41    @Effect.setter 
  42    def Effect(self, value): 
  43        self._Effect = value
  44
  45    @property 
  46    def EffectSettings(self): 
  47        return self._EffectSettings 
  48
  49    @EffectSettings.setter 
  50    def EffectSettings(self, value): 
  51        self._EffectSettings = value 
  52
  53    @property 
  54    def description(self): 
  55        return self._description 
  56
  57    @description.setter 
  58    def description(self, value): 
  59        self._description = value 
  60        
  61class MyForm(Form):
  62    def __init__(self):
  63        self.applicationDevice = None
  64        self.applicationBuffer = None
  65        self.path = ''
  66        self.fileName = ''
  67        #self.effectDescription = ArrayList()
  68        self.effectDescription = []
  69        self.shouldLoop = False
  70        self.isIgnoringSettings = False
  71        self.currentIndex = 0
  72        self.InitializeComponent()
  73        self.InitDirectSound()
  74        self.ClearUI(True)
  75
  76    def InitDirectSound(self):
  77        description = BufferDescription()
  78        wfx = WaveFormat()
  79        try:
  80            self.applicationDevice = Device()
  81            self.applicationDevice.SetCooperativeLevel(self, CooperativeLevel.Priority)
  82        except:
  83            MessageBox.Show("Unable to create sound device. Sample will now exit.")
  84            self.Close()
  85            raise
  86
  87    def ClearUI(self, ClearControls):
  88        self.labelParamName1.Text =\
  89        self.labelParamValue1.Text =\
  90        self.labelParamName2.Text =\
  91        self.labelParamValue2.Text =\
  92        self.labelParamName3.Text =\
  93        self.labelParamValue3.Text =\
  94        self.labelParamName4.Text =\
  95        self.labelParamValue4.Text =\
  96        self.labelParamName5.Text =\
  97        self.labelParamValue5.Text =\
  98        self.labelParamName6.Text =\
  99        self.labelParamValue6.Text = ''
 100
 101        if (ClearControls):
 102            self.groupboxFrameWaveform.Enabled =\
 103            self.radiobuttonTriangle.Enabled =\
 104            self.radiobuttonTriangle.Enabled =\
 105            self.radiobuttonRadioSine.Enabled =\
 106            self.groupboxFramePhase.Enabled =\
 107            self.radiobuttonRadioNeg180.Enabled =\
 108            self.radiobuttonRadioNeg90.Enabled =\
 109            self.radiobuttonRadioZero.Enabled =\
 110            self.radiobuttonRadio90.Enabled =\
 111            self.radiobuttonRadio180.Enabled = False
 112
 113            self.trackbarSlider1.Minimum =\
 114            self.trackbarSlider2.Minimum =\
 115            self.trackbarSlider3.Minimum =\
 116            self.trackbarSlider4.Minimum =\
 117            self.trackbarSlider5.Minimum =\
 118            self.trackbarSlider6.Minimum = 0
 119
 120            self.trackbarSlider1.Value =\
 121            self.trackbarSlider2.Value =\
 122            self.trackbarSlider3.Value =\
 123            self.trackbarSlider4.Value =\
 124            self.trackbarSlider5.Value =\
 125            self.trackbarSlider6.Value = 0
 126
 127            self.trackbarSlider1.Enabled =\
 128            self.trackbarSlider2.Enabled =\
 129            self.trackbarSlider3.Enabled =\
 130            self.trackbarSlider4.Enabled =\
 131            self.trackbarSlider5.Enabled =\
 132            self.trackbarSlider6.Enabled = False
 133
 134
 135    def _Form1_Load(self, sender, e):
 136        try:
 137            self.ApplicationDevice = Device()
 138            self.ApplicationDevice.SetCooperativeLevel(self, CooperativeLevel.Priority)
 139        except:
 140            MessageBox.Show("Unable to create sound device. Sample will now exit.")
 141            self.Close()
 142
 143    def Dispose(self, disposing):              
 144        if (disposing):
 145
 146            if (not self.applicationBuffer is None):
 147                self.applicationBuffer.Dispose()
 148            if (not self.applicationDevice is None):
 149                self.applicationDevice.Dispose()
 150
 151
 152        super(type(self), self).Dispose(disposing)    
 153
 154    def InitializeComponent(self):
 155    	self.components = Container()
 156        self.buttonOk = Button()
 157        self.groupboxFrame = GroupBox()
 158        self.labelParamName1 = Label()
 159        self.labelParamValue1 = Label()
 160        self.trackbarSlider1 = TrackBar()
 161        self.labelParamMin1 = Label()
 162        self.labelParamMax1 = Label()
 163        self.labelParamName2 = Label()
 164        self.labelParamValue2 = Label()
 165        self.trackbarSlider2 = TrackBar()
 166        self.labelParamMin2 = Label()
 167        self.labelParamMax2 = Label()
 168        self.labelParamName3 = Label()
 169        self.labelParamValue3 = Label()
 170        self.trackbarSlider3 = TrackBar()
 171        self.labelParamMin3 = Label()
 172        self.labelParamMax3 = Label()
 173        self.labelParamName4 = Label()
 174        self.labelParamValue4 = Label()
 175        self.trackbarSlider4 = TrackBar()
 176        self.labelParamMin4 = Label()
 177        self.labelParamMax4 = Label()
 178        self.labelParamName5 = Label()
 179        self.labelParamValue5 = Label()
 180        self.trackbarSlider5 = TrackBar()
 181        self.labelParamMin5 = Label()
 182        self.labelParamMax5 = Label()
 183        self.labelParamName6 = Label()
 184        self.labelParamValue6 = Label()
 185        self.trackbarSlider6 = TrackBar()
 186        self.labelParamMin6 = Label()
 187        self.labelParamMax6 = Label()
 188        self.radiobuttonTriangle = RadioButton()
 189        self.radiobuttonSquare = RadioButton()
 190        self.radiobuttonRadioSine = RadioButton()
 191        self.groupboxFrameWaveform = GroupBox()
 192        self.buttonOpen = Button()
 193        self.labelTextFilename = Label()
 194        self.labelStatic2 = Label()
 195        self.labelTextStatus = Label()
 196        self.checkboxLoop = CheckBox()
 197        self.buttonPlay = Button()
 198        self.buttonStop = Button()
 199        self.labelStatic3 = Label()
 200        self.labelStatic4 = Label()
 201        self.radiobuttonRadioNeg180 = RadioButton()
 202        self.radiobuttonRadioNeg90 = RadioButton()
 203        self.radiobuttonRadioZero = RadioButton()
 204        self.radiobuttonRadio90 = RadioButton()
 205        self.radiobuttonRadio180 = RadioButton()
 206        self.groupboxFramePhase = GroupBox()
 207        self.groupboxEffects = GroupBox()
 208        self.buttonDelete = Button()
 209        self.listboxEffects = ListBox()
 210        self.comboEffects = ComboBox()
 211        self.timer1 = Timer(self.components)
 212        self.trackbarSlider1.BeginInit()
 213        self.trackbarSlider2.BeginInit()
 214        self.trackbarSlider3.BeginInit()
 215        self.trackbarSlider4.BeginInit()
 216        self.trackbarSlider5.BeginInit()
 217        self.trackbarSlider6.BeginInit()
 218        self.groupboxFrameWaveform.SuspendLayout()
 219        self.groupboxFramePhase.SuspendLayout()
 220        self.groupboxEffects.SuspendLayout()
 221        self.SuspendLayout()
 222
 223	# 
 224        # buttonOk
 225        # 
 226        self.buttonOk.Location = Point(87, 432)
 227        self.buttonOk.Name = "buttonOk"
 228        self.buttonOk.Size = Size(67, 23)
 229        self.buttonOk.TabIndex = 0
 230        self.buttonOk.Text = "E&xit"
 231        self.buttonOk.Click += self.buttonOk_Click
 232        # 
 233        # groupboxFrame
 234        # 
 235        self.groupboxFrame.Location = Point(165, 76)
 236        self.groupboxFrame.Name = "groupboxFrame"
 237        self.groupboxFrame.Size = Size(525, 380)
 238        self.groupboxFrame.TabIndex = 1
 239        self.groupboxFrame.TabStop = False
 240        self.groupboxFrame.Text = "Parameters"
 241        # 
 242        # labelParamName1
 243        # 
 244        self.labelParamName1.Location = Point(169, 112)
 245        self.labelParamName1.Name = "labelParamName1"
 246        self.labelParamName1.Size = Size(117, 13)
 247        self.labelParamName1.TabIndex = 2
 248        self.labelParamName1.TextAlign = ContentAlignment.TopRight
 249        # 
 250        # labelParamValue1
 251        # 
 252        self.labelParamValue1.BorderStyle = BorderStyle.Fixed3D
 253        self.labelParamValue1.Location = Point(294, 112)
 254        self.labelParamValue1.Name = "labelParamValue1"
 255        self.labelParamValue1.Size = Size(67, 16)
 256        self.labelParamValue1.TabIndex = 3
 257        self.labelParamValue1.Text = "Value"
 258        self.labelParamValue1.TextAlign = ContentAlignment.TopCenter
 259        # 
 260        # trackbarSlider1
 261        # 
 262        self.trackbarSlider1.Location = Point(426, 112)
 263        self.trackbarSlider1.Name = "trackbarSlider1"
 264        self.trackbarSlider1.Size = Size(195, 45)
 265        self.trackbarSlider1.TabIndex = 4
 266        self.trackbarSlider1.Text = "Slider1"
 267        self.trackbarSlider1.TickStyle = TickStyle.None
 268        self.trackbarSlider1.Scroll += self.trackbarSliderScroll
 269        # 
 270        # labelParamMin1
 271        # 
 272        self.labelParamMin1.Location = Point(366, 112)
 273        self.labelParamMin1.Name = "labelParamMin1"
 274        self.labelParamMin1.Size = Size(60, 16)
 275        self.labelParamMin1.TabIndex = 5
 276        self.labelParamMin1.Text = "min"
 277        self.labelParamMin1.TextAlign = ContentAlignment.TopCenter
 278        # 
 279        # labelParamMax1
 280        # 
 281        self.labelParamMax1.Location = Point(627, 120)
 282        self.labelParamMax1.Name = "labelParamMax1"
 283        self.labelParamMax1.Size = Size(52, 13)
 284        self.labelParamMax1.TabIndex = 6
 285        self.labelParamMax1.Text = "max"
 286        self.labelParamMax1.TextAlign = ContentAlignment.TopCenter
 287        # 
 288        # labelParamName2
 289        # 
 290        self.labelParamName2.Location = Point(169, 160)
 291        self.labelParamName2.Name = "labelParamName2"
 292        self.labelParamName2.Size = Size(117, 13)
 293        self.labelParamName2.TabIndex = 7
 294        self.labelParamName2.TextAlign = ContentAlignment.TopRight
 295        # 
 296        # labelParamValue2
 297        # 
 298        self.labelParamValue2.BorderStyle = BorderStyle.Fixed3D
 299        self.labelParamValue2.Location = Point(294, 160)
 300        self.labelParamValue2.Name = "labelParamValue2"
 301        self.labelParamValue2.Size = Size(67, 16)
 302        self.labelParamValue2.TabIndex = 8
 303        self.labelParamValue2.Text = "Value"
 304        self.labelParamValue2.TextAlign = ContentAlignment.TopCenter
 305        # 
 306        # trackbarSlider2
 307        # 
 308        self.trackbarSlider2.Location = Point(426, 163)
 309        self.trackbarSlider2.Name = "trackbarSlider2"
 310        self.trackbarSlider2.Size = Size(195, 45)
 311        self.trackbarSlider2.TabIndex = 9
 312        self.trackbarSlider2.Text = "Slider1"
 313        self.trackbarSlider2.TickStyle = TickStyle.None
 314        self.trackbarSlider2.Scroll += self.trackbarSliderScroll
 315        # 
 316        # labelParamMin2
 317        # 
 318        self.labelParamMin2.Location = Point(366, 160)
 319        self.labelParamMin2.Name = "labelParamMin2"
 320        self.labelParamMin2.Size = Size(60, 16)
 321        self.labelParamMin2.TabIndex = 10
 322        self.labelParamMin2.Text = "min"
 323        self.labelParamMin2.TextAlign = ContentAlignment.TopCenter
 324        # 
 325        # labelParamMax2
 326        # 
 327        self.labelParamMax2.Location = Point(627, 168)
 328        self.labelParamMax2.Name = "labelParamMax2"
 329        self.labelParamMax2.Size = Size(52, 13)
 330        self.labelParamMax2.TabIndex = 11
 331        self.labelParamMax2.Text = "max"
 332        self.labelParamMax2.TextAlign = ContentAlignment.TopCenter
 333        # 
 334        # labelParamName3
 335        # 
 336        self.labelParamName3.Location = Point(169, 208)
 337        self.labelParamName3.Name = "labelParamName3"
 338        self.labelParamName3.Size = Size(117, 13)
 339        self.labelParamName3.TabIndex = 12
 340        self.labelParamName3.TextAlign = ContentAlignment.TopRight
 341        # 
 342        # labelParamValue3
 343        # 
 344        self.labelParamValue3.BorderStyle = BorderStyle.Fixed3D
 345        self.labelParamValue3.Location = Point(294, 208)
 346        self.labelParamValue3.Name = "labelParamValue3"
 347        self.labelParamValue3.Size = Size(67, 16)
 348        self.labelParamValue3.TabIndex = 13
 349        self.labelParamValue3.Text = "Value"
 350        self.labelParamValue3.TextAlign = ContentAlignment.TopCenter
 351        # 
 352        # trackbarSlider3
 353        # 
 354        self.trackbarSlider3.Location = Point(426, 208)
 355        self.trackbarSlider3.Name = "trackbarSlider3"
 356        self.trackbarSlider3.Size = Size(195, 45)
 357        self.trackbarSlider3.TabIndex = 14
 358        self.trackbarSlider3.Text = "Slider1"
 359        self.trackbarSlider3.TickStyle = TickStyle.None
 360        self.trackbarSlider3.Scroll += self.trackbarSliderScroll
 361        # 
 362        # labelParamMin3
 363        # 
 364        self.labelParamMin3.Location = Point(366, 208)
 365        self.labelParamMin3.Name = "labelParamMin3"
 366        self.labelParamMin3.Size = Size(60, 16)
 367        self.labelParamMin3.TabIndex = 15
 368        self.labelParamMin3.Text = "min"
 369        self.labelParamMin3.TextAlign = ContentAlignment.TopCenter
 370        # 
 371        # labelParamMax3
 372        # 
 373        self.labelParamMax3.Location = Point(627, 216)
 374        self.labelParamMax3.Name = "labelParamMax3"
 375        self.labelParamMax3.Size = Size(52, 13)
 376        self.labelParamMax3.TabIndex = 16
 377        self.labelParamMax3.Text = "max"
 378        self.labelParamMax3.TextAlign = ContentAlignment.TopCenter
 379        # 
 380        # labelParamName4
 381        # 
 382        self.labelParamName4.Location = Point(169, 256)
 383        self.labelParamName4.Name = "labelParamName4"
 384        self.labelParamName4.Size = Size(117, 13)
 385        self.labelParamName4.TabIndex = 17
 386        self.labelParamName4.TextAlign = ContentAlignment.TopRight
 387        # 
 388        # labelParamValue4
 389        # 
 390        self.labelParamValue4.BorderStyle = BorderStyle.Fixed3D
 391        self.labelParamValue4.Location = Point(294, 256)
 392        self.labelParamValue4.Name = "labelParamValue4"
 393        self.labelParamValue4.Size = Size(67, 16)
 394        self.labelParamValue4.TabIndex = 18
 395        self.labelParamValue4.Text = "Value"
 396        self.labelParamValue4.TextAlign = ContentAlignment.TopCenter
 397        # 
 398        # trackbarSlider4
 399        # 
 400        self.trackbarSlider4.Location = Point(426, 256)
 401        self.trackbarSlider4.Name = "trackbarSlider4"
 402        self.trackbarSlider4.Size = Size(195, 45)
 403        self.trackbarSlider4.TabIndex = 19
 404        self.trackbarSlider4.Text = "Slider1"
 405        self.trackbarSlider4.TickStyle = TickStyle.None
 406        self.trackbarSlider4.Scroll += self.trackbarSliderScroll
 407        # 
 408        # labelParamMin4
 409        # 
 410        self.labelParamMin4.Location = Point(366, 256)
 411        self.labelParamMin4.Name = "labelParamMin4"
 412        self.labelParamMin4.Size = Size(60, 16)
 413        self.labelParamMin4.TabIndex = 20
 414        self.labelParamMin4.Text = "min"
 415        self.labelParamMin4.TextAlign = ContentAlignment.TopCenter
 416        # 
 417        # labelParamMax4
 418        # 
 419        self.labelParamMax4.Location = Point(627, 256)
 420        self.labelParamMax4.Name = "labelParamMax4"
 421        self.labelParamMax4.Size = Size(52, 13)
 422        self.labelParamMax4.TabIndex = 21
 423        self.labelParamMax4.Text = "max"
 424        self.labelParamMax4.TextAlign = ContentAlignment.TopCenter
 425        # 
 426        # labelParamName5
 427        # 
 428        self.labelParamName5.Location = Point(169, 304)
 429        self.labelParamName5.Name = "labelParamName5"
 430        self.labelParamName5.Size = Size(117, 13)
 431        self.labelParamName5.TabIndex = 22
 432        self.labelParamName5.TextAlign = ContentAlignment.TopRight
 433        # 
 434        # labelParamValue5
 435        # 
 436        self.labelParamValue5.BorderStyle = BorderStyle.Fixed3D
 437        self.labelParamValue5.Location = Point(294, 304)
 438        self.labelParamValue5.Name = "labelParamValue5"
 439        self.labelParamValue5.Size = Size(67, 16)
 440        self.labelParamValue5.TabIndex = 23
 441        self.labelParamValue5.Text = "Value"
 442        self.labelParamValue5.TextAlign = ContentAlignment.TopCenter
 443        # 
 444        # trackbarSlider5
 445        # 
 446        self.trackbarSlider5.Location = Point(426, 304)
 447        self.trackbarSlider5.Name = "trackbarSlider5"
 448        self.trackbarSlider5.Size = Size(195, 45)
 449        self.trackbarSlider5.TabIndex = 24
 450        self.trackbarSlider5.Text = "Slider1"
 451        self.trackbarSlider5.TickStyle = TickStyle.None
 452        self.trackbarSlider5.Scroll += self.trackbarSliderScroll
 453        # 
 454        # labelParamMin5
 455        # 
 456        self.labelParamMin5.Location = Point(366, 304)
 457        self.labelParamMin5.Name = "labelParamMin5"
 458        self.labelParamMin5.Size = Size(60, 16)
 459        self.labelParamMin5.TabIndex = 25
 460        self.labelParamMin5.Text = "min"
 461        self.labelParamMin5.TextAlign = ContentAlignment.TopCenter
 462        # 
 463        # labelParamMax5
 464        # 
 465        self.labelParamMax5.Location = Point(627, 312)
 466        self.labelParamMax5.Name = "labelParamMax5"
 467        self.labelParamMax5.Size = Size(52, 13)
 468        self.labelParamMax5.TabIndex = 26
 469        self.labelParamMax5.Text = "max"
 470        self.labelParamMax5.TextAlign = ContentAlignment.TopCenter
 471        # 
 472        # labelParamName6
 473        # 
 474        self.labelParamName6.Location = Point(169, 352)
 475        self.labelParamName6.Name = "labelParamName6"
 476        self.labelParamName6.Size = Size(117, 13)
 477        self.labelParamName6.TabIndex = 27
 478        self.labelParamName6.TextAlign = ContentAlignment.TopRight
 479        # 
 480        # labelParamValue6
 481        # 
 482        self.labelParamValue6.BorderStyle = BorderStyle.Fixed3D
 483        self.labelParamValue6.Location = Point(294, 352)
 484        self.labelParamValue6.Name = "labelParamValue6"
 485        self.labelParamValue6.Size = Size(67, 16)
 486        self.labelParamValue6.TabIndex = 28
 487        self.labelParamValue6.Text = "Value"
 488        self.labelParamValue6.TextAlign = ContentAlignment.TopCenter
 489        # 
 490        # trackbarSlider6
 491        # 
 492        self.trackbarSlider6.Location = Point(426, 352)
 493        self.trackbarSlider6.Name = "trackbarSlider6"
 494        self.trackbarSlider6.Size = Size(195, 45)
 495        self.trackbarSlider6.TabIndex = 29
 496        self.trackbarSlider6.Text = "Slider1"
 497        self.trackbarSlider6.TickStyle = TickStyle.None
 498        self.trackbarSlider6.Scroll += self.trackbarSliderScroll
 499        # 
 500        # labelParamMin6
 501        # 
 502        self.labelParamMin6.Location = Point(366, 352)
 503        self.labelParamMin6.Name = "labelParamMin6"
 504        self.labelParamMin6.Size = Size(60, 16)
 505        self.labelParamMin6.TabIndex = 30
 506        self.labelParamMin6.Text = "min"
 507        self.labelParamMin6.TextAlign = ContentAlignment.TopCenter
 508        # 
 509        # labelParamMax6
 510        # 
 511        self.labelParamMax6.Location = Point(627, 352)
 512        self.labelParamMax6.Name = "labelParamMax6"
 513        self.labelParamMax6.Size = Size(52, 13)
 514        self.labelParamMax6.TabIndex = 31
 515        self.labelParamMax6.Text = "max"
 516        self.labelParamMax6.TextAlign = ContentAlignment.TopCenter
 517        # 
 518        # radiobuttonTriangle
 519        # 
 520        self.radiobuttonTriangle.Location = Point(16, 16)
 521        self.radiobuttonTriangle.Name = "radiobuttonTriangle"
 522        self.radiobuttonTriangle.Size = Size(69, 16)
 523        self.radiobuttonTriangle.TabIndex = 32
 524        self.radiobuttonTriangle.Text = "Triangle"
 525        self.radiobuttonTriangle.CheckedChanged += self.trackbarSliderScroll
 526        # 
 527        # radiobuttonSquare
 528        # 
 529        self.radiobuttonSquare.Location = Point(88, 16)
 530        self.radiobuttonSquare.Name = "radiobuttonSquare"
 531        self.radiobuttonSquare.Size = Size(64, 16)
 532        self.radiobuttonSquare.TabIndex = 33
 533        self.radiobuttonSquare.Text = "Square"
 534        self.radiobuttonSquare.CheckedChanged += self.trackbarSliderScroll
 535        # 
 536        # radiobuttonRadioSine
 537        # 
 538        self.radiobuttonRadioSine.Location = Point(152, 16)
 539        self.radiobuttonRadioSine.Name = "radiobuttonRadioSine"
 540        self.radiobuttonRadioSine.Size = Size(48, 16)
 541        self.radiobuttonRadioSine.TabIndex = 34
 542        self.radiobuttonRadioSine.Text = "Sine"
 543        self.radiobuttonRadioSine.CheckedChanged += self.trackbarSliderScroll
 544
 545	# 
 546        # buttonOpen
 547        # 
 548        self.buttonOpen.Location = Point(12, 12)
 549        self.buttonOpen.Name = "buttonOpen"
 550        self.buttonOpen.TabIndex = 47
 551        self.buttonOpen.Text = "&Open File"
 552        self.buttonOpen.Click += self.buttonOpen_Click
 553        # 
 554        # labelTextFilename
 555        # 
 556        self.labelTextFilename.BorderStyle = BorderStyle.Fixed3D
 557        self.labelTextFilename.Location = Point(94, 14)
 558        self.labelTextFilename.Name = "labelTextFilename"
 559        self.labelTextFilename.Size = Size(595, 20)
 560        self.labelTextFilename.TabIndex = 48
 561        self.labelTextFilename.Text = "Filename"
 562        self.labelTextFilename.TextAlign = ContentAlignment.MiddleLeft
 563        # 
 564        # labelStatic2
 565        # 
 566        self.labelStatic2.Location = Point(19, 44)
 567        self.labelStatic2.Name = "labelStatic2"
 568        self.labelStatic2.Size = Size(67, 16)
 569        self.labelStatic2.TabIndex = 49
 570        self.labelStatic2.Text = "Status"
 571        # 
 572        # labelTextStatus
 573        # 
 574        self.labelTextStatus.BorderStyle = BorderStyle.Fixed3D
 575        self.labelTextStatus.Location = Point(94, 44)
 576        self.labelTextStatus.Name = "labelTextStatus"
 577        self.labelTextStatus.Size = Size(595, 20)
 578        self.labelTextStatus.TabIndex = 50
 579        self.labelTextStatus.Text = "No file loaded."
 580        self.labelTextStatus.TextAlign = ContentAlignment.MiddleLeft
 581        # 
 582        # checkboxLoop
 583        # 
 584        self.checkboxLoop.Location = Point(42, 376)
 585        self.checkboxLoop.Name = "checkboxLoop"
 586        self.checkboxLoop.Size = Size(86, 16)
 587        self.checkboxLoop.TabIndex = 51
 588        self.checkboxLoop.Text = "&Loop Sound"
 589        self.checkboxLoop.CheckedChanged += self.checkboxLoop_CheckedChanged
 590        # 
 591        # buttonPlay
 592        # 
 593        self.buttonPlay.Location = Point(10, 400)
 594        self.buttonPlay.Name = "buttonPlay"
 595        self.buttonPlay.Size = Size(67, 23)
 596        self.buttonPlay.TabIndex = 52
 597        self.buttonPlay.Text = "&Play"
 598        self.buttonPlay.Click += self.buttonPlay_Click
 599        # 
 600        # buttonStop
 601        # 
 602        self.buttonStop.Location = Point(87, 400)
 603        self.buttonStop.Name = "buttonStop"
 604        self.buttonStop.Size = Size(67, 23)
 605        self.buttonStop.TabIndex = 53
 606        self.buttonStop.Text = "&Stop"
 607        self.buttonStop.Enabled = False
 608        self.buttonStop.Click += self.buttonStop_Click
 609        # 
 610        # labelStatic3
 611        # 
 612        self.labelStatic3.BorderStyle = BorderStyle.Fixed3D
 613        self.labelStatic3.Location = Point(372, 88)
 614        self.labelStatic3.Name = "labelStatic3"
 615        self.labelStatic3.Size = Size(52, 16)
 616        self.labelStatic3.TabIndex = 62
 617        self.labelStatic3.Text = "Min"
 618        self.labelStatic3.TextAlign = ContentAlignment.TopCenter
 619        # 
 620        # labelStatic4
 621        # 
 622        self.labelStatic4.BorderStyle = BorderStyle.Fixed3D
 623        self.labelStatic4.Location = Point(627, 88)
 624        self.labelStatic4.Name = "labelStatic4"
 625        self.labelStatic4.Size = Size(52, 16)
 626        self.labelStatic4.TabIndex = 64
 627        self.labelStatic4.Text = "Max"
 628        self.labelStatic4.TextAlign = ContentAlignment.TopCenter
 629        # 
 630        # radiobuttonRadioNeg180
 631        # 
 632        self.radiobuttonRadioNeg180.Location = Point(16, 16)
 633        self.radiobuttonRadioNeg180.Name = "radiobuttonRadioNeg180"
 634        self.radiobuttonRadioNeg180.Size = Size(45, 16)
 635        self.radiobuttonRadioNeg180.TabIndex = 65
 636        self.radiobuttonRadioNeg180.Text = "-180"
 637        self.radiobuttonRadioNeg180.CheckedChanged += self.trackbarSliderScroll
 638        # 
 639        # radiobuttonRadioNeg90
 640        # 
 641        self.radiobuttonRadioNeg90.Location = Point(72, 16)
 642        self.radiobuttonRadioNeg90.Name = "radiobuttonRadioNeg90"
 643        self.radiobuttonRadioNeg90.Size = Size(39, 16)
 644        self.radiobuttonRadioNeg90.TabIndex = 66
 645        self.radiobuttonRadioNeg90.Text = "-90"
 646        self.radiobuttonRadioNeg90.CheckedChanged += self.trackbarSliderScroll
 647        # 
 648        # radiobuttonRadioZero
 649        # 
 650        self.radiobuttonRadioZero.Location = Point(120, 16)
 651        self.radiobuttonRadioZero.Name = "radiobuttonRadioZero"
 652        self.radiobuttonRadioZero.Size = Size(30, 16)
 653        self.radiobuttonRadioZero.TabIndex = 67
 654        self.radiobuttonRadioZero.Text = "0"
 655        self.radiobuttonRadioZero.CheckedChanged += self.trackbarSliderScroll
 656        # 
 657        # radiobuttonRadio90
 658        # 
 659        self.radiobuttonRadio90.Location = Point(152, 16)
 660        self.radiobuttonRadio90.Name = "radiobuttonRadio90"
 661        self.radiobuttonRadio90.Size = Size(36, 16)
 662        self.radiobuttonRadio90.TabIndex = 68
 663        self.radiobuttonRadio90.Text = "90"
 664        self.radiobuttonRadio90.CheckedChanged += self.trackbarSliderScroll
 665        # 
 666        # radiobuttonRadio180
 667        # 
 668        self.radiobuttonRadio180.Location = Point(200, 16)
 669        self.radiobuttonRadio180.Name = "radiobuttonRadio180"
 670        self.radiobuttonRadio180.Size = Size(42, 16)
 671        self.radiobuttonRadio180.TabIndex = 69
 672        self.radiobuttonRadio180.Text = "180"
 673        self.radiobuttonRadio180.CheckedChanged += self.trackbarSliderScroll
 674
 675        # 
 676        # labelTextFilename
 677        # 
 678        self.labelTextFilename.BorderStyle = BorderStyle.Fixed3D
 679        self.labelTextFilename.Location = Point(94, 14)
 680        self.labelTextFilename.Name = "labelTextFilename"
 681        self.labelTextFilename.Size = Size(595, 20)
 682        self.labelTextFilename.TabIndex = 48
 683        self.labelTextFilename.Text = "Filename"
 684        self.labelTextFilename.TextAlign = ContentAlignment.MiddleLeft
 685        # 
 686        # labelStatic2
 687        # 
 688        self.labelStatic2.Location = Point(19, 44)
 689        self.labelStatic2.Name = "labelStatic2"
 690        self.labelStatic2.Size = Size(67, 16)
 691        self.labelStatic2.TabIndex = 49
 692        self.labelStatic2.Text = "Status"
 693        # 
 694        # labelTextStatus
 695        # 
 696        self.labelTextStatus.BorderStyle = BorderStyle.Fixed3D
 697        self.labelTextStatus.Location = Point(94, 44)
 698        self.labelTextStatus.Name = "labelTextStatus"
 699        self.labelTextStatus.Size = Size(595, 20)
 700        self.labelTextStatus.TabIndex = 50
 701        self.labelTextStatus.Text = "No file loaded."
 702        self.labelTextStatus.TextAlign = ContentAlignment.MiddleLeft
 703        # 
 704        # checkboxLoop
 705        # 
 706        self.checkboxLoop.Location = Point(42, 376)
 707        self.checkboxLoop.Name = "checkboxLoop"
 708        self.checkboxLoop.Size = Size(86, 16)
 709        self.checkboxLoop.TabIndex = 51
 710        self.checkboxLoop.Text = "&Loop Sound"
 711        self.checkboxLoop.CheckedChanged += self.checkboxLoop_CheckedChanged
 712        # 
 713        # buttonPlay
 714        # 
 715        self.buttonPlay.Location = Point(10, 400)
 716        self.buttonPlay.Name = "buttonPlay"
 717        self.buttonPlay.Size = Size(67, 23)
 718        self.buttonPlay.TabIndex = 52
 719        self.buttonPlay.Text = "&Play"
 720        self.buttonPlay.Click += self.buttonPlay_Click
 721        # 
 722        # buttonStop
 723        # 
 724        self.buttonStop.Location = Point(87, 400)
 725        self.buttonStop.Name = "buttonStop"
 726        self.buttonStop.Size = Size(67, 23)
 727        self.buttonStop.TabIndex = 53
 728        self.buttonStop.Text = "&Stop"
 729        self.buttonStop.Enabled = False
 730        self.buttonStop.Click += self.buttonStop_Click
 731        # 
 732        # labelStatic3
 733        # 
 734        self.labelStatic3.BorderStyle = BorderStyle.Fixed3D
 735        self.labelStatic3.Location = Point(372, 88)
 736        self.labelStatic3.Name = "labelStatic3"
 737        self.labelStatic3.Size = Size(52, 16)
 738        self.labelStatic3.TabIndex = 62
 739        self.labelStatic3.Text = "Min"
 740        self.labelStatic3.TextAlign = ContentAlignment.TopCenter
 741        # 
 742        # labelStatic4
 743        # 
 744        self.labelStatic4.BorderStyle = BorderStyle.Fixed3D
 745        self.labelStatic4.Location = Point(627, 88)
 746        self.labelStatic4.Name = "labelStatic4"
 747        self.labelStatic4.Size = Size(52, 16)
 748        self.labelStatic4.TabIndex = 64
 749        self.labelStatic4.Text = "Max"
 750        self.labelStatic4.TextAlign = ContentAlignment.TopCenter
 751        # 
 752        # radiobuttonRadioNeg180
 753        # 
 754        self.radiobuttonRadioNeg180.Location = Point(16, 16)
 755        self.radiobuttonRadioNeg180.Name = "radiobuttonRadioNeg180"
 756        self.radiobuttonRadioNeg180.Size = Size(45, 16)
 757        self.radiobuttonRadioNeg180.TabIndex = 65
 758        self.radiobuttonRadioNeg180.Text = "-180"
 759        self.radiobuttonRadioNeg180.CheckedChanged += self.trackbarSliderScroll
 760        # 
 761        # radiobuttonRadioNeg90
 762        # 
 763        self.radiobuttonRadioNeg90.Location = Point(72, 16)
 764        self.radiobuttonRadioNeg90.Name = "radiobuttonRadioNeg90"
 765        self.radiobuttonRadioNeg90.Size = Size(39, 16)
 766        self.radiobuttonRadioNeg90.TabIndex = 66
 767        self.radiobuttonRadioNeg90.Text = "-90"
 768        self.radiobuttonRadioNeg90.CheckedChanged += self.trackbarSliderScroll
 769        # 
 770        # radiobuttonRadioZero
 771        # 
 772        self.radiobuttonRadioZero.Location = Point(120, 16)
 773        self.radiobuttonRadioZero.Name = "radiobuttonRadioZero"
 774        self.radiobuttonRadioZero.Size = Size(30, 16)
 775        self.radiobuttonRadioZero.TabIndex = 67
 776        self.radiobuttonRadioZero.Text = "0"
 777        self.radiobuttonRadioZero.CheckedChanged += self.trackbarSliderScroll
 778        # 
 779        # radiobuttonRadio90
 780        # 
 781        self.radiobuttonRadio90.Location = Point(152, 16)
 782        self.radiobuttonRadio90.Name = "radiobuttonRadio90"
 783        self.radiobuttonRadio90.Size = Size(36, 16)
 784        self.radiobuttonRadio90.TabIndex = 68
 785        self.radiobuttonRadio90.Text = "90"
 786        self.radiobuttonRadio90.CheckedChanged += self.trackbarSliderScroll
 787        # 
 788        # radiobuttonRadio180
 789        # 
 790        self.radiobuttonRadio180.Location = Point(200, 16)
 791        self.radiobuttonRadio180.Name = "radiobuttonRadio180"
 792        self.radiobuttonRadio180.Size = Size(42, 16)
 793        self.radiobuttonRadio180.TabIndex = 69
 794        self.radiobuttonRadio180.Text = "180"
 795        self.radiobuttonRadio180.CheckedChanged += self.trackbarSliderScroll
 796
 797        # 
 798        # buttonDelete
 799        # 
 800        self.buttonDelete.Location = Point(40, 248)
 801        self.buttonDelete.Name = "buttonDelete"
 802        self.buttonDelete.Size = Size(64, 24)
 803        self.buttonDelete.TabIndex = 3
 804        self.buttonDelete.Text = "Delete"
 805        self.buttonDelete.Click += self.buttonDelete_Click
 806        # 
 807        # listboxEffects
 808        # 
 809        self.listboxEffects.Location = Point(8, 48)
 810        self.listboxEffects.Name = "listboxEffects"
 811        self.listboxEffects.Size = Size(128, 186)
 812        self.listboxEffects.TabIndex = 2
 813        self.listboxEffects.KeyUp += KeyEventHandler(self.listboxEffects_KeyUp)
 814        self.listboxEffects.SelectedIndexChanged += self.listboxEffects_SelectedIndexChanged
 815
 816        # 
 817        # timer1
 818        # 
 819        self.timer1.Interval = 50
 820        self.timer1.Tick += self.timer1_Tick
 821
 822        # 
 823        # groupboxFrameWaveform
 824        # 
 825        self.groupboxFrameWaveform.Controls.AddRange(Array[Control] ([\
 826            self.radiobuttonSquare,\
 827            self.radiobuttonTriangle,\
 828            self.radiobuttonRadioSine\
 829        ]))
 830        self.groupboxFrameWaveform.Location = Point(180, 400)
 831        self.groupboxFrameWaveform.Name = "groupboxFrameWaveform"
 832        self.groupboxFrameWaveform.Size = Size(225, 42)
 833        self.groupboxFrameWaveform.TabIndex = 35
 834        self.groupboxFrameWaveform.TabStop = False
 835        self.groupboxFrameWaveform.Text = "Waveform"
 836
 837# 
 838        # groupboxFramePhase
 839        # 
 840        self.groupboxFramePhase.Controls.AddRange(Array[Control] ([
 841         self.radiobuttonRadioNeg180,
 842         self.radiobuttonRadioNeg90,
 843         self.radiobuttonRadioZero,
 844         self.radiobuttonRadio90,
 845         self.radiobuttonRadio180
 846        ]))
 847        self.groupboxFramePhase.Location = Point(420, 400)
 848        self.groupboxFramePhase.Name = "groupboxFramePhase"
 849        self.groupboxFramePhase.Size = Size(247, 42)
 850        self.groupboxFramePhase.TabIndex = 63
 851        self.groupboxFramePhase.TabStop = False
 852        self.groupboxFramePhase.Text = "Phase (Degrees)"
 853
 854	    # 
 855        # groupboxEffects
 856        # 
 857        self.groupboxEffects.Controls.AddRange(Array[Control] ([
 858	      self.buttonDelete,
 859	      self.listboxEffects,
 860	      self.comboEffects
 861	    ]))
 862        self.groupboxEffects.Location = Point(8, 80)
 863        self.groupboxEffects.Name = "groupboxEffects"
 864        self.groupboxEffects.Size = Size(144, 280)
 865        self.groupboxEffects.TabIndex = 71
 866        self.groupboxEffects.TabStop = False
 867        self.groupboxEffects.Text = "Effects"
 868
 869        # 
 870        # comboEffects
 871        # 
 872        self.comboEffects.DropDownStyle = ComboBoxStyle.DropDownList
 873        self.comboEffects.Items.AddRange(Array[Object] ([
 874          "Chorus",
 875          "Compressor",
 876          "Distortion",
 877          "Echo",
 878          "Flanger",
 879          "Gargle",
 880          "Waves Reverb",
 881          "ParamEq"
 882    	]))
 883        self.comboEffects.Location = Point(8, 16)
 884        self.comboEffects.Name = "comboEffects"
 885        self.comboEffects.Size = Size(128, 21)
 886        self.comboEffects.TabIndex = 1
 887        self.comboEffects.SelectedValueChanged += self.comboEffects_SelectedValueChanged
 888
 889        self.Controls.AddRange(Array[Control] ([
 890              self.groupboxEffects,
 891              self.buttonOk,
 892              self.labelParamName1,
 893              self.labelParamValue1,
 894              self.trackbarSlider1,
 895              self.labelParamMin1,
 896              self.labelParamMax1,
 897              self.labelParamName2,
 898              self.labelParamValue2,
 899              self.trackbarSlider2,
 900              self.labelParamMin2,
 901              self.labelParamMax2,
 902              self.labelParamName3,
 903              self.labelParamValue3,
 904              self.trackbarSlider3,
 905              self.labelParamMin3,
 906              self.labelParamMax3,
 907              self.labelParamName4,
 908              self.labelParamValue4,
 909              self.trackbarSlider4,
 910              self.labelParamMin4,
 911              self.labelParamMax4,
 912              self.labelParamName5,
 913              self.labelParamValue5,
 914              self.trackbarSlider5,
 915              self.labelParamMin5,
 916              self.labelParamMax5,
 917              self.labelParamName6,
 918              self.labelParamValue6,
 919              self.trackbarSlider6,
 920              self.labelParamMin6,
 921              self.labelParamMax6,
 922              self.buttonOpen,
 923              self.labelTextFilename,
 924              self.labelStatic2,
 925              self.labelTextStatus,
 926              self.checkboxLoop,
 927              self.buttonPlay,
 928              self.buttonStop,
 929              self.labelStatic3,
 930              self.labelStatic4,
 931              self.groupboxFrameWaveform,
 932              self.groupboxFramePhase,
 933              self.groupboxFrame
 934        ]))
 935        # Form
 936        self.AcceptButton = self.buttonOk
 937        self.ClientSize = Size(700, 472)
 938        self.FormBorderStyle = FormBorderStyle.FixedSingle
 939        self.Location = Point(150, 160)
 940        self.MaximizeBox = False
 941        self.Name = "MainForm"
 942        self.Text = "SoundFX - Sound effects applied to Device.SecondaryBuffer"
 943        self.Closing += CancelEventHandler(self.MainForm_Closing)
 944        self.trackbarSlider1.EndInit()
 945        self.trackbarSlider2.EndInit()
 946        self.trackbarSlider3.EndInit()
 947        self.trackbarSlider4.EndInit()
 948        self.trackbarSlider5.EndInit()
 949        self.trackbarSlider6.EndInit()
 950        self.groupboxFrameWaveform.ResumeLayout(False)
 951        self.groupboxFramePhase.ResumeLayout(False)
 952        self.groupboxEffects.ResumeLayout(False)
 953        self.ResumeLayout(False)
 954
 955    def trackbarSliderScroll(self, sender, e):
 956        # We're ignoring settings right now
 957        if self.isIgnoringSettings:
 958            return
 959
 960        eff = self.effectDescription[self.currentIndex]
 961        efftype = eff.Effect.GetType()
 962
 963        if (clr.GetClrType(ChorusEffect) == efftype):
 964            temp = EffectsChorus()
 965            temp.WetDryMix = self.trackbarSlider1.Value
 966            temp.Frequency = self.trackbarSlider4.Value
 967            temp.Feedback = self.trackbarSlider3.Value
 968            temp.Depth = self.trackbarSlider2.Value
 969            temp.Delay = self.trackbarSlider5.Value
 970            
 971            if (True == self.radiobuttonRadioSine.Checked):
 972                temp.Waveform = ChorusEffect.WaveSin
 973            else:
 974                temp.Waveform = ChorusEffect.WaveTriangle
 975            
 976            if (True == self.radiobuttonRadioNeg180.Checked):
 977                temp.Phase = ChorusEffect.PhaseNegative180
 978            elif (True == self.radiobuttonRadioNeg90.Checked):
 979                temp.Phase = ChorusEffect.PhaseNegative90
 980            elif (True == self.radiobuttonRadioZero.Checked):
 981                temp.Phase = ChorusEffect.PhaseZero
 982            elif (True == self.radiobuttonRadio90.Checked):
 983                temp.Phase = ChorusEffect.Phase90
 984            elif (True == self.radiobuttonRadio180.Checked):
 985                temp.Phase = ChorusEffect.Phase180
 986
 987            eff.EffectSettings = temp
 988            eff.Effect.AllParameters = temp            
 989
 990        elif (clr.GetClrType(CompressorEffect) == efftype):
 991            temp = EffectsCompressor()
 992            temp.Gain = self.trackbarSlider1.Value
 993            temp.Attack = self.trackbarSlider2.Value
 994            temp.Release = self.trackbarSlider3.Value
 995            temp.Threshold = self.trackbarSlider4.Value
 996            temp.Ratio = self.trackbarSlider5.Value
 997            temp.Predelay = self.trackbarSlider6.Value
 998
 999            eff.EffectSettings = temp
1000            eff.Effect.AllParameters = temp
1001        elif (clr.GetClrType(DistortionEffect) == efftype):
1002            temp = EffectsDistortion()
1003            temp.Gain = self.trackbarSlider1.Value
1004            temp.Edge = self.trackbarSlider2.Value
1005            temp.PostEqCenterFrequency = self.trackbarSlider3.Value
1006            temp.PostEqBandwidth = self.trackbarSlider4.Value
1007            temp.PreLowpassCutoff = self.trackbarSlider5.Value
1008
1009            eff.EffectSettings = temp
1010            eff.Effect.AllParameters = temp
1011        elif (clr.GetClrType(EchoEffect) == efftype):
1012            temp = EffectsEcho()
1013            temp.WetDryMix = self.trackbarSlider1.Value
1014            temp.Feedback = self.trackbarSlider2.Value
1015            temp.LeftDelay = self.trackbarSlider3.Value
1016            temp.RightDelay = self.trackbarSlider4.Value
1017            temp.PanDelay = self.trackbarSlider5.Value
1018
1019            eff.EffectSettings = temp
1020            eff.Effect.AllParameters = temp
1021        elif (clr.GetClrType(FlangerEffect) == efftype):
1022            temp = EffectsFlanger()
1023            temp.WetDryMix = self.trackbarSlider1.Value
1024            temp.Depth = self.trackbarSlider2.Value
1025            temp.Feedback = self.trackbarSlider3.Value
1026            temp.Frequency = self.trackbarSlider4.Value
1027            temp.Delay = self.trackbarSlider5.Value
1028        
1029            if (True == self.radiobuttonRadioSine.Checked):
1030                temp.Waveform = FlangerEffect.WaveSin
1031            else:
1032                temp.Waveform = FlangerEffect.WaveTriangle
1033
1034            if (True == self.radiobuttonRadioNeg180.Checked):
1035                temp.Phase = ChorusEffect.PhaseNegative180
1036            elif (True == self.radiobuttonRadioNeg90.Checked):
1037                temp.Phase = ChorusEffect.PhaseNegative90
1038            elif (True == self.radiobuttonRadioZero.Checked):
1039                temp.Phase = ChorusEffect.PhaseZero
1040            elif (True == self.radiobuttonRadio90.Checked):
1041                temp.Phase = ChorusEffect.Phase90
1042            elif (True == self.radiobuttonRadio180.Checked):
1043                temp.Phase = ChorusEffect.Phase180
1044
1045            eff.EffectSettings = temp
1046            eff.Effect.AllParameters = temp
1047
1048        elif (clr.GetClrType(GargleEffect) == efftype):
1049            temp = EffectsGargle()
1050            temp.RateHz = self.trackbarSlider1.Value
1051            if (self.radiobuttonSquare.Checked):
1052                temp.WaveShape = GargleEffect.WaveSquare
1053            else:
1054                temp.WaveShape = GargleEffect.WaveTriangle
1055
1056            if (True == self.radiobuttonSquare.Checked):
1057                temp.WaveShape = GargleEffect.WaveSquare
1058            else:
1059                temp.WaveShape = GargleEffect.WaveTriangle
1060
1061            eff.EffectSettings = temp
1062            eff.Effect.AllParameters = temp
1063
1064        elif (clr.GetClrType(ParamEqEffect) == efftype):
1065            temp = EffectsParamEq()
1066            temp.Center = self.trackbarSlider1.Value
1067            temp.Bandwidth = self.trackbarSlider2.Value
1068            temp.Gain = self.trackbarSlider3.Value
1069
1070            eff.EffectSettings = temp
1071            eff.Effect.AllParameters = temp
1072
1073        elif (clr.GetClrType(WavesReverbEffect) == efftype):
1074            temp = EffectsWavesReverb()
1075            temp.InGain = self.trackbarSlider1.Value
1076            temp.ReverbMix = self.trackbarSlider2.Value
1077            temp.ReverbTime = (.001 * self.trackbarSlider3.Value)
1078            temp.HighFrequencyRtRatio = (.001 * self.trackbarSlider4.Value)
1079
1080            eff.EffectSettings = temp
1081            eff.Effect.AllParameters = temp
1082
1083        self.effectDescription[self.currentIndex] = eff
1084        self.UpdateUI(False)
1085
1086    def buttonOk_Click(self, sender, e):
1087        """
1088        ???????
1089        """
1090        self.Close()
1091
1092    def buttonOpen_Click(self, sender, e):
1093        """
1094        ???????
1095        """
1096        description = BufferDescription()
1097        ofd = OpenFileDialog()
1098
1099        self.labelTextStatus.Text = "Loading file..."
1100
1101        # ?????? (?? C:\WINDOWS\MEDIA)
1102        if ('' == self.path):
1103            self.path = Environment.SystemDirectory.Substring(0, Environment.SystemDirectory.LastIndexOf("\\")) + "\\media"
1104
1105        ofd.DefaultExt = ".wav"
1106        ofd.Filter = "Wave Files|*.wav|All Files|*.*"
1107        ofd.FileName = self.fileName
1108        ofd.InitialDirectory = self.path
1109
1110        if (not None is self.applicationBuffer):
1111            self.applicationBuffer.Stop()
1112            self.applicationBuffer.SetCurrentPosition(0)
1113
1114
1115        # ????
1116        if (DialogResult.Cancel == ofd.ShowDialog(self)):
1117            if(not None is self.applicationBuffer):
1118                self.applicationBuffer.Dispose()
1119
1120            self.labelTextStatus.Text = "No file loaded."
1121            return
1122
1123        self.fileName = ''
1124
1125        description.ControlEffects = True
1126    
1127        # ?????? SecondaryBuffer
1128        try:
1129            self.applicationBuffer = SecondaryBuffer(ofd.FileName, description,  self.applicationDevice)
1130        except(BufferTooSmallException): 
1131            self.labelTextStatus.Text = "Wave file is too small to be used with effects."
1132            return
1133        except(FormatException):
1134            # Invalid file was used. Managed DirectSound tries to convert any files less than
1135            # 8 bit to 8 bit. Some drivers don't support this conversion, so make sure to
1136            # catch the FormatException if it's thrown.
1137            self.labelTextStatus.Text = "Failed to create SecondaryBuffer from selected file."
1138            return
1139
1140        
1141        # ????
1142        if (not None is self.applicationBuffer):
1143            self.fileName = ofd.FileName
1144            self.path =  self.fileName.Substring(0, self.fileName.LastIndexOf("\\"))
1145
1146        self.labelTextFilename.Text = self.fileName
1147
1148
1149
1150    def checkboxLoop_CheckedChanged(self, sender, e):
1151        """
1152        ???????????
1153        """
1154        self.shouldLoop = self.checkboxLoop.Checked
1155
1156
1157    def buttonPlay_Click(self, sender, e):
1158        """
1159        ???????
1160        """
1161        if (not None is self.applicationBuffer):
1162            self.applicationBuffer.Play(0, BufferPlayFlags.Looping if self.shouldLoop else BufferPlayFlags.Default)
1163            self.timer1.Enabled = True
1164            self.buttonStop.Enabled = True
1165            self.buttonPlay.Enabled = False
1166            self.comboEffects.Enabled = False
1167            self.labelTextStatus.Text="Sound playing."
1168
1169    def buttonStop_Click(self, sender, e):
1170        """
1171        ???????
1172        """
1173        if (not None is self.applicationBuffer):
1174            if self.applicationBuffer.Status.Playing:
1175                self.applicationBuffer.Stop()
1176                self.applicationBuffer.SetCurrentPosition(0)
1177                self.timer1.Enabled = False
1178                self.buttonStop.Enabled = False
1179                self.buttonPlay.Enabled = True
1180                self.comboEffects.Enabled = True
1181                self.labelTextStatus.Text="Sound stopped."
1182
1183
1184    def buttonDelete_Click(self, sender, e):
1185        """
1186        ???????
1187        """
1188        self.DeleteEffect()
1189
1190    def AddEffect(self, temp):
1191        """
1192        ????
1193        """
1194        ret = None
1195        fx = None      
1196        WasPlaying = False
1197        count = 0
1198
1199        if (not None is temp):
1200            #fx = Array.CreateInstance(EffectDescription, len(temp))
1201            #fx = []
1202            count = len(temp)
1203
1204        if (True == self.applicationBuffer.Status.Playing):
1205            WasPlaying = True
1206        
1207        self.applicationBuffer.Stop()
1208        
1209        # Store the current params for each effect.
1210        fx = [elem.description for elem in temp]
1211
1212        try:
1213            ret = self.applicationBuffer.SetEffects( Array[EffectDescription](fx) )
1214        except DirectXException as inst:
1215            
1216            labelTextStatus.Text = "Unable to set effect on the buffer. Some effects can't be set on 8 bit wave files."
1217
1218            # Revert to the last valid effects.
1219            if (len(temp) <= 1):
1220                return False
1221
1222            fx = Array.CreateInstance(EffectDescription, len(temp) -1)
1223            for i in range(count - 1):
1224                fx[i] = temp[i].description
1225
1226            try:
1227                self.applicationBuffer.SetEffects(fx)
1228            except(DirectXException):
1229                pass
1230
1231            return False
1232
1233        
1234        # Restore the params for each effect.
1235        for i in range(count):
1236            eff = EffectInfo()
1237
1238            eff.Effect = self.applicationBuffer.GetEffects(i)
1239            eff.EffectSettings = temp[i].EffectSettings
1240            eff.description = temp[i].description
1241
1242            efftype = eff.Effect.GetType()
1243
1244            if (clr.GetClrType(ChorusEffect) == efftype):
1245                if (not None is eff.EffectSettings):
1246                    eff.Effect.AllParameters = eff.EffectSettings
1247                else:
1248                    eff.EffectSettings = eff.Effect.AllParameters
1249            elif (clr.GetClrType ==efftype) :
1250                if (not None is eff.EffectSettings):
1251                    eff.Effect.AllParameters = eff.EffectSettings
1252                else:
1253                    eff.EffectSettings = eff.Effect.AllParameters
1254            elif (clr.GetClrType(DistortionEffect) == efftype):
1255                if (not None is eff.EffectSettings):
1256                    eff.Effect.AllParameters = eff.EffectSettings
1257                else:
1258                    eff.EffectSettings = eff.Effect.AllParameters
1259            elif (clr.GetClrType(EchoEffect) == efftype):
1260                if (not None is eff.EffectSettings):
1261                    eff.Effect.AllParameters = eff.EffectSettings
1262                else:
1263                    eff.EffectSettings = eff.Effect.AllParameters
1264            elif (clr.GetClrType(FlangerEffect) == efftype):
1265                 if (not None is eff.EffectSettings):
1266                     eff.Effect.AllParameters = eff.EffectSettings
1267                 else:
1268                     eff.EffectSettings = eff.Effect.AllParameters
1269            elif (clr.GetClrType(GargleEffect) == efftype):
1270                 if (not None is eff.EffectSettings):
1271                     eff.Effect.AllParameters = eff.EffectSettings
1272                 else:
1273                     eff.EffectSettings = eff.Effect.AllParameters
1274            elif (clr.GetClrType(ParamEqEffect) =

Large files files are truncated, but you can click here to view the full file