home *** CD-ROM | disk | FTP | other *** search
/ PC Shareware 1997 June / PC_Shareware-1997-06.iso / manga / mp2win95 / _setup.1 / MCIPLAY.CPP < prev    next >
Encoding:
C/C++ Source or Header  |  1997-01-30  |  2.7 KB  |  121 lines

  1. /* A simple function to send the playback time back to the main window and
  2.    handle seeks. This operates using the MCI command strings, and assumes
  3.    that a sound file aliased "sounder" is already loaded. Written by Jeff Tsay
  4.    (ctsay@pasteur.eecs.berkeley.edu).
  5.  
  6.    Last modified : 01/28/97 */
  7.  
  8. #define STRICT
  9. #define WIN32_LEAN_AND_MEAN
  10. #define NOMCX
  11. #define NOIME
  12. // #define NOGDI             GDI APIs and definitions
  13. // #define NOUSER            USER APIs and definitions
  14. #define NOSOUND
  15. #define NOCOMM
  16. #define NODRIVERS
  17. #define OEMRESOURCE
  18. #define NONLS
  19. #define NOSERVICE
  20. #define NOKANJI
  21. #define NOMINMAX
  22. #define NOLOGERROR
  23. #define NOPROFILER
  24. #define NOMEMMGR
  25. #define NOLFILEIO
  26. #define NOOPENFILE
  27. #define NORESOURCE
  28. #define NOATOM
  29. #define NOLANGUAGE
  30. #define NOLSTRING
  31. #define NODBCS
  32. #define NOKEYBOARDINFO
  33. #define NOGDICAPMASKS
  34. #define NOCOLOR
  35. #define NOGDIOBJ
  36. #define NODRAWTEXT
  37. #define NOTEXTMETRIC
  38. #define NOSCALABLEFONT
  39. #define NOBITMAP
  40. #define NORASTEROPS
  41. #define NOMETAFILE
  42. #define NOSYSMETRICS
  43. #define NOSYSTEMPARAMSINFO
  44. #define NOMSG
  45. #define NOWINSTYLES
  46. #define NOWINOFFSETS
  47. #define NOSHOWWINDOW
  48. #define NODEFERWINDOWPOS
  49. #define NOVIRTUALKEYCODES
  50. #define NOKEYSTATES
  51. #define NOWH
  52. #define NOMENUS
  53. #define NOSCROLL
  54. #define NOCLIPBOARD
  55. #define NOICONS
  56. #define NOMB
  57. #define NOSYSCOMMANDS
  58. #define NOMDI
  59. #define NOCTLMGR
  60. #define NOWINMESSAGES
  61. #define NOHELP
  62. // #define _WINUSER_
  63. #define __oleidl_h__
  64. #define _OLE2_H_
  65. #include <windows.h>
  66.  
  67. #define MMNODRV
  68. #define MMNOSOUND
  69. // #define MMNOWAVE
  70. #define MMNOMIDI
  71. #define MMNOAUX
  72. #define MMNOTIMER
  73. #define MMNOJOY
  74. //#define MMNOMCI
  75. #define MMNOMMIO
  76. #define MMNOMMSYSTEM
  77. #include <mmsystem.h>
  78.  
  79. #include "my_str_lib.h"
  80. #include "args.h"
  81. #include "mp2win.h"
  82.  
  83. DWORD mciplay (MCI_Args *args)
  84. {
  85.     char mci_buffer[1024];
  86.     char mci_command[256];
  87.     char ms_buffer[32];
  88.  
  89.     while(!args->stop_query()) {
  90.  
  91.         // Handle seeks
  92.  
  93.         if (args->position_change_query()) {
  94.             mciSendString("stop sounder", mci_buffer, 1024, NULL);
  95.             lstrcpy(mci_command, "seek sounder to ");
  96.             lstrcat(mci_command, my_itoa(args->desired_position_query(),
  97.                                       ms_buffer, 10));
  98.             lstrcat(mci_command, " wait");
  99.             mciSendString(mci_command, mci_buffer, 1024, NULL);
  100.  
  101.             if (args->playing)
  102.                 mciSendString("play sounder notify", mci_buffer, 1024, args->hWnd);
  103.  
  104.             args->set_position_change(FALSE);
  105.  
  106.             SendMessage(args->hWnd, SEEK_ACK, 0, 0);
  107.  
  108.         } else
  109.             Sleep(100);
  110.  
  111.       // Update the scroll bar
  112.         mciSendString("status sounder position", mci_buffer, 1024, NULL);
  113.         SendMessage(args->hWnd, SCROLL_POS, my_atoi(mci_buffer), 0);
  114.     }
  115.    args->set_done(TRUE);
  116.    ExitThread(0);
  117.    return(0);
  118. }
  119.  
  120.  
  121.