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

  1. // ModController.cpp : implementation file
  2. //
  3.  
  4. #include "stdafx.h"
  5. #include "tracker.h"
  6. #include "ModController.h"
  7. #include "isSynth.h"
  8. #include "isController.h"
  9.  
  10. #ifdef _DEBUG
  11. #define new DEBUG_NEW
  12. #undef THIS_FILE
  13. static char THIS_FILE[] = __FILE__;
  14. #endif
  15.  
  16.  
  17. #define FloatIntMAX 1024
  18. #define uFloatToInt(a) ((a)*1024)
  19. #define sFloatToInt(a) ((a)*1024+1024)
  20.  
  21. #define uIntToFloat(a) ((a)/1024.0f)
  22. #define sIntToFloat(a) (((a)-1024)/1024.0f)
  23.  
  24.  
  25. /////////////////////////////////////////////////////////////////////////////
  26. // CModController dialog
  27.  
  28.  
  29. CModController::CModController(CWnd* pParent /*=NULL*/)
  30.     : CModulateBaseDlg(CModController::IDD, pParent)
  31. {
  32.     //{{AFX_DATA_INIT(CModController)
  33.     //}}AFX_DATA_INIT
  34. }
  35.  
  36.  
  37. void CModController::DoDataExchange(CDataExchange* pDX)
  38. {
  39.     CModulateBaseDlg::DoDataExchange(pDX);
  40.     //{{AFX_DATA_MAP(CModController)
  41.     DDX_Control(pDX, IDC_STATIC_CUTOFFVAL, m_cutoffval);
  42.     DDX_Control(pDX, IDC_EDIT_CNTRNR, m_cntrnr);
  43.     DDX_Control(pDX, IDC_SLIDER_MOD_CNTR, m_cutoffslider);
  44.     //}}AFX_DATA_MAP
  45. }
  46.  
  47.  
  48. BEGIN_MESSAGE_MAP(CModController, CModulateBaseDlg)
  49.     //{{AFX_MSG_MAP(CModController)
  50.     ON_EN_MAXTEXT(IDC_EDIT_CNTRNR, OnMaxtextEditCntrnr)
  51.     ON_WM_HSCROLL()
  52.     //}}AFX_MSG_MAP
  53. END_MESSAGE_MAP()
  54.  
  55. /////////////////////////////////////////////////////////////////////////////
  56. // CModController message handlers
  57.  
  58. void CModController::OnMaxtextEditCntrnr() 
  59. {
  60.     // TODO: Add your control notification handler code here
  61.     isController*cntr;
  62.     cntr = (isController*)modulator;
  63.  
  64.     CString bla;
  65.     m_cntrnr.GetWindowText (bla);
  66.  
  67.     cntr->controllerNumber = atoi ((LPCSTR)bla);
  68.  
  69.     
  70. }
  71.  
  72. void CModController::OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar) 
  73. {
  74.     // TODO: Add your message handler code here and/or call default
  75.     isController*cntr;
  76.     cntr = (isController*)modulator;
  77.  
  78.     cntr->cutoff = uIntToFloat (m_cutoffslider.GetPos ());
  79.     CString bla;
  80.     bla.Format ("%5.4f",cntr->cutoff);
  81.     m_cutoffval.SetWindowText (bla);
  82.     
  83.     CModulateBaseDlg::OnHScroll(nSBCode, nPos, pScrollBar);
  84. }
  85.  
  86. BOOL CModController::OnInitDialog() 
  87. {
  88.     CModulateBaseDlg::OnInitDialog();
  89.     m_cutoffslider.SetRange (0,FloatIntMAX);
  90.     
  91.     // TODO: Add extra initialization here
  92.     
  93.     return TRUE;  // return TRUE unless you set the focus to a control
  94.                   // EXCEPTION: OCX Property Pages should return FALSE
  95. }
  96. void CModController::UpdateModulateData()
  97. {
  98.     isController*cntr;
  99.     cntr = (isController*)modulator;
  100.     
  101.     m_cutoffslider.SetPos (uFloatToInt(cntr->cutoff));
  102.     CString bla;
  103.     bla.Format ("%d",cntr->controllerNumber);
  104.     m_cntrnr.SetWindowText (bla);
  105.  
  106.     bla.Format ("%5.4f",cntr->cutoff);
  107.     m_cutoffval.SetWindowText (bla);
  108.     
  109. }
  110.