/*--------------------------------------------------------------------------------
'Nom du projet : Oscilloscope
'Outil : Visual C++ 6
'Nom du fichier: oscilloDlg.cpp
'Realisation:Mathieu Texier et Emmanuel Traineau
'Date: Juin 2003
'Responsable: Eric Meleiro
'--------------------------------------------------------------------------------
Explications : Fichier sur lequel sont réunis la plupart des fonctions permettant l'affichage et la gestion des dialogues de l'application.
*/
#include "stdafx.h"
#include "afx.h"
#include "conio.h"
#include "scope.h"
#include "Port.h"
#include "memoryfile.h"
#include "waveplay.h"
#include "wavedevcaps.h"
#include "oscillo.h"
#include "oscilloDlg.h"
#include "about.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
extern BYTE* pbufferEntree ;
extern BufferEntree;
bool Flg_action;
int m_volt;
int m_time;
int m_offset;
int m_ampli;
///////////////// Utility-Procs /////////////////////////////////////////
// Stop-Button
void CSoundrobberDlg::RemoteStop()
{
CWnd* child = GetDlgItem (IDC_BUTTON_STOP);
child->SendMessage (BM_SETSTATE, TRUE, 0L);
::Sleep (100);
child->SendMessage (BM_SETSTATE, FALSE, 0L);
OnButtonStop();
}
// Start-Button
void CSoundrobberDlg::RemoteStart()
{
CWnd* child = GetDlgItem (IDC_BUTTON_PLAY);
child->SendMessage (BM_SETSTATE, TRUE, 0L);
::Sleep (100);
child->SendMessage (BM_SETSTATE, FALSE, 0L);
OnButtonPlay();
}
// Stop/Start
void CSoundrobberDlg::Restart()
{
TempsDepartExecution = timeGetTime();
RemoteStop();
RemoteStart();
}
// inititalisation de l'affichage
void CSoundrobberDlg::ResetView()
{
m_mono = TRUE;
m_stereo = FALSE;
m_reverse = FALSE;
m_xor = FALSE;
m_add = FALSE;
m_mapper = TRUE;
m_8bits = TRUE;
m_fileend = 0;
m_filestart = 0;
m_position = 0;
//m_time = 1;
m_volt = 1;
m_ampli = 1;
m_offset = 1;
// Windows disable
CWnd *child = GetWindow (GW_CHILD);
while (child)
{
if (child != GetDlgItem (IDC_BUTTON_OPEN) && child != GetDlgItem (IDC_PICTURE))
child->EnableWindow (FALSE);
child = child->GetWindow (GW_HWNDNEXT);
}
GetDlgItem (IDC_BUTTON_ACQ)->EnableWindow (TRUE);
// Default-Caption malen
CString cs;
cs.LoadString (IDS_TITLE);
SetWindowText ((LPCSTR)cs);
UpdateData (FALSE);
}
/////////////////////////////////////////////////////////////////////////////
// CSoundrobberDlg dialog
CSoundrobberDlg::CSoundrobberDlg(CWnd* pParent /*=NULL*/)
: CDialog(CSoundrobberDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CSoundrobberDlg)
m_mono = FALSE;
m_stereo = FALSE;
m_reverse = FALSE;
m_fileend = 0;
m_filestart = 0;
// m_time = 0;
m_volt = 1;
m_offset = 1;
m_ampli = 1;
m_8bits = FALSE;
m_position = 0;
m_add = FALSE;
m_xor = FALSE;
m_addvalue = 0;
m_xorvalue = 0;
m_mapper = FALSE;
//}}AFX_DATA_INIT
// Note that LoadIcon does not require a subsequent DestroyIcon in Win32
m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
}
void CSoundrobberDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CSoundrobberDlg)
DDX_Control(pDX, IDC_SLIDER_START, m_slider_start);
DDX_Control(pDX, IDC_SLIDER_END, m_slider_end);
DDX_Control(pDX, IDC_PICTURE, m_scope);
DDX_Control(pDX, IDC_SPIN_TIME, m_spintime);
DDX_Control(pDX, IDC_SPIN_VOLT, m_spinvolt);
DDX_Control(pDX, IDC_SPIN_AMPLI, m_spinampli);
DDX_Control(pDX, IDC_SPIN_OFFSET, m_spinoffset);
DDX_Check(pDX, IDC_CHECK_MONO, m_mono);
DDX_Check(pDX, IDC_CHECK_STEREO, m_stereo);
DDX_Check(pDX, IDC_CHECK_REVERSE, m_reverse);
DDX_Text(pDX, IDC_EDIT_END, m_fileend);
DDX_Text(pDX, IDC_EDIT_START, m_filestart);
DDX_Text(pDX, IDC_EDIT_TIME, m_time);
DDX_Text(pDX, IDC_POSITION, m_position);
DDX_Check(pDX, IDC_CHECK_ADD, m_add);
DDX_Check(pDX, IDC_CHECK_XOR, m_xor);
DDX_Text(pDX, IDC_EDIT_ADD, m_addvalue);
DDX_Text(pDX, IDC_EDIT_XOR, m_xorvalue);
DDX_Check(pDX, IDC_CHECK_MAPPER, m_mapper);
DDX_Text(pDX, IDC_EDIT_VOLT, m_volt);
DDX_Text(pDX, IDC_EDIT_OFFSET, m_offset);
DDX_Text(pDX, IDC_EDIT_AMPLI, m_ampli);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CSoundrobberDlg, CDialog)
//{{AFX_MSG_MAP(CSoundrobberDlg)
ON_WM_SYSCOMMAND()
ON_WM_PAINT()
ON_WM_QUERYDRAGICON()
ON_BN_CLICKED(IDC_BUTTON_OPEN, OnButtonOpen)
ON_BN_CLICKED(IDC_CHECK_MONO, OnCheckMono)
ON_BN_CLICKED(IDC_CHECK_STEREO, OnCheckStereo)
ON_BN_CLICKED(IDC_CHECK_REVERSE, OnCheckReverse)
ON_BN_CLICKED(IDC_BUTTON_ACQ, OnButtonAcq)
ON_NOTIFY(UDN_DELTAPOS, IDC_SPIN_TIME, OnDeltaposSpinTime)
ON_NOTIFY(UDN_DELTAPOS, IDC_SPIN_VOLT, OnDeltaposSpinVolt)
ON_NOTIFY(UDN_DELTAPOS, IDC_SPIN_OFFSET, OnDeltaposSpinOffset)
ON_NOTIFY(UDN_DELTAPOS, IDC_SPIN_AMPLI, OnDeltaposSpinAmpli)
ON_WM_SIZE()
ON_BN_CLICKED(IDC_BUTTON_PLAY, OnButtonPlay)
ON_BN_CLICKED(IDC_BUTTON_STOP, OnButtonStop)
ON_EN_KILLFOCUS(IDC_EDIT_TIME, OnKillfocusEditTime)
ON_EN_KILLFOCUS(IDC_EDIT_VOLT, OnKillfocusEditVolt)
ON_EN_KILLFOCUS(IDC_EDIT_AMPLI, OnKillfocusEditAmpli)
ON_EN_KILLFOCUS(IDC_EDIT_OFFSET, OnKillfocusEditOffset)
ON_BN_CLICKED(IDC_BUTTON_WAVE, OnButtonWave)
ON_WM_TIMER()
ON_BN_CLICKED(IDC_GET_END, OnGetEnd)
ON_BN_CLICKED(IDC_GET_START, OnGetStart)
ON_EN_KILLFOCUS(IDC_EDIT_START, OnKillfocusEditStart)
ON_EN_KILLFOCUS(IDC_EDIT_END, OnKillfocusEditEnd)
ON_EN_SETFOCUS(IDC_POSITION, OnSetfocusPosition)
ON_WM_VSCROLL()
ON_WM_DROPFILES()
ON_BN_CLICKED(IDC_CHECK_XOR, OnCheckXor)
ON_BN_CLICKED(IDC_CHECK_ADD, OnCheckAdd)
ON_BN_CLICKED(IDC_CHECK_MAPPER, OnCheckMapper)
ON_WM_HSCROLL()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CSoundrobberDlg message handlers
// Dialog-schliessen beim druecken von RETURN abfangen
BOOL CSoundrobberDlg::OnCommand(WPARAM wParam, LPARAM lParam)
{
if (wParam == 1)
return TRUE;
return CDialog::OnCommand(wParam, lParam);
}
// Init-Dialog
BOOL CSoundrobberDlg::OnInitDialog()
{
CDialog::OnInitDialog();
// Drag/Drop Fichier
DragAcceptFiles();
// Add "About..." menu item to system menu.
CMenu* pSysMenu = GetSystemMenu(FALSE);
CString strAboutMenu;
CString strDevCaps;
int s;
strAboutMenu.LoadString(IDS_ABOUTBOX);
strDevCaps.LoadString (IDS_DEVCAPS);
for (s=0; s<3; s++)
pSysMenu->RemoveMenu (s, MF_BYPOSITION);
pSysMenu->AppendMenu (MF_SEPARATOR);
pSysMenu->AppendMenu (MF_STRING, IDM_DEVCAPS, strDevCaps);
pSysMenu->AppendMenu (MF_STRING, IDM_ABOUTBOX, strAboutMenu);
// Set the icon for this dialog. The framework does this automatically
// when the application's main window is not a dialog
SetIcon(m_hIcon, TRUE); // Set big icon
SetIcon(m_hIcon, FALSE); // Set small icon
// Controls vorbelegen
ResetView();
return TRUE;
}
// Menu-Commands
void CSoundrobberDlg::OnSysCommand(UINT nID, LPARAM lParam)
{
if ((nID & 0xFFF0) == IDM_ABOUTBOX)
{
CAboutDlg dlgAbout;
dlgAbout.DoModal();
}
else if ((nID & 0xFFF0) == IDM_DEVCAPS)
{
CWaveDevCaps cwd;
cwd.DoModal();
}
else
{
CDialog::OnSysCommand(nID, lParam);
}
}
// If you add a minimize button to your dialog, you will need the code below
// to draw the icon. For MFC applications using the document/view model,
// this is automatically done for you by the framework.
void CSoundrobberDlg::OnPaint()
{
if (IsIconic())
{
CPaintDC dc(this); // device context for painting
SendMessage(WM_ICONERASEBKGND, (WPARAM) dc.GetSafeHdc(), 0);
// Center icon in client rectangle
int cxIcon = GetSystemMetrics(SM_CXICON);
int cyIcon = GetSystemMetrics(SM_CYICON);
CRect rect;
GetClientRect(&rect);
int x = (rect.Width() - cxIcon + 1) / 2;
int y = (rect.Height() - cyIcon + 1) / 2;
// Draw the icon
dc.DrawIcon(x, y, m_hIcon);
}
else
{
CDialog::OnPaint();
}
}
// The system calls this to obtain the cursor to display while the user drags
// the minimized window.
HCURSOR CSoundrobberDlg::OnQueryDragIcon()
{
return (HCURSOR) m_hIcon;
}
/////////////////////////////// Control-Messages //////////////////////////
// Pos-Control hat den Input-Focus? -> das geht garnicht...
void CSoundrobberDlg::OnSetfocusPosition()
{
::SetFocus (NULL);
}
// Drag/Drop - Support
void CSoundrobberDlg::OnDropFiles(HDROP hDropInfo)
{
char fname[256];
DragQueryFile (hDropInfo, 0, fname, 256);
m_pathname = fname;
m_filename = m_pathname.Right (m_pathname.GetLength() -
m_pathname.ReverseFind (0x5c)
-1);
FileOpenProc();
CDialog::OnDropFiles(hDropInfo);
}
// File-Open Button
void CSoundrobberDlg::OnButtonOpen()
{
Flg_action = 0;
// Active fenetre OUVRIR FICHIER
CFileDialog cf(TRUE);
cf.m_ofn.lpstrTitle = "Open file for wave stealin'";
cf.m_ofn.lpstrFilter = "All files (*.*)\0 *.*\0";
cf.m_ofn.Flags &= ~OFN_EXPLORER;
if (cf.DoModal() == IDCANCEL)
return;
// Take File Name
m_pathname = cf.GetPathName();
m_filename = cf.GetFileName();
// Ouvrir Fichier..
FileOpenProc();
}
// Appel Fichier par les OnButtonOpen et les OnDropFiles !!!
void CSoundrobberDlg::FileOpenProc()
{
Flg_action = 0;
// Reinitialisation de la fenetre
ResetView();
RemoteStop();
m_memfile.Close();
// Ouverture fichier
//m_pathname = "tranfert.bin";
if (!m_memfile.Open (m_pathname, CFile::modeRead | CFile::typeBinary))
{
MessageBox (m_pathname, "Failed to open...", MB_ICONSTOP);
return;
}
m_fileend = m_memfile.GetLength();
//Ajustement Slider-Controls
m_slider_start.SetRange (0, m_fileend, TRUE);
m_slider_start.SetPos (0);
m_slider_start.SetPageSize (100+m_fileend/1000);
m_slider_end.SetRange (0, m_fileend, TRUE);
m_slider_end.SetPos (m_fileend);
m_slider_end.SetPageSize (100+m_fileend/1000);
// Entete fenetre principale
CString caption = "Oscilloscope (" + m_filename + ")";
SetWindowText ((LPCSTR)caption);
// Most Controls Enable
CWnd *child = GetWindow (GW_CHILD);
while (child)
{
if (child != GetDlgItem (IDC_EDIT_XOR) && child != GetDlgItem (IDC_EDIT_ADD))
child->EnableWindow ();
child = child->GetWindow (GW_HWNDNEXT);
}
UpdateData (FALSE);
}
///////////////////////// Handler for CheckBoxes //////////////////////
void CSoundrobberDlg::OnCheckMono()
{
m_stereo = FALSE;
m_mono = TRUE;
UpdateData (FALSE);
Restart();
}
void CSoundrobberDlg::OnCheckStereo()
{
m_mono = FALSE;
m_stereo = TRUE;
UpdateData (FALSE);
Restart();
}
void CSoundrobberDlg::OnCheckReverse()
{
if (m_reverse)
m_reverse = FALSE;
else
m_reverse = TRUE;
UpdateData (FALSE);
Restart();
}
void CSoundrobberDlg::OnCheckXor()
{
CWnd *child = GetDlgItem (IDC_EDIT_XOR);
if (m_xor)
{
m_xor = FALSE;
child->EnableWindow (FALSE);
}
else
{
m_xor = TRUE;
child->EnableWindow();
}
UpdateData (FALSE);
Restart();
}
void CSoundrobberDlg::OnCheckAdd()
{
CWnd *child = GetDlgItem (IDC_EDIT_ADD);
if (m_add)
{
m_add = FALSE;
child->EnableWindow (FALSE);
}
else
{
m_add = TRUE;
child->EnableWindow();
}
UpdateData (FALSE);
Restart();
}
void CSoundrobberDlg::OnCheckMapper()
{
if (m_mapper)
m_mapper = FALSE;
else
m_mapper = TRUE;
UpdateData (FALSE);
Restart();
}
//////////////////// Ende CheckBox-Handlers /////////////////////////////
///////////////////////// Handler for spin //////////////////////
// Spin-Control -> Time
void CSoundrobberDlg::OnDeltaposSpinTime(NMHDR* pNMHDR, LRESULT* pResult)
{
NM_UPDOWN* pNMUpDown = (NM_UPDOWN*)pNMHDR;
static int times[] = { 1, 2, 5, 10, 20, 50, 100, 200, 500, 1000};
static int TimeDiv = 0;
if (pNMUpDown->iDelta < 0)
TimeDiv ++;
else
TimeDiv --;
if (TimeDiv < 0)
TimeDiv = 0;
if (TimeDiv > 9)
TimeDiv = 9;
m_time = times[TimeDiv];
UpdateData (FALSE);
*pResult = 0;
}
//Spin-Control -> Volts/div
void CSoundrobberDlg::OnDeltaposSpinVolt(NMHDR* pNMHDR, LRESULT* pResult)
{
NM_UPDOWN* pNMUpDown = (NM_UPDOWN*)pNMHDR;
static int volts[] = { 1, 2, 5, 10, 20, 50, 100, 500};
static int VoltDiv =0;
if (pNMUpDown->iDelta < 0)
VoltDiv++;
else
VoltDiv--;
if (VoltDiv < 0 )
VoltDiv = 0;
if (VoltDiv > 7 )
VoltDiv = 7;
m_volt = volts[VoltDiv];
UpdateData (FALSE);
*pResult = 0;
}
//Spin-Control -> Amplification
void CSoundrobberDlg::OnDeltaposSpinAmpli(NMHDR* pNMHDR, LRESULT* pResult)
{
NM_UPDOWN* pNMUpDown = (NM_UPDOWN*)pNMHDR;
static int amplif[] = {1, 2, 3, 4, 5, 6, 7 ,8};
// Bit 7 6 5 4 3 2 1 0
// Nom X X BIT_CTRL IRQ_ENABLE SELECT_IN /INIT AUTOFEED /STROBE
// tableau avec init complémenté
static BYTE ampliAdd[] = {0xFA, 0xF8, 0xFE, 0xFC, 0xF2, 0xF0, 0xF6, 0xF4};
static int Amplifi =0;
if (pNMUpDown->iDelta < 0)
Amplifi++;
else
Amplifi--;
if (Amplifi < 0 )
Amplifi = 0;
if (Amplifi > 7 )
Amplifi = 7;
// Division du signal d'entrée
_outp(0x37A,ampliAdd[Amplifi]);
m_ampli = amplif[Amplifi];
UpdateData (FALSE);
*pResult = 0;
}
//Spin-Control -> Offset
void CSoundrobberDlg::OnDeltaposSpinOffset(NMHDR* pNMHDR, LRESULT* pResult)
{
NM_UPDOWN* pNMUpDown = (NM_UPDOWN*)pNMHDR;
if (pNMUpDown->iDelta < 0)
m_offset = m_offset + 100;
else
m_offset = m_offset - 100;
UpdateData (FALSE);
*pResult = 0;
}
///////////////////////// end for spin handler //////////////////////
///////////////////////// Handler for button //////////////////////
// fabrique le fichier wav
void CSoundrobberDlg::OnButtonWave()
{
CFileDialog cf (FALSE);
cf.m_ofn.lpstrFilter = "Audio samplings (*.WAV)\0\0";
cf.m_ofn.lpstrTitle = "Save file as a 'WAVE'";
cf.m_ofn.Flags &= ~OFN_EXPLORER;
cf.m_ofn.lpstrDefExt = "WAV";
//Destruction
if (cf.DoModal() == IDCANCEL)
return;
// production du son
WORD channels = 1;
WORD bits = 8;
CString savename;
// pointeur sur la position ouvert par la classe CMemoryFile
void *data = m_memfile.GetPointer();
if (!data)
data = m_memfile.Read (m_filestart, m_fileend);
if (m_stereo)
channels = 2;
savename = cf.GetPathName();
// enregistrement de la courbe
m_waveplay.MakeWaveFile (channels, m_time, bits,
data, m_fileend - m_filestart,
savename.GetBuffer(256));
}
// Play!!!
void CSoundrobberDlg::OnButtonPlay()
{
void *data;
WORD channels = 1;
WORD bits = 8;
// Erstmal alle Class-Wizard-Variablen auffrischen...
UpdateData();
// Daten in'n Speicher lesen
data = m_memfile.Read (m_filestart, m_fileend);
// Xorren?
if (m_xor)
m_memfile.XorByte (m_xorvalue);
// Byte aufaddieren?
if (m_add)
m_memfile.AddByte (m_addvalue);
// jouer éventuellement en arrière
if (m_reverse)
m_memfile.Reverse();
// Stereo?
if (m_stereo)
channels = 2;
// Lancement du timer
SetTimer (1, 1, NULL);
m_position = m_filestart;
TempsDepartExecution = timeGetTime();
UpdateData (FALSE);
}
// Stop!!!
void CSoundrobberDlg::OnButtonStop()
{
// Arret du fichier Wav...
m_waveplay.Stop();
// Arrêt du timer
KillTimer (1);
}
///////////////////////// end for button handler //////////////////////
// Entrée manuelle de la position de fin
void CSoundrobberDlg::OnKillfocusEditEnd()
{
long tmp = m_fileend;
m_fileend = (long)GetDlgItemInt (IDC_EDIT_END);
if (m_fileend <= m_filestart)
m_fileend = tmp;
if (m_fileend > (long)m_memfile.GetLength())
m_fileend = tmp;
//Positionne le Slider à la fin
m_slider_end.SetPos (m_fileend);
UpdateData (FALSE);
}
// Entrée manuelle de la position de depart
void CSoundrobberDlg::OnKillfocusEditStart()
{
long tmp = m_filestart;
m_filestart = (long)GetDlgItemInt (IDC_EDIT_START);
if (m_filestart > m_fileend)
m_filestart = tmp;
m_position = m_filestart;
// Tirer le Slider
m_slider_start.SetPos (m_filestart);
UpdateData (FALSE);
}
void CSoundrobberDlg::OnButtonAcq()
{
Flg_action = 1;
// Reinitialisation de la fenetre
ResetView();
RemoteStop();
//Ajustement Slider-Controls
m_slider_start.SetRange (0, m_fileend, TRUE);
m_slider_start.SetPos (0);
m_slider_start.SetPageSize (100+m_fileend/1000);
m_slider_end.SetRange (0, m_fileend, TRUE);
m_slider_end.SetPos (m_fileend);
m_slider_end.SetPageSize (100+m_fileend/1000);
// Entete fenetre principale
CString caption = "Oscilloscope (Capture du port)";
SetWindowText ((LPCSTR)caption);
// Most Controls Enable, bis auf einige gewisse....
CWnd *child = GetWindow (GW_CHILD);
while (child)
{
if (child != GetDlgItem (IDC_EDIT_XOR)
&& child != GetDlgItem (IDC_EDIT_ADD)
&& child != GetDlgItem (IDC_EDIT_START)
&& child != GetDlgItem (IDC_EDIT_END)
&& child != GetDlgItem (IDC_SLIDER_START)
&& child != GetDlgItem (IDC_SLIDER_END)
&& child != GetDlgItem (IDC_GET_END)
&& child != GetDlgItem (IDC_GET_START)
&& child != GetDlgItem (IDC_POSITION)
)
child->EnableWindow ();
child = child->GetWindow (GW_HWNDNEXT);
}
// Lancement de la fonction Ontime() toutes les 1 ms
SetTimer (1, 1, NULL);
// Positionne le début du fichier
m_position = m_filestart;
TempsDepartExecution = timeGetTime();
UpdateData (FALSE);
}
// Manuelle Eingabe der Gewschwindigkeit
void CSoundrobberDlg::OnKillfocusEditTime()
{
UpdateData();
}
void CSoundrobberDlg::OnKillfocusEditVolt()
{
UpdateData();
}
void CSoundrobberDlg::OnKillfocusEditOffset()
{
UpdateData();
}
void CSoundrobberDlg::OnKillfocusEditAmpli()
{
UpdateData();
}
// fonction appelé par SetTimer () à intervale régulier de 1 ms
void CSoundrobberDlg::OnTimer (UINT nIDEvent)
{
// si on est en mode acquisition
if (Flg_action == 1)
{
// calculer l'echantillon correspondant à la position temporelle courante
//EchantillonExecution=(unsigned long) ((float) TempsExecution*Frequence/1000.);
TempsExecution = timeGetTime()-TempsDepartExecution ;
m_position = m_filestart + TempsExecution;
// lecture du port parrallèle
CPort::CPort();
// Ouverture du buffer
CMemFile m_memfile( pbufferEntree, BUFFER_LENGHT, 0 );
//renvoie la position de fin du buffer
m_fileend = m_memfile.GetLength();
if (! m_fileend)
{MessageBox ("erreur", "Failed to open...");}
//affiche les données
m_scope.UpdateView (pbufferEntree + TempsExecution);
if (m_position + 512 >= m_fileend)
{
TempsDepartExecution = timeGetTime();
m_memfile.Close();
}
}
else
{
TempsExecution = timeGetTime()-TempsDepartExecution ;
m_position = m_filestart + TempsExecution;
// Current Pos und Scope aktualisieren
SetDlgItemInt (IDC_POSITION, m_position, FALSE);
m_scope.UpdateView ((BYTE *)m_memfile.GetPointer() + TempsExecution);
if (m_position >= m_fileend-1)
{
m_scope.Reset();
RemoteStop();
}
}
}
//////////////////////////////// Get Buttons /////////////////////
// Ende des Waves aus'm Pos-Control holen
void CSoundrobberDlg::OnGetEnd()
{
m_fileend = m_position;
UpdateData (FALSE);
// Slider anpassen
m_slider_end.SetPos (m_position);
// Stop-Button druecken
RemoteStop();
}
// Start des Waves aus'm Pos-Control holen
void CSoundrobberDlg::OnGetStart()
{
m_filestart = m_position;
// m_fileoffset = m_position;
UpdateData (FALSE);
// Slider anpassen
m_slider_start.SetPos (m_position);
// Stop-Button druecken
RemoteStop();
}
void CSoundrobberDlg::OnHScroll (UINT nSBCode, UINT nPos, CScrollBar* pScrollBar)
{
switch (nSBCode)
{
case TB_THUMBTRACK:
case TB_PAGEDOWN:
case TB_PAGEUP:
if ((CSliderCtrl *)pScrollBar == &m_slider_start)
{
m_filestart = m_slider_start.GetPos();
if (m_filestart > m_fileend)
{
m_fileend = m_filestart;
m_slider_end.SetPos (m_filestart);
}
}
else if ((CSliderCtrl *)pScrollBar == &m_slider_end)
{
m_fileend = m_slider_end.GetPos();
if (m_fileend < m_filestart)
{
m_filestart = m_fileend;
m_slider_start.SetPos (m_fileend);
}
}
break;
}
UpdateData (FALSE);
CDialog::OnHScroll(nSBCode, nPos, pScrollBar);
}