home *** CD-ROM | disk | FTP | other *** search
/ Large Pack of OldSkool DOS MOD Trackers / beaversweeper_v101.zip / src / SendFxDelay.cpp < prev    next >
C/C++ Source or Header  |  2003-01-06  |  3KB  |  134 lines

  1. // SendFxDelay.cpp : implementation file
  2. //
  3.  
  4. #include "stdafx.h"
  5. #include "tracker.h"
  6. #include "SendFxDelay.h"
  7.  
  8. #ifdef _DEBUG
  9. #define new DEBUG_NEW
  10. #undef THIS_FILE
  11. static char THIS_FILE[] = __FILE__;
  12. #endif
  13.  
  14. #include "isDelay.h"
  15.  
  16. /////////////////////////////////////////////////////////////////////////////
  17. // CSendFxDelay dialog
  18.  
  19.  
  20. CSendFxDelay::CSendFxDelay(CWnd* pParent /*=NULL*/)
  21.     : CDialog(CSendFxDelay::IDD, pParent)
  22. {
  23.     //{{AFX_DATA_INIT(CSendFxDelay)
  24.         // NOTE: the ClassWizard will add member initialization here
  25.     //}}AFX_DATA_INIT
  26.     m_delay = 0;
  27. }
  28.  
  29.  
  30. void CSendFxDelay::DoDataExchange(CDataExchange* pDX)
  31. {
  32.     CDialog::DoDataExchange(pDX);
  33.     //{{AFX_DATA_MAP(CSendFxDelay)
  34.         // NOTE: the ClassWizard will add DDX and DDV calls here
  35.     //}}AFX_DATA_MAP
  36. }
  37.  
  38.  
  39. BEGIN_MESSAGE_MAP(CSendFxDelay, CDialog)
  40.     //{{AFX_MSG_MAP(CSendFxDelay)
  41.     //}}AFX_MSG_MAP
  42. END_MESSAGE_MAP()
  43.  
  44. /////////////////////////////////////////////////////////////////////////////
  45. // CSendFxDelay message handlers
  46.  
  47. void CSendFxDelay::setDelay(isDelay *delay)
  48. {
  49.     m_delay = delay;
  50.  
  51.  
  52. }
  53.  
  54. static void WINAPI s_EFFECTSLIDER_CALLBACK(LPVOID passed, float newval)
  55. {
  56.     CSendFxDelay *p = (CSendFxDelay *) passed;
  57.     p->update();
  58. }
  59.  
  60. void CSendFxDelay::update(void)
  61. {
  62.     if (m_delay)
  63.         m_delay->Update();
  64. }
  65.  
  66.  
  67. BOOL CSendFxDelay::OnInitDialog() 
  68. {
  69.     CDialog::OnInitDialog();
  70.  
  71.     if (!m_delay)
  72.         return FALSE;
  73.     
  74.     // TODO: Add extra initialization here
  75.     // Position?
  76.     POINT p;
  77.     p.x = 10;    
  78.     int spacing = -1;
  79.     // TODO: Add your control notification handler code here
  80.     for (int i=0;i<8;i++) {
  81.         
  82.         if (i==0 || i == 4)
  83.             p.y = 30;
  84.  
  85.         if (i < 4) 
  86.             p.x = 10;
  87.         else
  88.             p.x = 350;
  89.  
  90.         m_sliders[i].Create( IDD_EFFECTSLIDER, this );    
  91.         m_sliders[i].setRange( 0, 1 );
  92.         WINDOWPLACEMENT pm;
  93.         m_sliders[i].SetWindowPos( 0, p.x, p.y, 0, 0, SWP_NOSIZE | SWP_SHOWWINDOW );
  94.         m_sliders[i].GetWindowPlacement( &pm );        
  95.         p.y += pm.rcNormalPosition.bottom - pm.rcNormalPosition.top + spacing;
  96.  
  97.         isDelay::DELAYTAP *tap;
  98.         if (i>3)
  99.             tap = &m_delay->right;
  100.         else
  101.             tap = &m_delay->left;
  102.  
  103.         switch (i%4) {
  104.             case 0:
  105.                 m_sliders[i].setTitle( _T("Delay") );
  106.                 m_sliders[i].setRange(0,128);
  107.                 m_sliders[i].setInt( (int*)&tap->delay );                
  108.                 break;
  109.             case 1:
  110.                 m_sliders[i].setTitle( _T("EchoLength") );
  111.                 m_sliders[i].setRange(0,128);
  112.                 m_sliders[i].setInt( (int*)&tap->echoLength );                
  113.                 break;
  114.             case 2:
  115.                 m_sliders[i].setTitle( _T("Volume") );
  116.                 m_sliders[i].setRange(-1,1);
  117.                 m_sliders[i].setFloat( &tap->volume );
  118.                 break;
  119.             case 3:
  120.                 m_sliders[i].setRange(-1,1);
  121.                 m_sliders[i].setTitle( _T("FeedBack") );
  122.                 m_sliders[i].setFloat( &tap->feedback );
  123.                 break;
  124.         }
  125.         m_sliders[i].setChangeCallback( s_EFFECTSLIDER_CALLBACK, this );
  126.     }
  127.  
  128.     
  129.     
  130.     
  131.     return TRUE;  // return TRUE unless you set the focus to a control
  132.                   // EXCEPTION: OCX Property Pages should return FALSE
  133. }
  134.